Add lame source.

Change-Id: I6b66611fa10c094331b48bc84d3f82fe15603817
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1e8a9af
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,66 @@
+/build
+/source/build
+*.mode1v3
+*.pbxuser
+*.pbxindex/
+!user.pbxuser
+/*.log
+*.user
+*.ncb
+*.suo
+*.pdb
+*.pdf
+*.html
+*.idb
+*.o
+*.lo
+*.a
+*.so
+*.so.0
+*.la
+.deps
+.libs
+*.pyc
+.DS_Store
+# Emacs and other editor backup files
+*~
+
+# builds on Windows
+Debug/
+Release/
+release/
+
+Debug NASM/
+Release NASM/
+/config.h
+
+/ACM/ADbg/Makefile
+/ACM/Makefile
+/ACM/ddk/Makefile
+/ACM/tinyxml/Makefile
+/Dll/Makefile
+/Makefile
+/config.log
+/config.status
+/debian/Makefile
+/doc/Makefile
+/doc/html/Makefile
+/doc/man/Makefile
+/dshow/Makefile
+/frontend/Makefile
+/include/Makefile
+/lame.spec
+/libmp3lame/.libs/
+/libmp3lame/Makefile
+/libmp3lame/Makefile.in
+/libmp3lame/i386/Makefile
+/libmp3lame/vector/Makefile
+/libtool
+/mac/Makefile
+/macosx/English.lproj/Makefile
+/macosx/LAME.xcodeproj/Makefile
+/macosx/Makefile
+/misc/Makefile
+/mpglib/Makefile
+/stamp-h1
+/x86-unknown-linux/
\ No newline at end of file
diff --git a/ACM/ACM.cpp b/ACM/ACM.cpp
new file mode 100644
index 0000000..4735d88
--- /dev/null
+++ b/ACM/ACM.cpp
@@ -0,0 +1,1405 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: ACM.cpp,v 1.20.8.1 2008/11/01 20:41:47 robert Exp $
+*/
+
+#if !defined(STRICT)
+#define STRICT
+#endif // STRICT
+
+#include <algorithm>
+
+#include <windows.h>
+#include <windowsx.h>
+#include <intshcut.h>
+
+#include <mmreg.h>
+#include <msacm.h>
+#include <msacmdrv.h>
+
+#include <assert.h>
+
+#include <lame.h>
+
+#include "adebug.h"
+#include "resource.h"
+#include "ACMStream.h"
+
+#ifdef ENABLE_DECODING
+#include "DecodeStream.h"
+#endif // ENABLE_DECODING
+
+#include "ACM.h"
+
+#ifndef IDC_HAND
+#define IDC_HAND            MAKEINTRESOURCE(32649)
+#endif // IDC_HAND
+
+char ACM::VersionString[120];
+
+const char ACM_VERSION[] = "0.9.2";
+
+#ifdef WIN32
+//
+//  32-bit versions
+//
+#if (WINVER >= 0x0400)
+ #define VERSION_ACM_DRIVER  MAKE_ACM_VERSION(4,  0, 0)
+#else
+#define VERSION_ACM_DRIVER  MAKE_ACM_VERSION(3, 51, 0)
+#endif
+#define VERSION_MSACM MAKE_ACM_VERSION(3, 50, 0)
+
+#else
+//
+//  16-bit versions
+//
+#define VERSION_ACM_DRIVER MAKE_ACM_VERSION(1, 0, 0)
+#define VERSION_MSACM MAKE_ACM_VERSION(2, 1, 0)
+
+#endif
+
+#define PERSONAL_FORMAT WAVE_FORMAT_MPEGLAYER3
+#define SIZE_FORMAT_STRUCT sizeof(MPEGLAYER3WAVEFORMAT)
+//#define SIZE_FORMAT_STRUCT 0
+
+//static const char channel_mode[][13] = {"mono","stereo","joint stereo","dual channel"};
+static const char channel_mode[][13] = {"mono","stereo"};
+static const unsigned int mpeg1_freq[] = {48000,44100,32000};
+static const unsigned int mpeg2_freq[] = {24000,22050,16000,12000,11025,8000};
+static const unsigned int mpeg1_bitrate[] = {320, 256, 224, 192, 160, 128, 112, 96, 80, 64, 56, 48, 40, 32};
+static const unsigned int mpeg2_bitrate[] = {160, 144, 128, 112,  96,  80,  64, 56, 48, 40, 32, 24, 16,  8};
+
+#define SIZE_CHANNEL_MODE (sizeof(channel_mode)  / (sizeof(char) * 13))
+#define SIZE_FREQ_MPEG1 (sizeof(mpeg1_freq)    / sizeof(unsigned int))
+#define SIZE_FREQ_MPEG2 (sizeof(mpeg2_freq)    / sizeof(unsigned int))
+#define SIZE_BITRATE_MPEG1 (sizeof(mpeg1_bitrate) / sizeof(unsigned int))
+#define SIZE_BITRATE_MPEG2 (sizeof(mpeg2_bitrate) / sizeof(unsigned int))
+
+static const int FORMAT_TAG_MAX_NB = 2; // PCM and PERSONAL (mandatory to have at least PCM and your format)
+static const int FILTER_TAG_MAX_NB = 0; // this is a codec, not a filter
+
+// number of supported PCM formats
+static const int FORMAT_MAX_NB_PCM =
+	2 *                                           // number of PCM channel mode (stereo/mono)
+		(SIZE_FREQ_MPEG1 + // number of MPEG 1 sampling freq
+		SIZE_FREQ_MPEG2); // number of MPEG 2 sampling freq
+
+//////////////////////////////////////////////////////////////////////
+//
+//////////////////////////////////////////////////////////////////////
+bool bitrate_item::operator<(const bitrate_item & other_bitrate) const
+{
+	return (other_bitrate.frequency < frequency ||
+		    (other_bitrate.frequency == frequency &&
+			 (other_bitrate.bitrate < bitrate ||
+			  (other_bitrate.bitrate == bitrate &&
+			   (other_bitrate.channels < channels)))));
+}
+
+//////////////////////////////////////////////////////////////////////
+// Configuration Dialog
+//////////////////////////////////////////////////////////////////////
+/*
+static CALLBACK ConfigProc(
+  HWND hwndDlg,  // handle to dialog box
+UINT uMsg,     // message
+WPARAM wParam, // first message parameter
+LPARAM lParam  // second message parameter
+)
+{
+	BOOL bResult;
+
+	switch (uMsg) {
+		case WM_COMMAND:
+			UINT command;
+			command = GET_WM_COMMAND_ID(wParam, lParam);
+            if (IDOK == command)
+            {
+                EndDialog(hwndDlg, (IDOK == command));
+            } else if (IDCANCEL == command)
+            {
+                EndDialog(hwndDlg, (IDOK == command));
+            }
+            bResult = FALSE;
+			break;
+		default:
+			bResult = FALSE; // will be treated by DefWindowProc
+}
+	return bResult;
+}
+
+
+inline DWORD ACM::Configure(HWND hParentWindow, LPDRVCONFIGINFO pConfig)
+{
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM : Configure (Parent Window = 0x%08X)",hParentWindow);
+
+	DialogBoxParam( my_hModule, MAKEINTRESOURCE(IDD_CONFIG), hParentWindow, ::ConfigProc , (LPARAM)this);
+
+	return DRVCNF_OK; // Can also return
+					// DRVCNF_CANCEL
+					// and DRVCNF_RESTART
+}
+*/
+//////////////////////////////////////////////////////////////////////
+// About Dialog
+//////////////////////////////////////////////////////////////////////
+
+static BOOL CALLBACK AboutProc(
+  HWND hwndDlg,  // handle to dialog box
+UINT uMsg,     // message
+WPARAM wParam, // first message parameter
+LPARAM lParam  // second message parameter
+)
+{
+	static HBRUSH hBrushStatic = NULL;
+//	static LOGFONT lf;  // structure for font information  
+//	static HFONT hfnt;
+	static HCURSOR hcOverCursor = NULL;
+	BOOL bResult;
+
+	switch (uMsg) {
+		case WM_INITDIALOG:
+			char tmp[150];
+			wsprintf(tmp,"LAME MP3 codec v%s", ACM::GetVersionString());
+			::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_ABOUT_TITLE), tmp);
+
+/*
+			::GetObject(::GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf); 
+			lf.lfUnderline = TRUE;
+
+			hfnt = ::CreateFontIndirect(&lf);
+
+			::SendMessage(::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), WM_SETFONT, (WPARAM) hfnt, TRUE);
+* /
+			hBrushStatic = ::CreateSolidBrush(::GetSysColor (COLOR_BTNFACE));
+*/			hcOverCursor = ::LoadCursor(NULL,(LPCTSTR)IDC_HAND); 
+			if (hcOverCursor == NULL)
+				hcOverCursor = ::LoadCursor(NULL,(LPCTSTR)IDC_CROSS); 
+
+			bResult = TRUE;
+			break;
+/*
+		case WM_CTLCOLORSTATIC:
+			/// \todo only if there are URLs
+			if ((HWND)lParam == ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL))
+			{
+				::SetTextColor((HDC)wParam, ::GetSysColor (COLOR_HIGHLIGHT));
+				::SetBkColor((HDC)wParam, ::GetSysColor (COLOR_BTNFACE));
+
+				return (LRESULT) hBrushStatic;
+			}
+			else
+				return (LRESULT) NULL;
+*/
+		case WM_MOUSEMOVE:
+			{
+				POINT pnt;
+				::GetCursorPos(&pnt);
+
+				RECT rect;
+				::GetWindowRect( ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), &rect);
+
+				if (  ::PtInRect(&rect,pnt)  )
+				{
+					::SetCursor(hcOverCursor);
+				}
+
+
+			}
+			break;
+
+		case WM_LBUTTONUP:
+			{
+				POINT pnt;
+				::GetCursorPos(&pnt);
+
+				RECT rect;
+				::GetWindowRect( ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), &rect);
+
+				TCHAR Url[200];
+				bool bUrl = false;
+				if (::PtInRect(&rect,pnt))
+				{
+					wsprintf(Url,get_lame_url());
+					bUrl = true;
+				}
+
+				if (bUrl)
+				{
+					LPSTR tmpStr;
+					HRESULT hresult = ::TranslateURL(Url, TRANSLATEURL_FL_GUESS_PROTOCOL|TRANSLATEURL_FL_GUESS_PROTOCOL, &tmpStr);
+					if (hresult == S_OK)
+						::ShellExecute(hwndDlg,"open",tmpStr,NULL,"",SW_SHOWMAXIMIZED );
+					else if (hresult == S_FALSE)
+						::ShellExecute(hwndDlg,"open",Url,NULL,"",SW_SHOWMAXIMIZED );
+				}
+
+			}
+			break;
+
+		case WM_COMMAND:
+			UINT command;
+			command = GET_WM_COMMAND_ID(wParam, lParam);
+            if (IDOK == command)
+            {
+                EndDialog(hwndDlg, TRUE);
+            }
+            bResult = FALSE;
+			break;
+
+		case IDC_STATIC_ABOUT_URL:
+			break;
+		default:
+			bResult = FALSE; // will be treated by DefWindowProc
+}
+	return bResult;
+}
+
+inline DWORD ACM::About(HWND hParentWindow)
+{
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM : About (Parent Window = 0x%08X)",hParentWindow);
+
+	DialogBoxParam( my_hModule, MAKEINTRESOURCE(IDD_ABOUT), hParentWindow, ::AboutProc , (LPARAM)this);
+
+	return DRVCNF_OK; // Can also return
+// DRVCNF_CANCEL
+// and DRVCNF_RESTART
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+ACM::ACM( HMODULE hModule )
+ :my_hModule(hModule),
+  my_hIcon(NULL),
+  my_debug(ADbg(DEBUG_LEVEL_CREATION)),
+  my_EncodingProperties(hModule)
+{
+	my_EncodingProperties.ParamsRestore();
+
+	/// \todo get the debug level from the registry
+	unsigned char DebugFileName[512];
+
+	char tmp[128];
+	wsprintf(tmp,"LAMEacm 0x%08X",this);
+	my_debug.setPrefix(tmp); /// \todo get it from the registry
+	my_debug.setIncludeTime(true);  /// \todo get it from the registry
+
+	// Check in the registry if we have to Output Debug information
+	DebugFileName[0] = '\0';
+
+	HKEY OssKey;
+	if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI", 0, KEY_READ , &OssKey ) == ERROR_SUCCESS) {
+		DWORD DataType;
+		DWORD DebugFileNameSize = 512;
+		if (RegQueryValueEx( OssKey, "DebugFile", NULL, &DataType, DebugFileName, &DebugFileNameSize ) == ERROR_SUCCESS) {
+			if (DataType == REG_SZ) {
+				my_debug.setUseFile(true);
+				my_debug.setDebugFile((char *)DebugFileName);
+				my_debug.OutPut("Debug file is %s",(char *)DebugFileName);
+			}
+		}
+	}
+        wsprintf(VersionString,"%s - %s", ACM_VERSION, get_lame_version() );
+	BuildBitrateTable();
+	
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "New ACM Creation (0x%08X)",this);
+}
+
+ACM::~ACM()
+{
+// not used, it's done automatically when closing the driver	if (my_hIcon != NULL)
+//		CloseHandle(my_hIcon);
+
+	bitrate_table.clear();
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM Deleted (0x%08X)",this);
+}
+
+//////////////////////////////////////////////////////////////////////
+// Main message handler
+//////////////////////////////////////////////////////////////////////
+
+LONG ACM::DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2)
+{
+    DWORD dwRes = 0L;
+
+//my_debug.OutPut(DEBUG_LEVEL_MSG, "message 0x%08X for ThisACM 0x%08X", msg, this);
+
+switch (msg) {
+    case DRV_INSTALL:
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_INSTALL");
+		// Sent when the driver is installed.
+		dwRes = DRVCNF_OK;  // Can also return 
+		break;              // DRVCNF_CANCEL
+							// and DRV_RESTART
+
+	case DRV_REMOVE:
+		// Sent when the driver is removed.
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_REMOVE");
+		dwRes = 1L;  // return value ignored
+		break;
+
+    case DRV_QUERYCONFIGURE:
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_QUERYCONFIGURE");
+		// Sent to determine if the driver can be
+		// configured.
+		dwRes = 1L;  // Zero indicates configuration
+		break;       // NOT supported
+
+	case DRV_CONFIGURE:
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_CONFIGURE");
+		// Sent to display the configuration
+		// dialog box for the driver.
+//		dwRes = Configure( (HWND) lParam1, (LPDRVCONFIGINFO) lParam2 );
+		if (my_EncodingProperties.Config(my_hModule, (HWND) lParam1))
+		{
+			dwRes = DRVCNF_OK; // Can also return
+					// DRVCNF_CANCEL
+					// and DRVCNF_RESTART
+		} else {
+			dwRes = DRVCNF_CANCEL;
+		}
+		break;
+
+	/**************************************
+	// ACM additional messages
+	***************************************/
+
+	case ACMDM_DRIVER_ABOUT:
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_DRIVER_ABOUT");
+
+		dwRes = About( (HWND) lParam1 );
+
+        break;
+
+	case ACMDM_DRIVER_DETAILS: // acmDriverDetails
+		// Fill-in general informations about the driver/codec
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_DRIVER_DETAILS");
+
+		dwRes = OnDriverDetails(hdrvr, (LPACMDRIVERDETAILS) lParam1);
+        
+		break;
+
+	case ACMDM_FORMATTAG_DETAILS: // acmFormatTagDetails
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMATTAG_DETAILS");
+
+		dwRes = OnFormatTagDetails((LPACMFORMATTAGDETAILS) lParam1, lParam2);
+
+        break;
+
+	case ACMDM_FORMAT_DETAILS: // acmFormatDetails
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMAT_DETAILS");
+
+		dwRes = OnFormatDetails((LPACMFORMATDETAILS) lParam1, lParam2);
+		
+        break;           
+
+    case ACMDM_FORMAT_SUGGEST: // acmFormatSuggest
+		// Sent to determine if the driver can be
+		// configured.
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMAT_SUGGEST");
+		dwRes = OnFormatSuggest((LPACMDRVFORMATSUGGEST) lParam1);
+        break; 
+
+	/**************************************
+	// ACM stream messages
+	***************************************/
+
+	case ACMDM_STREAM_OPEN:
+	// Sent to determine if the driver can be
+	// configured.
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_OPEN");
+		dwRes = OnStreamOpen((LPACMDRVSTREAMINSTANCE) lParam1);
+        break; 
+
+	case ACMDM_STREAM_SIZE:
+	// returns a recommended size for a source 
+	// or destination buffer on an ACM stream
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_SIZE");
+		dwRes = OnStreamSize((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMDRVSTREAMSIZE)lParam2);
+        break; 
+
+	case ACMDM_STREAM_PREPARE:
+	// prepares an ACMSTREAMHEADER structure for
+	// an ACM stream conversion
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_PREPARE");
+		dwRes = OnStreamPrepareHeader((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMSTREAMHEADER) lParam2);
+        break; 
+
+	case ACMDM_STREAM_UNPREPARE:
+	// cleans up the preparation performed by
+	// the ACMDM_STREAM_PREPARE message for an ACM stream
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_UNPREPARE");
+		dwRes = OnStreamUnPrepareHeader((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMSTREAMHEADER) lParam2);
+        break; 
+
+	case ACMDM_STREAM_CONVERT:
+	// perform a conversion on the specified conversion stream
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_CONVERT");
+		dwRes = OnStreamConvert((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMDRVSTREAMHEADER) lParam2);
+		
+        break; 
+
+	case ACMDM_STREAM_CLOSE:
+	// closes an ACM conversion stream
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_CLOSE");
+		dwRes = OnStreamClose((LPACMDRVSTREAMINSTANCE)lParam1);
+        break;
+
+	/**************************************
+	// Unknown message
+	***************************************/
+
+	default:
+	// Process any other messages.
+		my_debug.OutPut(DEBUG_LEVEL_MSG, "ACM::DriverProc unknown message (0x%08X), lParam1 = 0x%08X, lParam2 = 0x%08X", msg, lParam1, lParam2);
+		return DefDriverProc ((DWORD)this, hdrvr, msg, lParam1, lParam2);
+    }
+
+    return dwRes;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Special message handlers
+//////////////////////////////////////////////////////////////////////
+/*!
+	Retreive the config details of this ACM driver
+	The index represent the specified format
+
+	\param a_FormatDetails will be filled with all the corresponding data
+*/
+inline DWORD ACM::OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILS a_Query = 0x%08X",a_Query);
+	switch (a_Query & ACM_FORMATDETAILSF_QUERYMASK) {
+
+		// Fill-in the informations corresponding to the FormatDetails->dwFormatTagIndex
+		case ACM_FORMATDETAILSF_INDEX :
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "enter ACM_FORMATDETAILSF_INDEX for index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex);
+			if (a_FormatDetails->dwFormatTag == PERSONAL_FORMAT) {
+				if (a_FormatDetails->dwFormatIndex < GetNumberEncodingFormats()) {
+					LPWAVEFORMATEX WaveExt;
+					WaveExt = a_FormatDetails->pwfx;
+
+					WaveExt->wFormatTag = PERSONAL_FORMAT;
+
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format in  : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec);
+					GetMP3FormatForIndex(a_FormatDetails->dwFormatIndex, *WaveExt, a_FormatDetails->szFormat);
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format out : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec);
+					Result = MMSYSERR_NOERROR;
+				}
+				else
+				{
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILSF_INDEX unknown index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex);
+				}
+			}
+			else if (a_FormatDetails->dwFormatTag == WAVE_FORMAT_PCM) {
+				if (a_FormatDetails->dwFormatIndex < FORMAT_MAX_NB_PCM) {
+					LPWAVEFORMATEX WaveExt;
+					WaveExt = a_FormatDetails->pwfx;
+
+					WaveExt->wFormatTag = WAVE_FORMAT_PCM;
+
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format in  : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec);
+					GetPCMFormatForIndex(a_FormatDetails->dwFormatIndex, *WaveExt, a_FormatDetails->szFormat);
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format out : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec);
+					Result = MMSYSERR_NOERROR;
+				}
+				else
+				{
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILSF_INDEX unknown index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex);
+				}
+			}
+			else
+			{
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Unknown a_FormatDetails->dwFormatTag = 0x%08X",a_FormatDetails->dwFormatTag);
+			}
+
+		case ACM_FORMATDETAILSF_FORMAT :
+			/// \todo we may output the corresponding strong (only for personal format)
+			LPWAVEFORMATEX WaveExt;
+			WaveExt = a_FormatDetails->pwfx;
+
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "enter ACM_FORMATDETAILSF_FORMAT : 0x%04X:%03d, format in : channels %d, sample rate %d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex, WaveExt->nChannels, WaveExt->nSamplesPerSec);
+
+			Result = MMSYSERR_NOERROR;
+			break;
+		
+		default:
+			Result = ACMERR_NOTPOSSIBLE;
+			break;
+	}
+
+	a_FormatDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
+
+	return Result;
+}
+
+/*!
+	Retreive the details of each known format by this ACM driver
+	The index represent the specified format (0 = MP3 / 1 = PCM)
+
+	\param a_FormatTagDetails will be filled with all the corresponding data
+*/
+inline DWORD ACM::OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query)
+{
+	DWORD Result;
+	DWORD the_format = WAVE_FORMAT_UNKNOWN; // the format to give details
+
+	if (a_FormatTagDetails->cbStruct >= sizeof(*a_FormatTagDetails)) {
+
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACMDM_FORMATTAG_DETAILS, a_Query = 0x%08X",a_Query);
+		switch(a_Query & ACM_FORMATTAGDETAILSF_QUERYMASK) {
+
+			case ACM_FORMATTAGDETAILSF_INDEX:
+			// Fill-in the informations corresponding to the a_FormatDetails->dwFormatTagIndex
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "get ACM_FORMATTAGDETAILSF_INDEX for index %03d",a_FormatTagDetails->dwFormatTagIndex);
+
+				if (a_FormatTagDetails->dwFormatTagIndex < FORMAT_TAG_MAX_NB) {
+					switch (a_FormatTagDetails->dwFormatTagIndex)
+					{
+					case 0:
+						the_format = PERSONAL_FORMAT;
+						break;
+					default :
+						the_format = WAVE_FORMAT_PCM;
+						break;
+					}
+				}
+				else
+				{
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATTAGDETAILSF_INDEX for unsupported index %03d",a_FormatTagDetails->dwFormatTagIndex);
+					Result = ACMERR_NOTPOSSIBLE;
+				}
+				break;
+
+			case ACM_FORMATTAGDETAILSF_FORMATTAG:
+			// Fill-in the informations corresponding to the a_FormatDetails->dwFormatTagIndex and hdrvr given
+				switch (a_FormatTagDetails->dwFormatTag)
+				{
+				case WAVE_FORMAT_PCM:
+					the_format = WAVE_FORMAT_PCM;
+					break;
+				case PERSONAL_FORMAT:
+					the_format = PERSONAL_FORMAT;
+					break;
+				default:
+                    return (ACMERR_NOTPOSSIBLE);
+				}
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "get ACM_FORMATTAGDETAILSF_FORMATTAG for index 0x%02X, cStandardFormats = %d",a_FormatTagDetails->dwFormatTagIndex,a_FormatTagDetails->cStandardFormats);
+				break;
+			case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATTAGDETAILSF_LARGESTSIZE not used");
+				Result = 0L;
+				break;
+			default:
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails Unknown Format tag query");
+				Result = MMSYSERR_NOTSUPPORTED;
+				break;
+		}
+
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails the_format = 0x%08X",the_format);
+		switch(the_format)
+		{
+			case WAVE_FORMAT_PCM:
+				a_FormatTagDetails->dwFormatTag      = WAVE_FORMAT_PCM;
+				a_FormatTagDetails->dwFormatTagIndex = 0;
+				a_FormatTagDetails->cbFormatSize     = sizeof(PCMWAVEFORMAT);
+				/// \note 0 may mean we don't know how to decode
+				a_FormatTagDetails->fdwSupport       = ACMDRIVERDETAILS_SUPPORTF_CODEC;
+				a_FormatTagDetails->cStandardFormats = FORMAT_MAX_NB_PCM;
+				// should be filled by Windows				a_FormatTagDetails->szFormatTag[0] = '\0';
+				Result = MMSYSERR_NOERROR;
+				break;
+			case PERSONAL_FORMAT:
+				a_FormatTagDetails->dwFormatTag      = PERSONAL_FORMAT;
+				a_FormatTagDetails->dwFormatTagIndex = 1;
+				a_FormatTagDetails->cbFormatSize     = SIZE_FORMAT_STRUCT;
+				a_FormatTagDetails->fdwSupport       = ACMDRIVERDETAILS_SUPPORTF_CODEC;
+				a_FormatTagDetails->cStandardFormats = GetNumberEncodingFormats();
+				lstrcpyW( a_FormatTagDetails->szFormatTag, L"Lame MP3" );
+				Result = MMSYSERR_NOERROR;
+				break;
+			default:
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails Unknown format 0x%08X",the_format);
+				return (ACMERR_NOTPOSSIBLE);
+		}
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails %d possibilities for format 0x%08X",a_FormatTagDetails->cStandardFormats,the_format);
+	}
+	else
+	{
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "a_FormatTagDetails->cbStruct < sizeof(*a_FormatDetails)");
+		Result = ACMERR_NOTPOSSIBLE;
+	}
+
+	return Result;
+}
+
+/*!
+	Retreive the global details of this ACM driver
+
+	\param a_DriverDetail will be filled with all the corresponding data
+*/
+inline DWORD ACM::OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail)
+{
+	if (my_hIcon == NULL)
+		my_hIcon = LoadIcon(GetDriverModuleHandle(hdrvr), MAKEINTRESOURCE(IDI_ICON));
+	a_DriverDetail->hicon       = my_hIcon;
+
+	a_DriverDetail->fccType     = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
+	a_DriverDetail->fccComp     = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
+
+	/// \note this is an explicit hack of the FhG values
+	/// \note later it could be a new value when the decoding is done
+	a_DriverDetail->wMid        = MM_FRAUNHOFER_IIS;
+	a_DriverDetail->wPid        = MM_FHGIIS_MPEGLAYER3;
+
+	a_DriverDetail->vdwACM      = VERSION_MSACM;
+	a_DriverDetail->vdwDriver   = VERSION_ACM_DRIVER;
+	a_DriverDetail->fdwSupport  = ACMDRIVERDETAILS_SUPPORTF_CODEC;
+	a_DriverDetail->cFormatTags = FORMAT_TAG_MAX_NB; // 2 : MP3 and PCM
+//	a_DriverDetail->cFormatTags = 1; // 2 : MP3 and PCM
+	a_DriverDetail->cFilterTags = FILTER_TAG_MAX_NB;
+
+	lstrcpyW( a_DriverDetail->szShortName, L"LAME MP3" );
+	char tmpStr[128];
+	wsprintf(tmpStr, "LAME MP3 Codec v%s", GetVersionString());
+	int u = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tmpStr, -1, a_DriverDetail->szLongName, 0);
+	MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tmpStr, -1, a_DriverDetail->szLongName, u);
+	lstrcpyW( a_DriverDetail->szCopyright, L"2002 Steve Lhomme" );
+	lstrcpyW( a_DriverDetail->szLicensing, L"LGPL (see gnu.org)" );
+	/// \todo update this part when the code changes
+	lstrcpyW( a_DriverDetail->szFeatures , L"only CBR implementation" );
+
+    return MMSYSERR_NOERROR;  // Can also return DRVCNF_CANCEL
+}
+
+/*!
+	Suggest an output format for the specified input format
+
+	\param a_FormatSuggest will be filled with all the corresponding data
+*/
+inline DWORD ACM::OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest)
+{
+	DWORD Result = MMSYSERR_NOTSUPPORTED;
+    DWORD fdwSuggest = (ACM_FORMATSUGGESTF_TYPEMASK & a_FormatSuggest->fdwSuggest);
+
+my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest %s%s%s%s (0x%08X)",
+				 (fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS) ? "channels, ":"",
+				 (fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC) ? "samples/sec, ":"",
+				 (fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE) ? "bits/sample, ":"",
+				 (fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG) ? "format, ":"",
+				 fdwSuggest);
+
+my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for source format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d",
+				 a_FormatSuggest->pwfxSrc->wFormatTag,
+				 a_FormatSuggest->pwfxSrc->nChannels,
+				 a_FormatSuggest->pwfxSrc->nSamplesPerSec,
+				 a_FormatSuggest->pwfxSrc->nAvgBytesPerSec,
+				 a_FormatSuggest->pwfxSrc->nBlockAlign,
+				 a_FormatSuggest->pwfxSrc->wBitsPerSample);
+
+my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggested destination format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d",
+			 a_FormatSuggest->pwfxDst->wFormatTag,
+			 a_FormatSuggest->pwfxDst->nChannels,
+			 a_FormatSuggest->pwfxDst->nSamplesPerSec,
+			 a_FormatSuggest->pwfxDst->nAvgBytesPerSec,
+			 a_FormatSuggest->pwfxDst->nBlockAlign,
+			 a_FormatSuggest->pwfxDst->wBitsPerSample);
+
+	switch (a_FormatSuggest->pwfxSrc->wFormatTag)
+	{
+        case WAVE_FORMAT_PCM:
+			/// \todo handle here the decoding ?
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for PCM source");
+            //
+			//  if the destination format tag is restricted, verify that
+			//  it is within our capabilities...
+			//
+			//  this driver is able to decode to PCM
+			//
+			if (ACM_FORMATSUGGESTF_WFORMATTAG & fdwSuggest)
+            {
+                if (PERSONAL_FORMAT != a_FormatSuggest->pwfxDst->wFormatTag)
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->wFormatTag = PERSONAL_FORMAT;
+            }
+
+
+my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed A");
+            //
+			//  if the destination channel count is restricted, verify that
+			//  it is within our capabilities...
+			//
+			//  this driver is not able to change the number of channels
+			//
+			if (ACM_FORMATSUGGESTF_NCHANNELS & fdwSuggest)
+            {
+                if (a_FormatSuggest->pwfxSrc->nChannels != a_FormatSuggest->pwfxDst->nChannels)
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->nChannels = a_FormatSuggest->pwfxSrc->nChannels;
+            }
+
+			if (a_FormatSuggest->pwfxSrc->nChannels != 1 && a_FormatSuggest->pwfxSrc->nChannels != 2)
+				return MMSYSERR_INVALPARAM;
+
+
+my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed B");
+            //
+			//  if the destination samples per second is restricted, verify
+			//  that it is within our capabilities...
+			//
+			//  this driver is not able to change the sample rate
+			//
+			if (ACM_FORMATSUGGESTF_NSAMPLESPERSEC & fdwSuggest)
+            {
+                if (a_FormatSuggest->pwfxSrc->nSamplesPerSec != a_FormatSuggest->pwfxDst->nSamplesPerSec)
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->nSamplesPerSec = a_FormatSuggest->pwfxSrc->nSamplesPerSec;
+            }
+
+
+my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed C");
+            //
+			//  if the destination bits per sample is restricted, verify
+			//  that it is within our capabilities...
+			//
+			//  We prefer decoding to 16-bit PCM.
+			//
+			if (ACM_FORMATSUGGESTF_WBITSPERSAMPLE & fdwSuggest)
+            {
+                if ( (16 != a_FormatSuggest->pwfxDst->wBitsPerSample) && (8 != a_FormatSuggest->pwfxDst->wBitsPerSample) )
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->wBitsPerSample = 16;
+            }
+
+			//			a_FormatSuggest->pwfxDst->nBlockAlign = FORMAT_BLOCK_ALIGN;
+			a_FormatSuggest->pwfxDst->nBlockAlign = a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8;
+			
+			a_FormatSuggest->pwfxDst->nAvgBytesPerSec = a_FormatSuggest->pwfxDst->nChannels * 64000 / 8;
+
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed");
+			Result = MMSYSERR_NOERROR;
+
+
+			break;
+		case PERSONAL_FORMAT:
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for PERSONAL source");
+            //
+			//  if the destination format tag is restricted, verify that
+			//  it is within our capabilities...
+			//
+			//  this driver is able to decode to PCM
+			//
+			if (ACM_FORMATSUGGESTF_WFORMATTAG & fdwSuggest)
+            {
+                if (WAVE_FORMAT_PCM != a_FormatSuggest->pwfxDst->wFormatTag)
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->wFormatTag = WAVE_FORMAT_PCM;
+            }
+
+
+            //
+			//  if the destination channel count is restricted, verify that
+			//  it is within our capabilities...
+			//
+			//  this driver is not able to change the number of channels
+			//
+			if (ACM_FORMATSUGGESTF_NCHANNELS & fdwSuggest)
+            {
+                if (a_FormatSuggest->pwfxSrc->nChannels != a_FormatSuggest->pwfxDst->nChannels)
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->nChannels = a_FormatSuggest->pwfxSrc->nChannels;
+            }
+
+
+            //
+			//  if the destination samples per second is restricted, verify
+			//  that it is within our capabilities...
+			//
+			//  this driver is not able to change the sample rate
+			//
+			if (ACM_FORMATSUGGESTF_NSAMPLESPERSEC & fdwSuggest)
+            {
+                if (a_FormatSuggest->pwfxSrc->nSamplesPerSec != a_FormatSuggest->pwfxDst->nSamplesPerSec)
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->nSamplesPerSec = a_FormatSuggest->pwfxSrc->nSamplesPerSec;
+            }
+
+
+            //
+			//  if the destination bits per sample is restricted, verify
+			//  that it is within our capabilities...
+			//
+			//  We prefer decoding to 16-bit PCM.
+			//
+			if (ACM_FORMATSUGGESTF_WBITSPERSAMPLE & fdwSuggest)
+            {
+                if ( (16 != a_FormatSuggest->pwfxDst->wBitsPerSample) && (8 != a_FormatSuggest->pwfxDst->wBitsPerSample) )
+                    return (ACMERR_NOTPOSSIBLE);
+            }
+            else
+			{
+                a_FormatSuggest->pwfxDst->wBitsPerSample = 16;
+            }
+
+			//			a_FormatSuggest->pwfxDst->nBlockAlign = FORMAT_BLOCK_ALIGN;
+			a_FormatSuggest->pwfxDst->nBlockAlign = a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8;
+			
+			/// \todo this value must be a correct one !
+			a_FormatSuggest->pwfxDst->nAvgBytesPerSec = a_FormatSuggest->pwfxDst->nSamplesPerSec * a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8;
+
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed");
+			Result = MMSYSERR_NOERROR;
+
+
+			break;
+	}
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggested destination format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d",
+				 a_FormatSuggest->pwfxDst->wFormatTag,
+				 a_FormatSuggest->pwfxDst->nChannels,
+				 a_FormatSuggest->pwfxDst->nSamplesPerSec,
+				 a_FormatSuggest->pwfxDst->nAvgBytesPerSec,
+				 a_FormatSuggest->pwfxDst->nBlockAlign,
+				 a_FormatSuggest->pwfxDst->wBitsPerSample);
+
+	return Result;
+}
+
+/*!
+	Create a stream instance for decoding/encoding
+
+	\param a_StreamInstance contain information about the stream desired
+*/
+inline DWORD ACM::OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+	//
+	//  the most important condition to check before doing anything else
+	//  is that this ACM driver can actually perform the conversion we are
+	//  being opened for. this check should fail as quickly as possible
+	//  if the conversion is not possible by this driver.
+	//
+	//  it is VERY important to fail quickly so the ACM can attempt to
+	//  find a driver that is suitable for the conversion. also note that
+	//  the ACM may call this driver several times with slightly different
+	//  format specifications before giving up.
+	//
+	//  this driver first verifies that the source and destination formats
+	//  are acceptable...
+	//
+	switch (a_StreamInstance->pwfxSrc->wFormatTag)
+	{
+        case WAVE_FORMAT_PCM:
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PCM source (%05d samples %d channels %d bits/sample)",a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxSrc->nChannels,a_StreamInstance->pwfxSrc->wBitsPerSample);
+			if (a_StreamInstance->pwfxDst->wFormatTag == PERSONAL_FORMAT)
+			{
+				unsigned int OutputFrequency;
+
+				/// \todo Smart mode
+				if (my_EncodingProperties.GetSmartOutputMode())
+					OutputFrequency = ACMStream::GetOutputSampleRate(a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxDst->nAvgBytesPerSec,a_StreamInstance->pwfxDst->nChannels);
+				else
+					OutputFrequency = a_StreamInstance->pwfxSrc->nSamplesPerSec;
+
+				my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PERSONAL output (%05d samples %d channels %d bits/sample %d kbps)",a_StreamInstance->pwfxDst->nSamplesPerSec,a_StreamInstance->pwfxDst->nChannels,a_StreamInstance->pwfxDst->wBitsPerSample,8 * a_StreamInstance->pwfxDst->nAvgBytesPerSec);
+
+				/// \todo add the possibility to have channel resampling (mono to stereo / stereo to mono)
+				/// \todo support resampling ?
+				/// \todo only do the test on OutputFrequency in "Smart Output" mode
+				if (a_StreamInstance->pwfxDst->nSamplesPerSec != OutputFrequency ||
+//					a_StreamInstance->pwfxSrc->nSamplesPerSec != a_StreamInstance->pwfxDst->nSamplesPerSec ||
+					a_StreamInstance->pwfxSrc->nChannels != a_StreamInstance->pwfxDst->nChannels ||
+					a_StreamInstance->pwfxSrc->wBitsPerSample != 16)
+				{
+					Result = ACMERR_NOTPOSSIBLE;
+				} else {
+					if ((a_StreamInstance->fdwOpen & ACM_STREAMOPENF_QUERY) == 0)
+					{
+						ACMStream * the_stream = ACMStream::Create();
+						a_StreamInstance->dwInstance = (DWORD) the_stream;
+
+						if (the_stream != NULL)
+						{
+							MPEGLAYER3WAVEFORMAT * casted = (MPEGLAYER3WAVEFORMAT *) a_StreamInstance->pwfxDst;
+							vbr_mode a_mode = (casted->fdwFlags-2 == 0)?vbr_abr:vbr_off;
+							if (the_stream->init(a_StreamInstance->pwfxDst->nSamplesPerSec,
+												 OutputFrequency,
+												 a_StreamInstance->pwfxDst->nChannels,
+												 a_StreamInstance->pwfxDst->nAvgBytesPerSec,
+												 a_mode))
+								Result = MMSYSERR_NOERROR;
+							else
+								ACMStream::Erase( the_stream );
+						}
+					}
+					else
+					{
+						Result = MMSYSERR_NOERROR;
+					}
+				}
+			}
+			break;
+		case PERSONAL_FORMAT:
+			my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PERSONAL source (%05d samples %d channels %d bits/sample %d kbps)",a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxSrc->nChannels,a_StreamInstance->pwfxSrc->wBitsPerSample,8 * a_StreamInstance->pwfxSrc->nAvgBytesPerSec);
+			if (a_StreamInstance->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
+			{
+#ifdef ENABLE_DECODING
+				if ((a_StreamInstance->fdwOpen & ACM_STREAMOPENF_QUERY) == 0)
+				{
+					/// \todo create the decoding stream
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PCM output (%05d samples %d channels %d bits/sample %d B/s)",a_StreamInstance->pwfxDst->nSamplesPerSec,a_StreamInstance->pwfxDst->nChannels,a_StreamInstance->pwfxDst->wBitsPerSample,a_StreamInstance->pwfxDst->nAvgBytesPerSec);
+
+					DecodeStream * the_stream = DecodeStream::Create();
+					a_StreamInstance->dwInstance = (DWORD) the_stream;
+
+					if (the_stream != NULL)
+					{
+						if (the_stream->init(a_StreamInstance->pwfxDst->nSamplesPerSec,
+											 a_StreamInstance->pwfxDst->nChannels,
+											 a_StreamInstance->pwfxDst->nAvgBytesPerSec,
+											 a_StreamInstance->pwfxSrc->nAvgBytesPerSec))
+							Result = MMSYSERR_NOERROR;
+						else
+							DecodeStream::Erase( the_stream );
+					}
+				}
+				else
+				{
+					/// \todo decoding verification
+					my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream is valid");
+					Result = MMSYSERR_NOERROR;
+				}
+#endif // ENABLE_DECODING
+			}
+			break;
+	}
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream Result = %d",Result);
+	return Result;
+}
+
+inline DWORD ACM::OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+    switch (ACM_STREAMSIZEF_QUERYMASK & the_StreamSize->fdwSize)
+    {
+	case ACM_STREAMSIZEF_DESTINATION:
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Get source buffer size for destination size = %d",the_StreamSize->cbDstLength);
+		break;
+	case ACM_STREAMSIZEF_SOURCE:
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Get destination buffer size for source size = %d",the_StreamSize->cbSrcLength);
+        if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag &&
+			PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag)
+        {
+			ACMStream * the_stream = (ACMStream *) a_StreamInstance->dwInstance;
+			if (the_stream != NULL)
+			{
+				the_StreamSize->cbDstLength = the_stream->GetOutputSizeForInput(the_StreamSize->cbSrcLength);
+				Result = MMSYSERR_NOERROR;
+			}
+		}
+        else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag &&
+			 WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag)
+		{
+#ifdef ENABLE_DECODING
+			DecodeStream * the_stream = (DecodeStream *) a_StreamInstance->dwInstance;
+			if (the_stream != NULL)
+			{
+				the_StreamSize->cbDstLength = the_stream->GetOutputSizeForInput(the_StreamSize->cbSrcLength);
+				Result = MMSYSERR_NOERROR;
+			}
+#endif // ENABLE_DECODING
+		}
+		break;
+	default:
+		Result = MMSYSERR_INVALFLAG;
+		break;
+	}
+
+	return Result;
+}
+
+inline DWORD ACM::OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamClose the stream 0x%X",a_StreamInstance->dwInstance);
+    if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag &&
+		PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag)
+    {
+	ACMStream::Erase( (ACMStream *) a_StreamInstance->dwInstance );
+	}
+    else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag &&
+		 WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag)
+    {
+#ifdef ENABLE_DECODING
+		DecodeStream::Erase( (DecodeStream *) a_StreamInstance->dwInstance );
+#endif // ENABLE_DECODING
+	}
+
+	// nothing to do yet
+	Result = MMSYSERR_NOERROR;
+
+	return Result;
+}
+
+inline DWORD ACM::OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "  prepare : Src : %d (0x%08X) / %d - Dst : %d (0x%08X) / %d"
+												, a_StreamHeader->cbSrcLength
+												, a_StreamHeader->pbSrc
+												, a_StreamHeader->cbSrcLengthUsed
+												, a_StreamHeader->cbDstLength
+												, a_StreamHeader->pbDst
+												, a_StreamHeader->cbDstLengthUsed
+											  );
+
+	if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag &&
+		PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag)
+	{
+		ACMStream * the_stream = (ACMStream *)a_StreamInstance->dwInstance;
+		
+		if (the_stream->open(my_EncodingProperties))
+			Result = MMSYSERR_NOERROR;
+	}
+	else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag &&
+		     WAVE_FORMAT_PCM == a_StreamInstance->pwfxDst->wFormatTag)
+	{
+#ifdef ENABLE_DECODING
+		DecodeStream * the_stream = (DecodeStream *)a_StreamInstance->dwInstance;
+		
+		if (the_stream->open())
+			Result = MMSYSERR_NOERROR;
+#endif // ENABLE_DECODING
+	}
+
+	return Result;
+}
+
+inline DWORD ACM::OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+	my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "unprepare : Src : %d / %d - Dst : %d / %d"
+											, a_StreamHeader->cbSrcLength
+											, a_StreamHeader->cbSrcLengthUsed
+											, a_StreamHeader->cbDstLength
+											, a_StreamHeader->cbDstLengthUsed
+											);
+    if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag &&
+		PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag)
+    {
+	ACMStream * the_stream = (ACMStream *)a_StreamInstance->dwInstance;
+	DWORD OutputSize = a_StreamHeader->cbDstLength;
+	
+	if (the_stream->close(a_StreamHeader->pbDst, &OutputSize) && (OutputSize <= a_StreamHeader->cbDstLength))
+	{
+		a_StreamHeader->cbDstLengthUsed = OutputSize;
+			Result = MMSYSERR_NOERROR;
+		}
+	}
+    else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag &&
+		 WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag)
+    {
+#ifdef ENABLE_DECODING
+		DecodeStream * the_stream = (DecodeStream *)a_StreamInstance->dwInstance;
+		DWORD OutputSize = a_StreamHeader->cbDstLength;
+		
+		if (the_stream->close(a_StreamHeader->pbDst, &OutputSize) && (OutputSize <= a_StreamHeader->cbDstLength))
+		{
+			a_StreamHeader->cbDstLengthUsed = OutputSize;
+			Result = MMSYSERR_NOERROR;
+	}
+#endif // ENABLE_DECODING
+	}
+
+	return Result;
+}
+
+inline DWORD ACM::OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader)
+{
+	DWORD Result = ACMERR_NOTPOSSIBLE;
+
+	if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag &&
+		PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag)
+	{
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert SRC = PCM (encode)");
+
+		ACMStream * the_stream = (ACMStream *) a_StreamInstance->dwInstance;
+		if (the_stream != NULL)
+		{
+			if (the_stream->ConvertBuffer( a_StreamHeader ))
+				Result = MMSYSERR_NOERROR;
+		}
+	}
+	else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag &&
+		     WAVE_FORMAT_PCM == a_StreamInstance->pwfxDst->wFormatTag)
+	{
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert SRC = MP3 (decode)");
+
+#ifdef ENABLE_DECODING
+		DecodeStream * the_stream = (DecodeStream *) a_StreamInstance->dwInstance;
+		if (the_stream != NULL)
+		{
+			if (the_stream->ConvertBuffer( a_StreamHeader ))
+				Result = MMSYSERR_NOERROR;
+		}
+#endif // ENABLE_DECODING
+	}
+	else
+		my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert unsupported conversion");
+
+	return Result;
+}
+
+
+void ACM::GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const
+{
+	int Block_size;
+    char temp[ACMFORMATDETAILS_FORMAT_CHARS];
+
+
+	if (the_Index < bitrate_table.size())
+	{
+	//	the_Format.wBitsPerSample = 16;
+		the_Format.wBitsPerSample = 0;
+	
+		/// \todo handle more channel modes (mono, stereo, joint-stereo, dual-channel)
+	//	the_Format.nChannels = SIZE_CHANNEL_MODE - int(the_Index % SIZE_CHANNEL_MODE);
+	
+		the_Format.nBlockAlign = 1;
+
+		the_Format.nSamplesPerSec = bitrate_table[the_Index].frequency;
+		the_Format.nAvgBytesPerSec = bitrate_table[the_Index].bitrate * 1000 / 8;
+		if (bitrate_table[the_Index].frequency >= mpeg1_freq[SIZE_FREQ_MPEG1-1])
+			Block_size = 1152;
+		else
+			Block_size = 576;
+	
+		the_Format.nChannels = bitrate_table[the_Index].channels;
+
+		the_Format.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+		MPEGLAYER3WAVEFORMAT * tmpFormat = (MPEGLAYER3WAVEFORMAT *) &the_Format;
+		tmpFormat->wID             = 1;
+		// this is the only way I found to know if we do CBR or ABR
+		tmpFormat->fdwFlags        = 2 + ((bitrate_table[the_Index].mode == vbr_abr)?0:2);
+		tmpFormat->nBlockSize      = WORD(Block_size * the_Format.nAvgBytesPerSec / the_Format.nSamplesPerSec);
+		tmpFormat->nFramesPerBlock = 1;
+		tmpFormat->nCodecDelay     = 0; // 0x0571 on FHG
+	
+         /// \todo : generate the string with the appropriate stereo mode
+         if (bitrate_table[the_Index].mode == vbr_abr)
+             wsprintfA( temp, "%d Hz, %d kbps ABR, %s", the_Format.nSamplesPerSec, the_Format.nAvgBytesPerSec * 8 / 1000, (the_Format.nChannels == 1)?"Mono":"Stereo");
+         else
+             wsprintfA( temp, "%d Hz, %d kbps CBR, %s", the_Format.nSamplesPerSec, the_Format.nAvgBytesPerSec * 8 / 1000, (the_Format.nChannels == 1)?"Mono":"Stereo");
+
+         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, temp, -1, the_String, ACMFORMATDETAILS_FORMAT_CHARS);
+     }
+ }
+
+void ACM::GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const
+{
+	the_Format.nChannels = SIZE_CHANNEL_MODE - int(the_Index % SIZE_CHANNEL_MODE);
+	the_Format.wBitsPerSample = 16;
+	the_Format.nBlockAlign = the_Format.nChannels * the_Format.wBitsPerSample / 8;
+
+
+	DWORD a_Channel_Independent = the_Index / SIZE_CHANNEL_MODE;
+
+	// first MPEG1 frequencies
+	if (a_Channel_Independent < SIZE_FREQ_MPEG1)
+	{
+		the_Format.nSamplesPerSec = mpeg1_freq[a_Channel_Independent];
+	}
+	else
+	{
+		a_Channel_Independent -= SIZE_FREQ_MPEG1;
+		the_Format.nSamplesPerSec = mpeg2_freq[a_Channel_Independent];
+	}
+
+	the_Format.nAvgBytesPerSec = the_Format.nSamplesPerSec * the_Format.nChannels * the_Format.wBitsPerSample / 8;
+}
+
+DWORD ACM::GetNumberEncodingFormats() const
+{
+	return bitrate_table.size();
+}
+
+bool ACM::IsSmartOutput(const int frequency, const int bitrate, const int channels) const
+{
+	double compression_ratio = double(frequency * 2 * channels) / double(bitrate * 100);
+
+//my_debug.OutPut(DEBUG_LEVEL_FUNC_DEBUG, "compression_ratio %f, freq %d, bitrate %d, channels %d", compression_ratio, frequency, bitrate, channels);
+
+	if(my_EncodingProperties.GetSmartOutputMode())
+		return (compression_ratio <= my_EncodingProperties.GetSmartRatio());
+	else return true;
+}
+
+void ACM::BuildBitrateTable()
+{
+	my_debug.OutPut("entering BuildBitrateTable");
+
+	// fill the table
+	unsigned int channel,bitrate,freq;
+	
+	bitrate_table.clear();
+
+	// CBR bitrates
+	for (channel = 0;channel < SIZE_CHANNEL_MODE;channel++)
+	{
+		// MPEG I
+		for (freq = 0;freq < SIZE_FREQ_MPEG1;freq++)
+		{
+			for (bitrate = 0;bitrate < SIZE_BITRATE_MPEG1;bitrate++)
+			{
+
+				if (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg1_freq[freq], mpeg1_bitrate[bitrate], channel+1))
+				{
+					bitrate_item bitrate_table_tmp;
+					
+					bitrate_table_tmp.frequency = mpeg1_freq[freq];
+					bitrate_table_tmp.bitrate = mpeg1_bitrate[bitrate];
+					bitrate_table_tmp.channels = channel+1;
+					bitrate_table_tmp.mode = vbr_off;
+					bitrate_table.push_back(bitrate_table_tmp);
+				}
+			}
+		}
+		// MPEG II / II.5
+		for (freq = 0;freq < SIZE_FREQ_MPEG2;freq++)
+		{
+			for (bitrate = 0;bitrate < SIZE_BITRATE_MPEG2;bitrate++)
+			{
+				if (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg2_freq[freq], mpeg2_bitrate[bitrate], channel+1))
+				{
+					bitrate_item bitrate_table_tmp;
+
+                                        bitrate_table_tmp.frequency = mpeg2_freq[freq];
+					bitrate_table_tmp.bitrate = mpeg2_bitrate[bitrate];
+					bitrate_table_tmp.channels = channel+1;
+					bitrate_table_tmp.mode = vbr_abr;
+					bitrate_table.push_back(bitrate_table_tmp);
+				}
+			}
+		}
+	}
+
+	if (my_EncodingProperties.GetAbrOutputMode())
+	// ABR bitrates
+	{
+		for (channel = 0;channel < SIZE_CHANNEL_MODE;channel++)
+		{
+			// MPEG I
+			for (freq = 0;freq < SIZE_FREQ_MPEG1;freq++)
+			{
+				for (bitrate = my_EncodingProperties.GetAbrBitrateMax();
+					   bitrate >= my_EncodingProperties.GetAbrBitrateMin(); 
+				     bitrate -= my_EncodingProperties.GetAbrBitrateStep())
+				{
+					if (bitrate >= mpeg1_bitrate[SIZE_BITRATE_MPEG1-1] && (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg1_freq[freq], bitrate, channel+1)))
+					{
+						bitrate_item bitrate_table_tmp;
+						
+						bitrate_table_tmp.frequency = mpeg1_freq[freq];
+						bitrate_table_tmp.bitrate = bitrate;
+						bitrate_table_tmp.channels = channel+1;
+						bitrate_table_tmp.mode = vbr_abr;
+						bitrate_table.push_back(bitrate_table_tmp);
+					}
+				}
+			}
+			// MPEG II / II.5
+			for (freq = 0;freq < SIZE_FREQ_MPEG2;freq++)
+			{
+				for (bitrate = my_EncodingProperties.GetAbrBitrateMax();
+					   bitrate >= my_EncodingProperties.GetAbrBitrateMin(); 
+				     bitrate -= my_EncodingProperties.GetAbrBitrateStep())
+				{
+					if (bitrate >= mpeg2_bitrate[SIZE_BITRATE_MPEG2-1] && (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg2_freq[freq], bitrate, channel+1)))
+					{
+						bitrate_item bitrate_table_tmp;
+						
+						bitrate_table_tmp.frequency = mpeg2_freq[freq];
+						bitrate_table_tmp.bitrate = bitrate;
+						bitrate_table_tmp.channels = channel+1;
+						bitrate_table_tmp.mode = vbr_abr;
+						bitrate_table.push_back(bitrate_table_tmp);
+					}
+				}
+			}
+		}
+	}
+
+	// sorting by frequency/bitrate/channel
+	std::sort(bitrate_table.begin(), bitrate_table.end());
+
+/*	{
+		// display test
+		int i=0;
+		for (i=0; i<bitrate_table.size();i++)
+		{
+			my_debug.OutPut("bitrate_table[%d].frequency = %d",i,bitrate_table[i].frequency);
+			my_debug.OutPut("bitrate_table[%d].bitrate = %d",i,bitrate_table[i].bitrate);
+			my_debug.OutPut("bitrate_table[%d].channel = %d",i,bitrate_table[i].channels);
+			my_debug.OutPut("bitrate_table[%d].ABR = %s\n",i,(bitrate_table[i].mode == vbr_abr)?"ABR":"CBR");
+		}
+	}*/
+
+	my_debug.OutPut("leaving BuildBitrateTable");
+}
diff --git a/ACM/ACM.h b/ACM/ACM.h
new file mode 100644
index 0000000..3d5e280
--- /dev/null
+++ b/ACM/ACM.h
@@ -0,0 +1,101 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: ACM.h,v 1.8 2006/12/25 21:37:34 robert Exp $
+*/
+
+#if !defined(_ACM_H__INCLUDED_)
+#define _ACM_H__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include <vector>
+
+#include <windows.h>
+#include <mmsystem.h>
+#include <mmreg.h>
+#include <msacm.h>
+#include <msacmdrv.h>
+
+
+#include "ADbg/ADbg.h"
+
+class AEncodeProperties;
+
+typedef enum vbr_mode_e vbr_mode;
+
+class bitrate_item {
+	public:
+		unsigned int frequency;
+		unsigned int bitrate;
+		unsigned int channels;
+		vbr_mode     mode;
+	
+		bool operator<(const bitrate_item & bitrate) const;
+};
+
+class ACM  
+{
+public:
+	ACM( HMODULE hModule );
+	virtual ~ACM();
+
+	LONG DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2);
+
+	static const char * GetVersionString(void) {return VersionString;}
+
+protected:
+//	inline DWORD Configure( HWND hParentWindow, LPDRVCONFIGINFO pConfig );
+	inline DWORD About( HWND hParentWindow );
+
+	inline DWORD OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail);
+	inline DWORD OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query);
+	inline DWORD OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query);
+	inline DWORD OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest);
+	inline DWORD OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance);
+	inline DWORD OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance);
+	inline DWORD OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize);
+	inline DWORD OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader);
+	inline DWORD OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader);
+	inline DWORD OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader);
+
+	void GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const;
+	void GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const;
+	DWORD GetNumberEncodingFormats() const;
+	bool IsSmartOutput(const int frequency, const int bitrate, const int channels) const;
+	void BuildBitrateTable();
+
+	HMODULE my_hModule;
+	HICON   my_hIcon;
+	ADbg    my_debug;
+	AEncodeProperties my_EncodingProperties;
+	std::vector<bitrate_item> bitrate_table;
+
+	static char VersionString[120];
+};
+
+#endif // !defined(_ACM_H__INCLUDED_)
+
diff --git a/ACM/ACMStream.cpp b/ACM/ACMStream.cpp
new file mode 100644
index 0000000..83d6470
--- /dev/null
+++ b/ACM/ACMStream.cpp
@@ -0,0 +1,397 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: ACMStream.cpp,v 1.12.2.1 2008/11/01 20:41:47 robert Exp $
+*/
+
+#if !defined(STRICT)
+#define STRICT
+#endif // STRICT
+
+#include <assert.h>
+#include <windows.h>
+
+#include "adebug.h"
+
+#include "ACMStream.h"
+
+#include <lame.h>
+
+// static methods
+
+ACMStream * ACMStream::Create()
+{
+	ACMStream * Result;
+
+	Result = new ACMStream;
+
+	return Result;
+}
+
+const bool ACMStream::Erase(const ACMStream * a_ACMStream)
+{
+	delete a_ACMStream;
+	return true;
+}
+
+// class methods
+
+ACMStream::ACMStream() :
+ m_WorkingBufferUseSize(0),
+ gfp(NULL)
+{
+	 /// \todo get the debug level from the registry
+my_debug = new ADbg(DEBUG_LEVEL_CREATION);
+	if (my_debug != NULL) {
+		unsigned char DebugFileName[512];
+
+		my_debug->setPrefix("LAMEstream"); /// \todo get it from the registry
+my_debug->setIncludeTime(true);  /// \todo get it from the registry
+
+// Check in the registry if we have to Output Debug information
+DebugFileName[0] = '\0';
+
+		HKEY OssKey;
+		if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI", 0, KEY_READ , &OssKey ) == ERROR_SUCCESS) {
+			DWORD DataType;
+			DWORD DebugFileNameSize = 512;
+			if (RegQueryValueEx( OssKey, "DebugFile", NULL, &DataType, DebugFileName, &DebugFileNameSize ) == ERROR_SUCCESS) {
+				if (DataType == REG_SZ) {
+					my_debug->setUseFile(true);
+					my_debug->setDebugFile((char *)DebugFileName);
+					my_debug->OutPut("Debug file is %s",(char *)DebugFileName);
+				}
+			}
+		}
+		my_debug->OutPut(DEBUG_LEVEL_FUNC_START, "ACMStream Creation (0X%08X)",this);
+	}
+	else {
+		ADbg debug;
+		debug.OutPut("ACMStream::ACMACMStream : Impossible to create my_debug");
+	}
+
+}
+
+ACMStream::~ACMStream()
+{
+        // release memory - encoding is finished
+	if (gfp) lame_close( gfp );
+
+	if (my_debug != NULL)
+	{
+		my_debug->OutPut(DEBUG_LEVEL_FUNC_START, "ACMStream Deletion (0X%08X)",this);
+		delete my_debug;
+	}
+}
+
+bool ACMStream::init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode)
+{
+	bool bResult = false;
+
+	my_SamplesPerSec  = nSamplesPerSec;
+	my_OutBytesPerSec = nOutputSamplesPerSec;
+	my_Channels       = nChannels;
+	my_AvgBytesPerSec = nAvgBytesPerSec;
+	my_VBRMode = mode;
+
+	bResult = true;
+
+	return bResult;
+
+}
+
+bool ACMStream::open(const AEncodeProperties & the_Properties)
+{
+	bool bResult = false;
+
+	// Init the MP3 Stream
+	// Init the global flags structure
+	gfp = lame_init();
+
+	// Set input sample frequency
+	lame_set_in_samplerate( gfp, my_SamplesPerSec );
+
+	// Set output sample frequency
+	lame_set_out_samplerate( gfp, my_OutBytesPerSec );
+
+	lame_set_num_channels( gfp, my_Channels );
+	if (my_Channels == 1)
+		lame_set_mode( gfp, MONO );
+	else
+		lame_set_mode( gfp, (MPEG_mode_e)the_Properties.GetChannelModeValue()) ; /// \todo Get the mode from the default configuration
+
+//	lame_set_VBR( gfp, vbr_off ); /// \note VBR not supported for the moment
+	lame_set_VBR( gfp, my_VBRMode ); /// \note VBR not supported for the moment
+	
+	if (my_VBRMode == vbr_abr)
+	{
+		lame_set_VBR_q( gfp, 1 );
+
+		lame_set_VBR_mean_bitrate_kbps( gfp, (my_AvgBytesPerSec * 8 + 500) / 1000 );
+
+		if (24000 > lame_get_in_samplerate( gfp ))
+		{
+			// For MPEG-II
+			lame_set_VBR_min_bitrate_kbps( gfp, 8);
+
+			lame_set_VBR_max_bitrate_kbps( gfp, 160);
+		}
+		else
+		{
+			// For MPEG-I
+			lame_set_VBR_min_bitrate_kbps( gfp, 32);
+
+			lame_set_VBR_max_bitrate_kbps( gfp, 320);
+		}
+	}
+
+	// Set bitrate
+	lame_set_brate( gfp, my_AvgBytesPerSec * 8 / 1000 );
+
+	/// \todo Get the mode from the default configuration
+	// Set copyright flag?
+	lame_set_copyright( gfp, the_Properties.GetCopyrightMode()?1:0 );
+	// Do we have to tag  it as non original 
+	lame_set_original( gfp, the_Properties.GetOriginalMode()?1:0 );
+	// Add CRC?
+	lame_set_error_protection( gfp, the_Properties.GetCRCMode()?1:0 );
+	// Set private bit?
+	lame_set_extension( gfp, the_Properties.GetPrivateMode()?1:0 );
+	// INFO tag support not possible in ACM - it requires rewinding 
+        // output stream to the beginning after encoding is finished.   
+	lame_set_bWriteVbrTag( gfp, 0 );
+
+	if (0 == lame_init_params( gfp ))
+	{
+		//LAME encoding call will accept any number of samples.  
+		if ( 0 == lame_get_version( gfp ) )
+		{
+			// For MPEG-II, only 576 samples per frame per channel
+			my_SamplesPerBlock = 576 * lame_get_num_channels( gfp );
+		}
+		else
+		{
+			// For MPEG-I, 1152 samples per frame per channel
+			my_SamplesPerBlock = 1152 * lame_get_num_channels( gfp );
+		}
+	}
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "version                =%d",lame_get_version( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Layer                  =3");
+	switch ( lame_get_mode( gfp ) )
+	{
+		case STEREO:       my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "mode                   =Stereo" ); break;
+		case JOINT_STEREO: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "mode                   =Joint-Stereo" ); break;
+		case DUAL_CHANNEL: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "mode                   =Forced Stereo" ); break;
+		case MONO:         my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "mode                   =Mono" ); break;
+		case NOT_SET:      /* FALLTROUGH */
+		default:           my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "mode                   =Error (unknown)" ); break;
+	}
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "sampling frequency     =%.1f kHz", lame_get_in_samplerate( gfp ) /1000.0 );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "bitrate                =%d kbps", lame_get_brate( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Vbr Min bitrate        =%d kbps", lame_get_VBR_min_bitrate_kbps( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Vbr Max bitrate        =%d kbps", lame_get_VBR_max_bitrate_kbps( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Quality Setting        =%d", lame_get_quality( gfp ) );
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Low pass frequency     =%d", lame_get_lowpassfreq( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Low pass width         =%d", lame_get_lowpasswidth( gfp ) );
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "High pass frequency    =%d", lame_get_highpassfreq( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "High pass width        =%d", lame_get_highpasswidth( gfp ) );
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "No Short Blocks        =%d", lame_get_no_short_blocks( gfp ) );
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "de-emphasis            =%d", lame_get_emphasis( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "private flag           =%d", lame_get_extension( gfp ) );
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "copyright flag         =%d", lame_get_copyright( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "original flag          =%d",	lame_get_original( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "CRC                    =%s", lame_get_error_protection( gfp ) ? "on" : "off" );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Fast mode              =%s", ( lame_get_quality( gfp ) )? "enabled" : "disabled" );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Force mid/side stereo  =%s", ( lame_get_force_ms( gfp ) )?"enabled":"disabled" );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Disable Resorvoir      =%d", lame_get_disable_reservoir( gfp ) );
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "VBR                    =%s, VBR_q =%d, VBR method =",
+					( lame_get_VBR( gfp ) !=vbr_off ) ? "enabled": "disabled",
+		            lame_get_VBR_q( gfp ) );
+
+	switch ( lame_get_VBR( gfp ) )
+	{
+		case vbr_off:	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "vbr_off" );	break;
+		case vbr_mt :	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "vbr_mt" );	break;
+		case vbr_rh :	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "vbr_rh" );	break;
+		case vbr_mtrh:	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "vbr_mtrh" );	break;
+		case vbr_abr: 
+			my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG,  "vbr_abr (average bitrate %d kbps)", lame_get_VBR_mean_bitrate_kbps( gfp ) );
+		break;
+		default:
+			my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "error, unknown VBR setting");
+		break;
+	}
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Write VBR Header       =%s\n", ( lame_get_bWriteVbrTag( gfp ) ) ?"Yes":"No");
+
+#ifdef FROM_DLL
+beConfig.format.LHV1.dwReSampleRate		= my_OutBytesPerSec;	  // force the user resampling
+#endif // FROM_DLL
+
+	bResult = true;
+
+	return bResult;
+}
+
+bool ACMStream::close(LPBYTE pOutputBuffer, DWORD *pOutputSize)
+{
+
+bool bResult = false;
+
+	int nOutputSamples = 0;
+
+    nOutputSamples = lame_encode_flush( gfp, pOutputBuffer, 0 );
+
+	if ( nOutputSamples < 0 )
+	{
+		// BUFFER_TOO_SMALL
+*pOutputSize = 0;
+	}
+	else
+{
+		*pOutputSize = nOutputSamples;
+
+		bResult = true;
+	}
+
+	// lame will be closed in destructor
+        //lame_close( gfp );
+
+	return bResult;
+}
+
+DWORD ACMStream::GetOutputSizeForInput(const DWORD the_SrcLength) const
+{
+/*	double OutputInputRatio;
+
+	if (my_VBRMode == vbr_off)
+		OutputInputRatio = double(my_AvgBytesPerSec) / double(my_OutBytesPerSec * 2);
+	else // reserve the space for 320 kbps
+		OutputInputRatio = 40000.0 / double(my_OutBytesPerSec * 2);
+
+	OutputInputRatio *= 1.15; // allow 15% more*/
+
+    DWORD Result;
+
+//	Result = DWORD(double(the_SrcLength) * OutputInputRatio);
+    Result = DWORD(1.25*the_SrcLength + 7200);
+
+my_debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "Result = %d",Result);
+
+	return Result;
+}
+
+bool ACMStream::ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader)
+{
+	bool result;
+
+if (my_debug != NULL)
+{
+my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "enter ACMStream::ConvertBuffer");
+}
+
+	DWORD InSize = a_StreamHeader->cbSrcLength / 2, OutSize = a_StreamHeader->cbDstLength; // 2 for 8<->16 bits
+
+// Encode it
+int dwSamples;
+	int nOutputSamples = 0;
+
+	dwSamples = InSize / lame_get_num_channels( gfp );
+
+	if ( 1 == lame_get_num_channels( gfp ) )
+	{
+		nOutputSamples = lame_encode_buffer(gfp,(PSHORT)a_StreamHeader->pbSrc,(PSHORT)a_StreamHeader->pbSrc,dwSamples,a_StreamHeader->pbDst,a_StreamHeader->cbDstLength);
+	}
+	else
+	{
+		nOutputSamples = lame_encode_buffer_interleaved(gfp,(PSHORT)a_StreamHeader->pbSrc,dwSamples,a_StreamHeader->pbDst,a_StreamHeader->cbDstLength);
+	}
+
+	a_StreamHeader->cbSrcLengthUsed = a_StreamHeader->cbSrcLength;
+	a_StreamHeader->cbDstLengthUsed = nOutputSamples;
+
+	result = a_StreamHeader->cbDstLengthUsed <= a_StreamHeader->cbDstLength;
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "UsedSize = %d / EncodedSize = %d, result = %d (%d <= %d)", InSize, OutSize, result, a_StreamHeader->cbDstLengthUsed, a_StreamHeader->cbDstLength);
+
+if (my_debug != NULL)
+{
+my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "ACMStream::ConvertBuffer result = %d (0x%02X 0x%02X)",result,a_StreamHeader->pbDst[0],a_StreamHeader->pbDst[1]);
+}
+
+	return result;
+}
+
+/* map frequency to a valid MP3 sample frequency
+ *
+ * Robert Hegemann 2000-07-01
+ */
+static int
+map2MP3Frequency(int freq)
+{
+    if (freq <= 8000)
+        return 8000;
+    if (freq <= 11025)
+        return 11025;
+    if (freq <= 12000)
+        return 12000;
+    if (freq <= 16000)
+        return 16000;
+    if (freq <= 22050)
+        return 22050;
+    if (freq <= 24000)
+        return 24000;
+    if (freq <= 32000)
+        return 32000;
+    if (freq <= 44100)
+        return 44100;
+
+    return 48000;
+}
+
+
+unsigned int ACMStream::GetOutputSampleRate(int samples_per_sec, int bitrate, int channels)
+{
+    if (bitrate==0)
+        bitrate = (64000*channels)/8;
+  
+        /// \todo pass through the same LAME routine
+	unsigned int OutputFrequency;
+	double compression_ratio = double(samples_per_sec * 16 * channels / (bitrate * 8));
+	if (compression_ratio > 13.)
+		OutputFrequency = map2MP3Frequency( int((10. * bitrate * 8) / (16 * channels)));
+	else
+		OutputFrequency = map2MP3Frequency( int(0.97 * samples_per_sec) );
+
+	return OutputFrequency;
+
+}
+
diff --git a/ACM/ACMStream.h b/ACM/ACMStream.h
new file mode 100644
index 0000000..9cba528
--- /dev/null
+++ b/ACM/ACMStream.h
@@ -0,0 +1,85 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: ACMStream.h,v 1.5 2006/12/25 21:37:34 robert Exp $
+*/
+
+#if !defined(_ACMSTREAM_H__INCLUDED_)
+#define _ACMSTREAM_H__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include <mmreg.h>
+#include <msacm.h>
+#include <msacmdrv.h>
+
+#include "ADbg/ADbg.h"
+
+#include "AEncodeProperties.h"
+
+
+typedef enum vbr_mode_e vbr_mode;
+typedef struct lame_global_struct lame_global_flags;
+
+
+class ACMStream
+{
+public:
+	ACMStream( );
+	virtual ~ACMStream( );
+
+	static ACMStream * Create();
+	static const bool Erase(const ACMStream * a_ACMStream);
+
+	bool init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode);
+	bool open(const AEncodeProperties & the_Properties);
+	bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);
+
+	DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
+	bool  ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);
+
+	static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);
+
+protected:
+	lame_global_flags * gfp;
+
+	ADbg * my_debug;
+	int my_SamplesPerSec;
+	int my_Channels;
+	int my_AvgBytesPerSec;
+	int my_OutBytesPerSec;
+	vbr_mode my_VBRMode;
+	DWORD  my_SamplesPerBlock;
+
+unsigned int m_WorkingBufferUseSize;
+	char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock
+
+inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const;
+
+};
+
+#endif // !defined(_ACMSTREAM_H__INCLUDED_)
+
diff --git a/ACM/ADbg/ADbg.cpp b/ACM/ADbg/ADbg.cpp
new file mode 100644
index 0000000..80dc92f
--- /dev/null
+++ b/ACM/ADbg/ADbg.cpp
@@ -0,0 +1,181 @@
+/************************************************************************
+Project               : C++ debugging class
+File version          : 0.4
+
+BSD License post 1999 : 
+
+Copyright (c) 2001, Steve Lhomme
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met: 
+
+- Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+- 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. 
+
+- The name of the author may not be used to endorse or promote products derived
+from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 <stdio.h>
+#include <stdarg.h>
+#include <windows.h>
+
+#include "ADbg.h"
+
+#if !defined(NDEBUG)
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+ADbg::ADbg(int level)
+:my_level(level)
+,my_time_included(false)
+,my_use_file(false)
+,my_debug_output(true)
+,hFile(NULL)
+{
+	prefix[0] = '\0';
+	OutPut(-1,"ADbg Creation at debug level = %d (0x%08X)",my_level,this);
+}
+
+ADbg::~ADbg()
+{
+	unsetDebugFile();
+	OutPut(-1,"ADbg Deletion (0x%08X)",this);
+}
+
+inline int ADbg::_OutPut(const char * format,va_list params) const
+{
+	int result;
+
+	char tst[1000];
+	char myformat[256];
+
+	if (my_time_included) {
+		SYSTEMTIME time;
+		GetSystemTime(&time);
+		if (prefix[0] == '\0')
+			wsprintf(myformat,"%04d/%02d/%02d %02d:%02d:%02d.%03d UTC : %s\r\n",
+							time.wYear,
+							time.wMonth,
+							time.wDay,
+							time.wHour,
+							time.wMinute,
+							time.wSecond,
+							time.wMilliseconds,
+							format);
+		else
+			wsprintf(myformat,"%04d/%02d/%02d %02d:%02d:%02d.%03d UTC : %s - %s\r\n",
+							time.wYear,
+							time.wMonth,
+							time.wDay,
+							time.wHour,
+							time.wMinute,
+							time.wSecond,
+							time.wMilliseconds,
+							prefix,
+							format);
+	} else {
+		if (prefix[0] == '\0')
+			wsprintf( myformat, "%s\r\n", format);
+		else
+			wsprintf( myformat, "%s - %s\r\n", prefix, format);
+	}
+
+	result = vsprintf(tst,myformat,params);
+	
+	if (my_debug_output)
+		OutputDebugString(tst);
+
+	if (my_use_file && (hFile != NULL)) {
+		SetFilePointer( hFile, 0, 0, FILE_END );
+		DWORD written;
+		WriteFile( hFile, tst, lstrlen(tst), &written, NULL );
+	}
+
+	return result;
+}
+
+int ADbg::OutPut(int forLevel, const char * format,...) const
+{
+	int result=0;
+	
+	if (forLevel >= my_level) {
+		va_list tstlist;
+		int result;
+
+		va_start(tstlist, format);
+
+		result = _OutPut(format,tstlist);
+
+	}
+
+	return result;
+}
+
+int ADbg::OutPut(const char * format,...) const
+{
+	va_list tstlist;
+
+	va_start(tstlist, format);
+
+	return _OutPut(format,tstlist);
+}
+
+bool ADbg::setDebugFile(const char * NewFilename) {
+	bool result;
+	result = unsetDebugFile();
+
+	if (result) {
+		result = false;
+
+		hFile = CreateFile(NewFilename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
+		
+		if (hFile != INVALID_HANDLE_VALUE) {
+			SetFilePointer( hFile, 0, 0, FILE_END );
+
+			result = true;
+
+			OutPut(-1,"Debug file Opening succeeded");
+
+		}
+		else
+			OutPut(-1,"Debug file %s Opening failed",NewFilename);
+	}
+
+	return result;
+}
+
+bool ADbg::unsetDebugFile() {
+	bool result = (hFile == NULL);
+	
+	if (hFile != NULL) {
+		result = (CloseHandle(hFile) != 0);
+		
+		if (result) {
+			OutPut(-1,"Debug file Closing succeeded");
+			hFile = NULL;
+		}
+	}
+
+	return result;
+}
+
+#endif // !defined(NDEBUG)
diff --git a/ACM/ADbg/ADbg.dsp b/ACM/ADbg/ADbg.dsp
new file mode 100644
index 0000000..2d3352d
--- /dev/null
+++ b/ACM/ADbg/ADbg.dsp
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="ADbg" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Static Library" 0x0104

+

+CFG=ADbg - Win32 Debug

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "ADbg.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "ADbg.mak" CFG="ADbg - Win32 Debug"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "ADbg - Win32 Release" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE "ADbg - Win32 Debug" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "ADbg - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\..\obj\Release"

+# PROP Intermediate_Dir "..\..\obj\Release\ADbg"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD BASE RSC /l 0x40c

+# ADD RSC /l 0x40c

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo

+

+!ELSEIF  "$(CFG)" == "ADbg - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\..\obj\Debug"

+# PROP Intermediate_Dir "..\..\obj\Debug\ADbg"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD BASE RSC /l 0x40c

+# ADD RSC /l 0x40c

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo

+

+!ENDIF 

+

+# Begin Target

+

+# Name "ADbg - Win32 Release"

+# Name "ADbg - Win32 Debug"

+# Begin Group "Sources"

+

+# PROP Default_Filter "cpp"

+# Begin Source File

+

+SOURCE=.\ADbg.cpp

+# End Source File

+# End Group

+# Begin Group "Headers"

+

+# PROP Default_Filter "h"

+# Begin Source File

+

+SOURCE=.\ADbg.h

+# End Source File

+# End Group

+# End Target

+# End Project

diff --git a/ACM/ADbg/ADbg.h b/ACM/ADbg/ADbg.h
new file mode 100644
index 0000000..9cb40b8
--- /dev/null
+++ b/ACM/ADbg/ADbg.h
@@ -0,0 +1,133 @@
+/************************************************************************
+Project               : C++ debugging class
+File version          : 0.4
+
+BSD License post 1999 : 
+
+Copyright (c) 2001, Steve Lhomme
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met: 
+
+- Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+- 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. 
+
+- The name of the author may not be used to endorse or promote products derived
+from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. 
+************************************************************************/
+
+#if !defined(_DBG_H__INCLUDED_)
+#define _DBG_H__INCLUDED_
+
+#include <windows.h>
+
+static const int MAX_PREFIX_LENGTH = 128;
+
+#if !defined(NDEBUG)
+// define the working debugging class
+
+class ADbg  
+{
+public:
+	ADbg(int level = 0);
+	virtual ~ADbg();
+
+	/// \todo make an inline function to test the level first and the process
+	int OutPut(int level, const char * format,...) const;
+
+	int OutPut(const char * format,...) const;
+
+	inline int setLevel(const int level) {
+		return my_level = level;
+	}
+
+	inline bool setIncludeTime(const bool included = true) {
+		return my_time_included = included;
+	}
+
+	bool setDebugFile(const char * NewFilename);
+	bool unsetDebugFile();
+
+	inline bool setUseFile(const bool usefile = true) {
+		return my_use_file = usefile;
+	}
+
+	inline const char * setPrefix(const char * string) {
+		return strncpy(prefix, string, MAX_PREFIX_LENGTH);
+	}
+
+private:
+	int my_level;
+	bool my_time_included;
+	bool my_use_file;
+	bool my_debug_output;
+
+	int _OutPut(const char * format,va_list params) const;
+
+	char prefix[MAX_PREFIX_LENGTH];
+
+	HANDLE hFile;
+};
+
+#else // !defined(NDEBUG)
+
+// define a class that does nothing (no output)
+
+class ADbg  
+{
+public:
+	ADbg(int level = 0){}
+	virtual ~ADbg() {}
+
+	inline int OutPut(int level, const char * format,...) const {
+		return 0;
+	}
+
+	inline int OutPut(const char * format,...) const {
+		return 0;
+	}
+
+	inline int setLevel(const int level) {
+		return level;
+	}
+
+	inline bool setIncludeTime(const bool included = true) {
+		return true;
+	}
+
+	inline bool setDebugFile(const char * NewFilename) {
+		return true;
+	}
+
+	inline bool unsetDebugFile() {
+		return true;
+	}
+
+	inline bool setUseFile(const bool usefile = true) {
+		return true;
+	}
+
+	inline const char * setPrefix(const char * string) {
+		return string;
+	}
+};
+
+#endif // !defined(NDEBUG)
+
+#endif // !defined(_DBG_H__INCLUDED_)
diff --git a/ACM/ADbg/ADbg_vc7.vcproj b/ACM/ADbg/ADbg_vc7.vcproj
new file mode 100644
index 0000000..c967dda
--- /dev/null
+++ b/ACM/ADbg/ADbg_vc7.vcproj
@@ -0,0 +1,465 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="7.10"

+	Name="ADbg"

+	ProjectGUID="{4A9EBEED-ACCA-4548-B10A-90524B1CFCD1}"

+	SccProjectName=""

+	SccLocalPath="">

+	<Platforms>

+		<Platform

+			Name="Win32"/>

+	</Platforms>

+	<Configurations>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory=".\Debug"

+			IntermediateDirectory=".\Debug"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/ADbg.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="1"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory=".\Release"

+			IntermediateDirectory=".\Release"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="1"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"

+				StringPooling="TRUE"

+				RuntimeLibrary="4"

+				EnableFunctionLevelLinking="TRUE"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/ADbg.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Release\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME debug|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/ADbg.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="1"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME release|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/ADbg.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="1"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME release Nasm|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="1"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"

+				StringPooling="TRUE"

+				RuntimeLibrary="4"

+				EnableFunctionLevelLinking="TRUE"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/ADbg.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Release\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll debug|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/ADbg.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="1"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll release|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/ADbg.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="1"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll release Nasm|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="1"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"

+				StringPooling="TRUE"

+				RuntimeLibrary="4"

+				EnableFunctionLevelLinking="TRUE"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/ADbg.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Release\ADbg.lib"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Sources"

+			Filter="cpp">

+			<File

+				RelativePath="ADbg.cpp">

+				<FileConfiguration

+					Name="Debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="2"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="2"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="2"

+						PreprocessorDefinitions=""/>

+				</FileConfiguration>

+			</File>

+		</Filter>

+		<Filter

+			Name="Headers"

+			Filter="h">

+			<File

+				RelativePath="ADbg.h">

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/ACM/ADbg/Makefile.am b/ACM/ADbg/Makefile.am
new file mode 100644
index 0000000..684e4c1
--- /dev/null
+++ b/ACM/ADbg/Makefile.am
@@ -0,0 +1,10 @@
+## $Id: Makefile.am,v 1.2 2005/08/21 17:32:08 bouvigne Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	ADbg.cpp \
+	ADbg.dsp \
+	ADbg_vc7.vcproj \
+	ADbg.h
+
diff --git a/ACM/ADbg/Makefile.in b/ACM/ADbg/Makefile.in
new file mode 100644
index 0000000..44bbb75
--- /dev/null
+++ b/ACM/ADbg/Makefile.in
@@ -0,0 +1,361 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = ACM/ADbg
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	ADbg.cpp \
+	ADbg.dsp \
+	ADbg_vc7.vcproj \
+	ADbg.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  ACM/ADbg/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  ACM/ADbg/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ACM/AEncodeProperties.cpp b/ACM/AEncodeProperties.cpp
new file mode 100644
index 0000000..d4f4c36
--- /dev/null
+++ b/ACM/AEncodeProperties.cpp
@@ -0,0 +1,2027 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: AEncodeProperties.cpp,v 1.9.8.1 2008/11/01 20:41:47 robert Exp $
+*/
+
+#if !defined(STRICT)
+#define STRICT
+#endif // !defined(STRICT)
+
+#include <windows.h>
+#include <windowsx.h>
+#include <shlobj.h>
+#include <assert.h>
+
+#ifdef _MSC_VER
+// no problem with unknown pragmas
+#pragma warning(disable: 4068)
+#endif
+
+#include "resource.h"
+#include <lame.h>
+#include "adebug.h"
+#include "AEncodeProperties.h"
+#include "ACM.h"
+//#include "AParameters/AParameters.h"
+
+#ifndef TTS_BALLOON
+#define TTS_BALLOON            0x40
+#endif // TTS_BALLOON
+
+const unsigned int AEncodeProperties::the_Bitrates[18] = {320, 256, 224, 192, 160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8 };
+const unsigned int AEncodeProperties::the_MPEG1_Bitrates[14] = {320, 256, 224, 192, 160, 128, 112, 96, 80, 64, 56, 48, 40, 32 };
+const unsigned int AEncodeProperties::the_MPEG2_Bitrates[14] = {160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8};
+const unsigned int AEncodeProperties::the_ChannelModes[3] = { STEREO, JOINT_STEREO, DUAL_CHANNEL };
+//const char         AEncodeProperties::the_Presets[][13] = {"None", "CD", "Studio", "Hi-Fi", "Phone", "Voice", "Radio", "Tape", "FM", "AM", "SW"};
+//const LAME_QUALTIY_PRESET AEncodeProperties::the_Presets[] = {LQP_NOPRESET, LQP_R3MIX_QUALITY, LQP_NORMAL_QUALITY, LQP_LOW_QUALITY, LQP_HIGH_QUALITY, LQP_VERYHIGH_QUALITY, LQP_VOICE_QUALITY, LQP_PHONE, LQP_SW, LQP_AM, LQP_FM, LQP_VOICE, LQP_RADIO, LQP_TAPE, LQP_HIFI, LQP_CD, LQP_STUDIO};
+//const unsigned int AEncodeProperties::the_SamplingFreqs[9] = { 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 };
+
+ToolTipItem AEncodeProperties::Tooltips[13]={
+	{ IDC_CHECK_ENC_ABR, "Allow encoding with an average bitrate\r\ninstead of a constant one.\r\n\r\nIt can improve the quality for the same bitrate." },
+	{ IDC_CHECK_COPYRIGHT, "Mark the encoded data as copyrighted." },
+	{ IDC_CHECK_CHECKSUM, "Put a checksum in the encoded data.\r\n\r\nThis can make the file less sensitive to data loss." },
+	{ IDC_CHECK_ORIGINAL, "Mark the encoded data as an original file." },
+	{ IDC_CHECK_PRIVATE, "Mark the encoded data as private." },
+	{ IDC_COMBO_ENC_STEREO, "Select the type of stereo mode used for encoding:\r\n\r\n- Stereo : the usual one\r\n- Joint-Stereo : mix both channel to achieve better compression\r\n- Dual Channel : treat both channel as separate" },
+	{ IDC_STATIC_DECODING, "Decoding not supported for the moment by the codec." },
+	{ IDC_CHECK_ENC_SMART, "Disable bitrate when there is too much compression.\r\n(default 1:15 ratio)" },
+	{ IDC_STATIC_CONFIG_VERSION, "Version of this codec.\r\n\r\nvX.X.X is the version of the codec interface.\r\nX.XX is the version of the encoding engine." },
+	{ IDC_SLIDER_AVERAGE_MIN, "Select the minimum Average Bitrate allowed." },
+	{ IDC_SLIDER_AVERAGE_MAX, "Select the maximum Average Bitrate allowed." },
+	{ IDC_SLIDER_AVERAGE_STEP, "Select the step of Average Bitrate between the min and max.\r\n\r\nA step of 5 between 152 and 165 means you have :\r\n165, 160 and 155" },
+	{ IDC_SLIDER_AVERAGE_SAMPLE, "Check the resulting values of the (min,max,step) combination.\r\n\r\nUse the keyboard to navigate (right -> left)." },
+};
+//int AEncodeProperties::tst = 0;
+
+/*
+#pragma argsused
+static UINT CALLBACK DLLFindCallback(
+  HWND hdlg,      // handle to child dialog box
+  UINT uiMsg,     // message identifier
+  WPARAM wParam,  // message parameter
+  LPARAM lParam   // message parameter
+  )
+{
+	UINT result = 0;
+
+	switch (uiMsg)
+	{
+		case WM_NOTIFY:
+			OFNOTIFY * info = (OFNOTIFY *)lParam;
+			if (info->hdr.code == CDN_FILEOK)
+			{
+				result = 1; // by default we don't accept the file
+
+				// Check if the selected file is a valid DLL with all the required functions
+				ALameDLL * tstFile = new ALameDLL;
+				if (tstFile != NULL)
+				{
+					if (tstFile->Load(info->lpOFN->lpstrFile))
+					{
+						result = 0;
+					}
+
+					delete tstFile;
+				}
+
+				if (result == 1)
+				{
+					TCHAR output[250];
+					::LoadString(AOut::GetInstance(),IDS_STRING_DLL_UNRECOGNIZED,output,250);
+					AOut::MyMessageBox( output, MB_OK|MB_ICONEXCLAMATION, hdlg);
+					SetWindowLong(hdlg, DWL_MSGRESULT , -100);
+				}
+			}
+	}
+
+	return result;
+}
+
+#pragma argsused
+static int CALLBACK BrowseFolderCallbackroc(
+    HWND hwnd,
+    UINT uMsg,
+    LPARAM lParam,
+    LPARAM lpData
+    )
+{
+	AEncodeProperties * the_prop;
+	the_prop = (AEncodeProperties *) lpData;
+
+
+	if (uMsg == BFFM_INITIALIZED)
+	{
+//		char FolderName[MAX_PATH];
+//		SHGetPathFromIDList((LPITEMIDLIST) lParam,FolderName);
+//ADbg tst;
+//tst.OutPut("init folder to %s ",the_prop->GetOutputDirectory());
+//		CreateFile();
+		::SendMessage(hwnd, BFFM_SETSELECTION, (WPARAM)TRUE, (LPARAM)the_prop->GetOutputDirectory());
+	}/* else if (uMsg == BFFM_SELCHANGED)
+	{
+		// verify that the folder is writable
+//		::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)0); // disable
+		char FolderName[MAX_PATH];
+		SHGetPathFromIDList((LPITEMIDLIST) lParam, FolderName);
+		
+//		if (CreateFile(FolderName,STANDARD_RIGHTS_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL) == INVALID_HANDLE_VALUE)
+		if ((GetFileAttributes(FolderName) & FILE_ATTRIBUTE_DIRECTORY) != 0)
+			::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)1); // enable
+		else
+			::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)0); // disable
+//ADbg tst;
+//tst.OutPut("change folder to %s ",FolderName);
+	}* /
+
+	return 0;
+}
+*/
+#pragma argsused
+static BOOL CALLBACK ConfigProc(
+  HWND hwndDlg,  // handle to dialog box
+  UINT uMsg,     // message
+  WPARAM wParam, // first message parameter
+  LPARAM lParam  // second message parameter
+  )
+{
+	BOOL bResult;
+	AEncodeProperties * the_prop;
+	the_prop = (AEncodeProperties *) GetProp(hwndDlg, "AEncodeProperties-Config");
+
+	switch (uMsg) {
+		case WM_COMMAND:
+			if (the_prop != NULL)
+			{
+				bResult = the_prop->HandleDialogCommand( hwndDlg, wParam, lParam);
+			}
+			break;
+		case WM_INITDIALOG:
+			assert(the_prop == NULL);
+
+			the_prop = (AEncodeProperties *) lParam;
+			the_prop->my_debug.OutPut("there hwnd = 0x%08X",hwndDlg);
+
+			assert(the_prop != NULL);
+
+			SetProp(hwndDlg, "AEncodeProperties-Config", the_prop);
+
+			the_prop->InitConfigDlg(hwndDlg);
+
+			bResult = TRUE;
+			break;
+
+		case WM_HSCROLL:
+			// check if it's the ABR sliders
+			if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_MIN))
+			{
+				the_prop->UpdateDlgFromSlides(hwndDlg);
+			}
+			else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_MAX))
+			{
+				the_prop->UpdateDlgFromSlides(hwndDlg);
+			}
+			else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_STEP))
+			{
+				the_prop->UpdateDlgFromSlides(hwndDlg);
+			}
+			else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_SAMPLE))
+			{
+				the_prop->UpdateDlgFromSlides(hwndDlg);
+			}
+			break;
+
+		case WM_NOTIFY:
+			if (TTN_GETDISPINFO == ((LPNMHDR)lParam)->code) {
+				NMTTDISPINFO *lphdr = (NMTTDISPINFO *)lParam;
+				UINT id = (lphdr->uFlags & TTF_IDISHWND) ? GetWindowLong((HWND)lphdr->hdr.idFrom, GWL_ID) : lphdr->hdr.idFrom;
+
+				*lphdr->lpszText = 0;
+
+				SendMessage(lphdr->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 5000);
+
+				for(int i=0; i<sizeof AEncodeProperties::Tooltips/sizeof AEncodeProperties::Tooltips[0]; ++i) {
+					if (id == AEncodeProperties::Tooltips[i].id)
+						lphdr->lpszText = const_cast<char *>(AEncodeProperties::Tooltips[i].tip);
+				}
+
+				return TRUE;
+			}
+			break;
+
+		default:
+			bResult = FALSE; // will be treated by DefWindowProc
+	}
+	return bResult;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+/**
+	\class AEncodeProperties
+*/
+
+
+const char * AEncodeProperties::GetChannelModeString(int a_channelID) const
+{
+	assert(a_channelID < sizeof(the_ChannelModes));
+
+	switch (a_channelID) {
+		case 0:
+			return "Stereo";
+		case 1:
+			return "Joint-stereo";
+		case 2:
+			return "Dual Channel";
+		default:
+			assert(a_channelID);
+			return NULL;
+	}
+}
+
+const int AEncodeProperties::GetBitrateString(char * string, int string_size, int a_bitrateID) const
+{
+	assert(a_bitrateID < sizeof(the_Bitrates));
+	assert(string != NULL);
+
+	if (string_size >= 4)
+		return wsprintf(string,"%d",the_Bitrates[a_bitrateID]);
+	else
+		return -1;
+}
+
+const unsigned int AEncodeProperties::GetChannelModeValue() const
+{
+	assert(nChannelIndex < sizeof(the_ChannelModes));
+
+	return the_ChannelModes[nChannelIndex];
+}
+
+const unsigned int AEncodeProperties::GetBitrateValue() const
+{
+	assert(nMinBitrateIndex < sizeof(the_Bitrates));
+
+	return the_Bitrates[nMinBitrateIndex];
+}
+
+inline const int AEncodeProperties::GetBitrateValueMPEG2(DWORD & bitrate) const
+{
+	int i;
+
+	for (i=0;i<sizeof(the_MPEG2_Bitrates)/sizeof(unsigned int);i++)
+	{
+		if (the_MPEG2_Bitrates[i] == the_Bitrates[nMinBitrateIndex])
+		{
+			bitrate = the_MPEG2_Bitrates[i];
+			return 0;
+		}
+		else if (the_MPEG2_Bitrates[i] < the_Bitrates[nMinBitrateIndex])
+		{
+			bitrate = the_MPEG2_Bitrates[i];
+			return -1;
+		}
+	}
+	
+	bitrate = 160;
+	return -1;
+}
+
+inline const int AEncodeProperties::GetBitrateValueMPEG1(DWORD & bitrate) const
+{
+	int i;
+
+	for (i=sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1;i>=0;i--)
+	{
+		if (the_MPEG1_Bitrates[i] == the_Bitrates[nMinBitrateIndex])
+		{
+			bitrate = the_MPEG1_Bitrates[i];
+			return 0;
+		}
+		else if (the_MPEG1_Bitrates[i] > the_Bitrates[nMinBitrateIndex])
+		{
+			bitrate = the_MPEG1_Bitrates[i];
+			return 1;
+		}
+	}
+	
+	bitrate = 32;
+	return 1;
+}
+/*
+const int AEncodeProperties::GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const
+{
+	assert((MPEG_Version == MPEG1) || (MPEG_Version == MPEG2));
+	assert(nMinBitrateIndex < sizeof(the_Bitrates));
+
+	if (MPEG_Version == MPEG2)
+		return GetBitrateValueMPEG2(bitrate);
+	else
+		return GetBitrateValueMPEG1(bitrate);
+}
+/*
+const char * AEncodeProperties::GetPresetModeString(const int a_presetID) const
+{
+	assert(a_presetID < sizeof(the_Presets));
+
+	switch (a_presetID) {
+		case 1:
+			return "r3mix";
+		case 2:
+			return "Normal";
+		case 3:
+			return "Low";
+		case 4:
+			return "High";
+		case 5:
+			return "Very High";
+		case 6:
+			return "Voice";
+		case 7:
+			return "Phone";
+		case 8:
+			return "SW";
+		case 9:
+			return "AM";
+		case 10:
+			return "FM";
+		case 11:
+			return "Voice";
+		case 12:
+			return "Radio";
+		case 13:
+			return "Tape";
+		case 14:
+			return "Hi-Fi";
+		case 15:
+			return "CD";
+		case 16:
+			return "Studio";
+		default:
+			return "None";
+	}
+}
+
+const LAME_QUALTIY_PRESET AEncodeProperties::GetPresetModeValue() const
+{
+	assert(nPresetIndex < sizeof(the_Presets));
+
+	return the_Presets[nPresetIndex];
+}
+*/
+bool AEncodeProperties::Config(const HINSTANCE Hinstance, const HWND HwndParent)
+{
+	//WM_INITDIALOG ?
+
+	// remember the instance to retreive strings
+//	hDllInstance = Hinstance;
+
+	my_debug.OutPut("here");
+	int ret = ::DialogBoxParam(Hinstance, MAKEINTRESOURCE(IDD_CONFIG), HwndParent, ::ConfigProc, (LPARAM) this);
+/*	if (ret == -1)
+	{
+		LPVOID lpMsgBuf;
+		FormatMessage( 
+			FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+			FORMAT_MESSAGE_FROM_SYSTEM | 
+			FORMAT_MESSAGE_IGNORE_INSERTS,
+			NULL,
+			GetLastError(),
+			MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+			(LPTSTR) &lpMsgBuf,
+			0,
+			NULL 
+		);
+		// Process any inserts in lpMsgBuf.
+		// ...
+		// Display the string.
+		AOut::MyMessageBox( (LPCTSTR)lpMsgBuf, MB_OK | MB_ICONINFORMATION );
+		// Free the buffer.
+		LocalFree( lpMsgBuf );	
+		return false;
+	}
+*/	
+	return true;
+}
+
+bool AEncodeProperties::InitConfigDlg(HWND HwndDlg)
+{
+	// get all the required strings
+//	TCHAR Version[5];
+//	LoadString(hDllInstance, IDS_STRING_VERSION, Version, 5);
+
+	int i;
+
+	// Add required channel modes
+	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_RESETCONTENT , NULL, NULL);
+	for (i=0;i<GetChannelLentgh();i++)
+		SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_ADDSTRING, NULL, (LPARAM) GetChannelModeString(i));
+
+	char tmp[20];
+	wsprintf(tmp, "v%s",ACM::GetVersionString());
+	SetWindowText( GetDlgItem( HwndDlg, IDC_STATIC_CONFIG_VERSION), tmp);
+
+	// Add all possible re-sampling freq
+/*	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_RESETCONTENT , NULL, NULL);
+	char tmp[10];
+	for (i=0;i<sizeof(the_SamplingFreqs)/sizeof(unsigned int);i++)
+	{
+		wsprintf(tmp, "%d", the_SamplingFreqs[i]);
+		SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_ADDSTRING, NULL, (LPARAM) tmp );
+	}
+*/	
+
+	// Add required bitrates
+/*	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_RESETCONTENT , NULL, NULL);
+	for (i=0;i<GetBitrateLentgh();i++)
+	{
+		GetBitrateString(tmp, 5, i);
+		SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_ADDSTRING, NULL, (LPARAM) tmp );
+	}
+
+	// Add bitrates to the VBR combo box too
+	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_RESETCONTENT , NULL, NULL);
+	for (i=0;i<GetBitrateLentgh();i++)
+	{
+		GetBitrateString(tmp, 5, i);
+		SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_ADDSTRING, NULL, (LPARAM) tmp );
+	}
+
+	// Add VBR Quality Slider
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_SETRANGE, TRUE, MAKELONG(0,9));
+
+	// Add presets
+	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_RESETCONTENT , NULL, NULL);
+	for (i=0;i<GetPresetLentgh();i++)
+		SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_ADDSTRING, NULL, (LPARAM) GetPresetModeString(i));
+*/
+
+	// Add ABR Sliders
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETRANGE, TRUE, MAKELONG(8,320));
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_SETRANGE, TRUE, MAKELONG(8,320));
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_SETRANGE, TRUE, MAKELONG(1,16));
+
+	// Tool-Tip initialiasiation
+	TOOLINFO ti;
+	HWND ToolTipWnd;
+	char DisplayStr[30] = "test tooltip";
+
+	ToolTipWnd = CreateWindowEx(WS_EX_TOPMOST,
+        TOOLTIPS_CLASS,
+        NULL,
+        WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP|TTS_BALLOON ,		
+        CW_USEDEFAULT,
+        CW_USEDEFAULT,
+        CW_USEDEFAULT,
+        CW_USEDEFAULT,
+        HwndDlg,
+        NULL,
+        NULL,
+        NULL
+        );
+
+	SetWindowPos(ToolTipWnd,
+        HWND_TOPMOST,
+        0,
+        0,
+        0,
+        0,
+        SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+    /* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
+	ti.cbSize		= sizeof(TOOLINFO);
+	ti.uFlags		= TTF_SUBCLASS | TTF_IDISHWND;
+	ti.hwnd			= HwndDlg;
+	ti.lpszText		= LPSTR_TEXTCALLBACK;
+    
+    /* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
+	for(i=0; i<sizeof Tooltips/sizeof Tooltips[0]; ++i) {
+		ti.uId			= (WPARAM)GetDlgItem(HwndDlg, Tooltips[i].id);
+
+		if (ti.uId)
+			SendMessage(ToolTipWnd, TTM_ADDTOOL, 0, (LPARAM)&ti);
+	}
+
+my_debug.OutPut("call UpdateConfigs");
+
+	UpdateConfigs(HwndDlg);
+
+my_debug.OutPut("call UpdateDlgFromValue");
+
+	UpdateDlgFromValue(HwndDlg);
+
+
+	my_debug.OutPut("finished InitConfigDlg");
+
+
+	return true;
+}
+
+bool AEncodeProperties::UpdateDlgFromValue(HWND HwndDlg)
+{
+	// get all the required strings
+//	TCHAR Version[5];
+//	LoadString(hDllInstance, IDS_STRING_VERSION, Version, 5);
+
+	int i;
+
+	// Check boxes if required
+	::CheckDlgButton( HwndDlg, IDC_CHECK_CHECKSUM,     GetCRCMode()        ?BST_CHECKED:BST_UNCHECKED );
+	::CheckDlgButton( HwndDlg, IDC_CHECK_ORIGINAL,     GetOriginalMode()   ?BST_CHECKED:BST_UNCHECKED );
+	::CheckDlgButton( HwndDlg, IDC_CHECK_PRIVATE,      GetPrivateMode()    ?BST_CHECKED:BST_UNCHECKED );
+	::CheckDlgButton( HwndDlg, IDC_CHECK_COPYRIGHT,    GetCopyrightMode()  ?BST_CHECKED:BST_UNCHECKED );
+	::CheckDlgButton( HwndDlg, IDC_CHECK_ENC_SMART,    GetSmartOutputMode()?BST_CHECKED:BST_UNCHECKED );
+	::CheckDlgButton( HwndDlg, IDC_CHECK_ENC_ABR,      GetAbrOutputMode()  ?BST_CHECKED:BST_UNCHECKED );
+//	::CheckDlgButton( HwndDlg, IDC_CHECK_RESERVOIR,    !GetNoBiResMode() ?BST_CHECKED:BST_UNCHECKED );
+//	::CheckDlgButton( HwndDlg, IDC_CHECK_XINGVBR,      GetXingFrameMode()?BST_CHECKED:BST_UNCHECKED );
+//	::CheckDlgButton( HwndDlg, IDC_CHECK_RESAMPLE,     GetResampleMode() ?BST_CHECKED:BST_UNCHECKED );
+//	::CheckDlgButton( HwndDlg, IDC_CHECK_CHANNELFORCE, bForceChannel     ?BST_CHECKED:BST_UNCHECKED );
+	
+	// Add required channel modes
+	for (i=0;i<GetChannelLentgh();i++)
+	{
+		if (i == nChannelIndex)
+		{
+			SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_SETCURSEL, i, NULL);
+			break;
+		}
+	}
+
+	// Add VBR Quality
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETPOS, TRUE, AverageBitrate_Min);
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_SETPOS, TRUE, AverageBitrate_Max);
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_SETPOS, TRUE, AverageBitrate_Step);
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETPOS, TRUE, AverageBitrate_Max);
+
+	UpdateDlgFromSlides(HwndDlg);
+
+	EnableAbrOptions(HwndDlg, GetAbrOutputMode());
+//	UpdateAbrSteps(AverageBitrate_Min, AverageBitrate_Max, AverageBitrate_Step);
+	// Add all possible re-sampling freq
+/*	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_SETCURSEL, nSamplingFreqIndex, NULL);
+	
+
+	// Add required bitrates
+	for (i=0;i<GetBitrateLentgh();i++)
+	{
+		if (i == nMinBitrateIndex)
+		{
+			SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_SETCURSEL, i, NULL);
+			break;
+		}
+	}
+
+	// Add bitrates to the VBR combo box too
+	for (i=0;i<GetBitrateLentgh();i++)
+	{
+		if (i == nMaxBitrateIndex)
+		{
+			SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_SETCURSEL, i, NULL);
+			break;
+		}
+	}
+
+//	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_SETRANGE, TRUE, MAKELONG(0,9));
+
+	char tmp[3];
+	wsprintf(tmp,"%d",VbrQuality);
+	SetWindowText(GetDlgItem( HwndDlg, IDC_CONFIG_QUALITY), tmp);
+	SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_SETPOS, TRUE, VbrQuality);
+	
+	wsprintf(tmp,"%d",AverageBitrate);
+	SetWindowText(GetDlgItem( HwndDlg, IDC_EDIT_AVERAGE), tmp);
+	
+	// Display VBR settings if needed
+	AEncodeProperties::DisplayVbrOptions(HwndDlg, mBRmode);
+
+	// Display Resample settings if needed
+	if (GetResampleMode())
+	{
+		::EnableWindow(::GetDlgItem(HwndDlg,IDC_COMBO_SAMPLEFREQ), TRUE);
+	}
+	else
+	{
+		::EnableWindow(::GetDlgItem(HwndDlg,IDC_COMBO_SAMPLEFREQ), FALSE);
+	}
+
+
+	// Add presets
+	for (i=0;i<GetPresetLentgh();i++)
+	{
+		if (i == nPresetIndex)
+		{
+			SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_SETCURSEL, i, NULL);
+			break;
+		}
+	}
+
+	// Add User configs
+//	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_RESETCONTENT , NULL, NULL);
+	::SetWindowText(::GetDlgItem( HwndDlg, IDC_EDIT_OUTPUTDIR), OutputDir.c_str());
+*/
+	/**
+		\todo Select the right saved config
+	*/
+
+	return true;
+}
+
+bool AEncodeProperties::UpdateValueFromDlg(HWND HwndDlg)
+{
+	nChannelIndex      = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO),   CB_GETCURSEL, NULL, NULL);
+//	nMinBitrateIndex   = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE),    CB_GETCURSEL, NULL, NULL);
+//	nMaxBitrateIndex   = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_GETCURSEL, NULL, NULL);
+//	nPresetIndex       = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET),     CB_GETCURSEL, NULL, NULL);
+//	VbrQuality         = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_GETPOS , NULL, NULL);
+//	nSamplingFreqIndex = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_GETCURSEL, NULL, NULL);
+
+	bCRC          = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_CHECKSUM)     == BST_CHECKED);
+	bCopyright    = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_COPYRIGHT)    == BST_CHECKED);
+	bOriginal     = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_ORIGINAL)     == BST_CHECKED);
+	bPrivate      = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_PRIVATE)      == BST_CHECKED);
+	bSmartOutput  = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_ENC_SMART)    == BST_CHECKED);
+	bAbrOutput    = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_ENC_ABR)      == BST_CHECKED);
+//	bNoBitRes     =!(::IsDlgButtonChecked( HwndDlg, IDC_CHECK_RESERVOIR)    == BST_CHECKED);
+//	bXingFrame    = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_XINGVBR)      == BST_CHECKED);
+//	bResample     = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_RESAMPLE)     == BST_CHECKED);
+//	bForceChannel = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_CHANNELFORCE) == BST_CHECKED);
+
+	AverageBitrate_Min  = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_GETPOS , NULL, NULL);
+	AverageBitrate_Max  = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_GETPOS , NULL, NULL);
+	AverageBitrate_Step = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_GETPOS , NULL, NULL);
+
+	EnableAbrOptions(HwndDlg, bAbrOutput);
+
+my_debug.OutPut("nChannelIndex %d, bCRC %d, bCopyright %d, bOriginal %d, bPrivate %d",nChannelIndex, bCRC, bCopyright, bOriginal, bPrivate);
+
+/*	char tmpPath[MAX_PATH];
+	::GetWindowText( ::GetDlgItem( HwndDlg, IDC_EDIT_OUTPUTDIR), tmpPath, MAX_PATH);
+	OutputDir = tmpPath;
+
+	if (::IsDlgButtonChecked(HwndDlg, IDC_RADIO_BITRATE_CBR) == BST_CHECKED)
+		mBRmode = BR_CBR;
+	else if (::IsDlgButtonChecked(HwndDlg, IDC_RADIO_BITRATE_VBR) == BST_CHECKED)
+		mBRmode = BR_VBR;
+	else
+		mBRmode = BR_ABR;
+	
+	::GetWindowText( ::GetDlgItem( HwndDlg, IDC_EDIT_AVERAGE), tmpPath, MAX_PATH);
+	AverageBitrate = atoi(tmpPath);
+	if (AverageBitrate < 8)
+		AverageBitrate = 8;
+	if (AverageBitrate > 320)
+		AverageBitrate = 320;
+*/
+	return true;
+}
+/*
+VBRMETHOD AEncodeProperties::GetVBRValue(DWORD & MaxBitrate, int & Quality, DWORD & AbrBitrate, BOOL & VBRHeader, const DWORD MPEG_Version) const
+{
+	assert((MPEG_Version == MPEG1) || (MPEG_Version == MPEG2));
+	assert(nMaxBitrateIndex < sizeof(the_Bitrates));
+
+	if (mBRmode == BR_VBR)
+	{
+		MaxBitrate = the_Bitrates[nMaxBitrateIndex];
+
+		if (MPEG_Version == MPEG1)
+			MaxBitrate = MaxBitrate>the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]?MaxBitrate:the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1];
+		else
+			MaxBitrate = MaxBitrate<the_MPEG2_Bitrates[0]?MaxBitrate:the_MPEG2_Bitrates[0];
+
+		VBRHeader = bXingFrame;
+		Quality = VbrQuality;
+		AbrBitrate = 0;
+
+		return VBR_METHOD_DEFAULT; // for the moment
+	} 
+	else if (mBRmode == BR_ABR)
+	{
+		MaxBitrate = the_Bitrates[nMaxBitrateIndex];
+
+		if (MPEG_Version == MPEG1)
+			MaxBitrate = MaxBitrate>the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]?MaxBitrate:the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1];
+		else
+			MaxBitrate = MaxBitrate<the_MPEG2_Bitrates[0]?MaxBitrate:the_MPEG2_Bitrates[0];
+
+		VBRHeader = bXingFrame;
+		Quality = 0;
+		AbrBitrate = AverageBitrate*1000;
+		return VBR_METHOD_ABR;
+	}
+	else
+	{
+		return VBR_METHOD_NONE;
+	}
+}
+*/
+void AEncodeProperties::ParamsRestore()
+{
+	// use these default parameters in case one is not found
+	bCopyright    = true;
+	bCRC          = true;
+	bOriginal     = true;
+	bPrivate      = true;
+	bNoBitRes     = false; // enable bit reservoir
+	bXingFrame    = true;
+	bResample     = false;
+	bForceChannel = false;
+	bSmartOutput  = true;
+	bAbrOutput    = true;
+	
+	AverageBitrate_Min = 80; // a bit lame
+	AverageBitrate_Max = 160; // a bit lame
+	AverageBitrate_Step = 8; // a bit lame
+	SmartRatioMax = 15.0;
+
+	nChannelIndex = 2; // joint-stereo
+	mBRmode       = BR_CBR;
+	nMinBitrateIndex = 6; // 128 kbps (works for both MPEGI and II)
+	nMaxBitrateIndex = 4; // 160 kbps (works for both MPEGI and II)
+	nPresetIndex = 0; // None
+	VbrQuality = 1; // Quite High
+//	AverageBitrate = 128; // a bit lame
+	nSamplingFreqIndex = 1; // 44100
+
+//	OutputDir = "c:\\";
+
+//	DllLocation = "plugins\\lame_enc.dll";
+
+	// get the values from the saved file if possible
+	if (my_stored_data.LoadFile(my_store_location))
+	{
+		TiXmlNode* node;
+
+		node = my_stored_data.FirstChild("lame_acm");
+
+		TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
+
+		std::string CurrentConfig = "";
+
+		if (CurrentNode->Attribute("default") != NULL)
+		{
+			CurrentConfig = *CurrentNode->Attribute("default");
+		}
+
+/*		// output parameters
+		TiXmlElement* iterateElmt = node->FirstChildElement("DLL");
+		if (iterateElmt != NULL)
+		{
+			const std::string * tmpname = iterateElmt->Attribute("location");
+			if (tmpname != NULL)
+			{
+				DllLocation = *tmpname;
+			}
+		}
+*/
+		GetValuesFromKey(CurrentConfig, *CurrentNode);
+	}
+	else
+	{
+		/**
+			\todo save the data in the file !
+		*/
+	}
+}
+
+void AEncodeProperties::ParamsSave()
+{
+/*
+
+
+	save the current parameters in the corresponding subkey
+	
+
+
+
+	HKEY OssKey;
+
+	if (RegCreateKeyEx ( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI\\out_lame", 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE , NULL, &OssKey, NULL ) == ERROR_SUCCESS) {
+
+		if (RegSetValueEx(OssKey, "DLL Location", 0, REG_EXPAND_SZ, (CONST BYTE *)DllLocation, strlen(DllLocation)+1 ) != ERROR_SUCCESS)
+			return;
+		
+		RegCloseKey(OssKey); 
+	}
+*/
+}
+/*
+void AEncodeProperties::DisplayVbrOptions(const HWND hDialog, const BRMode the_mode)
+{
+	bool bVBR = false;
+	bool bABR = false;
+
+	switch ( the_mode )
+	{
+		case BR_CBR:
+			::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_CBR);
+			break;
+		case BR_VBR:
+			::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_VBR);
+			bVBR = true;
+			break;
+		case BR_ABR:
+			::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_ABR);
+			bABR = true;
+			break;
+
+	}
+
+	if(bVBR|bABR)
+	{
+		::SetWindowText(::GetDlgItem(hDialog,IDC_STATIC_MINBITRATE), "Min Bitrate");
+	}
+	else
+	{
+		::SetWindowText(::GetDlgItem(hDialog,IDC_STATIC_MINBITRATE), "Bitrate");
+	}
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_CHECK_XINGVBR), bVBR|bABR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_COMBO_MAXBITRATE), bVBR|bABR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_MAXBITRATE), bVBR|bABR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_QUALITY), bVBR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_CONFIG_QUALITY), bVBR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY), bVBR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY_LOW), bVBR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY_HIGH), bVBR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_ABR), bABR);
+
+	::EnableWindow(::GetDlgItem( hDialog, IDC_EDIT_AVERAGE), bABR);
+}
+*/
+AEncodeProperties::AEncodeProperties(HMODULE hModule)
+ :my_debug(ADbg(DEBUG_LEVEL_CREATION)),
+ my_hModule(hModule)
+{
+	std::string path = "";
+//	HMODULE htmp = LoadLibrary("out_lame.dll");
+	if (hModule != NULL)
+	{
+		char output[MAX_PATH];
+		::GetModuleFileName(hModule, output, MAX_PATH);
+//		::FreeLibrary(htmp);
+
+		path = output;
+	}
+	my_store_location = path.substr(0,path.find_last_of('\\')+1);
+	my_store_location += "lame_acm.xml";
+
+	my_debug.OutPut("store path = %s",my_store_location.c_str());
+//#ifdef OLD
+//	::OutputDebugString(my_store_location.c_str());
+
+	// make sure the XML file is present
+	HANDLE hFile = ::CreateFile(my_store_location.c_str(), 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL );
+	::CloseHandle(hFile);
+//#endif // OLD
+	my_debug.OutPut("AEncodeProperties creation completed (0x%08X)",this);
+}
+
+// Save the values to the right XML saved config
+void AEncodeProperties::SaveValuesToStringKey(const std::string & config_name)
+{
+	// get the current data in the file to keep them
+	if (my_stored_data.LoadFile(my_store_location))
+	{
+		// check if the Node corresponding to the config_name already exist.
+		TiXmlNode* node = my_stored_data.FirstChild("lame_acm");
+
+		if (node != NULL)
+		{
+			TiXmlElement* ConfigNode = node->FirstChildElement("encodings");
+
+			if (ConfigNode != NULL)
+			{
+				// look all the <config> tags
+				TiXmlElement* tmpNode = ConfigNode->FirstChildElement("config");
+				while (tmpNode != NULL)
+				{
+					const std::string * tmpname = tmpNode->Attribute("name");
+					if (tmpname->compare(config_name) == 0)
+					{
+						break;
+					}
+					tmpNode = tmpNode->NextSiblingElement("config");
+				}
+
+				if (tmpNode == NULL)
+				{
+					// Create the node
+					tmpNode = new TiXmlElement("config");
+					tmpNode->SetAttribute("name",config_name);
+
+					// save data in the node
+					SaveValuesToElement(tmpNode);
+
+					ConfigNode->InsertEndChild(*tmpNode);
+				}
+				else
+				{
+					// save data in the node
+					SaveValuesToElement(tmpNode);
+				}
+
+
+				// and save the file
+				my_stored_data.SaveFile(my_store_location);
+			}
+		}
+	}
+}
+
+void AEncodeProperties::GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode)
+{
+	TiXmlElement* tmpElt;
+	TiXmlElement* iterateElmt;
+
+	// find the config that correspond to CurrentConfig
+	iterateElmt = parentNode.FirstChildElement("config");
+	while (iterateElmt != NULL)
+	{
+		const std::string * tmpname = iterateElmt->Attribute("name");
+		if ((tmpname != NULL) && (tmpname->compare(config_name) == 0))
+		{
+			break;
+		}
+		iterateElmt = iterateElmt->NextSiblingElement("config");
+	}
+
+	if (iterateElmt != NULL)
+	{
+		// get all the parameters saved in this Element
+		const std::string * tmpname;
+
+		// Smart output parameter
+		tmpElt = iterateElmt->FirstChildElement("Smart");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bSmartOutput = (tmpname->compare("true") == 0);
+			
+			tmpname = tmpElt->Attribute("ratio");
+			if (tmpname != NULL)
+				SmartRatioMax = atof(tmpname->c_str());
+		}
+
+		// Smart output parameter
+		tmpElt = iterateElmt->FirstChildElement("ABR");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bAbrOutput = (tmpname->compare("true") == 0);
+			
+			tmpname = tmpElt->Attribute("min");
+			if (tmpname != NULL)
+				AverageBitrate_Min = atoi(tmpname->c_str());
+
+			tmpname = tmpElt->Attribute("max");
+			if (tmpname != NULL)
+				AverageBitrate_Max = atoi(tmpname->c_str());
+
+			tmpname = tmpElt->Attribute("step");
+			if (tmpname != NULL)
+				AverageBitrate_Step = atoi(tmpname->c_str());
+		}
+
+		// Copyright parameter
+		tmpElt = iterateElmt->FirstChildElement("Copyright");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bCopyright = (tmpname->compare("true") == 0);
+		}
+
+		// Copyright parameter
+		tmpElt = iterateElmt->FirstChildElement("CRC");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bCRC = (tmpname->compare("true") == 0);
+		}
+
+		// Copyright parameter
+		tmpElt = iterateElmt->FirstChildElement("Original");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bOriginal = (tmpname->compare("true") == 0);
+		}
+
+		// Copyright parameter
+		tmpElt = iterateElmt->FirstChildElement("Private");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bPrivate = (tmpname->compare("true") == 0);
+		}
+/*
+		// Copyright parameter
+		tmpElt = iterateElmt->FirstChildElement("Bit_reservoir");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bNoBitRes = !(tmpname->compare("true") == 0);
+		}
+
+		// bitrates
+		tmpElt = iterateElmt->FirstChildElement("bitrate");
+		tmpname = tmpElt->Attribute("min");
+		if (tmpname != NULL)
+		{
+			unsigned int uitmp = atoi(tmpname->c_str());
+			for (int i=0;i<sizeof(the_Bitrates)/sizeof(unsigned int);i++)
+			{
+				if (the_Bitrates[i] == uitmp)
+				{
+					nMinBitrateIndex = i;
+					break;
+				}
+			}
+		}
+
+		tmpname = tmpElt->Attribute("max");
+		if (tmpname != NULL)
+		{
+			unsigned int uitmp = atoi(tmpname->c_str());
+			for (int i=0;i<sizeof(the_Bitrates)/sizeof(unsigned int);i++)
+			{
+				if (the_Bitrates[i] == uitmp)
+				{
+					nMaxBitrateIndex = i;
+					break;
+				}
+			}
+		}
+*/
+/*
+		// resampling parameters
+		tmpElt = iterateElmt->FirstChildElement("resampling");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+				bResample = (tmpname->compare("true") == 0);
+
+			unsigned int uitmp = atoi(tmpElt->Attribute("freq")->c_str());
+			for (int i=0;i<sizeof(the_SamplingFreqs)/sizeof(unsigned int);i++)
+			{
+				if (the_SamplingFreqs[i] == uitmp)
+				{
+					nSamplingFreqIndex = i;
+					break;
+				}
+			}
+		}
+
+		// VBR parameters
+		tmpElt = iterateElmt->FirstChildElement("VBR");
+		if (tmpElt != NULL)
+		{
+			tmpname = tmpElt->Attribute("use");
+			if (tmpname != NULL)
+			{
+				if (tmpname->compare("ABR") == 0)
+					mBRmode = BR_ABR;
+				else if (tmpname->compare("true") == 0)
+					mBRmode = BR_VBR;
+				else
+					mBRmode = BR_CBR;
+			}
+
+			tmpname = tmpElt->Attribute("header");
+			if (tmpname != NULL)
+				bXingFrame = (tmpname->compare("true") == 0);
+
+			tmpname = tmpElt->Attribute("quality");
+			if (tmpname != NULL)
+			{
+				VbrQuality = atoi(tmpname->c_str());
+			}
+
+			tmpname = tmpElt->Attribute("average");
+			if (tmpname != NULL)
+			{
+				AverageBitrate = atoi(tmpname->c_str());
+			}
+			else
+			{
+			}
+		}
+
+		// output parameters
+		tmpElt = iterateElmt->FirstChildElement("output");
+		if (tmpElt != NULL)
+		{
+			OutputDir = *tmpElt->Attribute("path");
+		}
+*/
+//#ifdef OLD
+		// Channel mode parameter
+		tmpElt = iterateElmt->FirstChildElement("Channel");
+		if (tmpElt != NULL)
+		{
+			const std::string * tmpStr = tmpElt->Attribute("mode");
+			if (tmpStr != NULL)
+			{
+				for (int i=0;i<GetChannelLentgh();i++)
+				{
+					if (tmpStr->compare(GetChannelModeString(i)) == 0)
+					{
+						nChannelIndex = i;
+						break;
+					}
+				}
+			}
+/*
+			tmpname = tmpElt->Attribute("force");
+			if (tmpname != NULL)
+				bForceChannel = (tmpname->compare("true") == 0);
+*/
+		}
+//#endif // OLD
+
+		// Preset parameter
+/*
+		tmpElt = iterateElmt->FirstChildElement("Preset");
+		if (tmpElt != NULL)
+		{
+			const std::string * tmpStr = tmpElt->Attribute("type");
+			for (int i=0;i<GetPresetLentgh();i++)
+			{
+				if (tmpStr->compare(GetPresetModeString(i)) == 0)
+				{
+					nPresetIndex = i;
+					break;
+				}
+			}
+
+		}
+*/
+	}
+}
+
+/**
+	\todo save the parameters
+* /
+void AEncodeProperties::SaveParams(const HWND hParentWnd)
+{
+	char string[MAX_PATH];
+/*	int nIdx = SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETCURSEL, NULL, NULL);
+	::SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETLBTEXT , nIdx, (LPARAM) string);
+* /
+}*/
+
+bool AEncodeProperties::operator !=(const AEncodeProperties & the_instance) const
+{
+/*
+	::OutputDebugString(bCopyright != the_instance.bCopyright?"1":"-");
+	::OutputDebugString(bCRC != the_instance.bCRC            ?"2":"-");
+	::OutputDebugString(bOriginal != the_instance.bOriginal  ?"3":"-");
+	::OutputDebugString(bPrivate != the_instance.bPrivate    ?"4":"-");
+	::OutputDebugString(bNoBitRes != the_instance.bNoBitRes  ?"5":"-");
+	::OutputDebugString(mBRmode != the_instance.mBRmode      ?"6":"-");
+	::OutputDebugString(bXingFrame != the_instance.bXingFrame?"7":"-");
+	::OutputDebugString(bForceChannel != the_instance.bForceChannel?"8":"-");
+	::OutputDebugString(bResample != the_instance.bResample  ?"9":"-");
+	::OutputDebugString(nChannelIndex != the_instance.nChannelIndex?"10":"-");
+	::OutputDebugString(nMinBitrateIndex != the_instance.nMinBitrateIndex?"11":"-");
+	::OutputDebugString(nMaxBitrateIndex != the_instance.nMaxBitrateIndex?"12":"-");
+	::OutputDebugString(nPresetIndex != the_instance.nPresetIndex?"13":"-");
+	::OutputDebugString(VbrQuality != the_instance.VbrQuality?"14":"-");
+	::OutputDebugString(AverageBitrate != the_instance.AverageBitrate?"15":"-");
+	::OutputDebugString(nSamplingFreqIndex != the_instance.nSamplingFreqIndex?"16":"-");
+	::OutputDebugString(OutputDir.compare(the_instance.OutputDir) != 0?"17":"-");
+
+	std::string tmp = "";
+	char tmpI[10];
+	_itoa(AverageBitrate,tmpI,10);
+	tmp += tmpI;
+	tmp += " != ";
+	_itoa(the_instance.AverageBitrate,tmpI,10);
+	tmp += tmpI;
+	::OutputDebugString(tmp.c_str());
+*/
+	return ((bCopyright != the_instance.bCopyright)
+		 || (bCRC != the_instance.bCRC)
+		 || (bOriginal != the_instance.bOriginal)
+		 || (bPrivate != the_instance.bPrivate)
+		 || (bSmartOutput != the_instance.bSmartOutput)
+		 || (SmartRatioMax != the_instance.SmartRatioMax)
+		 || (bAbrOutput != the_instance.bAbrOutput)
+		 || (AverageBitrate_Min != the_instance.AverageBitrate_Min)
+		 || (AverageBitrate_Max != the_instance.AverageBitrate_Max)
+		 || (AverageBitrate_Step != the_instance.AverageBitrate_Step)
+		 || (bNoBitRes != the_instance.bNoBitRes)
+		 || (mBRmode != the_instance.mBRmode)
+		 || (bXingFrame != the_instance.bXingFrame)
+		 || (bForceChannel != the_instance.bForceChannel)
+		 || (bResample != the_instance.bResample)
+		 || (nChannelIndex != the_instance.nChannelIndex)
+		 || (nMinBitrateIndex != the_instance.nMinBitrateIndex)
+		 || (nMaxBitrateIndex != the_instance.nMaxBitrateIndex)
+		 || (nPresetIndex != the_instance.nPresetIndex)
+		 || (VbrQuality != the_instance.VbrQuality)
+//		 || (AverageBitrate != the_instance.AverageBitrate)
+		 || (nSamplingFreqIndex != the_instance.nSamplingFreqIndex)
+//		 || (OutputDir.compare(the_instance.OutputDir) != 0)
+		);
+}
+
+void AEncodeProperties::SelectSavedParams(const std::string the_string)
+{
+	// get the values from the saved file if possible
+	if (my_stored_data.LoadFile(my_store_location))
+	{
+		TiXmlNode* node;
+
+		node = my_stored_data.FirstChild("lame_acm");
+
+		TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
+
+		if (CurrentNode != NULL)
+		{
+			CurrentNode->SetAttribute("default",the_string);
+			GetValuesFromKey(the_string, *CurrentNode);
+			my_stored_data.SaveFile(my_store_location);
+		}
+	}
+}
+
+inline void AEncodeProperties::SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const
+{
+	if (the_value == false)
+		the_elt->SetAttribute(the_string, "false");
+	else
+		the_elt->SetAttribute(the_string, "true");
+}
+
+void AEncodeProperties::SaveValuesToElement(TiXmlElement * the_element) const
+{
+	// get all the parameters saved in this Element
+	TiXmlElement * tmpElt;
+
+	// Bit Reservoir parameter
+/*
+	tmpElt = the_element->FirstChildElement("Bit_reservoir");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Bit_reservoir");
+		SetAttributeBool(tmpElt, "use", !bNoBitRes);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool(tmpElt, "use", !bNoBitRes);
+	}
+*/
+	// Copyright parameter
+	tmpElt = the_element->FirstChildElement("Copyright");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Copyright");
+		SetAttributeBool( tmpElt, "use", bCopyright);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bCopyright);
+	}
+
+	// Smart Output parameter
+	tmpElt = the_element->FirstChildElement("Smart");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Smart");
+		SetAttributeBool( tmpElt, "use", bSmartOutput);
+		tmpElt->SetAttribute("ratio", int(SmartRatioMax));
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bSmartOutput);
+		tmpElt->SetAttribute("ratio", int(SmartRatioMax));
+	}
+
+	// Smart Output parameter
+	tmpElt = the_element->FirstChildElement("ABR");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("ABR");
+		SetAttributeBool( tmpElt, "use", bAbrOutput);
+		tmpElt->SetAttribute("min", AverageBitrate_Min);
+		tmpElt->SetAttribute("max", AverageBitrate_Max);
+		tmpElt->SetAttribute("step", AverageBitrate_Step);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bAbrOutput);
+		tmpElt->SetAttribute("min", AverageBitrate_Min);
+		tmpElt->SetAttribute("max", AverageBitrate_Max);
+		tmpElt->SetAttribute("step", AverageBitrate_Step);
+	}
+
+	// CRC parameter
+	tmpElt = the_element->FirstChildElement("CRC");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("CRC");
+		SetAttributeBool( tmpElt, "use", bCRC);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bCRC);
+	}
+
+	// Original parameter
+	tmpElt = the_element->FirstChildElement("Original");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Original");
+		SetAttributeBool( tmpElt, "use", bOriginal);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bOriginal);
+	}
+
+	// Private parameter
+	tmpElt = the_element->FirstChildElement("Private");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Private");
+		SetAttributeBool( tmpElt, "use", bPrivate);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bPrivate);
+	}
+
+	// Channel Mode parameter
+	tmpElt = the_element->FirstChildElement("Channel");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Channel");
+		tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex));
+//		SetAttributeBool( tmpElt, "force", bForceChannel);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex));
+//		SetAttributeBool( tmpElt, "force", bForceChannel);
+	}
+/*
+	// Preset parameter
+	tmpElt = the_element->FirstChildElement("Preset");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("Preset");
+		tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex));
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex));
+	}
+
+	// Bitrate parameter
+	tmpElt = the_element->FirstChildElement("bitrate");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("bitrate");
+		tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]);
+		tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]);
+		tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]);
+	}
+
+	// Output Directory parameter
+	tmpElt = the_element->FirstChildElement("output");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("output");
+		tmpElt->SetAttribute("path", OutputDir);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		tmpElt->SetAttribute("path", OutputDir);
+	}
+*/
+/*
+	// Resampling parameter
+	tmpElt = the_element->FirstChildElement("resampling");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("resampling");
+		SetAttributeBool( tmpElt, "use", bResample);
+		tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		SetAttributeBool( tmpElt, "use", bResample);
+		tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]);
+	}
+
+	// VBR parameter
+	tmpElt = the_element->FirstChildElement("VBR");
+	if (tmpElt == NULL)
+	{
+		tmpElt = new TiXmlElement("VBR");
+		
+		if (mBRmode == BR_ABR)
+			tmpElt->SetAttribute("use", "ABR");
+		else
+			SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR));
+
+		SetAttributeBool( tmpElt, "header", bXingFrame);
+		tmpElt->SetAttribute("quality", VbrQuality);
+		tmpElt->SetAttribute("average", AverageBitrate);
+		the_element->InsertEndChild(*tmpElt);
+	}
+	else
+	{
+		if (mBRmode == BR_ABR)
+			tmpElt->SetAttribute("use", "ABR");
+		else
+			SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR));
+
+		SetAttributeBool( tmpElt, "header", bXingFrame);
+		tmpElt->SetAttribute("quality", VbrQuality);
+		tmpElt->SetAttribute("average", AverageBitrate);
+	}
+*/
+}
+
+bool AEncodeProperties::HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam)
+{
+	UINT command;
+	command = GET_WM_COMMAND_ID(wParam, lParam);
+
+	switch (command)
+	{
+	case IDOK :
+	{
+		bool bShouldEnd = true;
+
+		// save parameters
+		char string[MAX_PATH];
+//		::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
+
+		wsprintf(string,"Current"); // only the Current config is supported at the moment
+		
+		my_debug.OutPut("my_hModule = 0x%08X",my_hModule);
+/*
+		AEncodeProperties tmpDlgProps(my_hModule);
+		AEncodeProperties tmpSavedProps(my_hModule);
+//#ifdef OLD
+		tmpDlgProps.UpdateValueFromDlg(parentWnd);
+		tmpSavedProps.SelectSavedParams(string);
+		tmpSavedProps.ParamsRestore();
+		// check if the values from the DLG are the same as the one saved in the config file
+		// if yes, just do nothing
+/*
+		if (tmpDlgProps != tmpSavedProps)
+		{
+			int save;
+
+			if (strcmp(string,"Current") == 0)
+			{
+				// otherwise, prompt the user if he wants to overwrite the settings
+				TCHAR tmpStr[250];
+				::LoadString(AOut::GetInstance(),IDS_STRING_PROMPT_REPLACE_CURRENT,tmpStr,250);
+
+				save = AOut::MyMessageBox( tmpStr, MB_OKCANCEL|MB_ICONQUESTION, parentWnd);
+			}
+			else
+			{
+				// otherwise, prompt the user if he wants to overwrite the settings
+				TCHAR tmpStr[250];
+				::LoadString(AOut::GetInstance(),IDS_STRING_PROMPT_REPLACE_SETING,tmpStr,250);
+				TCHAR tmpDsp[500];
+				wsprintf(tmpDsp,tmpStr,string);
+
+				save = AOut::MyMessageBox( tmpDsp, MB_YESNOCANCEL|MB_ICONQUESTION, parentWnd);
+			}
+
+			if (save == IDCANCEL)
+				bShouldEnd = false;
+			else if (save == IDNO)
+			{
+				// save the values in 'current'
+				UpdateValueFromDlg(parentWnd);
+				SaveValuesToStringKey("Current");
+				SelectSavedParams("Current");
+			}
+			else
+			{
+				// do so and save in XML
+				UpdateValueFromDlg(parentWnd);
+				SaveValuesToStringKey(string);
+			}
+		}
+*/
+//#endif // OLD
+my_debug.OutPut("before : nChannelIndex %d, bCRC %d, bCopyright %d, bOriginal %d, bPrivate %d",nChannelIndex, bCRC, bCopyright, bOriginal, bPrivate);
+
+my_debug.OutPut("call UpdateValueFromDlg");
+
+		UpdateValueFromDlg(parentWnd);
+
+my_debug.OutPut("call SaveValuesToStringKey");
+
+		SaveValuesToStringKey("Current"); // only Current config is supported now
+
+//		SaveParams(parentWnd);
+
+//my_debug.OutPut("call SelectSavedParams");
+
+//		SelectSavedParams(string);
+//		UpdateDlgFromValue(parentWnd);
+
+my_debug.OutPut("finished saving");
+
+		if (bShouldEnd)
+		{
+			RemoveProp(parentWnd, "AEncodeProperties-Config");
+		
+			EndDialog(parentWnd, true);
+		}
+	}
+	break;
+
+	case IDCANCEL:
+		RemoveProp(parentWnd, "AEncodeProperties-Config");
+        EndDialog(parentWnd, false);
+		break;
+
+/*	case IDC_FIND_DLL:
+	{
+		OPENFILENAME file;
+		char DllLocation[512];
+		wsprintf(DllLocation,"%s",GetDllLocation());
+
+		memset(&file, 0, sizeof(file));
+		file.lStructSize = sizeof(file); 
+		file.hwndOwner  = parentWnd;
+		file.Flags = OFN_FILEMUSTEXIST | OFN_NODEREFERENCELINKS | OFN_ENABLEHOOK | OFN_EXPLORER ;
+///				file.lpstrFile = AOut::the_AOut->DllLocation;
+		file.lpstrFile = DllLocation;
+		file.lpstrFilter = "Lame DLL (lame_enc.dll)\0LAME_ENC.DLL\0DLL (*.dll)\0*.DLL\0All (*.*)\0*.*\0";
+		file.nFilterIndex = 1;
+		file.nMaxFile  = sizeof(DllLocation);
+		file.lpfnHook  = DLLFindCallback; // use to validate the DLL chosen
+
+		GetOpenFileName(&file);
+
+		SetDllLocation(DllLocation);
+		// use this filename if necessary
+	}
+	break;
+*/
+/*	case IDC_BUTTON_OUTPUT:
+	{
+#ifndef SIMPLE_FOLDER
+		BROWSEINFO info;
+		memset(&info,0,sizeof(info));
+
+		char FolderName[MAX_PATH];
+
+		info.hwndOwner = parentWnd;
+		info.pszDisplayName  = FolderName;
+		info.lpfn = BrowseFolderCallbackroc;
+		info.lParam = (LPARAM) this;
+
+		// get the localised window title
+		TCHAR output[250];
+		::LoadString(AOut::GetInstance(),IDS_STRING_DIR_SELECT,output,250);
+		info.lpszTitle = output;
+
+#ifdef BIF_EDITBOX
+		info.ulFlags |= BIF_EDITBOX;
+#else // BIF_EDITBOX
+		info.ulFlags |= 0x0010;
+#endif // BIF_EDITBOX
+
+#ifdef BIF_VALIDATE
+		info.ulFlags |= BIF_VALIDATE;
+#else // BIF_VALIDATE
+		info.ulFlags |= 0x0020;
+#endif // BIF_VALIDATE
+
+#ifdef BIF_NEWDIALOGSTYLE
+		info.ulFlags |= BIF_NEWDIALOGSTYLE;
+#else // BIF_NEWDIALOGSTYLE
+		info.ulFlags |= 0x0040;
+#endif // BIF_NEWDIALOGSTYLE
+
+		ITEMIDLIST *item = SHBrowseForFolder(&info);
+
+    	if (item != NULL)
+		{
+			char tmpOutputDir[MAX_PATH];
+			wsprintf(tmpOutputDir,"%s",GetOutputDirectory());
+
+			SHGetPathFromIDList( item,tmpOutputDir );
+			SetOutputDirectory( tmpOutputDir );
+			::SetWindowText(GetDlgItem( parentWnd, IDC_EDIT_OUTPUTDIR), tmpOutputDir);
+//					wsprintf(OutputDir,FolderName);
+		}
+#else // SIMPLE_FOLDER
+		OPENFILENAME file;
+
+		memset(&file, 0, sizeof(file));
+		file.lStructSize = sizeof(file); 
+		file.hwndOwner  = parentWnd;
+		file.Flags = OFN_FILEMUSTEXIST | OFN_NODEREFERENCELINKS | OFN_ENABLEHOOK | OFN_EXPLORER ;
+//				file.lpstrFile = GetDllLocation();
+//				file.lpstrFile = GetOutputDirectory();
+		file.lpstrInitialDir = GetOutputDirectory();
+		file.lpstrFilter = "A Directory\0.*\0";
+//				file.nFilterIndex = 1;
+		file.nMaxFile  = MAX_PATH;
+//				file.lpfnHook  = DLLFindCallback; // use to validate the DLL chosen
+//				file.Flags = OFN_ENABLESIZING | OFN_NOREADONLYRETURN | OFN_HIDEREADONLY;
+		file.Flags = OFN_NOREADONLYRETURN | OFN_HIDEREADONLY | OFN_EXPLORER;
+
+		TCHAR output[250];
+		::LoadString(AOut::GetInstance(),IDS_STRING_DIR_SELECT,output,250);
+		file.lpstrTitle = output;
+
+		GetSaveFileName(&file);
+#endif // SIMPLE_FOLDER
+	}
+	break;
+*/
+		case IDC_CHECK_ENC_ABR:
+			EnableAbrOptions(parentWnd, ::IsDlgButtonChecked( parentWnd, IDC_CHECK_ENC_ABR) == BST_CHECKED);
+			break;
+/*	case IDC_RADIO_BITRATE_CBR:
+		AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_CBR);
+		break;
+
+	case IDC_RADIO_BITRATE_VBR:
+		AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_VBR);
+		break;
+
+	case IDC_RADIO_BITRATE_ABR:
+		AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_ABR);
+		break;
+
+	case IDC_CHECK_RESAMPLE:
+	{
+		bool tmp_bResampleUsed = (::IsDlgButtonChecked( parentWnd, IDC_CHECK_RESAMPLE) == BST_CHECKED);
+		if (tmp_bResampleUsed)
+		{
+			::EnableWindow(::GetDlgItem(parentWnd,IDC_COMBO_SAMPLEFREQ), TRUE);
+		}
+		else
+		{
+			::EnableWindow(::GetDlgItem(parentWnd,IDC_COMBO_SAMPLEFREQ), FALSE);
+		}
+	}
+	break;
+*/
+/*	case IDC_COMBO_SETTINGS:
+//				if (CBN_SELCHANGE == GET_WM_COMMAND_CMD(wParam, lParam))
+		if (CBN_SELENDOK == GET_WM_COMMAND_CMD(wParam, lParam))
+		{
+			char string[MAX_PATH];
+			int nIdx = SendMessage(HWND(lParam), CB_GETCURSEL, NULL, NULL);
+			SendMessage(HWND(lParam), CB_GETLBTEXT , nIdx, (LPARAM) string);
+
+			// get the info corresponding to the new selected item
+			SelectSavedParams(string);
+			UpdateDlgFromValue(parentWnd);
+		}
+		break;
+*/
+/*	case IDC_BUTTON_CONFIG_SAVE:
+	{
+		// save the data in the current config
+		char string[MAX_PATH];
+		::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
+
+		UpdateValueFromDlg(parentWnd);
+		SaveValuesToStringKey(string);
+		SelectSavedParams(string);
+		UpdateConfigs(parentWnd);
+		UpdateDlgFromValue(parentWnd);
+	}
+	break;
+
+	case IDC_BUTTON_CONFIG_RENAME:
+	{
+		char string[MAX_PATH];
+		::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
+
+		if (RenameCurrentTo(string))
+		{
+			// Update the names displayed
+			UpdateConfigs(parentWnd);
+		}
+
+	}
+	break;
+
+	case IDC_BUTTON_CONFIG_DELETE:
+	{
+		char string[MAX_PATH];
+		::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
+		
+		if (DeleteConfig(string))
+		{
+			// Update the names displayed
+			UpdateConfigs(parentWnd);
+			UpdateDlgFromValue(parentWnd);
+		}
+	}
+	break;
+*/
+	}
+	
+    return FALSE;
+}
+
+bool AEncodeProperties::RenameCurrentTo(const std::string & new_config_name)
+{
+	bool bResult = false;
+
+	// display all the names of the saved configs
+	// get the values from the saved file if possible
+	if (my_stored_data.LoadFile(my_store_location))
+	{
+		TiXmlNode* node;
+
+		node = my_stored_data.FirstChild("lame_acm");
+
+		TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
+
+		if (CurrentNode->Attribute("default") != NULL)
+		{
+			std::string CurrentConfigName = *CurrentNode->Attribute("default");
+
+			// no rename possible for Current
+			if (CurrentConfigName == "")
+			{
+				bResult = true;
+			}
+			else if (CurrentConfigName != "Current")
+			{
+				// find the config that correspond to CurrentConfig
+				TiXmlElement* iterateElmt = CurrentNode->FirstChildElement("config");
+//				int Idx = 0;
+				while (iterateElmt != NULL)
+				{
+					const std::string * tmpname = iterateElmt->Attribute("name");
+					/**
+						\todo support language names
+					*/
+					if (tmpname != NULL)
+					{
+						if (tmpname->compare(CurrentConfigName) == 0)
+						{
+							iterateElmt->SetAttribute("name",new_config_name);	
+							bResult = true;
+							break;
+						}
+					}
+//					Idx++;
+					iterateElmt = iterateElmt->NextSiblingElement("config");
+				}
+			}
+
+			if (bResult)
+			{
+				CurrentNode->SetAttribute("default",new_config_name);
+
+				my_stored_data.SaveFile(my_store_location);
+			}
+		}
+	}
+
+	return bResult;
+}
+
+bool AEncodeProperties::DeleteConfig(const std::string & config_name)
+{
+	bool bResult = false;
+
+	if (config_name != "Current")
+	{
+		// display all the names of the saved configs
+		// get the values from the saved file if possible
+		if (my_stored_data.LoadFile(my_store_location))
+		{
+			TiXmlNode* node;
+
+			node = my_stored_data.FirstChild("lame_acm");
+
+			TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
+
+			TiXmlElement* iterateElmt = CurrentNode->FirstChildElement("config");
+//			int Idx = 0;
+			while (iterateElmt != NULL)
+			{
+				const std::string * tmpname = iterateElmt->Attribute("name");
+				/**
+					\todo support language names
+				*/
+				if (tmpname != NULL)
+				{
+					if (tmpname->compare(config_name) == 0)
+					{
+						CurrentNode->RemoveChild(iterateElmt);
+						bResult = true;
+						break;
+					}
+				}
+//				Idx++;
+				iterateElmt = iterateElmt->NextSiblingElement("config");
+			}
+		}
+
+		if (bResult)
+		{
+			my_stored_data.SaveFile(my_store_location);
+
+			// select a new default config : "Current"
+			SelectSavedParams("Current");
+
+		}
+	}
+
+	return bResult;
+}
+
+void AEncodeProperties::UpdateConfigs(const HWND HwndDlg)
+{
+	// Add User configs
+//	SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_RESETCONTENT , NULL, NULL);
+
+	// display all the names of the saved configs
+	// get the values from the saved file if possible
+	if (my_stored_data.LoadFile(my_store_location))
+	{
+		TiXmlNode* node;
+
+		node = my_stored_data.FirstChild("lame_acm");
+
+		TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
+
+		std::string CurrentConfig = "";
+
+		if (CurrentNode->Attribute("default") != NULL)
+		{
+			CurrentConfig = *CurrentNode->Attribute("default");
+		}
+
+		TiXmlElement* iterateElmt;
+
+my_debug.OutPut("are we here ?");
+
+		// find the config that correspond to CurrentConfig
+		iterateElmt = CurrentNode->FirstChildElement("config");
+		int Idx = 0;
+		while (iterateElmt != NULL)
+		{
+			const std::string * tmpname = iterateElmt->Attribute("name");
+			/**
+				\todo support language names
+			*/
+			if (tmpname != NULL)
+			{
+//				SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_ADDSTRING, NULL, (LPARAM) tmpname->c_str());
+				if (tmpname->compare(CurrentConfig) == 0)
+				{
+//					SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_SETCURSEL, Idx, NULL);
+					SelectSavedParams(*tmpname);
+					UpdateDlgFromValue(HwndDlg);
+				}
+			}
+my_debug.OutPut("Idx = %d",Idx);
+
+			Idx++;
+			// only Current config supported now
+//			iterateElmt = iterateElmt->NextSiblingElement("config");
+			iterateElmt = NULL;
+my_debug.OutPut("iterateElmt = 0x%08X",iterateElmt);
+
+		}
+	}
+}
+/*
+void AEncodeProperties::UpdateAbrSteps(unsigned int min, unsigned int max, unsigned int step) const
+{
+}
+*/
+void AEncodeProperties::UpdateDlgFromSlides(HWND hwndDlg) const
+{
+	UINT value_min, value_max, value_step, value;
+	char tmp[4];
+
+	value_min = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_GETPOS, NULL, NULL);
+	value_max = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_GETPOS, NULL, NULL);
+
+	if (value_min>value_max)
+	{
+		SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETPOS, TRUE, value_max);
+		UpdateDlgFromSlides(hwndDlg);
+		return;
+	}
+
+	if (value_max<value_min)
+	{
+		SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_SETPOS, TRUE, value_min);
+		UpdateDlgFromSlides(hwndDlg);
+		return;
+	}
+
+	wsprintf(tmp,"%3d",value_min);
+	::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_MIN_VALUE), tmp);
+	
+	SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETRANGEMIN, TRUE, value_min);
+
+	wsprintf(tmp,"%3d",value_max);
+	::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_MAX_VALUE), tmp);
+	
+	SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETRANGEMAX, TRUE, value_max);
+	
+	value_step = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_GETPOS, NULL, NULL);
+	wsprintf(tmp,"%3d",value_step);
+	::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_STEP_VALUE), tmp);
+
+	SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_CLEARTICS, TRUE, 0);
+	for(UINT i=value_max; i>=value_min;i-=value_step)
+	{
+		SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETTIC, 0, i);
+	}
+	SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETLINESIZE, 0, value_step);
+	SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETPAGESIZE, 0, value_step);
+	
+	value = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_GETPOS, NULL, NULL);
+	wsprintf(tmp,"%3d",value);
+	::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_SAMPLE_VALUE), tmp);
+}
+
+void AEncodeProperties::EnableAbrOptions(HWND hDialog, bool enable)
+{
+	::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_MIN), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_MAX), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_STEP), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_SAMPLE), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MIN), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MAX), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_STEP), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_SAMPLE), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MIN_VALUE), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MAX_VALUE), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_STEP_VALUE), enable);
+	::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_SAMPLE_VALUE), enable);
+}
+
diff --git a/ACM/AEncodeProperties.h b/ACM/AEncodeProperties.h
new file mode 100644
index 0000000..4d2e1db
--- /dev/null
+++ b/ACM/AEncodeProperties.h
@@ -0,0 +1,448 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: AEncodeProperties.h,v 1.5 2002/04/07 13:31:35 robux4 Exp $
+*/
+
+#if !defined(_AENCODEPROPERTIES_H__INCLUDED_)
+#define _AENCODEPROPERTIES_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <windows.h>
+#include <string>
+
+#include "ADbg/ADbg.h"
+//#include "BladeMP3EncDLL.h"
+#include "tinyxml/tinyxml.h"
+//#include "AParameters/AParameters.h"
+
+typedef const struct {
+	UINT id;
+	const char *tip;
+} ToolTipItem;
+/**
+  \class AEncodeProperties
+  \brief the AEncodeProperties class is responsible for handling all the encoding properties
+*/
+class AEncodeProperties  
+{
+public:
+	/**
+		\brief default constructor
+
+		\param the windows module with which you can retrieve many informations
+	*/
+	AEncodeProperties(HMODULE hModule);
+
+	/**
+		\brief default destructor
+	*/
+	virtual ~AEncodeProperties() {}
+
+	/**
+		\enum BRMode
+		\brief A bitrate mode (CBR, VBR, ABR)
+	*/
+	enum BRMode { BR_CBR, BR_VBR, BR_ABR };
+
+	/**
+		\brief Handle all the commands that occur in the Config dialog box
+	*/
+	bool HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam);
+	/**
+		\brief check wether 2 instances are equal, ie have the same encoding parameters
+	*/
+	bool operator != (const AEncodeProperties & the_instance) const;
+
+	/**
+		\brief Check wether the Encode process should use the Copyright bit
+	*/
+	inline const bool GetCopyrightMode() const { return bCopyright; }
+	/**
+		\brief Check wether the Encode process should use the CRC bit
+	*/
+	inline const bool GetCRCMode() const { return bCRC; }
+	/**
+		\brief Check wether the Encode process should use the Original bit
+	*/
+	inline const bool GetOriginalMode() const { return bOriginal; }
+	/**
+		\brief Check wether the Encode process should use the Private bit
+	*/
+	inline const bool GetPrivateMode() const { return bPrivate; }
+	/**
+		\brief Check wether the Encode process should use the Smart Bitrate output
+	*/
+	inline const bool GetSmartOutputMode() const { return bSmartOutput; }
+	/**
+		\brief Check wether the Encode process should allow Average Bitrate output
+	*/
+	inline const bool GetAbrOutputMode() const { return bAbrOutput; }
+
+	/**
+		\brief Check wether the Encode process shouldn't use the Bit Reservoir
+	*/
+	inline const bool GetNoBiResMode() const { return bNoBitRes; }
+
+	/**
+		\brief Check wether the Encode process should force the channel mode (stereo or mono resampling)
+	*/
+	inline const bool GetForceChannelMode() const { return bForceChannel; }
+
+	/**
+		\brief Check wether the Encode process should use the VBR mode
+	*/
+	inline const BRMode GetVBRUseMode() const { return mBRmode; }
+	/**
+		\brief Check wether the Encode process should use the Xing frame in the VBR mode
+		\note the Xing frame is a silent frame at the beginning that contain VBR statistics about the file.
+	*/
+	inline const bool GetXingFrameMode() const { return bXingFrame; }
+
+	/**
+		\brief Check wether the Encode process should resample before encoding
+	*/
+	inline const bool GetResampleMode() const { return bResample; }
+	
+	/**
+		\brief Set wether the Encode process should use the Copyright bit
+	*/
+	inline void SetCopyrightMode(const bool bMode) { bCopyright = bMode; }
+	/**
+		\brief Set wether the Encode process should use the CRC bit
+	*/
+	inline void SetCRCMode(const bool bMode) { bCRC = bMode; }
+	/**
+		\brief Set wether the Encode process should use the Original bit
+	*/
+	inline void SetOriginalMode(const bool bMode) { bOriginal = bMode; }
+	/**
+		\brief Set wether the Encode process should use the Private bit
+	*/
+	inline void SetPrivateMode(const bool bMode) { bPrivate = bMode; }
+
+	/**
+		\brief Set wether the Encode process should use the Smart Bitrate output
+	*/
+	inline void SetSmartOutputMode(const bool bMode) { bSmartOutput = bMode; }
+	/**
+		\brief Set wether the Encode process should use the Average Bitrate output
+	*/
+	inline void SetAbrOutputMode(const bool bMode) { bAbrOutput = bMode; }
+
+
+	/**
+		\brief Set wether the Encode process shouldn't use the Bit Reservoir
+	*/
+	inline void SetNoBiResMode(const bool bMode) { bNoBitRes = bMode; }
+	
+	/**
+		\brief Set wether the Encode process should force the channel mode (stereo or mono resampling)
+	*/
+	inline void SetForceChannelMode(const bool bMode) { bForceChannel = bMode; }
+	
+	/**
+		\brief Set wether the Encode process should use the VBR mode
+	*/
+	inline void SetVBRUseMode(const BRMode mode) { mBRmode = mode; }
+
+	/**
+		\brief Set wether the Encode process should use the Xing frame in the VBR mode
+		\note the Xing frame is a silent frame at the beginning that contain VBR statistics about the file.
+	*/
+	inline void SetXingFrameMode(const bool bMode) { bXingFrame = bMode; }
+
+	/**
+		\brief CBR : Get the bitrate to use         / 
+		       VBR : Get the minimum bitrate value
+	*/
+	const unsigned int GetBitrateValue() const;
+
+	/**
+		\brief Get the current (VBR:min) bitrate for the specified MPEG version
+
+		\param bitrate the data that will be filled with the bitrate
+		\param MPEG_Version The MPEG version (MPEG1 or MPEG2)
+
+		\return 0 if the bitrate is not found, 1 if the bitrate is found
+	*/
+	const int GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const;
+	/**
+		\brief Get the current (VBR:min) bitrate for MPEG I
+
+		\param bitrate the data that will be filled with the bitrate
+
+		\return 0 if the bitrate is not found, 1 if the bitrate is found
+	*/
+	const int GetBitrateValueMPEG1(DWORD & bitrate) const;
+	/**
+		\brief Get the current (VBR:min) bitrate for MPEG II
+
+		\param bitrate the data that will be filled with the bitrate
+
+		\return 0 if the bitrate is not found, 1 if the bitrate is found
+	*/
+	const int GetBitrateValueMPEG2(DWORD & bitrate) const;
+
+	/**
+		\brief Get the current (VBR:min) bitrate in the form of a string
+
+		\param string the string that will be filled
+		\param string_size the size of the string
+
+		\return -1 if the bitrate is not found, and the number of char copied otherwise
+	*/
+	inline const int GetBitrateString(char * string, int string_size) const {return GetBitrateString(string,string_size,nMinBitrateIndex); }
+
+	/**
+		\brief Get the (VBR:min) bitrate corresponding to the specified index in the form of a string
+
+		\param string the string that will be filled
+		\param string_size the size of the string
+		\param a_bitrateID the index in the Bitrate table
+
+		\return -1 if the bitrate is not found, and the number of char copied otherwise
+	*/
+	const int GetBitrateString(char * string, int string_size, int a_bitrateID) const;
+
+	/**
+		\brief Get the number of possible bitrates
+	*/
+	inline const int GetBitrateLentgh() const { return sizeof(the_Bitrates) / sizeof(unsigned int); }
+	/**
+		\brief Get the number of possible sampling frequencies
+	*/
+	inline const unsigned int GetResampleFreq() const { return the_SamplingFreqs[nSamplingFreqIndex]; }
+	/**
+		\brief Get the max compression ratio allowed (1:15 default)
+	*/
+	inline double GetSmartRatio() const { return SmartRatioMax;}
+	/**
+		\brief Get the min ABR bitrate possible
+	*/
+	inline unsigned int GetAbrBitrateMin() const { return AverageBitrate_Min;}
+	/**
+		\brief Get the max ABR bitrate possible
+	*/
+	inline unsigned int GetAbrBitrateMax() const { return AverageBitrate_Max;}
+	/**
+		\brief Get the step between ABR bitrates
+	*/
+	inline unsigned int GetAbrBitrateStep() const { return AverageBitrate_Step;}
+
+	/**
+		\brief Get the VBR attributes for a specified MPEG version
+
+		\param MaxBitrate receive the maximum bitrate possible in the VBR mode
+		\param Quality receive the quality value (0 to 9 see Lame doc for more info)
+		\param VBRHeader receive the value that indicates wether the VBR/Xing header should be filled
+		\param MPEG_Version The MPEG version (MPEG1 or MPEG2)
+
+		\return the VBR mode (Old, New, ABR, MTRH, Default or None)
+	*/
+//	VBRMETHOD GetVBRValue(DWORD & MaxBitrate, int & Quality, DWORD & AbrBitrate, BOOL & VBRHeader, const DWORD MPEG_Version) const;
+
+	/**
+		\brief Get the Lame DLL Location
+	*/
+//	const char * GetDllLocation() const { return DllLocation.c_str(); }
+	/**
+		\brief Set the Lame DLL Location
+	*/
+//	void SetDllLocation( const char * the_string ) { DllLocation = the_string; }
+
+	/**
+		\brief Get the output directory for encoding
+	*/
+//	const char * GetOutputDirectory() const { return OutputDir.c_str(); }
+	/**
+		\brief Set the output directory for encoding
+	*/
+//	void SetOutputDirectory( const char * the_string ) { OutputDir = the_string; }
+
+	/**
+		\brief Get the current channel mode to use
+	*/
+	const unsigned int GetChannelModeValue() const;
+	/**
+		\brief Get the current channel mode in the form of a string
+	*/
+	inline const char * GetChannelModeString() const {return GetChannelModeString(nChannelIndex); }
+	/**
+		\brief Get the channel mode in the form of a string for the specified Channel mode index
+
+		\param a_channelID the Channel mode index (see GetChannelLentgh())
+	*/
+	const char * GetChannelModeString(const int a_channelID) const;
+	/**
+		\brief Get the number of possible channel mode
+	*/
+	inline const int GetChannelLentgh() const { return 3; }
+
+	/**
+		\brief Get the current preset to use, see lame documentation/code for more info on the possible presets
+	*/
+//	const LAME_QUALTIY_PRESET GetPresetModeValue() const;
+	/**
+		\brief Get the preset in the form of a string for the specified Channel mode index
+
+		\param a_presetID the preset index (see GetPresetLentgh())
+	*/
+	const char * GetPresetModeString(const int a_presetID) const;
+	/**
+		\brief Get the number of possible presets
+	*/
+//	inline const int GetPresetLentgh() const { return sizeof(the_Presets) / sizeof(LAME_QUALTIY_PRESET); }
+
+	/**
+		\brief Start the user configuration process (called by AOut::config())
+	*/
+	bool Config(const HINSTANCE hInstance, const HWND HwndParent);
+
+	/**
+		\brief Init the config dialog box with the right texts and choices
+	*/
+	bool InitConfigDlg(HWND hDialog);
+
+	/**
+		\brief Update the instance parameters from the config dialog box
+	*/
+	bool UpdateValueFromDlg(HWND hDialog);
+	/**
+		\brief Update the config dialog box from the instance parameters
+	*/
+	bool UpdateDlgFromValue(HWND hDialog);
+
+	/**
+		\brief Update the config dialog box with the BitRate mode
+	*/
+	static void DisplayVbrOptions(const HWND hDialog, const BRMode the_mode);
+
+	/**
+		\brief Handle the saving of parameters when something has changed in the config dialog box
+	*/
+	void SaveParams(const HWND hDialog);
+
+	/**
+		\brief Save the current parameters (current config in use)
+	*/
+	void ParamsSave(void);
+	/**
+		\brief Load the parameters (current config in use)
+	*/
+	void ParamsRestore(void);
+
+	/**
+		\brief Select the specified config name as the new default one
+	*/
+	void SelectSavedParams(const std::string config_name);
+	/**
+		\brief Save the current parameters to the specified config name
+	*/
+	void SaveValuesToStringKey(const std::string & config_name);
+	/**
+		\brief Rename the current config name to something else
+	*/
+	bool RenameCurrentTo(const std::string & new_config_name);
+	/**
+		\brief Delete the config name from the saved configs
+	*/
+	bool DeleteConfig(const std::string & config_name);
+
+	ADbg              my_debug;
+
+	/**
+		\brief Update the slides value (on scroll)
+	*/
+	void UpdateDlgFromSlides(HWND parent_window) const;
+
+	static ToolTipItem Tooltips[13];
+private:
+
+	bool bCopyright;
+	bool bCRC;
+	bool bOriginal;
+	bool bPrivate;
+	bool bNoBitRes;
+	BRMode mBRmode;
+	bool bXingFrame;
+	bool bForceChannel;
+	bool bResample;
+	bool bSmartOutput;
+	bool bAbrOutput;
+
+	int VbrQuality;
+	unsigned int AverageBitrate_Min;
+	unsigned int AverageBitrate_Max;
+	unsigned int AverageBitrate_Step;
+
+	double SmartRatioMax;
+
+	static const unsigned int the_ChannelModes[3];
+	int nChannelIndex;
+
+	static const unsigned int the_Bitrates[18];
+	static const unsigned int the_MPEG1_Bitrates[14];
+	static const unsigned int the_MPEG2_Bitrates[14];
+	int nMinBitrateIndex; // CBR and VBR
+	int nMaxBitrateIndex; // only used in VBR mode
+
+	static const unsigned int the_SamplingFreqs[9];
+	int nSamplingFreqIndex;
+
+//	static const LAME_QUALTIY_PRESET the_Presets[17];
+	int nPresetIndex;
+
+//	char DllLocation[512];
+//	std::string DllLocation;
+//	char OutputDir[MAX_PATH];
+//	std::string OutputDir;
+
+//	AParameters my_base_parameters;
+	TiXmlDocument my_stored_data;
+	std::string my_store_location;
+	std::string my_current_config;
+
+//	HINSTANCE hDllInstance;
+
+	void SaveValuesToElement(TiXmlElement * the_element) const;
+	inline void SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const;
+	void UpdateConfigs(const HWND HwndDlg);
+	void EnableAbrOptions(HWND hDialog, bool enable);
+
+	HMODULE my_hModule;
+
+	/**
+		\brief
+
+		\param config_name
+		\param parentNode
+	*/
+	void GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode);
+};
+
+#endif // !defined(_AENCODEPROPERTIES_H__INCLUDED_)
diff --git a/ACM/DecodeStream.cpp b/ACM/DecodeStream.cpp
new file mode 100644
index 0000000..c2c753c
--- /dev/null
+++ b/ACM/DecodeStream.cpp
@@ -0,0 +1,242 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: DecodeStream.cpp,v 1.3 2002/01/25 17:51:42 robux4 Exp $
+*/
+
+#if !defined(STRICT)
+#define STRICT
+#endif // STRICT
+
+#include <assert.h>
+#include <windows.h>
+
+#ifdef ENABLE_DECODING
+
+#include "adebug.h"
+
+#include "DecodeStream.h"
+
+// static methods
+
+DecodeStream * DecodeStream::Create()
+{
+	DecodeStream * Result;
+
+	Result = new DecodeStream;
+
+	return Result;
+}
+
+const bool DecodeStream::Erase(const DecodeStream * a_ACMStream)
+{
+	delete a_ACMStream;
+	return true;
+}
+
+// class methods
+
+DecodeStream::DecodeStream() :
+ m_WorkingBufferUseSize(0),
+ gfp(NULL)
+{
+	 /// \todo get the debug level from the registry
+my_debug = new ADbg(DEBUG_LEVEL_CREATION);
+	if (my_debug != NULL) {
+		unsigned char DebugFileName[512];
+
+		my_debug->setPrefix("MPG123stream"); /// \todo get it from the registry
+my_debug->setIncludeTime(true);  /// \todo get it from the registry
+
+// Check in the registry if we have to Output Debug information
+DebugFileName[0] = '\0';
+
+		HKEY OssKey;
+		if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI", 0, KEY_READ , &OssKey ) == ERROR_SUCCESS) {
+			DWORD DataType;
+			DWORD DebugFileNameSize = 512;
+			if (RegQueryValueEx( OssKey, "DebugFile", NULL, &DataType, DebugFileName, &DebugFileNameSize ) == ERROR_SUCCESS) {
+				if (DataType == REG_SZ) {
+					my_debug->setUseFile(true);
+					my_debug->setDebugFile((char *)DebugFileName);
+					my_debug->OutPut("Debug file is %s",(char *)DebugFileName);
+				}
+			}
+		}
+		my_debug->OutPut(DEBUG_LEVEL_FUNC_START, "DecodeStream Creation (0X%08X)",this);
+	}
+	else {
+		ADbg debug;
+		debug.OutPut("DecodeStream::ACMACMStream : Impossible to create my_debug");
+	}
+
+}
+
+DecodeStream::~DecodeStream()
+{
+//	lame_close( gfp );
+
+	if (my_debug != NULL)
+	{
+		my_debug->OutPut(DEBUG_LEVEL_FUNC_START, "DecodeStream Deletion (0X%08X)",this);
+		delete my_debug;
+	}
+}
+
+bool DecodeStream::init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate)
+{
+	bool bResult = false;
+
+	my_SamplesPerSec  = nSamplesPerSec;
+	my_Channels       = nChannels;
+	my_AvgBytesPerSec = nAvgBytesPerSec;
+	my_SourceBitrate  = nSourceBitrate;
+
+	bResult = true;
+
+	return bResult;
+}
+
+bool DecodeStream::open()
+{
+	bool bResult = false;
+
+	bResult = bool(InitMP3(&my_DecodeData) != 0);
+
+	return bResult;
+}
+
+bool DecodeStream::close(LPBYTE pOutputBuffer, DWORD *pOutputSize)
+{
+
+	bool bResult = false;
+/*
+	int nOutputSamples = 0;
+
+    nOutputSamples = lame_encode_flush( gfp, pOutputBuffer, 0 );
+
+	if ( nOutputSamples < 0 )
+	{
+		// BUFFER_TOO_SMALL
+		*pOutputSize = 0;
+	}
+	else
+	{
+		*pOutputSize = nOutputSamples;
+
+		bResult = true;
+	}
+/*
+	// lame will be close in VbrWriteTag function
+	if ( !lame_get_bWriteVbrTag( gfp ) )
+	{
+		// clean up of allocated memory
+		lame_close( gfp );
+	}
+*/
+    
+	ExitMP3(&my_DecodeData);
+
+	bResult = true;
+    
+	return bResult;
+}
+
+DWORD DecodeStream::GetOutputSizeForInput(const DWORD the_SrcLength) const
+{
+	DWORD Result;
+
+	double OutputInputRatio = double(my_SamplesPerSec * 2 * my_Channels) / double(my_SourceBitrate);
+
+	OutputInputRatio *= 1.15; // allow 15% more
+
+	Result = DWORD(double(the_SrcLength) * OutputInputRatio);
+
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "Result = %d (OutputInputRatio = %f)",Result,OutputInputRatio);
+
+	return Result;
+}
+
+bool DecodeStream::ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader)
+{
+	bool result = false;
+
+if (my_debug != NULL)
+{
+my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "enter DecodeStream::ConvertBuffer");
+}
+
+	int ProcessedBytes;
+
+	int ret = decodeMP3(&my_DecodeData, a_StreamHeader->pbSrc, a_StreamHeader->cbSrcLength, (char *)a_StreamHeader->pbDst, a_StreamHeader->cbDstLength, &ProcessedBytes);
+
+	switch (ret)
+	{
+	    case MP3_OK:
+			a_StreamHeader->cbSrcLengthUsed = a_StreamHeader->cbSrcLength;
+			a_StreamHeader->cbDstLengthUsed = ProcessedBytes;
+			result = true;
+			break;
+	    case MP3_NEED_MORE:
+			a_StreamHeader->cbSrcLengthUsed = 0;
+	a_StreamHeader->cbDstLengthUsed = 0;
+			break;
+	    case MP3_ERR:
+			break;
+	}
+
+/*
+	DWORD InSize = a_StreamHeader->cbSrcLength / 2, OutSize = a_StreamHeader->cbDstLength; // 2 for 8<->16 bits
+
+// Encode it
+int dwSamples;
+	int nOutputSamples = 0;
+
+	dwSamples = InSize / lame_get_num_channels( gfp );
+
+	if ( 1 == lame_get_num_channels( gfp ) )
+	{
+		nOutputSamples = lame_encode_buffer(gfp,(PSHORT)a_StreamHeader->pbSrc,(PSHORT)a_StreamHeader->pbSrc,dwSamples,a_StreamHeader->pbDst,a_StreamHeader->cbDstLength);
+	}
+	else
+	{
+		nOutputSamples = lame_encode_buffer_interleaved(gfp,(PSHORT)a_StreamHeader->pbSrc,dwSamples,a_StreamHeader->pbDst,a_StreamHeader->cbDstLength);
+	}
+
+	a_StreamHeader->cbSrcLengthUsed = a_StreamHeader->cbSrcLength;
+	a_StreamHeader->cbDstLengthUsed = nOutputSamples;
+
+	result = a_StreamHeader->cbDstLengthUsed <= a_StreamHeader->cbDstLength;
+*/
+	my_debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "UsedSize = %d / EncodedSize = %d, result = %d, ret = %s", a_StreamHeader->cbSrcLengthUsed, a_StreamHeader->cbDstLengthUsed, result,
+		(ret == MP3_OK)?"MP3_OK":(ret == MP3_NEED_MORE)?"MP3_NEED_MORE":"error");
+
+if (my_debug != NULL)
+{
+my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "DecodeStream::ConvertBuffer result = %d",result);
+}
+
+	return result;
+}
+#endif // ENABLE_DECODING
diff --git a/ACM/DecodeStream.h b/ACM/DecodeStream.h
new file mode 100644
index 0000000..135ce21
--- /dev/null
+++ b/ACM/DecodeStream.h
@@ -0,0 +1,83 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: DecodeStream.h,v 1.2 2006/12/25 21:37:34 robert Exp $
+*/
+
+#if !defined(_DECODESTREAM_H__INCLUDED_)
+#define _DECODESTREAM_H__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include <mmreg.h>
+#include <msacm.h>
+#include <msacmdrv.h>
+
+#include "ADbg/ADbg.h"
+
+
+struct lame_global_flags;
+
+
+class DecodeStream
+{
+public:
+	DecodeStream( );
+	virtual ~DecodeStream( );
+
+	static DecodeStream * Create();
+	static const bool Erase(const DecodeStream * a_ACMStream);
+
+	bool init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate);
+	bool open();
+	bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);
+
+	DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
+	bool  ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);
+
+	static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);
+
+protected:
+	lame_global_flags * gfp;
+
+	ADbg * my_debug;
+	int my_SamplesPerSec;
+	int my_Channels;
+	int my_AvgBytesPerSec;
+	DWORD  my_SamplesPerBlock;
+	int my_SourceBitrate;
+
+	MPSTR my_DecodeData;
+
+	unsigned int m_WorkingBufferUseSize;
+	char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock
+
+	inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const;
+
+};
+
+#endif // !defined(_DECODESTREAM_H__INCLUDED_)
+
diff --git a/ACM/LameACM.inf b/ACM/LameACM.inf
new file mode 100644
index 0000000..be70430
--- /dev/null
+++ b/ACM/LameACM.inf
@@ -0,0 +1,91 @@
+; Lame codec
+; enable MP3 compression in Windows
+
+; Usage : right-click on this file and choose "Install" in the pop up menu
+
+[Version]
+Signature = "$CHICAGO$"
+Class = MEDIA
+
+[SourceDisksNames]
+1="Lame MP3 Install Disk",, 0001
+
+[SourceDisksFiles]
+LameACM.inf=1
+LameACM.acm=1
+lame_acm.xml=1
+
+[Installable.Drivers]
+lameacm  = 1:LameACM.acm, "msacm.lameacm", %DisplayNameWin% , , ,
+
+[DefaultInstall]
+CopyFiles  = LameACM.Copy,LameACM.Copy.Inf
+Updateinis = LameACM.Updateini
+;addreg     = LameACM.AddReg,LameACM.AddReg9x,LameACM.DoReg
+addreg     = LameACM.AddReg,LameACM.AddReg9x
+MediaType  = SOFTWARE
+
+[DefaultInstall.ntx86]
+CopyFiles  = LameACM.Copy,LameACM.Copy.Inf
+;addreg     = LameACM.AddReg,LameACM.AddRegNT,LameACM.DoReg
+addreg     = LameACM.AddReg,LameACM.AddRegNT
+MediaType  = SOFTWARE
+
+[Remove_LameMP3]
+;AddReg     = LameACM.Unregister
+DelReg     = LameACM.DelReg
+DelFiles   = LameACM.Copy,LameACM.Copy.Inf
+UpdateInis = LameACM.UpdateIni
+
+[LameACM.Copy]
+LameACM.acm
+lame_acm.xml
+
+[LameACM.Copy.Inf]
+LameACM.inf
+
+[LameACM.UpdateIni]
+system.ini, drivers32,,"msacm.lameacm=LameACM.acm"
+
+[LameACM.AddReg]
+HKLM, "Software\Microsoft\Windows NT\CurrentVersion\Drivers32","msacm.lameacm",,"LameACM.acm"
+HKLM, "Software\Microsoft\Windows NT\CurrentVersion\Drivers.desc","LameACM.acm",,%DisplayNameWin%
+
+
+[LameACM.AddReg9x]
+HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\msacm\msacm.lameacm,Description,,%DisplayNameWin%
+HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\msacm\msacm.lameacm,Driver,,LameACM.acm
+HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\msacm\msacm.lameacm,FriendlyName,,%DisplayNameWin%
+HKLM,%UnInstallPath%,DisplayName,,%DisplayNameWin%
+HKLM,%UnInstallPath%,UninstallString,,"%10%\rundll.exe setupx.dll,InstallHinfSection Remove_LameMP3 132 %17%\%InfFile%"
+
+[LameACM.AddRegNT]
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers32","msacm.lameacm",,"LameACM.acm"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc","LameACM.acm",,%DisplayNameWin%
+HKLM,%UnInstallPath%,DisplayName,,%DisplayNameWin%
+HKLM,%UnInstallPath%,UninstallString,,"%11%\rundll32.exe setupapi,InstallHinfSection Remove_LameMP3 132 %17%\%InfFile%"
+
+;[LameACM.DoReg]
+;HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,"Lame ACM MP3 Codec",,"%11%\regsvr32.exe /s %11%\LameCom.acm"
+
+[LameACM.DelReg]
+HKLM,"SYSTEM\CurrentControlSet\Control\MediaResources\msacm\msacm.lameacm"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc","LameACM.acm",,""
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers32","msacm.lameacm",,""
+HKLM,%UnInstallPath%
+
+;[LameACM.Unregister]
+;HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup","Lame ACM MP3 Codec",,"%11%\regsvr32.exe /s /u %11%\LameCom.acm"
+
+[DestinationDirs]
+DefaultDestDir   = 11	; LDID_SYS
+LameACM.Copy     = 11
+LameACM.Copy.Inf = 17
+
+[Strings]
+InfFile="LameACM.inf"
+DisplayNameWin="Lame ACM MP3 Codec"
+UnInstallPath="Software\Microsoft\Windows\CurrentVersion\Uninstall\LameACM"
+MediaClassName="Media Devices"
+mfgname="Steve Lhomme"
+
diff --git a/ACM/Makefile.am b/ACM/Makefile.am
new file mode 100644
index 0000000..c05a1cf
--- /dev/null
+++ b/ACM/Makefile.am
@@ -0,0 +1,28 @@
+## $Id: Makefile.am,v 1.6 2005/08/21 17:32:07 bouvigne Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+SUBDIRS = ADbg ddk tinyxml
+
+EXTRA_DIST = \
+	ACM.cpp \
+	ACM.h \
+	ACMStream.cpp \
+	ACMStream.h \
+	AEncodeProperties.cpp \
+	AEncodeProperties.h \
+	DecodeStream.cpp \
+	DecodeStream.h \
+	LameACM.inf \
+	TODO \
+	acm.rc \
+	adebug.h \
+	lame.ico \
+	lameACM.def \
+	lameACM_vc6.dsp \
+	lameACM_vc7.vcproj \
+	lame_acm.xml \
+	main.cpp \
+	readme.txt \
+	resource.h
+
diff --git a/ACM/Makefile.in b/ACM/Makefile.in
new file mode 100644
index 0000000..3205c1b
--- /dev/null
+++ b/ACM/Makefile.in
@@ -0,0 +1,537 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global TODO
+subdir = ACM
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+SUBDIRS = ADbg ddk tinyxml
+EXTRA_DIST = \
+	ACM.cpp \
+	ACM.h \
+	ACMStream.cpp \
+	ACMStream.h \
+	AEncodeProperties.cpp \
+	AEncodeProperties.h \
+	DecodeStream.cpp \
+	DecodeStream.h \
+	LameACM.inf \
+	TODO \
+	acm.rc \
+	adebug.h \
+	lame.ico \
+	lameACM.def \
+	lameACM_vc6.dsp \
+	lameACM_vc7.vcproj \
+	lame_acm.xml \
+	main.cpp \
+	readme.txt \
+	resource.h
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  ACM/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  ACM/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ACM/TODO b/ACM/TODO
new file mode 100644
index 0000000..c88aba2
--- /dev/null
+++ b/ACM/TODO
@@ -0,0 +1,9 @@
+- known bug : when recording, converting, and recording a lame_close() call fail
+- allow decompression the same way as in the command-line
+- allow VBR mode
+- allow channel resampling (mono to stereo / stereo to mono)
+- allow internal resampling (difference in the format suggestion)
+- use global pointers for string
+- use the bitrate/freq tables from LAME
+
+/ add the decoding engine
diff --git a/ACM/acm.rc b/ACM/acm.rc
new file mode 100644
index 0000000..117a5d7
--- /dev/null
+++ b/ACM/acm.rc
@@ -0,0 +1,219 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Französisch (Frankreich) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,9,1,0
+ PRODUCTVERSION 0,9,1,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x3L
+ FILESUBTYPE 0x8L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "This is an ACM driver for Win32 using Lame to encode\0"
+            VALUE "CompanyName", "http://www.mp3dev.org/\0"
+            VALUE "FileDescription", "Lame MP3 codec engine\0"
+            VALUE "FileVersion", "0.9.2\0"
+            VALUE "InternalName", "lameACM\0"
+            VALUE "LegalCopyright", "Copyright © 2002 Steve Lhomme, Copyright © 2002-2007 The LAME Project\0"
+            VALUE "LegalTrademarks", "LGPL (see gnu.org)\0"
+            VALUE "OriginalFilename", "lameACM.acm\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "Lame MP3 codec\0"
+            VALUE "ProductVersion", "0.9.2\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON                ICON    DISCARDABLE     "lame.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONFIG DIALOGEX 0, 0, 231, 204
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Lame MP3 codec : About"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,65,183,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,125,183,50,14
+    GROUPBOX        "Encoding",IDC_STATIC,7,7,142,166
+    GROUPBOX        "Decoding",IDC_STATIC_DECODING,154,7,70,113,WS_DISABLED
+    GROUPBOX        "Bits",IDC_STATIC,16,121,124,42
+    CONTROL         "Copyright",IDC_CHECK_COPYRIGHT,"Button",BS_AUTOCHECKBOX | 
+                    BS_FLAT | WS_GROUP | WS_TABSTOP,23,132,45,10
+    CONTROL         "Checksum",IDC_CHECK_CHECKSUM,"Button",BS_AUTOCHECKBOX | 
+                    BS_FLAT | WS_GROUP | WS_TABSTOP,84,132,49,10
+    CONTROL         "Original",IDC_CHECK_ORIGINAL,"Button",BS_AUTOCHECKBOX | 
+                    BS_FLAT | WS_GROUP | WS_TABSTOP,23,148,39,10
+    CONTROL         "Private",IDC_CHECK_PRIVATE,"Button",BS_AUTOCHECKBOX | 
+                    BS_FLAT | WS_GROUP | WS_TABSTOP,84,148,38,10
+    COMBOBOX        IDC_COMBO_ENC_STEREO,70,21,60,53,CBS_DROPDOWNLIST | 
+                    WS_VSCROLL | WS_GROUP | WS_TABSTOP
+    LTEXT           "Stereo mode",IDC_STATIC,23,24,41,8
+    CONTROL         "Smart Encode",IDC_CHECK_ENC_SMART,"Button",
+                    BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,49,39,
+                    61,10
+    ICON            IDI_ICON,IDC_STATIC_ENC_ICON,179,129,20,20
+    CTEXT           "v0.0.0 - 0.00",IDC_STATIC_CONFIG_VERSION,168,155,43,17
+    CONTROL         "Average BitRate",IDC_CHECK_ENC_ABR,"Button",
+                    BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,49,53,
+                    68,10
+    LTEXT           "Min",IDC_STATIC_AVERAGE_MIN,19,67,12,8
+    LTEXT           "Max",IDC_STATIC_AVERAGE_MAX,17,79,14,8
+    LTEXT           "Step",IDC_STATIC_AVERAGE_STEP,15,91,16,8
+    LTEXT           "test",IDC_STATIC_AVERAGE_SAMPLE,19,105,12,8
+    CONTROL         "Slider2",IDC_SLIDER_AVERAGE_MIN,"msctls_trackbar32",
+                    TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_GROUP | 
+                    WS_TABSTOP,33,67,92,11
+    CONTROL         "Slider3",IDC_SLIDER_AVERAGE_MAX,"msctls_trackbar32",
+                    TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_GROUP | 
+                    WS_TABSTOP,33,79,92,11
+    CONTROL         "Slider1",IDC_SLIDER_AVERAGE_STEP,"msctls_trackbar32",
+                    TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_GROUP | 
+                    WS_TABSTOP,33,91,92,11
+    CONTROL         "Slider4",IDC_SLIDER_AVERAGE_SAMPLE,"msctls_trackbar32",
+                    WS_TABSTOP,33,104,92,12
+    CTEXT           "000",IDC_STATIC_AVERAGE_SAMPLE_VALUE,125,105,15,9,0,
+                    WS_EX_STATICEDGE
+    CTEXT           "000",IDC_STATIC_AVERAGE_STEP_VALUE,125,92,15,9,0,
+                    WS_EX_STATICEDGE
+    CTEXT           "000",IDC_STATIC_AVERAGE_MAX_VALUE,125,80,15,9,0,
+                    WS_EX_STATICEDGE
+    CTEXT           "000",IDC_STATIC_AVERAGE_MIN_VALUE,125,67,15,9,0,
+                    WS_EX_STATICEDGE
+END
+
+IDD_ABOUT DIALOG DISCARDABLE  0, 0, 187, 77
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Lame MP3 codec : About"
+FONT 8, "MS Sans Serif"
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,130,56,50,14
+    LTEXT           "Steve Lhomme + LAME developers",IDC_STATIC,7,33,112,8
+    LTEXT           "LGPL license",IDC_STATIC,7,20,43,8
+    ICON            IDI_ICON,IDC_STATIC,145,16,20,20
+    LTEXT           "Static",IDC_STATIC_ABOUT_TITLE,7,7,173,8
+    LTEXT           "http://www.mp3dev.org/",IDC_STATIC_ABOUT_URL,7,47,80,8
+    LTEXT           "icon : Lucas Granito",IDC_STATIC,7,61,64,8
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE 
+BEGIN
+    IDD_CONFIG, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 224
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 197
+    END
+
+    IDD_ABOUT, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 180
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 70
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Französisch (Frankreich) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/ACM/adebug.h b/ACM/adebug.h
new file mode 100644
index 0000000..32ec192
--- /dev/null
+++ b/ACM/adebug.h
@@ -0,0 +1,39 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: adebug.h,v 1.2 2002/01/22 19:45:02 robux4 Exp $
+*/
+
+#if !defined(_DEBUG_H__INCLUDED_)
+#define _DEBUG_H__INCLUDED_
+
+#define DEBUG_LEVEL_CREATION 0
+
+#define DEBUG_LEVEL_MSG 0
+#define DEBUG_LEVEL_FUNC_START 1
+#define DEBUG_LEVEL_FUNC_DEBUG 2
+#define DEBUG_LEVEL_FUNC_CODE 3
+
+#endif /* !defined(_DEBUG_H__INCLUDED_) */
+
diff --git a/ACM/ddk/Makefile.am b/ACM/ddk/Makefile.am
new file mode 100644
index 0000000..4988997
--- /dev/null
+++ b/ACM/ddk/Makefile.am
@@ -0,0 +1,6 @@
+## $Id: Makefile.am,v 1.1 2003/12/09 15:48:37 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	msacmdrv.h
diff --git a/ACM/ddk/Makefile.in b/ACM/ddk/Makefile.in
new file mode 100644
index 0000000..48094c1
--- /dev/null
+++ b/ACM/ddk/Makefile.in
@@ -0,0 +1,358 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = ACM/ddk
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	msacmdrv.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  ACM/ddk/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  ACM/ddk/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ACM/ddk/msacmdrv.h b/ACM/ddk/msacmdrv.h
new file mode 100644
index 0000000..aa3c200
--- /dev/null
+++ b/ACM/ddk/msacmdrv.h
@@ -0,0 +1,185 @@
+/**
+ *
+ * Alternative msacmdrv.h file, for use in the Lame project.
+ * File from the FFDshow project, released under LGPL by permission
+ * from Milan Cutka.
+ * Modified by Gabriel Bouvigne to allow compilation of Lame.
+ *
+ *  Copyright (c) 2003 Milan Cutka
+ *  Copyright (c) 2003 Gabriel Bouvigne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef _MSACMDRV_H_
+#define _MSACMDRV_H_
+
+
+#include <mmreg.h>
+#include <msacm.h>
+
+
+
+typedef  unsigned long ULONG_PTR, *PULONG_PTR;
+
+
+
+typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
+
+
+#undef ACMDRIVERDETAILS
+#undef PACMDRIVERDETAILS
+#undef LPACMDRIVERDETAILS
+
+#define ACMDRIVERDETAILS        ACMDRIVERDETAILSW
+#define PACMDRIVERDETAILS       PACMDRIVERDETAILSW
+#define LPACMDRIVERDETAILS      LPACMDRIVERDETAILSW
+
+#undef ACMFORMATTAGDETAILS
+#undef PACMFORMATTAGDETAILS
+#undef LPACMFORMATTAGDETAILS
+
+#define ACMFORMATTAGDETAILS     ACMFORMATTAGDETAILSW
+#define PACMFORMATTAGDETAILS    PACMFORMATTAGDETAILSW
+#define LPACMFORMATTAGDETAILS   LPACMFORMATTAGDETAILSW
+
+#undef ACMFORMATDETAILS
+#undef PACMFORMATDETAILS
+#undef LPACMFORMATDETAILS
+
+#define ACMFORMATDETAILS	ACMFORMATDETAILSW
+#define PACMFORMATDETAILS	PACMFORMATDETAILSW
+#define LPACMFORMATDETAILS	LPACMFORMATDETAILSW
+
+
+#define MAKE_ACM_VERSION(mjr, mnr, bld) (((long)(mjr)<<24)| \
+                                         ((long)(mnr)<<16)| \
+                                         ((long)bld))
+
+#define VERSION_MSACM       MAKE_ACM_VERSION(3, 50, 0)
+#define VERSION_ACM_DRIVER  MAKE_ACM_VERSION(4,  0, 0)
+
+
+#define ACMDM_DRIVER_NOTIFY             (ACMDM_BASE + 1)
+#define ACMDM_DRIVER_DETAILS            (ACMDM_BASE + 10)
+
+#define ACMDM_HARDWARE_WAVE_CAPS_INPUT  (ACMDM_BASE + 20)
+#define ACMDM_HARDWARE_WAVE_CAPS_OUTPUT (ACMDM_BASE + 21)
+
+#define ACMDM_FORMATTAG_DETAILS         (ACMDM_BASE + 25)
+#define ACMDM_FORMAT_DETAILS            (ACMDM_BASE + 26)
+#define ACMDM_FORMAT_SUGGEST            (ACMDM_BASE + 27)
+
+#define ACMDM_FILTERTAG_DETAILS         (ACMDM_BASE + 50)
+#define ACMDM_FILTER_DETAILS            (ACMDM_BASE + 51)
+
+#define ACMDM_STREAM_OPEN               (ACMDM_BASE + 76)
+#define ACMDM_STREAM_CLOSE              (ACMDM_BASE + 77)
+#define ACMDM_STREAM_SIZE               (ACMDM_BASE + 78)
+#define ACMDM_STREAM_CONVERT            (ACMDM_BASE + 79)
+#define ACMDM_STREAM_RESET              (ACMDM_BASE + 80)
+#define ACMDM_STREAM_PREPARE            (ACMDM_BASE + 81)
+#define ACMDM_STREAM_UNPREPARE          (ACMDM_BASE + 82)
+
+typedef struct tACMDRVFORMATSUGGEST
+{
+    DWORD               cbStruct;           // sizeof(ACMDRVFORMATSUGGEST)
+    DWORD               fdwSuggest;         // Suggest flags
+    LPWAVEFORMATEX      pwfxSrc;            // Source Format
+    DWORD               cbwfxSrc;           // Source Size
+    LPWAVEFORMATEX      pwfxDst;            // Dest format
+    DWORD               cbwfxDst;           // Dest Size
+
+} ACMDRVFORMATSUGGEST, *PACMDRVFORMATSUGGEST, FAR *LPACMDRVFORMATSUGGEST;
+
+
+
+
+typedef struct tACMDRVOPENDESC
+{
+    DWORD           cbStruct;       // sizeof(ACMDRVOPENDESC)
+    FOURCC          fccType;        // 'audc'
+    FOURCC          fccComp;        // sub-type (not used--must be 0)
+    DWORD           dwVersion;      // current version of ACM opening you
+    DWORD           dwFlags;        //
+    DWORD           dwError;        // result from DRV_OPEN request
+    LPCWSTR         pszSectionName; // see DRVCONFIGINFO.lpszDCISectionName
+    LPCWSTR         pszAliasName;   // see DRVCONFIGINFO.lpszDCIAliasName
+    DWORD           dnDevNode;	    // devnode id for pnp drivers.
+
+} ACMDRVOPENDESC, *PACMDRVOPENDESC, FAR *LPACMDRVOPENDESC;
+
+
+typedef struct tACMDRVSTREAMINSTANCE
+{
+    DWORD               cbStruct;
+    LPWAVEFORMATEX      pwfxSrc;
+    LPWAVEFORMATEX      pwfxDst;
+    LPWAVEFILTER        pwfltr;
+    DWORD_PTR           dwCallback;
+    DWORD_PTR           dwInstance;
+    DWORD               fdwOpen;
+    DWORD               fdwDriver;
+    DWORD_PTR           dwDriver;
+    HACMSTREAM          has;
+
+} ACMDRVSTREAMINSTANCE, *PACMDRVSTREAMINSTANCE, FAR *LPACMDRVSTREAMINSTANCE;
+
+typedef struct tACMDRVSTREAMSIZE
+{
+    DWORD               cbStruct;
+    DWORD               fdwSize;
+    DWORD               cbSrcLength;
+    DWORD               cbDstLength;
+
+} ACMDRVSTREAMSIZE, *PACMDRVSTREAMSIZE, FAR *LPACMDRVSTREAMSIZE;
+
+typedef struct tACMDRVSTREAMHEADER FAR *LPACMDRVSTREAMHEADER;
+typedef struct tACMDRVSTREAMHEADER
+{
+    DWORD                   cbStruct;
+    DWORD                   fdwStatus;
+    DWORD_PTR               dwUser;
+    LPBYTE                  pbSrc;
+    DWORD                   cbSrcLength;
+    DWORD                   cbSrcLengthUsed;
+    DWORD_PTR               dwSrcUser;
+    LPBYTE                  pbDst;
+    DWORD                   cbDstLength;
+    DWORD                   cbDstLengthUsed;
+    DWORD_PTR               dwDstUser;
+
+    DWORD                   fdwConvert;     // flags passed from convert func
+    LPACMDRVSTREAMHEADER    padshNext;      // for async driver queueing
+    DWORD                   fdwDriver;      // driver instance flags
+    DWORD_PTR               dwDriver;       // driver instance data
+
+    //
+    //  all remaining fields are used by the ACM for bookkeeping purposes.
+    //  an ACM driver should never use these fields (though than can be
+    //  helpful for debugging)--note that the meaning of these fields
+    //  may change, so do NOT rely on them in shipping code.
+    //
+    DWORD                   fdwPrepared;
+    DWORD_PTR               dwPrepared;
+    LPBYTE                  pbPreparedSrc;
+    DWORD                   cbPreparedSrcLength;
+    LPBYTE                  pbPreparedDst;
+    DWORD                   cbPreparedDstLength;
+
+} ACMDRVSTREAMHEADER, *PACMDRVSTREAMHEADER;
+
+#endif
diff --git a/ACM/lame.ico b/ACM/lame.ico
new file mode 100644
index 0000000..5610b8c
--- /dev/null
+++ b/ACM/lame.ico
Binary files differ
diff --git a/ACM/lameACM.def b/ACM/lameACM.def
new file mode 100644
index 0000000..5de031f
--- /dev/null
+++ b/ACM/lameACM.def
@@ -0,0 +1,25 @@
+; Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+;
+;  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+;
+; This library is free software; you can redistribute it and/or
+; modify it under the terms of the GNU Lesser General Public
+; License as published by the Free Software Foundation; either
+; version 2.1 of the License, or (at your option) any later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+; Lesser General Public License for more details.
+;
+; You should have received a copy of the GNU Lesser General Public
+; License along with this library; if not, write to the Free Software
+; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+LIBRARY     lameACM.ACM
+
+; DESCRIPTION 'lameACM.acm: MP3 Lame ACM Codec'
+
+EXPORTS     DriverProc
+
+; EOF
diff --git a/ACM/lameACM_vc6.dsp b/ACM/lameACM_vc6.dsp
new file mode 100644
index 0000000..a855658
--- /dev/null
+++ b/ACM/lameACM_vc6.dsp
@@ -0,0 +1,187 @@
+# Microsoft Developer Studio Project File - Name="lameACM" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

+

+CFG=LAMEACM - WIN32 RELEASE

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "lameACM_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "lameACM_vc6.mak" CFG="LAMEACM - WIN32 RELEASE"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "lameACM - Win32 Release" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE "lameACM - Win32 Debug" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+MTL=midl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "lameACM - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\lameACM"

+# PROP Ignore_Export_Lib 1

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /Zp2 /MT /W3 /GX /Ob2 /I "../libmp3lame" /I "../include" /I ".." /I "../.." /I "../mpglib" /I "./" /I "./ddk" /D "NDEBUG" /D "_BLADEDLL" /D "_WINDOWS" /D "WIN32" /D "NOANALYSIS" /D "LAME_ACM" /YX /FD /c

+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"

+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"

+# ADD BASE RSC /l 0x409 /d "NDEBUG"

+# ADD RSC /l 0x409 /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386

+# ADD LINK32 libmp3lame.lib shell32.lib url.lib gdi32.lib winmm.lib advapi32.lib user32.lib kernel32.lib libc.lib libcp.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib /def:".\lameACM.def" /out:"..\output\Release\lameACM.acm" /libpath:"..\output\Release" /opt:NOWIN98

+# Begin Special Build Tool

+TargetDir=\cvs\lame-398b4\lame\output\Release

+SOURCE="$(InputPath)"

+PostBuild_Desc=ACM config files

+PostBuild_Cmds=copy lameacm.inf $(TargetDir)\*.*	copy lame_acm.xml $(TargetDir)\*.*

+# End Special Build Tool

+

+!ELSEIF  "$(CFG)" == "lameACM - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\lameACM"

+# PROP Ignore_Export_Lib 1

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /Zp2 /MTd /W3 /GX /ZI /Od /I "../libmp3lame" /I "../include" /I ".." /I "../.." /I "../mpglib" /I "./" /I "./ddk" /D "_DEBUG" /D "_BLADEDLL" /D "_WINDOWS" /D "WIN32" /D "NOANALYSIS" /D "LAME_ACM" /YX /FD /c

+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"

+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"

+# ADD BASE RSC /l 0x409 /d "_DEBUG"

+# ADD RSC /l 0x409 /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept

+# ADD LINK32 libmp3lame.lib shell32.lib url.lib gdi32.lib winmm.lib advapi32.lib user32.lib kernel32.lib libcd.lib libcpd.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib /def:".\lameACM.def" /out:"..\output\Debug\lameACM.acm" /pdbtype:sept /libpath:"..\output\Debug" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none /incremental:no

+# Begin Special Build Tool

+TargetDir=\cvs\lame-398b4\lame\output\Debug

+SOURCE="$(InputPath)"

+PostBuild_Desc=ACM config files

+PostBuild_Cmds=copy lameacm.inf $(TargetDir)\*.*	copy lame_acm.xml $(TargetDir)\*.*

+# End Special Build Tool

+

+!ENDIF 

+

+# Begin Target

+

+# Name "lameACM - Win32 Release"

+# Name "lameACM - Win32 Debug"

+# Begin Group "Source"

+

+# PROP Default_Filter "c;cpp"

+# Begin Source File

+

+SOURCE=.\ACM.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\ACMStream.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\AEncodeProperties.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\DecodeStream.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\lameACM.def

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE=.\main.cpp

+# End Source File

+# End Group

+# Begin Group "Include"

+

+# PROP Default_Filter "h"

+# Begin Source File

+

+SOURCE=.\ACM.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\ACMStream.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\adebug.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\AEncodeProperties.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\DecodeStream.h

+# End Source File

+# End Group

+# Begin Group "Resource"

+

+# PROP Default_Filter "rc"

+# Begin Source File

+

+SOURCE=.\acm.rc

+# End Source File

+# Begin Source File

+

+SOURCE=.\lame.ico

+# End Source File

+# End Group

+# Begin Group "Install"

+

+# PROP Default_Filter "inf;acm"

+# Begin Source File

+

+SOURCE=.\LameACM.inf

+# End Source File

+# End Group

+# Begin Source File

+

+SOURCE=.\readme.txt

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE=.\TODO

+# PROP Exclude_From_Build 1

+# End Source File

+# End Target

+# End Project

diff --git a/ACM/lameACM_vc7.vcproj b/ACM/lameACM_vc7.vcproj
new file mode 100644
index 0000000..572c55f
--- /dev/null
+++ b/ACM/lameACM_vc7.vcproj
@@ -0,0 +1,1197 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="7.10"

+	Name="lameACM"

+	ProjectGUID="{88A0CD70-E576-456B-9C13-1D6AD838B87E}"

+	SccProjectName=""

+	SccLocalPath="">

+	<Platforms>

+		<Platform

+			Name="Win32"/>

+	</Platforms>

+	<Configurations>

+		<Configuration

+			Name="Debug NASM|Win32"

+			OutputDirectory=".\Debug_NASM"

+			IntermediateDirectory=".\Debug_NASM"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="_DEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="1"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug_NASM/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Debug_NASM/"

+				ObjectFile=".\Debug_NASM/"

+				ProgramDataBaseFileName=".\Debug_NASM/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libcd.lib libcpd.lib ADbg/Debug/adbg.lib tinyxml/Debug/tinyxml.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug_NASM/lameACM.pdb"

+				SubSystem="2"

+				ImportLibrary=".\Debug_NASM/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug_NASM/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory=".\Release"

+			IntermediateDirectory=".\Release"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="3"

+				GlobalOptimizations="TRUE"

+				InlineFunctionExpansion="2"

+				FavorSizeOrSpeed="1"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="0"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libc.lib libcp.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				ProgramDatabaseFile=".\Release/lameACM.pdb"

+				GenerateMapFile="TRUE"

+				MapFileName=".\Release/lameACM.map"

+				SubSystem="2"

+				ImportLibrary=".\Release/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="Release NASM|Win32"

+			OutputDirectory=".\Release_NASM"

+			IntermediateDirectory=".\Release_NASM"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="3"

+				GlobalOptimizations="TRUE"

+				InlineFunctionExpansion="2"

+				FavorSizeOrSpeed="1"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="NDEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="0"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release_NASM/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Release_NASM/"

+				ObjectFile=".\Release_NASM/"

+				ProgramDataBaseFileName=".\Release_NASM/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libc.lib libcp.lib ADbg\Release\adbg.lib tinyxml/Release/tinyxml.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				ProgramDatabaseFile=".\Release_NASM/lameACM.pdb"

+				GenerateMapFile="TRUE"

+				MapFileName=".\Release_NASM/lameACM.map"

+				SubSystem="2"

+				ImportLibrary=".\Release_NASM/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release_NASM/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory=".\Debug"

+			IntermediateDirectory=".\Debug"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="1"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libcd.lib libcpd.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug/lameACM.pdb"

+				SubSystem="2"

+				ImportLibrary=".\Debug/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME debug|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="1"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libcd.lib libcpd.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug/lameACM.pdb"

+				SubSystem="2"

+				ImportLibrary=".\Debug/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME release|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="1"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libcd.lib libcpd.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug/lameACM.pdb"

+				SubSystem="2"

+				ImportLibrary=".\Debug/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME release Nasm|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="3"

+				GlobalOptimizations="TRUE"

+				InlineFunctionExpansion="2"

+				FavorSizeOrSpeed="1"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="0"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libc.lib libcp.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				ProgramDatabaseFile=".\Release/lameACM.pdb"

+				GenerateMapFile="TRUE"

+				MapFileName=".\Release/lameACM.map"

+				SubSystem="2"

+				ImportLibrary=".\Release/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll debug|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="1"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libcd.lib libcpd.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug/lameACM.pdb"

+				SubSystem="2"

+				ImportLibrary=".\Debug/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll release|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="1"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libcd.lib libcpd.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug/lameACM.pdb"

+				SubSystem="2"

+				ImportLibrary=".\Debug/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll release Nasm|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="3"

+				GlobalOptimizations="TRUE"

+				InlineFunctionExpansion="2"

+				FavorSizeOrSpeed="1"

+				AdditionalIncludeDirectories="../libmp3lame,../include,..,../..,../mpglib,./"

+				PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM"

+				RuntimeLibrary="0"

+				StructMemberAlignment="2"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/lameACM_vc6.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				CompileAs="0"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="url.lib winmm.lib libc.lib libcp.lib"

+				OutputFile="..\output\lameACM.acm"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				IgnoreAllDefaultLibraries="TRUE"

+				ModuleDefinitionFile=".\lameACM.def"

+				ProgramDatabaseFile=".\Release/lameACM.pdb"

+				GenerateMapFile="TRUE"

+				MapFileName=".\Release/lameACM.map"

+				SubSystem="2"

+				ImportLibrary=".\Release/lameACM.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release/lameACM_vc6.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy lameacm.inf ..\output\*.*

+copy lame_acm.xml ..\output\*.*

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source"

+			Filter="c;cpp">

+			<File

+				RelativePath="ACM.cpp">

+				<FileConfiguration

+					Name="Debug NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="ACMStream.cpp">

+				<FileConfiguration

+					Name="Debug NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="AEncodeProperties.cpp">

+				<FileConfiguration

+					Name="Debug NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="DecodeStream.cpp">

+				<FileConfiguration

+					Name="Debug NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="lameACM.def">

+			</File>

+			<File

+				RelativePath="main.cpp">

+				<FileConfiguration

+					Name="Debug NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;HAVE_NASM;MMX_choose_table;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="LAME release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll debug|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="0"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="_DEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="dll release Nasm|Win32">

+					<Tool

+						Name="VCCLCompilerTool"

+						Optimization="3"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions="NDEBUG;_BLADEDLL;TAKEHIRO_IEEE754_HACK;HAVE_CONFIG_H;HAVE_MPGLIB;_WINDOWS;WIN32;NOANALYSIS;LAME_ACM;$(NoInherit)"/>

+				</FileConfiguration>

+			</File>

+		</Filter>

+		<Filter

+			Name="Include"

+			Filter="h">

+			<File

+				RelativePath="ACM.h">

+			</File>

+			<File

+				RelativePath="ACMStream.h">

+			</File>

+			<File

+				RelativePath="adebug.h">

+			</File>

+			<File

+				RelativePath="AEncodeProperties.h">

+			</File>

+			<File

+				RelativePath="DecodeStream.h">

+			</File>

+		</Filter>

+		<Filter

+			Name="Resource"

+			Filter="rc">

+			<File

+				RelativePath="acm.rc">

+			</File>

+			<File

+				RelativePath="lame.ico">

+			</File>

+		</Filter>

+		<Filter

+			Name="Install"

+			Filter="inf;acm">

+			<File

+				RelativePath="LameACM.inf">

+			</File>

+		</Filter>

+		<File

+			RelativePath="readme.txt">

+		</File>

+		<File

+			RelativePath="TODO">

+		</File>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/ACM/lame_acm.xml b/ACM/lame_acm.xml
new file mode 100644
index 0000000..0fc5186
--- /dev/null
+++ b/ACM/lame_acm.xml
@@ -0,0 +1,13 @@
+<lame_acm>
+    <encodings default="Current">
+        <config name="Current">
+            <Smart use="true" />
+            <Copyright use="true" />
+            <CRC use="true" />
+            <Original use="false" />
+            <Private use="false" />
+            <Channel mode="Joint-stereo" />
+            <ABR use="true" min="88" max="160" step="6" />
+        </config>
+    </encodings>
+</lame_acm>
diff --git a/ACM/main.cpp b/ACM/main.cpp
new file mode 100644
index 0000000..84e4773
--- /dev/null
+++ b/ACM/main.cpp
@@ -0,0 +1,216 @@
+/**
+ *
+ * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
+ *
+ *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+ 
+/*!
+	\author Steve Lhomme
+	\version \$Id: main.cpp,v 1.5 2006/12/25 21:37:34 robert Exp $
+*/
+
+#if !defined(STRICT)
+#define STRICT
+#endif // STRICT
+
+#include <windows.h>
+
+/// The ACM is considered as a driver and run in Kernel-Mode
+/// So the new/delete operators have to be overriden in order to use memory
+/// readable out of the calling process
+
+void * operator new( unsigned int cb )
+{
+	return LocalAlloc(LPTR, cb); // VirtualAlloc
+}
+
+void operator delete(void *block) {
+	LocalFree(block);
+}
+
+extern "C" {
+
+	void *acm_Calloc( size_t num, size_t size )
+	{
+		return LocalAlloc(LPTR, num * size); // VirtualAlloc
+	}
+
+	void *acm_Malloc( size_t size )
+	{
+		return LocalAlloc(LPTR, size); // VirtualAlloc
+	}
+
+	void acm_Free( void * mem)
+	{
+		LocalFree(mem);
+	}
+};
+
+////// End of memory instrumentation
+
+#include <mmreg.h>
+#include <msacm.h>
+#include <msacmdrv.h>
+
+#include <assert.h>
+
+#include "AEncodeProperties.h"
+#include "ACM.h"
+#include "resource.h"
+#include "adebug.h"
+
+
+ADbg * debug = NULL;
+
+LONG WINAPI DriverProc(DWORD dwDriverId, HDRVR hdrvr, UINT msg, LONG lParam1, LONG lParam2)
+{
+
+	switch (msg)
+	{
+		case DRV_OPEN: // acmDriverOpen
+		{
+			if (debug == NULL) {
+				debug = new ADbg(DEBUG_LEVEL_CREATION);
+				debug->setPrefix("LAMEdrv");
+			}
+
+			if (debug != NULL)
+			{
+				// Sent when the driver is opened.
+				if (lParam2 != NULL)
+					debug->OutPut(DEBUG_LEVEL_MSG, "DRV_OPEN (ID 0x%08X), pDesc = 0x%08X",dwDriverId,lParam2);
+				else
+					debug->OutPut(DEBUG_LEVEL_MSG, "DRV_OPEN (ID 0x%08X), pDesc = NULL",dwDriverId);
+			}
+
+			if (lParam2 != NULL) {
+				LPACMDRVOPENDESC pDesc = (LPACMDRVOPENDESC)lParam2;
+
+				if (pDesc->fccType != ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC) {
+					if (debug != NULL)
+					{
+						debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "wrong pDesc->fccType (0x%08X)",pDesc->fccType);
+					}
+					return NULL;
+				}
+			} else {
+				if (debug != NULL)
+				{
+					debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "pDesc == NULL");
+				}
+			}
+
+			ACM * ThisACM = new ACM(GetDriverModuleHandle(hdrvr));
+
+			if (debug != NULL)
+			{
+				debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "OPENED instance 0x%08X",ThisACM);
+			}
+
+			return (LONG)ThisACM;// returns 0L to fail
+								// value subsequently used
+								// for dwDriverId.
+		}
+		break;
+
+		case DRV_CLOSE: // acmDriverClose
+		{
+			if (debug != NULL)
+			{
+				// Sent when the driver is closed. Drivers are
+				// unloaded when the open count reaches zero.
+				debug->OutPut(DEBUG_LEVEL_MSG, "DRV_CLOSE");
+			}
+
+			ACM * ThisACM = (ACM *)dwDriverId;
+			delete ThisACM;
+			if (debug != NULL)
+			{
+				debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "CLOSED instance 0x%08X",ThisACM);
+				delete debug;
+				debug = NULL;
+			}
+			return 1L;  // returns 0L to fail
+		}
+		break;
+
+		case DRV_LOAD:
+		{
+			// nothing to do
+			if (debug != NULL)
+			{
+//				debug->OutPut(DEBUG_LEVEL_MSG, "DRV_LOAD, version %s %s %s", ACM_VERSION, __DATE__, __TIME__);
+				debug->OutPut(DEBUG_LEVEL_MSG, "DRV_LOAD, %s %s",  __DATE__, __TIME__);
+			}
+			return 1L;
+		}
+		break;
+
+		case DRV_ENABLE:
+		{
+			// nothing to do
+			if (debug != NULL)
+			{
+				debug->OutPut(DEBUG_LEVEL_MSG, "DRV_ENABLE");
+			}
+			return 1L;
+		}
+		break;
+
+		case DRV_DISABLE:
+		{
+			// nothing to do
+			if (debug != NULL)
+			{
+				debug->OutPut(DEBUG_LEVEL_MSG, "DRV_DISABLE");
+			}
+			return 1L;
+		}
+		break;
+
+		case DRV_FREE:
+		{
+			if (debug != NULL)
+			{
+				debug->OutPut(DEBUG_LEVEL_MSG, "DRV_FREE");
+			}
+			return 1L;
+		}
+		break;
+
+		default:
+		{
+			ACM * ThisACM = (ACM *)dwDriverId;
+
+			if (ThisACM != NULL)
+				return ThisACM->DriverProcedure(hdrvr, msg, lParam1, lParam2);
+			else
+			{
+				if (debug != NULL)
+				{
+					debug->OutPut(DEBUG_LEVEL_MSG, "Driver not opened, unknown message (0x%08X), lParam1 = 0x%08X, lParam2 = 0x%08X", msg, lParam1, lParam2);
+				}
+
+				return DefDriverProc (dwDriverId, hdrvr, msg, lParam1, lParam2);
+			}
+		}
+		break;
+	}
+}
+ 
diff --git a/ACM/readme.txt b/ACM/readme.txt
new file mode 100644
index 0000000..92a6422
--- /dev/null
+++ b/ACM/readme.txt
@@ -0,0 +1,29 @@
+In order to build this codec, you need the Windows98 DDK from Microsoft. It can also work
+with the Windows2000/ME/XP/2003 DDK:
+
+http://www.microsoft.com/ddk/
+
+Alternatively, the required headers are also available in CYGWIN+w32api, MINGW32 or Wine :
+
+http://www.cygwin.com/
+http://www.mingw.org/
+http://www.winehq.com/
+
+
+If you do not have a ddk, you should be able to use the alternative msacmdrv.h provided
+with this ACM codec. It is not used by default because it would probably broke any real
+DDK already installed.
+
+
+
+---------------
+
+Define ENABLE_DECODING if you want to use the decoding (alpha state, doesn't decode at the
+ moment, so use it only if you plan to develop)
+
+---------------
+
+To release this codec you will need :
+- lameACM.acm (result of the build process)
+- lameACM.inf
+- lame_acm.xml (where the initial configuration is stored)
diff --git a/ACM/resource.h b/ACM/resource.h
new file mode 100644
index 0000000..9052032
--- /dev/null
+++ b/ACM/resource.h
@@ -0,0 +1,42 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by acm.rc
+//
+#define IDI_ICON                        101
+#define IDD_CONFIG                      102
+#define IDD_ABOUT                       103
+#define IDC_STATIC_DECODING             1000
+#define IDC_CHECK_COPYRIGHT             1001
+#define IDC_CHECK_CHECKSUM              1002
+#define IDC_CHECK_ORIGINAL              1003
+#define IDC_CHECK_PRIVATE               1004
+#define IDC_COMBO_ENC_STEREO            1005
+#define IDC_CHECK_ENC_SMART             1006
+#define IDC_STATIC_ENC_ICON             1007
+#define IDC_STATIC_ABOUT_TITLE          1008
+#define IDC_STATIC_ABOUT_URL            1009
+#define IDC_STATIC_CONFIG_VERSION       1010
+#define IDC_CHECK_ENC_ABR               1011
+#define IDC_SLIDER_AVERAGE_MIN          1012
+#define IDC_SLIDER_AVERAGE_MAX          1013
+#define IDC_SLIDER_AVERAGE_STEP         1014
+#define IDC_SLIDER_AVERAGE_SAMPLE       1015
+#define IDC_STATIC_AVERAGE_MIN          1016
+#define IDC_STATIC_AVERAGE_MAX          1017
+#define IDC_STATIC_AVERAGE_STEP         1018
+#define IDC_STATIC_AVERAGE_SAMPLE       1019
+#define IDC_STATIC_AVERAGE_MIN_VALUE    1020
+#define IDC_STATIC_AVERAGE_MAX_VALUE    1021
+#define IDC_STATIC_AVERAGE_STEP_VALUE   1022
+#define IDC_STATIC_AVERAGE_SAMPLE_VALUE 1023
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        105
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1024
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/ACM/tinyxml/Makefile.am b/ACM/tinyxml/Makefile.am
new file mode 100644
index 0000000..e0bd660
--- /dev/null
+++ b/ACM/tinyxml/Makefile.am
@@ -0,0 +1,20 @@
+## $Id: Makefile.am,v 1.2 2005/08/21 17:32:08 bouvigne Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	Makefile.tinyxml \
+	changes.txt \
+	dox \
+	makedistlinux \
+	makedistwin.bat \
+	readme.txt \
+	test.dsp \
+	test.dsw \
+	tinyxml.cpp \
+	tinyxml.dsp \
+	tinyxml_vc7.vcproj \
+	tinyxml.h \
+	tinyxmlerror.cpp \
+	tinyxmlparser.cpp \
+	xmltest.cpp
diff --git a/ACM/tinyxml/Makefile.in b/ACM/tinyxml/Makefile.in
new file mode 100644
index 0000000..902a512
--- /dev/null
+++ b/ACM/tinyxml/Makefile.in
@@ -0,0 +1,372 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = ACM/tinyxml
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	Makefile.tinyxml \
+	changes.txt \
+	dox \
+	makedistlinux \
+	makedistwin.bat \
+	readme.txt \
+	test.dsp \
+	test.dsw \
+	tinyxml.cpp \
+	tinyxml.dsp \
+	tinyxml_vc7.vcproj \
+	tinyxml.h \
+	tinyxmlerror.cpp \
+	tinyxmlparser.cpp \
+	xmltest.cpp
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  ACM/tinyxml/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  ACM/tinyxml/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ACM/tinyxml/Makefile.tinyxml b/ACM/tinyxml/Makefile.tinyxml
new file mode 100644
index 0000000..58f4693
--- /dev/null
+++ b/ACM/tinyxml/Makefile.tinyxml
@@ -0,0 +1,150 @@
+#****************************************************************************
+#
+# Makefil for TinyXml test.
+# Lee Thomason
+# www.grinninglizard.com
+#
+# This is a GNU make (gmake) makefile
+#****************************************************************************
+
+# DEBUG can be set to YES to include debugging info, or NO otherwise
+DEBUG          := YES
+
+# PROFILE can be set to YES to include profiling info, or NO otherwise
+PROFILE        := NO
+
+#****************************************************************************
+
+CC     := gcc
+CXX    := g++
+LD     := g++
+AR     := ar rc
+RANLIB := ranlib
+
+DEBUG_CFLAGS     := -Wall -Wno-unknown-pragmas -Wno-format -g -DDEBUG
+RELEASE_CFLAGS   := -Wall -Wno-unknown-pragmas -Wno-format -O2
+
+LIBS		 :=
+
+DEBUG_CXXFLAGS   := ${DEBUG_CFLAGS} 
+RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}
+
+DEBUG_LDFLAGS    := -g
+RELEASE_LDFLAGS  :=
+
+ifeq (YES, ${DEBUG})
+   CFLAGS       := ${DEBUG_CFLAGS}
+   CXXFLAGS     := ${DEBUG_CXXFLAGS}
+   LDFLAGS      := ${DEBUG_LDFLAGS}
+else
+   CFLAGS       := ${RELEASE_CFLAGS}
+   CXXFLAGS     := ${RELEASE_CXXFLAGS}
+   LDFLAGS      := ${RELEASE_LDFLAGS}
+endif
+
+ifeq (YES, ${PROFILE})
+   CFLAGS   := ${CFLAGS} -pg
+   CXXFLAGS := ${CXXFLAGS} -pg
+   LDFLAGS  := ${LDFLAGS} -pg
+endif
+
+#****************************************************************************
+# Preprocessor directives
+#****************************************************************************
+
+ifeq (YES, ${PROFILE})
+  DEFS :=
+else
+  DEFS :=
+endif
+
+#****************************************************************************
+# Include paths
+#****************************************************************************
+
+#INCS := -I/usr/include/g++-2 -I/usr/local/include
+INCS :=
+
+
+#****************************************************************************
+# Makefile code common to all platforms
+#****************************************************************************
+
+CFLAGS   := ${CFLAGS}   ${DEFS}
+CXXFLAGS := ${CXXFLAGS} ${DEFS}
+
+#****************************************************************************
+# Targets of the build
+#****************************************************************************
+
+OUTPUT := xmltest
+
+all: ${OUTPUT}
+
+
+#****************************************************************************
+# Source files
+#****************************************************************************
+
+SRCS := tinyxml.cpp tinyxmlparser.cpp xmltest.cpp tinyxmlerror.cpp
+
+# Add on the sources for libraries
+SRCS := ${SRCS}
+
+OBJS := $(addsuffix .o,$(basename ${SRCS}))
+
+#****************************************************************************
+# Output
+#****************************************************************************
+
+${OUTPUT}: ${OBJS}
+	${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS}
+
+#****************************************************************************
+# common rules
+#****************************************************************************
+
+# Rules for compiling source files to object files
+%.o : %.cpp
+	${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@
+
+%.o : %.c
+	${CC} -c ${CFLAGS} ${INCS} $< -o $@
+
+clean:
+	-rm -f core ${OBJS} ${OUTPUT}
+
+depend:
+	makedepend ${INCS} ${SRCS}
+# DO NOT DELETE
+
+tinyxml.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h
+tinyxml.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+tinyxml.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
+tinyxml.o: /usr/include/bits/sched.h /usr/include/libio.h
+tinyxml.o: /usr/include/_G_config.h /usr/include/wchar.h
+tinyxml.o: /usr/include/bits/wchar.h /usr/include/gconv.h
+tinyxml.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h
+tinyxmlparser.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h
+tinyxmlparser.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+tinyxmlparser.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
+tinyxmlparser.o: /usr/include/bits/sched.h /usr/include/libio.h
+tinyxmlparser.o: /usr/include/_G_config.h /usr/include/wchar.h
+tinyxmlparser.o: /usr/include/bits/wchar.h /usr/include/gconv.h
+tinyxmlparser.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h
+tinyxmlparser.o: /usr/include/ctype.h /usr/include/endian.h
+tinyxmlparser.o: /usr/include/bits/endian.h
+xmltest.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h
+xmltest.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+xmltest.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
+xmltest.o: /usr/include/bits/sched.h /usr/include/libio.h
+xmltest.o: /usr/include/_G_config.h /usr/include/wchar.h
+xmltest.o: /usr/include/bits/wchar.h /usr/include/gconv.h
+xmltest.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h
+tinyxmlerror.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h
+tinyxmlerror.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+tinyxmlerror.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
+tinyxmlerror.o: /usr/include/bits/sched.h /usr/include/libio.h
+tinyxmlerror.o: /usr/include/_G_config.h /usr/include/wchar.h
+tinyxmlerror.o: /usr/include/bits/wchar.h /usr/include/gconv.h
+tinyxmlerror.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h
diff --git a/ACM/tinyxml/changes.txt b/ACM/tinyxml/changes.txt
new file mode 100644
index 0000000..c0b4cf7
--- /dev/null
+++ b/ACM/tinyxml/changes.txt
@@ -0,0 +1,81 @@
+Changes in version 1.0.1:
+- Fixed comment tags which were outputing as '<?--' instead of 
+  the correct '<!--'.
+- Implemented the Next and Prev methods of the TiXmlAttribute class.
+- Renamed 'LastAttribtute' to 'LastAttribute'
+- Fixed bad pointer to 'isspace' that could occur while parsing text.
+- Errors finding beginning and end of tags no longer throw it into an
+  infinite loop. (Hopefully.)
+
+Changes in version 1.0.2
+- Minor documentation fixes.
+
+Changes in version 1.0.3
+- After nodes are added to a document, they return a pointer
+  to the new node instead of a bool for success.
+- Elements can be constructed with a value, which is the
+  element name. Every element must have a value or it will be
+  invalid, but the code changes to enforce this are not fully
+  in place.
+
+Changes in version 1.1.0
+- Added the	TiXmlAttributeSet class to pull the attributes into
+  a seperate container.
+- Moved the doubly liked list out of XmlBase. Now XmlBase only
+  requires the Print() function and defines some utility functions.
+- Moved errors into a seperate file. (With the idea of internationalization
+  to the other latin-1 languages.)
+- Added the "NodeType"
+- Fixed white space parsing in text to conform with the standard. 
+  Basically, all white space becomes just one space.
+- Added the TiXmlDeclaration class to read xml declarations.
+
+Changes in version 1.2.0
+- Removed the factory. The factory was not really in the spirit 
+  of small and simple, confused the code, and was of limited value.
+- Added FirstChildElement and NextSiblingElement, because they
+  are such common functions.
+- Re-wrote the example to test and demonstrate more functionality.
+
+Changes in version 1.2.1
+- Fixed a bug where comments couldn't be inside elements.
+- Loading now clears out existing XML rather than appending.
+- Added the "Clear" method on a node to delete all its children.
+
+Changes in version 1.2.2
+- Fixed TiXmlAttribute::Previous actually returning "next." Thanks
+  to Rickard Troedsson for the bug fix.
+
+Changes in version 1.2.3
+- Added the TIXML prefix to the error strings to resolve conflicts
+  with #defines in OS headers. Thanks to Steve Lhomme.
+- Fixed a delete buf that should be a delete [] buf. 
+  Thanks to Ephi Sinowitz.
+
+Changes in version 1.2.4
+- ReplaceChild() was almost guarenteed to fail. Should be fixed,
+  thanks to Joe Smith. Joe also pointed out that the Print() functions
+  should take stream references: I agree, and would like to overload
+  the Print() method to take either format, but I don't want to do 
+  this in a dot release.
+- Some compilers seem to need an extra <ctype.h> include. Thanks
+  to Steve Lhomme for that.
+
+Changes in version 2.0.0
+- Made the ToXXX() casts safe if 'this' is null. 
+  When "LoadFile" is called with a filename, the value will correctly get set.
+  Thanks to Brian Yoder.
+- Fixed bug where isalpha() and isalnum() would get called with a negative value for 
+  high ascii numbers. Thanks to Alesky Aksenov.
+- Fixed some errors codes that were not getting set.
+- Made methods "const" that were not.
+- Added a switch to enable or disable the ignoring of white space. ( TiXmlDocument::SetIgnoreWhiteSpace() )
+- Greater standardization and code re-use in the parser.
+- Added a stream out operator.
+- Added a stream in operator.
+- Entity support.
+
+TODO
+CDATA.
+Support for "generic entity" #xxx thing.
+
diff --git a/ACM/tinyxml/dox b/ACM/tinyxml/dox
new file mode 100644
index 0000000..f431877
--- /dev/null
+++ b/ACM/tinyxml/dox
@@ -0,0 +1,708 @@
+# Doxyfile 1.2.2
+
+# This file describes the settings to be used by doxygen for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project. 
+
+PROJECT_NAME           = TinyXml
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = ./docs
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, 
+# Korean, Hungarian, Spanish, Romanian, Russian, Croatian, Polish, and 
+# Portuguese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES 
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation. 
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation. 
+
+EXTRACT_STATIC         = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled. 
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled. 
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this. 
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed. 
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description. 
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used. 
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation. 
+
+INTERNAL_DOCS          = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a class diagram (in Html and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. 
+
+CLASS_DIAGRAMS         = YES
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation. 
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible. 
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden. 
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this. 
+
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file. 
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the Javadoc-style will 
+# behave just like the Qt-style comments. 
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements. 
+
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members. 
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order. 
+
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments. 
+
+TAB_SIZE               = 4
+
+# The ENABLE_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif. 
+
+ENABLED_SECTIONS       = 
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines. 
+
+ALIASES                = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used. 
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used. 
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled. 
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. 
+
+WARN_FORMAT            = "$file:$line: $text"
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces. 
+
+INPUT                  = . "readme.txt"
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included. 
+
+FILE_PATTERNS          = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used. 
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag. 
+
+EXCLUDE                = 
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. 
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command). 
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included. 
+
+EXAMPLE_PATTERNS       = 
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command). 
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output. 
+
+INPUT_FILTER           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces. 
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20]) 
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers. 
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output. 
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path. 
+
+HTML_OUTPUT            = .
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet 
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used. 
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation. 
+
+GENERATE_HTMLHELP      = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it. 
+
+DISABLE_INDEX          = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output. 
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path. 
+
+LATEX_OUTPUT           = latex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general. 
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used. 
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output. 
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing! 
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer. 
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation. 
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML. 
+
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path. 
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general. 
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using a WORD or other. 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links. 
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value. 
+
+RTF_STYLESHEET_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages 
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path. 
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3) 
+
+MAN_EXTENSION          = .3
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Warning: This feature 
+# is still experimental and very incomplete.
+
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files. 
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES. 
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags. 
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found. 
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor. 
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used. 
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. 
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition. 
+
+EXPAND_AS_DEFINED      = 
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles. 
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads. 
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed. 
+
+ALLEXTERNALS           = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl'). 
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default) 
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes. 
+
+COLLABORATION_GRAPH    = YES
+
+# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to 
+# YES then doxygen will generate a graph for each documented file showing 
+# the direct and indirect include dependencies of the file with other 
+# documented files. 
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to 
+# YES then doxygen will generate a graph for each documented header file showing 
+# the documented files that directly or indirectly include this file 
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one. 
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path. 
+
+DOT_PATH               = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images. 
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images. 
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored. 
+
+SEARCHENGINE           = NO
+
+# The CGI_NAME tag should be the name of the CGI script that 
+# starts the search engine (doxysearch) with the correct parameters. 
+# A script with this name will be generated by doxygen. 
+
+CGI_NAME               = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the 
+# cgi binaries are located. See the documentation of your http daemon for 
+# details. 
+
+CGI_URL                = 
+
+# The DOC_URL tag should be the absolute URL to the directory where the 
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used. 
+
+DOC_URL                = 
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the 
+# documentation is located. If left blank the directory on the local machine 
+# will be used. 
+
+DOC_ABSPATH            = 
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
+# is installed. 
+
+BIN_ABSPATH            = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search 
+# the documentation for these projects as well. 
+
+EXT_DOC_PATHS          = 
diff --git a/ACM/tinyxml/makedistlinux b/ACM/tinyxml/makedistlinux
new file mode 100644
index 0000000..eaff150
--- /dev/null
+++ b/ACM/tinyxml/makedistlinux
@@ -0,0 +1,34 @@
+echo "Making version: "
+echo $1 
+echo $2 
+echo $3
+
+rm ./docs/*
+
+doxygen dox
+rm -rf ./tinyxml/*
+
+rm tinyxml_$1_$2_$3.zip
+rm tinyxml_$1_$2_$3.tar.gz
+
+rmdir tinyxml
+mkdir tinyxml
+
+cp readme.txt ./tinyxml
+cp changes.txt ./tinyxml
+cp Makefile ./tinyxml
+
+cp tinyxml.cpp tinyxml
+cp tinyxmlerror.cpp tinyxml
+cp tinyxmlparser.cpp tinyxml
+cp xmltest.cpp tinyxml
+
+cp tinyxml.h tinyxml
+cp tinyxml.dsp tinyxml
+
+mkdir ./tinyxml/docs
+cp ./docs/* ./tinyxml/docs
+
+tar -zcf tinyxml_$1_$2_$3.tar.gz tinyxml
+zip -r -q -9 tinyxml_$1_$2_$3.zip   tinyxml
+
diff --git a/ACM/tinyxml/makedistwin.bat b/ACM/tinyxml/makedistwin.bat
new file mode 100755
index 0000000..99a7b11
--- /dev/null
+++ b/ACM/tinyxml/makedistwin.bat
@@ -0,0 +1,19 @@
+del .\tinyxml_win\*.*
+del .\docs\*.*
+
+doxygen dox
+mkdir tinyxml_win
+
+copy readme.txt tinyxml_win
+copy changes.txt tinyxml_win
+
+copy *.cpp tinyxml_win
+copy *.h tinyxml_win
+copy *.dsp tinyxml_win
+copy test0.xml tinyxml_win
+copy test1.xml tinyxml_win
+copy test2.xml tinyxml_win
+
+mkdir .\tinyxml_win\docs
+copy docs .\tinyxml_win\docs
+
diff --git a/ACM/tinyxml/readme.txt b/ACM/tinyxml/readme.txt
new file mode 100644
index 0000000..c98c0f3
--- /dev/null
+++ b/ACM/tinyxml/readme.txt
@@ -0,0 +1,309 @@
+/** @mainpage
+
+<h1> TinyXml </h1>
+
+TinyXml is a simple, small, C++ XML parser that can be easily 
+integrating into other programs.
+
+
+<h2> What it does. </h2>
+	
+In brief, TinyXml parses an XML document, and builds from that a 
+Document Object Model that can be read, modified, and saved.
+
+XML stands for "eXtensible Markup Language." It allows you to create 
+your own document markups. Where HTML does a very good job of marking 
+documents for browsers, XML allows you to define any kind of document 
+markup, for example a document that describes a "to do" list for an 
+organizer application. XML is a very structured and convenient format.
+All those random file formats created to store application data can 
+all be replaced with XML. One parser for everything.
+
+There are different ways to access and interact with XML data.
+TinyXml uses a Document Object Model, meaning the XML data is parsed
+into a tree objects that can be browsed and manipulated, and then 
+written back to disk. You can also construct an XML document from 
+scratch with C++ objects and write this to disk.
+
+TinyXml is designed to be easy and fast. It is one header and three cpp 
+files. Simply add these to your project and off you go. There is an 
+example to get you started. It is released under the ZLib license, 
+so you can use it in open source or commercial code.
+
+It attempts to be a flexible parser, but with truly correct and 
+compliant XML output (with the exception of the character set,
+below.) TinyXml should compile on any reasonably C++ 
+system. It does not rely on exceptions or RTTI, and only uses the STL
+string class.
+
+
+<h2> What it doesn't do. </h2>
+
+It doesn’t parse or use DTDs (Document Type Definitions) or XSL’s 
+(eXtensible Stylesheet Language.) It is limited to the ASCII 
+character set. There are other parsers out there (check out 
+www.sourceforge.org, search for XML) that are much more fully 
+featured. But they are also much bigger, take longer to set up in 
+your project, have a higher learning curve, and often have a more 
+restrictive license. If you are working with browsers or have more 
+complete XML needs, TinyXml is not the parser for you. 
+
+
+<h2> Code Status.  </h2>
+
+Currently in use, TinyXml is looking pretty stable. If you find
+bugs, send them in and we'll get them straightened out as soon as possible.
+
+There are some areas of improvement; please check sourceforge if you are 
+interested in working on TinxXml.
+
+
+<h2> Changes between version 1 and 2 </h2>
+
+
+<h3> Entities </h3>
+TinyXml recognizes the pre-defined "entity references", meaning special 
+characters. Namely:
+
+@verbatim
+	&amp;	&
+	&lt;	<
+	&gt;	>
+	&quot;	"
+	&apos;	‘
+@endverbatim
+
+These are recognized when the XML document is read, and translated to there
+ASCII equivalents. For instance, text with the XML of:
+
+@verbatim
+	Far &amp; Away
+@endverbatim
+
+will have the Value() of "Far & Away" when queried from the TiXmlText object, 
+but will be written back to the XML stream/file as an entitity.
+
+TiXml will ignore unknown entities and the 
+@verbatim
+"&#x"
+@endverbatim
+entities, and leave them unprocessed.
+
+
+<h3> Streams </h3>
+TiXml has been modified to support both C (FILE) and C++ (operator <<,>>) 
+streams. There are some differences that you may need to be aware of.
+
+C style output:
+	- based on FILE*
+	- the Print() and SaveFile() methods
+
+	Generates formatted output, with plenty of white space, intended to be as 
+	human-readable as possible. They are very fast, and tolerant of ill formed 
+	XML documents. For example, an XML document that contains 2 root elements 
+	and 2 declarations, will print.
+
+C style input:
+	- based on FILE*
+	- the Parse() and LoadFile() methods
+
+	A fast, tolerant read. Use whenever you don't need the C++ streams.
+
+C++ style ouput:
+	- based on std::ostream
+	- operator<<
+
+	Generates condensed output, intended for network transmission rather than
+	readability. Depending on your system's implementation of the ostream class,
+	these may be somewhat slower. (Or may not.) Not tolerant of ill formed XML:
+	a document should contain the correct one root element. Additional root level
+	elements will not be streamed out.
+
+C++ style input:
+	- based on std::istream
+	- operator>>
+
+	Reads XML from a stream, making it useful for network transmission. The tricky
+	part is knowing when the XML document is complete, since there will almost
+	certainly be other data in the stream. TinyXml will assume the XML data is
+	complete after it reads the root element. Also not that operator>> is somewhat
+	slower than Parse, due to both implementation of the STL and limitations of
+	TinyXml.
+
+<h3> White space </h3>
+The world simply does not agree on whether white space should be kept, or condensed.
+For example, pretend the '_' is a space, and look at "Hello____world". HTML, and 
+at least some XML parsers, will interpret this as "Hello_world". They condense white
+space. Some XML parsers do not, and will leave it as "Hello____world". (Remember
+to keep pretending the _ is a space.)
+
+It's an issue that hasn't been resolved to my satisfaction. TinyXml supports both
+motifs. Call TiXmlBase::SetCondenseWhiteSpace( bool ) to set the desired behavior.
+The default is to condense white space.
+
+If you change the default, you should call TiXmlBase::SetCondenseWhiteSpace( bool )
+before making any calls to Parse XML data, and I don't recommend changing it after
+it has been set.
+
+
+<h2> Using and Installing </h2>
+
+To Compile and Run xmltest:
+
+A Linux Makefile and a Windows Visual C++ .dsp file is provided. 
+Simply compile and run. It will write the file demotest.xml to your 
+disk and generate output on the screen. It also tests walking the
+DOM by printing out the number of nodes found using different 
+techniques.
+
+The Linux makefile is very generic and will
+probably run on other systems, but is only tested on Linux. You no
+longer need to run 'make depend'. The dependecies have been
+hard coded.
+
+
+To Use in an Application:
+
+Add tinyxml.cpp, tinyxml.h, tinyxmlerror.cpp, and tinyxmlparser.cpp to your 
+project or make file. That's it! It should compile on any reasonably
+compliant C++ system. You do not need to enable exceptions or
+RTTI for TinyXml.
+
+
+<h2> Where it may go.  </h2>
+
+At this point, I'm focusing on tightening up remaining issues.
+Bug fixes (though comfortably rare) and minor interface 
+corrections. 
+
+There are some "it would be nice if..." items. I'll keep those
+posted as tasks on SourceForge. (www.sourceforge.net/projects/tinyxml)
+
+
+<h2> How TinyXml works.  </h2>
+
+An example is probably the best way to go. Take:
+@verbatim
+	<?xml version="1.0" standalone=‘no’>
+	<?-- Our to do list data -->
+	<ToDo>
+		<Item priority="1"> Go to the <bold>Toy store!</bold></Item>
+		<Item priority="2"> Do bills</Item>
+	</ToDo>
+@endverbatim
+
+It’s not much of a To Do list, but it will do. To read this file 
+(say "demo.xml") you would create a document, and parse it in:
+@verbatim
+	TiXmlDocument doc( "demo.xml" );
+	doc.LoadFile();
+@endverbatim
+
+And it’s ready to go. Now let’s look at some lines and how they 
+relate to the DOM.
+
+<?xml version="1.0" standalone=‘no’>
+
+	The first line is a declaration, and gets turned into the
+	TiXmlDeclaration class. It will be the first child of the
+	document node.
+	
+	This is the only directive/special tag parsed by by TinyXml.
+	Generally directive targs are stored in TiXmlUnknown so the 
+	commands won’t be lost when it is saved back to disk.
+
+<?-- Our to do list data -->
+
+	A comment. Will become a TiXmlComment object.
+
+<ToDo>
+
+	The ToDo tag defines a TiXmlElement object. This one does not have 
+	any attributes, but will contain 2 other elements, both of which 
+	are items.
+
+<Item priority="1"> 
+
+	Creates another TiXmlElement which is a child of the "ToDo" element. 
+	This element has 1 attribute, with the name ‘priority’ and the value 
+	‘1’.
+
+Go to the 
+
+	A TiXmlText. This is a leaf node and cannot contain other nodes. 
+	It is a child of the ‘Item" Element.
+
+<bold>
+	
+	Another TiXmlElement, this one a child of the "Item" element.
+
+Etc.
+
+Looking at the entire object tree, you end up with:
+@verbatim
+TiXmlDocument				"demo.xml"
+	TiXmlDeclaration		"version='1.0'" "standalone=‘no’"
+	TiXmlComment			" Our to do list data"
+	TiXmlElement			"ToDo"
+		TiXmlElement		"Item"		Attribtutes: priority = 1
+			TiXmlText		"Go to the "
+			TiXmlElement    "bold"
+				TiXmlText	"Toy store!"
+	TiXmlElement			"Item"		Attributes: priority=2
+		TiXmlText			"bills"
+@endverbatim
+
+<h2> Contributors </h2>
+
+Thanks very much to everyone who sends suggestions, bugs, ideas, and 
+encouragement. It all helps, and makes this project fun. A special thanks
+to the contributors on the web pages that keep it lively.
+
+So many people have sent in bugs and ideas, that rather than list here I
+try to give credit due in the "changes.txt" file.
+
+<h2> Documentation </h2>
+
+The documentation is build with Doxygen, using the 'dox' 
+configuration file.
+
+<h2> License </h2>
+
+TinyXml is released under the zlib license:
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this 
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and 
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+
+<h2> References  </h2>
+
+The World Wide Web Consortium is the definitive standard body for 
+XML, and there web pages contain huge amounts of information. I also 
+recommend "XML Pocket Reference" by Robert Eckstein and published by 
+O’Reilly.
+
+<h2> Contact Me: </h2>
+
+I’d appreciates your suggestions, and would love to know if you 
+use TinyXml. I hope you enjoy it and find it useful. Please post
+questions, comments, file bugs, or contact me at:
+
+www.sourceforge.net/projects/tinyxml
+
+Lee Thomason
+*/
diff --git a/ACM/tinyxml/test.dsp b/ACM/tinyxml/test.dsp
new file mode 100644
index 0000000..ec6445f
--- /dev/null
+++ b/ACM/tinyxml/test.dsp
@@ -0,0 +1,95 @@
+# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 5.00

+# ** DO NOT EDIT **

+

+# TARGTYPE "Win32 (x86) Console Application" 0x0103

+

+CFG=test - Win32 Debug

+!MESSAGE This is not a valid makefile. To build this project using NMAKE,

+!MESSAGE use the Export Makefile command and run

+!MESSAGE 

+!MESSAGE NMAKE /f "test.mak".

+!MESSAGE 

+!MESSAGE You can specify a configuration when running NMAKE

+!MESSAGE by defining the macro CFG on the command line. For example:

+!MESSAGE 

+!MESSAGE NMAKE /f "test.mak" CFG="test - Win32 Debug"

+!MESSAGE 

+!MESSAGE Possible choices for configuration are:

+!MESSAGE 

+!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Console Application")

+!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Console Application")

+!MESSAGE 

+

+# Begin Project

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "test - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "Release"

+# PROP Intermediate_Dir "Release"

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD BASE RSC /l 0x40c /d "NDEBUG"

+# ADD RSC /l 0x40c /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386

+

+!ELSEIF  "$(CFG)" == "test - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "test___W"

+# PROP BASE Intermediate_Dir "test___W"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "test___W"

+# PROP Intermediate_Dir "test___W"

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD BASE RSC /l 0x40c /d "_DEBUG"

+# ADD RSC /l 0x40c /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept

+

+!ENDIF 

+

+# Begin Target

+

+# Name "test - Win32 Release"

+# Name "test - Win32 Debug"

+# Begin Source File

+

+SOURCE=.\demotest.xml

+# End Source File

+# Begin Source File

+

+SOURCE=.\smalltest.xml

+# End Source File

+# Begin Source File

+

+SOURCE=.\xmltest.cpp

+# End Source File

+# End Target

+# End Project

diff --git a/ACM/tinyxml/test.dsw b/ACM/tinyxml/test.dsw
new file mode 100644
index 0000000..46bd976
--- /dev/null
+++ b/ACM/tinyxml/test.dsw
@@ -0,0 +1,44 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00

+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!

+

+###############################################################################

+

+Project: "test"=.\test.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name tinyxml

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "tinyxml"=.\tinyxml.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Global:

+

+Package=<5>

+{{{

+}}}

+

+Package=<3>

+{{{

+}}}

+

+###############################################################################

+

diff --git a/ACM/tinyxml/tinyxml.cpp b/ACM/tinyxml/tinyxml.cpp
new file mode 100644
index 0000000..981131e
--- /dev/null
+++ b/ACM/tinyxml/tinyxml.cpp
@@ -0,0 +1,1007 @@
+/*
+Copyright (c) 2000 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include "tinyxml.h"
+using namespace std;
+
+
+bool TiXmlBase::condenseWhiteSpace = true;
+
+
+void TiXmlBase::PutString( const std::string& str, std::ostream* stream )
+{
+	// Scan for the all important '&'
+	unsigned int i=0, j=0;
+
+	while ( i < str.length() )
+	{
+		unsigned next = str.find( '&', i );
+
+		if ( next == string::npos )
+		{
+			stream->write( &str.at( i ), str.length() - i );
+			return;
+   		}
+
+		// We found an entity.
+		if ( next - i > 0 )
+			stream->write( &str.at( i ), next - i );
+		i = next;
+
+		// Check for the special "&#x" entitity
+		if (    i < str.length() - 2
+		     && str[i] == '&'
+			 && str[i+1] == '#'
+			 && str[i+2] == 'x' )
+		{
+			stream->put( str[i] );
+		}
+		else
+		{
+			for ( j=0; j<NUM_ENTITY; ++j )
+			{
+				if ( str[i] == entity[j].chr )
+				{
+					stream->write( entity[j].str, entity[j].strLength );
+					break;
+				}
+			}
+			if ( j == NUM_ENTITY )
+			{
+				stream->put( str[i] );
+			}
+		}
+		++i;
+	}
+}
+
+
+TiXmlNode::TiXmlNode( NodeType _type )
+{
+	parent = 0;
+	type = _type;
+	firstChild = 0;
+	lastChild = 0;
+	prev = 0;
+	next = 0;
+}
+
+
+TiXmlNode::~TiXmlNode()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}	
+}
+
+
+void TiXmlNode::Clear()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}	
+
+	firstChild = 0;
+	lastChild = 0;
+}
+
+
+TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
+{
+	node->parent = this;
+	
+	node->prev = lastChild;
+	node->next = 0;
+
+	if ( lastChild )
+		lastChild->next = node;
+	else
+		firstChild = node;			// it was an empty list.
+
+	lastChild = node;
+	return node;
+}
+	
+
+TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
+{
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+
+	return LinkEndChild( node );
+}
+
+
+TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
+{
+	if ( beforeThis->parent != this )
+		return 0;
+	
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+	
+	node->next = beforeThis;
+	node->prev = beforeThis->prev;
+	beforeThis->prev->next = node;
+	beforeThis->prev = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
+{
+	if ( afterThis->parent != this )
+		return 0;
+	
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+	
+	node->prev = afterThis;
+	node->next = afterThis->next;
+	afterThis->next->prev = node;
+	afterThis->next = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
+{
+	if ( replaceThis->parent != this )
+		return 0;
+	
+	TiXmlNode* node = withThis.Clone();
+	if ( !node )
+		return 0;
+
+	node->next = replaceThis->next;
+	node->prev = replaceThis->prev;
+
+	if ( replaceThis->next )
+		replaceThis->next->prev = node;
+	else
+		lastChild = node;
+
+	if ( replaceThis->prev )
+		replaceThis->prev->next = node;
+	else
+		firstChild = node;
+
+	delete replaceThis;
+	node->parent = this;
+	return node;
+}
+
+
+bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
+{
+	if ( removeThis->parent != this )
+	{	
+		assert( 0 );
+		return false;
+	}
+	
+	if ( removeThis->next )
+		removeThis->next->prev = removeThis->prev;
+	else
+		lastChild = removeThis->prev;
+
+	if ( removeThis->prev )
+		removeThis->prev->next = removeThis->next;
+	else
+		firstChild = removeThis->next;
+
+	delete removeThis;
+	return true;
+}
+
+
+TiXmlNode* TiXmlNode::FirstChild( const std::string& value ) const
+{
+	TiXmlNode* node;
+	for ( node = firstChild; node; node = node->next )
+	{
+		if ( node->Value() == value )
+			return node;
+	}
+	return 0;
+}
+
+
+TiXmlNode* TiXmlNode::LastChild( const std::string& value ) const
+{
+	TiXmlNode* node;
+	for ( node = lastChild; node; node = node->prev )
+	{
+		if ( node->Value() == value )
+			return node;
+	}
+	return 0;
+}
+
+
+TiXmlNode* TiXmlNode::IterateChildren( TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild();
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling();
+	}
+}
+
+
+TiXmlNode* TiXmlNode::IterateChildren( const std::string& val, TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild( val );
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling( val );
+	}
+}
+
+
+TiXmlNode* TiXmlNode::NextSibling( const std::string& value ) const
+{
+	TiXmlNode* node;
+	for ( node = next; node; node = node->next )
+	{
+		if ( node->Value() == value )
+			return node;
+	}
+	return 0;
+}
+
+
+TiXmlNode* TiXmlNode::PreviousSibling( const std::string& value ) const
+{
+	TiXmlNode* node;
+	for ( node = prev; node; node = node->prev )
+	{
+		if ( node->Value() == value )
+			return node;
+	}
+	return 0;
+}
+
+
+void TiXmlElement::RemoveAttribute( const std::string& name )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+
+TiXmlElement* TiXmlNode::FirstChildElement() const
+{
+	TiXmlNode* node;
+
+	for (	node = FirstChild();
+			node;
+			node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+TiXmlElement* TiXmlNode::FirstChildElement( const std::string& value ) const
+{
+	TiXmlNode* node;
+
+	for (	node = FirstChild( value );
+			node;
+			node = node->NextSibling( value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+TiXmlElement* TiXmlNode::NextSiblingElement() const
+{
+	TiXmlNode* node;
+
+	for (	node = NextSibling();
+			node;
+			node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+TiXmlElement* TiXmlNode::NextSiblingElement( const std::string& value ) const
+{
+	TiXmlNode* node;
+
+	for (	node = NextSibling( value );
+			node;
+			node = node->NextSibling( value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+
+TiXmlDocument* TiXmlNode::GetDocument() const
+{
+	const TiXmlNode* node;
+
+	for( node = this; node; node = node->parent )
+	{
+		if ( node->ToDocument() )
+			return node->ToDocument();
+	}
+	return 0;
+}
+
+
+// TiXmlElement::TiXmlElement() 
+// 	: TiXmlNode( TiXmlNode::ELEMENT )
+// {
+// }
+
+TiXmlElement::TiXmlElement( const std::string& _value ) 
+	: TiXmlNode( TiXmlNode::ELEMENT )
+{
+	firstChild = lastChild = 0;
+	value = _value;
+}
+
+TiXmlElement::~TiXmlElement()
+{
+	while( attributeSet.First() )
+	{
+		TiXmlAttribute* node = attributeSet.First();
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+const std::string* TiXmlElement::Attribute( const std::string& name ) const
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+
+	if ( node )
+		return &(node->Value() );
+
+	return 0;
+}
+
+
+const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const
+{
+	const std::string* s = Attribute( name );
+	if ( s )
+		*i = atoi( s->c_str() );
+	else
+		*i = 0;
+	return s;
+}
+
+
+void TiXmlElement::SetAttribute( const std::string& name, int val )
+{	
+	char buf[64];
+	sprintf( buf, "%d", val );
+
+	std::string v = buf;
+
+	SetAttribute( name, v );
+}
+
+
+void TiXmlElement::SetAttribute( const std::string& name, const std::string& value )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		node->SetValue( value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( name, value );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+}
+
+
+void TiXmlElement::Print( FILE* cfile, int depth ) const
+{
+	int i;
+	for ( i=0; i<depth; i++ )
+	{
+		fprintf( cfile, "    " );
+	}
+
+	fprintf( cfile, "<%s", value.c_str() );
+
+	TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{
+		fprintf( cfile, " " );
+		attrib->Print( cfile, depth );
+	}
+
+	// There are 3 different formatting approaches:
+	// 1) An element without children is printed as a <foo /> node
+	// 2) An element with only a text child is printed as <foo> text </foo>
+	// 3) An element with children is printed on multiple lines.
+	TiXmlNode* node;
+	if ( !firstChild )
+	{
+		fprintf( cfile, " />" );
+  	}
+	else if ( firstChild == lastChild && firstChild->ToText() )
+	{
+		fprintf( cfile, ">" );
+		firstChild->Print( cfile, depth + 1 );
+		fprintf( cfile, "</%s>", value.c_str() );
+  	}
+	else
+	{
+		fprintf( cfile, ">" );
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+	 		if ( !node->ToText() )
+			{
+				fprintf( cfile, "\n" );
+			}
+			node->Print( cfile, depth+1 );
+		}
+		fprintf( cfile, "\n" );
+		for( i=0; i<depth; ++i )
+			fprintf( cfile, "    " );
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+}
+
+
+void TiXmlElement::StreamOut( std::ostream* stream ) const
+{
+	(*stream) << "<" << value;
+
+	TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{	
+		(*stream) << " ";
+		attrib->StreamOut( stream );
+	}
+
+	// If this node has children, give it a closing tag. Else
+	// make it an empty tag.
+	TiXmlNode* node;
+	if ( firstChild )
+	{ 		
+		(*stream) << ">";
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+			node->StreamOut( stream );
+		}
+		(*stream) << "</" << value << ">";
+	}
+	else
+	{
+		(*stream) << " />";
+	}
+}
+
+
+TiXmlNode* TiXmlElement::Clone() const
+{
+	TiXmlElement* clone = new TiXmlElement( Value() );
+
+	if ( !clone )
+		return 0;
+	
+	CopyToClone( clone );
+
+	// Clone the attributes, then clone the children.
+	TiXmlAttribute* attribute = 0;
+	for(	attribute = attributeSet.First(); 
+			attribute; 
+			attribute = attribute->Next() )
+	{
+		clone->SetAttribute( attribute->Name(), attribute->Value() );
+	}
+	
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		clone->LinkEndChild( node->Clone() );
+	}
+	return clone;
+}
+
+
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	error = false;
+//	ignoreWhiteSpace = true;
+}
+
+
+TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+//	ignoreWhiteSpace = true;
+	value = documentName;
+	error = false;
+}
+
+
+bool TiXmlDocument::LoadFile()
+{
+	return LoadFile( value );
+}
+
+
+bool TiXmlDocument::SaveFile() const
+{
+ 	return SaveFile( value );
+}
+
+
+bool TiXmlDocument::LoadFile( const std::string& filename )
+{	
+	// Delete the existing data:
+	Clear();
+	value = filename;
+	
+	FILE* file = fopen( filename.c_str(), "r" );
+
+	if ( file )
+	{
+		// Get the file size, so we can pre-allocate the string. HUGE speed impact.
+		long length = 0;
+		fseek( file, 0, SEEK_END );
+		length = ftell( file );
+		fseek( file, 0, SEEK_SET );
+
+		// If we have a file, assume it is all one big XML file, and read it in.
+		// The document parser may decide the document ends sooner than the entire file, however.
+		std::string data;
+		data.reserve( length );
+
+		const int BUF_SIZE = 2048;
+		char buf[BUF_SIZE];
+
+		while( fgets( buf, BUF_SIZE, file ) )
+		{
+			data += buf;
+		}
+		fclose( file );
+
+		Parse( data.c_str() );
+		if (  !Error() )
+		{
+			return true;
+		}
+	}
+	SetError( TIXML_ERROR_OPENING_FILE );
+	return false;
+}
+
+
+bool TiXmlDocument::SaveFile( const std::string& filename ) const
+{
+	// The old c stuff lives on...
+	FILE* fp = fopen( filename.c_str(), "w" );
+	if ( fp )
+	{
+		Print( fp, 0 );
+		fclose( fp );
+		return true;
+	}
+	return false;
+}
+
+
+TiXmlNode* TiXmlDocument::Clone() const
+{
+	TiXmlDocument* clone = new TiXmlDocument();
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	clone->error = error;
+	clone->errorDesc = errorDesc;
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		clone->LinkEndChild( node->Clone() );
+	}
+	return clone;
+}
+
+
+void TiXmlDocument::Print( FILE* cfile, int depth ) const
+{
+	TiXmlNode* node;
+	for ( node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->Print( cfile, depth );
+		fprintf( cfile, "\n" );
+	}
+}
+
+
+void TiXmlDocument::StreamOut( std::ostream* out ) const
+{
+	TiXmlNode* node;
+	for ( node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->StreamOut( out );
+
+		// Special rule for streams: stop after the root element.
+		// The stream in code will only read one element, so don't 
+		// write more than one.
+		if ( node->ToElement() )
+			break;
+	}
+}
+
+
+TiXmlAttribute* TiXmlAttribute::Next() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( next->value.empty() && next->name.empty() )
+		return 0;
+	return next;
+}
+
+
+TiXmlAttribute* TiXmlAttribute::Previous() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( prev->value.empty() && prev->name.empty() )
+		return 0;
+	return prev;
+}
+
+
+void TiXmlAttribute::Print( FILE* cfile, int /*depth*/ ) const
+{
+	ostringstream stream( ostringstream::out );
+	stream.str().reserve( 500 );
+	
+	StreamOut( &stream );
+	fprintf( cfile, "%s", stream.str().c_str() );
+}
+
+
+void TiXmlAttribute::StreamOut( std::ostream* stream ) const
+{
+	if ( value.find( '\"' ) != std::string::npos )
+	{
+		PutString( name, stream );
+		(*stream) << "=" << "'";
+		PutString( value, stream );
+		(*stream) << "'";
+	}
+	else
+	{
+		PutString( name, stream );
+		(*stream) << "=" << "\"";
+		PutString( value, stream );
+		(*stream) << "\"";
+	}
+}
+
+
+void TiXmlAttribute::SetIntValue( int value )
+{
+	std::string s;
+	std::ostringstream stream( s );
+	stream << value;
+	SetValue( stream.str() );
+}
+
+
+void TiXmlAttribute::SetDoubleValue( double value )
+{
+	std::string s;
+	std::ostringstream stream( s );
+	stream << value;
+	SetValue( stream.str() );
+}
+
+
+const int TiXmlAttribute::IntValue() const
+{
+	int v;
+	std::istringstream string( value );
+	string >> v;
+	return v;
+}
+
+
+const double  TiXmlAttribute::DoubleValue() const
+{
+	double v;
+	std::istringstream string( value );
+	string >> v;
+	return v;
+}
+
+
+void TiXmlComment::Print( FILE* cfile, int depth ) const
+{
+	ostringstream stream( ostringstream::out );
+	stream.str().reserve( 1000 );
+	
+	for ( int i=0; i<depth; i++ )
+	{
+		fprintf( cfile, "    " );
+	}
+	StreamOut( &stream );
+	fprintf( cfile, "%s", stream.str().c_str() );
+}
+
+
+void TiXmlComment::StreamOut( std::ostream* stream ) const
+{
+	(*stream) << "<!--";
+	PutString( value, stream );
+	(*stream) << "-->";
+}
+
+
+TiXmlNode* TiXmlComment::Clone() const
+{
+	TiXmlComment* clone = new TiXmlComment();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+void TiXmlText::Print( FILE* cfile, int depth ) const
+{
+	ostringstream stream( ostringstream::out );
+	stream.str().reserve( 1000 );
+	StreamOut( &stream );
+	fprintf( cfile, "%s", stream.str().c_str() );
+}
+
+
+void TiXmlText::StreamOut( std::ostream* stream ) const
+{
+	PutString( value, stream );
+}
+
+
+TiXmlNode* TiXmlText::Clone() const
+{	
+	TiXmlText* clone = 0;
+	clone = new TiXmlText( "" );
+	
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, 
+									const std::string& _encoding,
+									const std::string& _standalone )
+	: TiXmlNode( TiXmlNode::DECLARATION ) 
+{
+	version = _version;
+	encoding = _encoding;
+	standalone = _standalone;
+}
+
+
+void TiXmlDeclaration::Print( FILE* cfile, int depth ) const
+{
+	ostringstream stream( ostringstream::out );
+	stream.str().reserve( 200 );
+	StreamOut( &stream );
+	fprintf( cfile, "%s", stream.str().c_str() );
+}
+
+
+void TiXmlDeclaration::StreamOut( std::ostream* stream ) const
+{
+	(*stream) << "<?xml ";
+
+	if ( !version.empty() )
+	{
+		(*stream) << "version=\"";
+		PutString( version, stream );
+		(*stream) << "\" ";
+	}
+	if ( !encoding.empty() )
+	{
+		(*stream) << "encoding=\"";
+		PutString( encoding, stream );
+		(*stream ) << "\" ";
+	}
+	if ( !standalone.empty() )
+	{
+		(*stream) << "standalone=\"";
+		PutString( standalone, stream );
+		(*stream) << "\" ";
+	}
+	(*stream) << "?>";
+}
+
+
+TiXmlNode* TiXmlDeclaration::Clone() const
+{	
+	TiXmlDeclaration* clone = new TiXmlDeclaration();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	clone->version = version;
+	clone->encoding = encoding;
+	clone->standalone = standalone;
+	return clone;
+}
+
+
+void TiXmlUnknown::Print( FILE* cfile, int depth ) const
+{
+	ostringstream stream( ostringstream::out );
+	stream.str().reserve( 200 );
+	StreamOut( &stream );
+
+	for ( int i=0; i<depth; i++ )
+		fprintf( cfile, "    " );
+	fprintf( cfile, "%s", stream.str().c_str() );
+}
+
+
+void TiXmlUnknown::StreamOut( std::ostream* stream ) const
+{
+	(*stream) << "<" << value << ">";		// Don't use entities hear! It is unknown.
+}
+
+
+TiXmlNode* TiXmlUnknown::Clone() const
+{
+	TiXmlUnknown* clone = new TiXmlUnknown();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+TiXmlAttributeSet::TiXmlAttributeSet()
+{
+	sentinel.next = &sentinel;
+	sentinel.prev = &sentinel;
+}
+
+
+TiXmlAttributeSet::~TiXmlAttributeSet()
+{
+	assert( sentinel.next == &sentinel );
+	assert( sentinel.prev == &sentinel );
+}
+
+
+void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
+{
+	assert( !Find( addMe->Name() ) );	// Shouldn't be multiply adding to the set.
+	
+	addMe->next = &sentinel;
+	addMe->prev = sentinel.prev;
+
+	sentinel.prev->next = addMe;
+	sentinel.prev      = addMe;
+}
+
+void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node == removeMe )
+		{
+			node->prev->next = node->next;
+			node->next->prev = node->prev;
+			node->next = 0;
+			node->prev = 0;
+			return;
+		}
+	}
+	assert( 0 );		// we tried to remove a non-linked attribute.
+}
+
+
+TiXmlAttribute*	TiXmlAttributeSet::Find( const std::string& name ) const
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node->Name() == name )
+			return node;
+	}
+	return 0;
+}
+
diff --git a/ACM/tinyxml/tinyxml.dsp b/ACM/tinyxml/tinyxml.dsp
new file mode 100644
index 0000000..0669a3f
--- /dev/null
+++ b/ACM/tinyxml/tinyxml.dsp
@@ -0,0 +1,115 @@
+# Microsoft Developer Studio Project File - Name="tinyxml" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Static Library" 0x0104

+

+CFG=tinyxml - Win32 Debug

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "tinyxml.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "tinyxml.mak" CFG="tinyxml - Win32 Debug"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "tinyxml - Win32 Release" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE "tinyxml - Win32 Debug" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "tinyxml - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\..\obj\Release"

+# PROP Intermediate_Dir "..\..\obj\Release\tinyXML"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386

+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD BASE RSC /l 0x40c /d "NDEBUG"

+# ADD RSC /l 0x40c /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD LIB32 /nologo

+

+!ELSEIF  "$(CFG)" == "tinyxml - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\..\obj\Debug"

+# PROP Intermediate_Dir "..\..\obj\Debug\tinyXML"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept

+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c

+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c

+# ADD BASE RSC /l 0x40c /d "_DEBUG"

+# ADD RSC /l 0x40c /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD LIB32 /nologo

+

+!ENDIF 

+

+# Begin Target

+

+# Name "tinyxml - Win32 Release"

+# Name "tinyxml - Win32 Debug"

+# Begin Source File

+

+SOURCE=.\changes.txt

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE=.\readme.txt

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE=.\tinyxml.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\tinyxml.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\tinyxmlerror.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\tinyxmlparser.cpp

+# End Source File

+# End Target

+# End Project

diff --git a/ACM/tinyxml/tinyxml.h b/ACM/tinyxml/tinyxml.h
new file mode 100644
index 0000000..b9f1205
--- /dev/null
+++ b/ACM/tinyxml/tinyxml.h
@@ -0,0 +1,804 @@
+/*
+Copyright (c) 2000 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this 
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+*/
+
+
+#ifndef TINYXML_INCLUDED
+#define TINYXML_INCLUDED
+
+#pragma warning( disable : 4530 )
+#pragma warning( disable : 4786 )
+
+#include <string>
+#include <stdio.h>
+#include <assert.h>
+
+class TiXmlDocument;
+class TiXmlElement;
+class TiXmlComment;
+class TiXmlUnknown;
+class TiXmlAttribute;
+class TiXmlText;
+class TiXmlDeclaration;
+
+
+// Help out windows:
+#if defined( _DEBUG ) && !defined( DEBUG )
+	#define DEBUG
+#endif
+
+#if defined( DEBUG ) && defined( _MSC_VER )
+	#include <windows.h>
+	#define TIXML_LOG OutputDebugString
+#else
+	#define TIXML_LOG printf
+#endif 
+
+
+/** TiXmlBase is a base class for every class in TinyXml.
+	It does little except to establish that TinyXml classes
+	can be printed and provide some utility functions.
+
+	In XML, the document and elements can contain
+	other elements and other types of nodes.
+
+	@verbatim
+	A Document can contain:	Element	(container or leaf)
+							Comment (leaf)
+							Unknown (leaf)
+							Declaration( leaf )
+
+	An Element can contain:	Element (container or leaf)
+							Text	(leaf)
+							Attributes (not on tree)
+							Comment (leaf)
+							Unknown (leaf)
+
+	A Decleration contains: Attributes (not on tree)
+	@endverbatim
+*/
+class TiXmlBase
+{
+	friend class TiXmlNode;
+	friend class TiXmlElement;
+	friend class TiXmlDocument;
+ 
+  public:
+	TiXmlBase()								{}	
+	virtual ~TiXmlBase()					{}
+	
+	/**	All TinyXml classes can print themselves to a filestream.
+		This is a formatted print, and will insert tabs and newlines.
+		
+		(For an unformatted stream, use the << operator.)
+	*/
+ 	virtual void Print( FILE* cfile, int depth ) const = 0;
+
+	// [internal] Underlying implementation of the operator <<
+	virtual void StreamOut ( std::ostream* out ) const = 0;
+
+	/**	The world does not agree on whether white space should be kept or
+		not. In order to make everyone happy, these global, static functions
+		are provided to set whether or not TinyXml will condense all white space
+		into a single space or not. The default is to condense. Note changing these
+		values is not thread safe.
+	*/
+	static void SetCondenseWhiteSpace( bool condense )		{ condenseWhiteSpace = condense; }
+
+	/// Return the current white space setting.
+	static bool IsWhiteSpaceCondensed()						{ return condenseWhiteSpace; }
+
+  protected:
+	static const char* SkipWhiteSpace( const char* );
+	static bool StreamWhiteSpace( std::istream* in, std::string* tag );
+	static bool IsWhiteSpace( int c )		{ return ( isspace( c ) || c == '\n' || c == '\r' ); }
+
+	/*	Read to the specified character.
+		Returns true if the character found and no error.
+	*/
+	static bool StreamTo( std::istream* in, int character, std::string* tag );
+
+	/*	Reads an XML name into the string provided. Returns
+		a pointer just past the last character of the name, 
+		or 0 if the function has an error.
+	*/
+	static const char* ReadName( const char*, std::string* name );
+
+	/*	Reads text. Returns a pointer past the given end tag.
+		Wickedly complex options, but it keeps the (sensitive) code in one place.
+	*/
+	static const char* ReadText(	const char* in,				// where to start
+									std::string* text,			// the string read
+									bool ignoreWhiteSpace,		// whether to keep the white space
+									const char* endTag,			// what ends this text
+									bool ignoreCase );			// whether to ignore case in the end tag
+
+	virtual const char* Parse( const char* p ) = 0;
+
+	// If an entity has been found, transform it into a character.
+	static const char* GetEntity( const char* in, char* value );
+
+	// Get a character, while interpreting entities.
+	inline static const char* GetChar( const char* p, char* value )		
+											{		
+												assert( p );
+												if ( *p == '&' ) 
+												{
+													return GetEntity( p, value );
+												}
+												else 
+												{
+													*value = *p;
+													return p+1;
+												}
+											}
+
+	// Puts a string to a stream, expanding entities as it goes.
+	// Note this should not contian the '<', '>', etc, or they will be transformed into entities!
+	static void PutString( const std::string& str, std::ostream* stream );
+
+	// Return true if the next characters in the stream are any of the endTag sequences.
+	bool static StringEqual(	const char* p, 
+								const char* endTag, 
+								bool ignoreCase );
+													
+
+	enum
+	{
+		TIXML_NO_ERROR = 0,
+		TIXML_ERROR,
+		TIXML_ERROR_OPENING_FILE,
+		TIXML_ERROR_OUT_OF_MEMORY,
+		TIXML_ERROR_PARSING_ELEMENT,
+		TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
+		TIXML_ERROR_READING_ELEMENT_VALUE,
+		TIXML_ERROR_READING_ATTRIBUTES,
+		TIXML_ERROR_PARSING_EMPTY,
+		TIXML_ERROR_READING_END_TAG,
+		TIXML_ERROR_PARSING_UNKNOWN,
+		TIXML_ERROR_PARSING_COMMENT,
+		TIXML_ERROR_PARSING_DECLARATION,
+		TIXML_ERROR_DOCUMENT_EMPTY,
+
+		TIXML_ERROR_STRING_COUNT
+	};
+	static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
+
+  private:
+	struct Entity
+	{
+		const char*     str;
+		unsigned int	strLength;
+		int			    chr;
+	};
+	enum
+	{
+		NUM_ENTITY = 5,
+		MAX_ENTITY_LENGTH = 6
+
+	};
+	static Entity entity[ NUM_ENTITY ];
+	static bool condenseWhiteSpace;
+};
+
+
+/** The parent class for everything in the Document Object Model.
+	(Except for attributes, which are contained in elements.)
+	Nodes have siblings, a parent, and children. A node can be
+	in a document, or stand on its own. The type of a TiXmlNode
+	can be queried, and it can be cast to its more defined type.
+*/
+class TiXmlNode : public TiXmlBase
+{
+  public:
+
+	/** An output stream operator, for every class. Note that this outputs
+		without any newlines or formatting, as opposed to Print(), which
+		includes tabs and new lines.
+
+		The operator<< and operator>> are not completely symmetric. Writing
+		a node to a stream is very well defined. You'll get a nice stream
+		of output, without any extra whitespace or newlines. 
+		
+		But reading is not as well defined. (As it always is.) If you create
+		a TiXmlElement (for example) and read that from an input stream,
+		the text needs to define an element or junk will result. This is
+		true of all input streams, but it's worth keeping in mind.
+
+		A TiXmlDocument will read nodes until it reads a root element.
+	*/
+	friend std::ostream& operator<< ( std::ostream& out, const TiXmlNode& base )
+	{
+		base.StreamOut( &out );
+		return out;
+	}
+
+	/** An input stream operator, for every class. Tolerant of newlines and
+		formatting, but doesn't expect them.
+	*/
+	friend std::istream& operator>> ( std::istream& in, TiXmlNode& base )
+	{
+		std::string tag;
+		tag.reserve( 8 * 1000 );
+		base.StreamIn( &in, &tag );
+		
+		base.Parse( tag.c_str() );
+		return in;
+	}
+
+	/** The types of XML nodes supported by TinyXml. (All the
+		unsupported types are picked up by UNKNOWN.)
+	*/
+	enum NodeType 
+	{
+		DOCUMENT, 
+		ELEMENT, 
+		COMMENT, 
+		UNKNOWN, 
+		TEXT, 
+		DECLARATION, 
+		TYPECOUNT
+	};
+
+	virtual ~TiXmlNode();
+
+	/** The meaning of 'value' changes for the specific type of
+		TiXmlNode.
+		@verbatim
+		Document:	filename of the xml file
+		Element:	name of the element
+		Comment:	the comment text
+		Unknown:	the tag contents
+		Text:		the text string
+		@endverbatim
+
+		The subclasses will wrap this function.
+	*/
+	const std::string& Value()	const			{ return value; }
+
+	/** Changes the value of the node. Defined as:
+		@verbatim
+		Document:	filename of the xml file
+		Element:	name of the element
+		Comment:	the comment text
+		Unknown:	the tag contents
+		Text:		the text string
+		@endverbatim
+	*/
+	void SetValue( const std::string& _value )		{ value = _value; }
+
+	/// Delete all the children of this node. Does not affect 'this'.
+	void Clear();
+
+	/// One step up the DOM.
+	TiXmlNode* Parent() const					{ return parent; }
+
+	TiXmlNode* FirstChild()	const	{ return firstChild; }		///< The first child of this node. Will be null if there are no children.
+	TiXmlNode* FirstChild( const std::string& value ) const;	///< The first child of this node with the matching 'value'. Will be null if none found.
+	
+	TiXmlNode* LastChild() const	{ return lastChild; }		/// The last child of this node. Will be null if there are no children.
+	TiXmlNode* LastChild( const std::string& value ) const;		/// The last child of this node matching 'value'. Will be null if there are no children.
+
+	/** An alternate way to walk the children of a node.
+		One way to iterate over nodes is:
+		@verbatim
+			for( child = parent->FirstChild(); child; child = child->NextSibling() )
+		@endverbatim
+
+		IterateChildren does the same thing with the syntax:
+		@verbatim
+			child = 0;
+			while( child = parent->IterateChildren( child ) )
+		@endverbatim
+
+		IterateChildren takes the previous child as input and finds
+		the next one. If the previous child is null, it returns the
+		first. IterateChildren will return null when done.
+	*/
+	TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
+
+	/// This flavor of IterateChildren searches for children with a particular 'value'
+	TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* previous ) const;
+		
+	/** Add a new node related to this. Adds a child past the LastChild.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertEndChild( const TiXmlNode& addThis );					
+
+	/** Add a new node related to this. Adds a child before the specified child.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
+
+	/** Add a new node related to this. Adds a child after the specified child.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
+	
+	/** Replace a child of this node.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
+	
+	/// Delete a child of this node.
+	bool RemoveChild( TiXmlNode* removeThis );
+
+	/// Navigate to a sibling node.
+	TiXmlNode* PreviousSibling() const			{ return prev; }
+
+	/// Navigate to a sibling node.
+	TiXmlNode* PreviousSibling( const std::string& ) const;
+	
+	/// Navigate to a sibling node.
+	TiXmlNode* NextSibling() const				{ return next; }
+
+	/// Navigate to a sibling node with the given 'value'.
+	TiXmlNode* NextSibling( const std::string& ) const;
+
+	/** Convenience function to get through elements. 
+		Calls NextSibling and ToElement. Will skip all non-Element
+		nodes. Returns 0 if there is not another element.
+	*/
+	TiXmlElement* NextSiblingElement() const;
+
+	/** Convenience function to get through elements. 
+		Calls NextSibling and ToElement. Will skip all non-Element
+		nodes. Returns 0 if there is not another element.
+	*/
+	TiXmlElement* NextSiblingElement( const std::string& ) const;
+
+	/// Convenience function to get through elements.
+	TiXmlElement* FirstChildElement()	const;
+	
+	/// Convenience function to get through elements.
+	TiXmlElement* FirstChildElement( const std::string& value ) const;
+
+	/// Query the type (as an enumerated value, above) of this node.
+	virtual int Type() const	{ return type; }
+
+	/** Return a pointer to the Document this node lives in. 
+		Returns null if not in a document.
+	*/
+	TiXmlDocument* GetDocument() const;
+
+	/// Returns true if this node has no children.
+	bool NoChildren() const						{ return !firstChild; }
+
+	TiXmlDocument* ToDocument()	const		{ return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlElement*  ToElement() const		{ return ( this && type == ELEMENT  ) ? (TiXmlElement*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlComment*  ToComment() const		{ return ( this && type == COMMENT  ) ? (TiXmlComment*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlUnknown*  ToUnknown() const		{ return ( this && type == UNKNOWN  ) ? (TiXmlUnknown*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlText*	   ToText()    const		{ return ( this && type == TEXT     ) ? (TiXmlText*)     this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlDeclaration* ToDeclaration() const	{ return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+
+	virtual TiXmlNode* Clone() const = 0;
+
+	// The real work of the input operator.
+	virtual void StreamIn( std::istream* in, std::string* tag ) = 0;
+
+  protected:
+	TiXmlNode( NodeType type );
+
+	// The node is passed in by ownership. This object will delete it.
+	TiXmlNode* LinkEndChild( TiXmlNode* addThis );
+
+	// Figure out what is at *p, and parse it. Returns null if it is not an xml node.
+	TiXmlNode* Identify( const char* start );
+
+	void CopyToClone( TiXmlNode* target ) const	{ target->value = value; }
+
+	TiXmlNode*		parent;		
+	NodeType		type;
+	
+	TiXmlNode*		firstChild;
+	TiXmlNode*		lastChild;
+
+	std::string		value;
+	
+	TiXmlNode*		prev;
+	TiXmlNode*		next;
+};
+
+
+/** An attribute is a name-value pair. Elements have an arbitrary
+	number of attributes, each with a unique name.
+
+	@note The attributes are not TiXmlNodes, since they are not
+		  part of the tinyXML document object model. There are other
+		  suggested ways to look at this problem.
+
+	@note Attributes have a parent
+*/
+class TiXmlAttribute : public TiXmlBase
+{
+	friend class TiXmlAttributeSet;
+
+  public:
+	/// Construct an empty attribute.
+	TiXmlAttribute() : prev( 0 ), next( 0 )	{}
+
+	/// Construct an attribute with a name and value.
+	TiXmlAttribute( const std::string& _name, const std::string& _value )	: name( _name ), value( _value ), prev( 0 ), next( 0 ) {}
+
+	const std::string& Name()  const { return name; }		///< Return the name of this attribute.
+
+	const std::string& Value() const { return value; }		///< Return the value of this attribute.
+	const int          IntValue() const;					///< Return the value of this attribute, converted to an integer.
+	const double	   DoubleValue() const;					///< Return the value of this attribute, converted to a double.
+
+	void SetName( const std::string& _name )	{ name = _name; }		///< Set the name of this attribute.
+	void SetValue( const std::string& _value )	{ value = _value; }		///< Set the value.
+	void SetIntValue( int value );										///< Set the value from an integer.
+	void SetDoubleValue( double value );								///< Set the value from a double.
+
+	/// Get the next sibling attribute in the DOM. Returns null at end.
+	TiXmlAttribute* Next() const;
+	/// Get the previous sibling attribute in the DOM. Returns null at beginning.
+	TiXmlAttribute* Previous() const;
+
+	bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
+	bool operator<( const TiXmlAttribute& rhs )	 const { return name < rhs.name; }
+	bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
+
+	/*	[internal use] 
+		Attribtue parsing starts: first letter of the name
+						 returns: the next char after the value end quote
+	*/	
+	virtual const char* Parse( const char* p );
+
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth ) const;
+
+	// [internal use] 
+	virtual void StreamOut( std::ostream* out ) const;
+
+	// [internal use]
+	// Set the document pointer so the attribute can report errors.
+	void SetDocument( TiXmlDocument* doc )	{ document = doc; }
+
+  private:
+	TiXmlDocument*	document;	// A pointer back to a document, for error reporting.
+	std::string		name;
+	std::string		value;
+
+	TiXmlAttribute*	prev;
+	TiXmlAttribute*	next;
+};
+
+
+/*	A class used to manage a group of attributes.
+	It is only used internally, both by the ELEMENT and the DECLARATION.
+	
+	The set can be changed transparent to the Element and Declaration
+	classes that use it, but NOT transparent to the Attribute 
+	which has to implement a next() and previous() method. Which makes
+	it a bit problematic and prevents the use of STL.
+
+	This version is implemented with circular lists because:
+		- I like circular lists
+		- it demonstrates some independence from the (typical) doubly linked list.
+*/
+class TiXmlAttributeSet
+{
+  public:
+	TiXmlAttributeSet();
+	~TiXmlAttributeSet();
+
+	void Add( TiXmlAttribute* attribute );
+	void Remove( TiXmlAttribute* attribute );
+
+	TiXmlAttribute* First() const	{ return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+	TiXmlAttribute* Last()  const	{ return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+	
+	TiXmlAttribute*	Find( const std::string& name ) const;
+
+  private:
+	TiXmlAttribute sentinel;
+};
+
+
+/** The element is a container class. It has a value, the element name,
+	and can contain other elements, text, comments, and unknowns.
+	Elements also contain an arbitrary number of attributes.
+*/
+class TiXmlElement : public TiXmlNode
+{
+  public:
+	/// Construct an element.
+	TiXmlElement( const std::string& value );
+
+	virtual ~TiXmlElement();
+
+	/** Given an attribute name, attribute returns the value
+		for the attribute of that name, or null if none exists.
+	*/
+	const std::string* Attribute( const std::string& name ) const;
+
+	/** Given an attribute name, attribute returns the value
+		for the attribute of that name, or null if none exists.
+	*/
+	const std::string* Attribute( const std::string& name, int* i ) const;
+
+	/** Sets an attribute of name to a given value. The attribute
+		will be created if it does not exist, or changed if it does.
+	*/
+	void SetAttribute( const std::string& name, 
+					   const std::string& value );
+
+	/** Sets an attribute of name to a given value. The attribute
+		will be created if it does not exist, or changed if it does.
+	*/
+	void SetAttribute( const std::string& name, 
+					   int value );
+
+	/** Deletes an attribute with the given name.
+	*/
+	void RemoveAttribute( const std::string& name );
+
+	TiXmlAttribute* FirstAttribute() const	{ return attributeSet.First(); }		///< Access the first attribute in this element.
+	TiXmlAttribute* LastAttribute()	const 	{ return attributeSet.Last(); }		///< Access the last attribute in this element.
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth ) const;
+	// [internal use] 
+	virtual void StreamOut ( std::ostream* out ) const;
+	// [internal use] 
+	virtual void StreamIn( std::istream* in, std::string* tag );
+
+  protected:
+	/*	[internal use] 
+		Attribtue parsing starts: next char past '<'
+						 returns: next char past '>'
+	*/	
+	virtual const char* Parse( const char* p );
+
+	/*	[internal use]
+		Reads the "value" of the element -- another element, or text.
+		This should terminate with the current end tag.
+	*/
+	const char* ReadValue( const char* in );
+	bool ReadValue( std::istream* in );
+
+  private:
+	TiXmlAttributeSet attributeSet;
+};
+
+
+/**	An XML comment.
+*/
+class TiXmlComment : public TiXmlNode
+{
+  public:
+	/// Constructs an empty comment.
+	TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
+	virtual ~TiXmlComment()	{}
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth ) const;
+	// [internal use] 
+	virtual void StreamOut ( std::ostream* out ) const;
+	// [internal use] 
+	virtual void StreamIn( std::istream* in, std::string* tag );
+
+  protected:
+	/*	[internal use] 
+		Attribtue parsing starts: at the ! of the !--
+						 returns: next char past '>'
+	*/	
+	virtual const char* Parse( const char* p );
+};
+
+
+/** XML text. Contained in an element.
+*/
+class TiXmlText : public TiXmlNode
+{
+  public:
+	TiXmlText( const std::string& initValue )  : TiXmlNode( TiXmlNode::TEXT ) { SetValue( initValue ); }
+	virtual ~TiXmlText() {}
+
+
+	// [internal use] Creates a new Element and returns it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth ) const;
+	// [internal use] 
+	virtual void StreamOut ( std::ostream* out ) const;
+	// [internal use] 	
+	bool Blank() const;	// returns true if all white space and new lines
+	/*	[internal use] 
+		Attribtue parsing starts: First char of the text
+						 returns: next char past '>'
+	*/	
+	virtual const char* Parse( const char* p );
+	// [internal use]
+	virtual void StreamIn( std::istream* in, std::string* tag );
+};
+
+
+/** In correct XML the declaration is the first entry in the file.
+	@verbatim
+		<?xml version="1.0" standalone="yes"?>
+	@endverbatim
+
+	TinyXml will happily read or write files without a declaration,
+	however. There are 3 possible attributes to the declaration: 
+	version, encoding, and standalone.
+
+	Note: In this version of the code, the attributes are
+	handled as special cases, not generic attributes, simply
+	because there can only be at most 3 and they are always the same.
+*/
+class TiXmlDeclaration : public TiXmlNode
+{
+  public:
+	/// Construct an empty declaration.
+	TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
+
+	/// Construct.
+	TiXmlDeclaration( const std::string& version, 
+					  const std::string& encoding,
+					  const std::string& standalone );
+
+	virtual ~TiXmlDeclaration()	{}
+
+	/// Version. Will return empty if none was found.
+	const std::string& Version() const		{ return version; }
+	/// Encoding. Will return empty if none was found.
+	const std::string& Encoding() const		{ return encoding; }
+	/// Is this a standalone document? 
+	const std::string& Standalone() const		{ return standalone; }
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth ) const;
+	// [internal use] 
+	virtual void StreamOut ( std::ostream* out ) const;
+	// [internal use] 
+	virtual void StreamIn( std::istream* in, std::string* tag );
+
+  protected:
+	//	[internal use] 
+	//	Attribtue parsing starts: next char past '<'
+	//					 returns: next char past '>'
+	
+	virtual const char* Parse( const char* p );
+
+  private:
+	std::string version;
+	std::string encoding;
+	std::string standalone;
+};
+
+
+/** Any tag that tinyXml doesn't recognize is save as an 
+	unknown. It is a tag of text, but should not be modified.
+	It will be written back to the XML, unchanged, when the file 
+	is saved.
+*/
+class TiXmlUnknown : public TiXmlNode
+{
+  public:
+	TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
+	virtual ~TiXmlUnknown() {}
+
+	// [internal use] 	
+	virtual TiXmlNode* Clone() const;
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth ) const;
+	// [internal use] 
+	virtual void StreamOut ( std::ostream* out ) const;
+	// [internal use] 
+	virtual void StreamIn( std::istream* in, std::string* tag );
+
+  protected:
+	/*	[internal use] 
+		Attribute parsing starts: First char of the text
+						 returns: next char past '>'
+	*/	
+	virtual const char* Parse( const char* p );
+};
+
+
+/** Always the top level node. A document binds together all the
+	XML pieces. It can be saved, loaded, and printed to the screen.
+	The 'value' of a document node is the xml file name.
+*/
+class TiXmlDocument : public TiXmlNode
+{
+  public:
+	/// Create an empty document, that has no name.
+	TiXmlDocument();
+	/// Create a document with a name. The name of the document is also the filename of the xml.
+	TiXmlDocument( const std::string& documentName );
+	
+	virtual ~TiXmlDocument() {}
+
+	/** Load a file using the current document value. 
+		Returns true if successful. Will delete any existing
+		document data before loading.
+	*/
+	bool LoadFile();
+	/// Save a file using the current document value. Returns true if successful.
+	bool SaveFile() const;
+	/// Load a file using the given filename. Returns true if successful.
+	bool LoadFile( const std::string& filename );
+	/// Save a file using the given filename. Returns true if successful.
+	bool SaveFile( const std::string& filename ) const;
+
+	/// Parse the given null terminated block of xml data.
+	virtual const char* Parse( const char* p );
+
+	/** Get the root element -- the only top level element -- of the document.
+		In well formed XML, there should only be one. TinyXml is tolerant of
+		multiple elements at the document level.
+	*/
+	TiXmlElement* RootElement() const		{ return FirstChildElement(); }
+	
+	/// If, during parsing, a error occurs, Error will be set to true.
+	bool Error() const						{ return error; }
+
+	/// Contains a textual (english) description of the error if one occurs.
+	const std::string& ErrorDesc() const	{ return errorDesc; }
+
+	/** Generally, you probably want the error string ( ErrorDesc() ). But if you
+		prefer the ErrorId, this function will fetch it.
+	*/
+	const int ErrorId()	const				{ return errorId; }
+
+	/// If you have handled the error, it can be reset with this call.
+	void ClearError()						{ error = false; errorId = 0; errorDesc = ""; }
+  
+	/** Dump the document to standard out. */
+	void Print() const								{ Print( stdout, 0 ); }
+
+	// [internal use] 
+ 	virtual void Print( FILE* cfile, int depth = 0 ) const;
+	// [internal use] 
+	virtual void StreamOut ( std::ostream* out ) const;
+	// [internal use] 	
+	virtual TiXmlNode* Clone() const;
+	// [internal use] 	
+	void SetError( int err ) {		assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
+									error   = true; 
+									errorId = err;
+									errorDesc = errorString[ errorId ]; }
+	// [internal use] 
+	virtual void StreamIn( std::istream* in, std::string* tag );
+
+  protected:
+
+  private:
+	bool error;
+	int  errorId;	
+	std::string errorDesc;
+};
+
+
+
+#endif
+
diff --git a/ACM/tinyxml/tinyxml_vc7.vcproj b/ACM/tinyxml/tinyxml_vc7.vcproj
new file mode 100644
index 0000000..9c7b686
--- /dev/null
+++ b/ACM/tinyxml/tinyxml_vc7.vcproj
@@ -0,0 +1,601 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="7.10"

+	Name="tinyxml"

+	ProjectGUID="{9A0946C9-F019-4643-A53A-259BF980F5F9}"

+	SccProjectName=""

+	SccLocalPath="">

+	<Platforms>

+		<Platform

+			Name="Win32"/>

+	</Platforms>

+	<Configurations>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory=".\Release"

+			IntermediateDirectory=".\Release"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="1"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"

+				StringPooling="TRUE"

+				RuntimeLibrary="4"

+				EnableFunctionLevelLinking="TRUE"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/tinyxml.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Release\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory=".\Debug"

+			IntermediateDirectory=".\Debug"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/tinyxml.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME debug|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/tinyxml.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME release|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/tinyxml.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="LAME release Nasm|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="1"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"

+				StringPooling="TRUE"

+				RuntimeLibrary="4"

+				EnableFunctionLevelLinking="TRUE"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/tinyxml.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Release\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll debug|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/tinyxml.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll release|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="5"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Debug/tinyxml.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Debug\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="dll release Nasm|Win32"

+			OutputDirectory="$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="1"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"

+				StringPooling="TRUE"

+				RuntimeLibrary="4"

+				EnableFunctionLevelLinking="TRUE"

+				UsePrecompiledHeader="2"

+				PrecompiledHeaderFile=".\Release/tinyxml.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLibrarianTool"

+				OutputFile=".\Release\tinyxml.lib"/>

+			<Tool

+				Name="VCMIDLTool"/>

+			<Tool

+				Name="VCPostBuildEventTool"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1036"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<File

+			RelativePath="changes.txt">

+		</File>

+		<File

+			RelativePath="readme.txt">

+		</File>

+		<File

+			RelativePath="tinyxml.cpp">

+			<FileConfiguration

+				Name="Release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="Debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME release Nasm|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll release Nasm|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+		</File>

+		<File

+			RelativePath="tinyxml.h">

+		</File>

+		<File

+			RelativePath="tinyxmlerror.cpp">

+			<FileConfiguration

+				Name="Release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="Debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME release Nasm|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll release Nasm|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+		</File>

+		<File

+			RelativePath="tinyxmlparser.cpp">

+			<FileConfiguration

+				Name="Release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="Debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="LAME release Nasm|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll debug|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll release|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="0"

+					PreprocessorDefinitions=""

+					BasicRuntimeChecks="3"/>

+			</FileConfiguration>

+			<FileConfiguration

+				Name="dll release Nasm|Win32">

+				<Tool

+					Name="VCCLCompilerTool"

+					Optimization="2"

+					PreprocessorDefinitions=""/>

+			</FileConfiguration>

+		</File>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/ACM/tinyxml/tinyxmlerror.cpp b/ACM/tinyxml/tinyxmlerror.cpp
new file mode 100644
index 0000000..11b9486
--- /dev/null
+++ b/ACM/tinyxml/tinyxmlerror.cpp
@@ -0,0 +1,26 @@
+#include "tinyxml.h"
+
+// The goal of the seperate error file is to make the first
+// step towards localization. tinyxml (currently) only supports
+// latin-1, but at least the error messages could now be translated.
+//
+// It also cleans up the code a bit.
+//
+
+const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+{
+	"No error",
+	"Error",
+	"Failed to open file",
+	"Memory allocation failed.",
+	"Error parsing Element.",
+	"Failed to read Element name",
+	"Error reading Element value.",
+	"Error reading Attributes.",
+	"Error: empty tag.",
+	"Error reading end tag.",
+	"Error parsing Unknown.",
+	"Error parsing Comment.",
+	"Error parsing Declaration.",
+	"Error document empty."
+};
diff --git a/ACM/tinyxml/tinyxmlparser.cpp b/ACM/tinyxml/tinyxmlparser.cpp
new file mode 100644
index 0000000..ef9b0c1
--- /dev/null
+++ b/ACM/tinyxml/tinyxmlparser.cpp
@@ -0,0 +1,928 @@
+/*
+Copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and 
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+*/
+
+#include "tinyxml.h"
+#include <ctype.h>
+#include <strstream>
+using namespace std;
+
+//#define DEBUG_PARSER
+
+TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = 
+{
+	{ "&amp;",  5, '&' },
+	{ "&lt;",   4, '<' },
+	{ "&gt;",   4, '>' },
+	{ "&quot;", 6, '\"' },
+	{ "&apos;", 6, '\'' }
+};
+
+
+const char* TiXmlBase::SkipWhiteSpace( const char* p )
+{
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+	while ( p && *p )
+	{
+		if ( isspace( *p ) || *p == '\n' || *p =='\r' )		// Still using old rules for white space.
+			++p;
+		else
+			break;
+	}
+
+	return p;
+}
+
+
+/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream* in, std::string* tag )
+{
+	for( ;; )
+	{
+		if ( !in->good() ) return false;
+
+		int c = in->peek();
+		if ( !IsWhiteSpace( c ) )
+			return true;
+		*tag += in->get();
+	}
+}
+
+
+/*static*/ bool TiXmlBase::StreamTo( std::istream* in, int character, std::string* tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();
+		if ( c == character )
+			return true;
+
+		in->get();
+		*tag += c;
+	}
+	return false;
+}
+
+
+const char* TiXmlBase::ReadName( const char* p, string* name )
+{
+	*name = "";
+	assert( p );
+
+	// Names start with letters or underscores.
+	// After that, they can be letters, underscores, numbers,
+	// hyphens, or colons. (Colons are valid ony for namespaces,
+	// but tinyxml can't tell namespaces from names.)
+	if (    p && *p 
+		 && ( isalpha( (unsigned char) *p ) || *p == '_' ) )
+	{
+		while(		p && *p
+				&&	(		isalnum( (unsigned char ) *p ) 
+						 || *p == '_'
+						 || *p == '-'
+						 || *p == ':' ) )
+		{
+			(*name) += *p;
+			++p;
+		}
+		return p;
+	}
+	return 0;
+}
+
+
+const char* TiXmlBase::GetEntity( const char* p, char* value )
+{
+	// Presume an entity, and pull it out.
+	string ent;
+	int i;
+
+	// Ignore the &#x entities.
+	if ( strncmp( "&#x", p, 3 ) == 0 )
+	{
+		*value = *p;
+		return p+1;
+	}
+
+	// Now try to match it.
+	for( i=0; i<NUM_ENTITY; ++i )
+	{
+		if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
+		{
+			assert( strlen( entity[i].str ) == entity[i].strLength );
+			*value = entity[i].chr;
+			return ( p + entity[i].strLength );
+		}
+	}
+
+	// So it wasn't an entity, its unrecognized, or something like that.
+	*value = *p;	// Don't put back the last one, since we return it!
+	return p+1;
+}
+
+
+bool TiXmlBase::StringEqual( const char* p,
+							 const char* tag,
+							 bool ignoreCase )
+{
+	assert( p );
+	if ( !p || !*p )
+	{
+		assert( 0 );
+		return false;
+	}
+
+    if ( tolower( *p ) == tolower( *tag ) )
+	{
+		const char* q = p;
+
+		if (ignoreCase)
+		{
+			while ( *q && *tag && *q == *tag )
+			{
+				++q;
+				++tag;
+			}
+
+			if ( *tag == 0 )		// Have we found the end of the tag, and everything equal?
+			{
+				return true;
+			}
+		}
+		else
+		{
+			while ( *q && *tag && tolower( *q ) == tolower( *tag ) )
+			{
+				++q;
+				++tag;
+			}
+
+			if ( *tag == 0 )
+			{
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+
+const char* TiXmlBase::ReadText(	const char* p, 
+									string* text, 
+									bool trimWhiteSpace, 
+									const char* endTag, 
+									bool caseInsensitive )
+{
+	*text = "";
+
+	if (    !trimWhiteSpace			// certain tags always keep whitespace
+		 || !condenseWhiteSpace )	// if true, whitespace is always kept
+	{
+		// Keep all the white space.
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive )
+			  )
+		{
+			char c;
+			p = GetChar( p, &c );
+			text->append( &c, 1 );
+		}
+	}
+	else
+	{
+		bool whitespace = false;
+
+		// Remove leading white space:
+		p = SkipWhiteSpace( p );
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive ) )
+		{
+			if ( *p == '\r' || *p == '\n' )
+			{
+				whitespace = true;
+				++p;
+			}
+			else if ( isspace( *p ) )
+			{
+				whitespace = true;
+				++p;
+			}
+			else
+			{
+				// If we've found whitespace, add it before the
+				// new character. Any whitespace just becomes a space.
+				if ( whitespace )
+				{
+					text->append( " ", 1 );
+					whitespace = false;
+				}
+				char c;
+				p = GetChar( p, &c );
+				text->append( &c, 1 );
+			}
+		}
+	}
+	return p + strlen( endTag );
+}
+
+
+void TiXmlDocument::StreamIn( std::istream* in, std::string* tag )
+{
+	// The basic issue with a document is that we don't know what we're
+	// streaming. Read something presumed to be a tag (and hope), then
+	// identify it, and call the appropriate stream method on the tag.
+	//
+	// This "pre-streaming" will never read the closing ">" so the
+	// sub-tag can orient itself.
+
+	if ( !StreamTo( in, '<', tag ) ) 
+	{
+		SetError( TIXML_ERROR_PARSING_EMPTY );
+		return;
+	}
+
+	while ( in->good() )
+	{
+		int tagIndex = tag->length();
+		while ( in->good() && in->peek() != '>' )
+		{
+			int c = in->get();
+			(*tag) += (char) c;
+		}
+
+		if ( in->good() )
+		{
+			// We now have something we presume to be a node of 
+			// some sort. Identify it, and call the node to
+			// continue streaming.
+			TiXmlNode* node = Identify( tag->c_str() + tagIndex );
+
+			if ( node )
+			{
+				node->StreamIn( in, tag );
+				bool isElement = node->ToElement() != 0;
+				delete node;
+				node = 0;
+
+				// If this is the root element, we're done. Parsing will be
+				// done by the >> operator.
+				if ( isElement )
+				{
+					return;
+				}
+			}
+			else
+			{
+				SetError( TIXML_ERROR );
+				return;
+			}
+		}
+	}
+	// We should have returned sooner. 
+	SetError( TIXML_ERROR );
+}
+
+
+const char* TiXmlDocument::Parse( const char* p )
+{
+	// Parse away, at the document level. Since a document
+	// contains nothing but other tags, most of what happens
+	// here is skipping white space.
+	//
+	// In this variant (as opposed to stream and Parse) we
+	// read everything we can.
+
+
+	if ( !p || !*p  || !( p = SkipWhiteSpace( p ) ) )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
+		return false;
+	}
+	
+	while ( p && *p )
+	{
+		TiXmlNode* node = Identify( p );
+		if ( node )
+		{				
+			p = node->Parse( p );
+			LinkEndChild( node );
+		}		
+		else
+		{
+			break;
+		}		
+		p = SkipWhiteSpace( p );
+	}
+	// All is well.
+	return p;
+}
+
+
+TiXmlNode* TiXmlNode::Identify( const char* p )
+{
+	TiXmlNode* returnNode = 0;
+
+	p = SkipWhiteSpace( p );
+	if( !p || !*p || *p != '<' )
+	{
+		return 0;
+	}
+
+	TiXmlDocument* doc = GetDocument();
+	p = SkipWhiteSpace( p );
+
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+
+	// What is this thing? 
+	// - Elements start with a letter or underscore, but xml is reserved.
+	// - Comments: <!--
+	// - Decleration: <?xml
+	// - Everthing else is unknown to tinyxml.
+	//
+
+	const char* xmlHeader = { "<?xml" };
+	const char* commentHeader = { "<!--" };
+
+	if ( StringEqual( p, xmlHeader, true ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Declaration\n" );
+		#endif
+		returnNode = new TiXmlDeclaration();
+	}
+	else if (    isalpha( *(p+1) )
+			  || *(p+1) == '_' )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Element\n" );
+		#endif
+		returnNode = new TiXmlElement( "" );
+	}
+	else if ( StringEqual( p, commentHeader, false ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Comment\n" );
+		#endif
+		returnNode = new TiXmlComment();
+	}
+	else
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Unknown\n" );
+		#endif
+		returnNode = new TiXmlUnknown();
+	}
+
+	if ( returnNode )
+	{
+		// Set the parent, so it can report errors
+		returnNode->parent = this;
+		//p = returnNode->Parse( p );
+	}
+	else
+	{
+		if ( doc )
+			doc->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+	return returnNode;
+}
+
+
+void TiXmlElement::StreamIn( std::istream* in, std::string* tag )
+{
+	// We're called with some amount of pre-parsing. That is, some of "this"
+	// element is in "tag". Go ahead and stream to the closing ">"
+	while( in->good() )
+	{
+		int c = in->get();
+		(*tag) += (char) c ;
+		
+		if ( c == '>' )
+			break;
+	}
+
+	if ( tag->length() < 3 ) return;
+
+	// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
+	// If not, identify and stream.
+
+	if (    tag->at( tag->length() - 1 ) == '>' 
+		 && tag->at( tag->length() - 2 ) == '/' )
+	{
+		// All good!
+		return;
+	}
+	else if ( tag->at( tag->length() - 1 ) == '>' )
+	{
+		// There is more. Could be:
+		//		text
+		//		closing tag
+		//		another node.
+		for ( ;; )
+		{
+			StreamWhiteSpace( in, tag );
+
+			// Do we have text?
+			if ( in->peek() != '<' )
+			{
+				// Yep, text.
+				TiXmlText text( "" );
+				text.StreamIn( in, tag );
+
+				// What follows text is a closing tag or another node.
+				// Go around again and figure it out.
+				continue;
+			}
+
+			// We now have either a closing tag...or another node.
+			// We should be at a "<", regardless.
+			if ( !in->good() ) return;
+			assert( in->peek() == '<' );
+			int tagIndex = tag->length();
+
+			bool closingTag = false;
+			bool firstCharFound = false;
+
+			for( ;; )
+			{
+				if ( !in->good() )
+					return;
+
+				int c = in->peek();
+				
+				if ( c == '>' )
+					break;
+
+				*tag += c;
+				in->get();
+
+				if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
+				{
+					firstCharFound = true;
+					if ( c == '/' )
+						closingTag = true;
+				}
+			}
+			// If it was a closing tag, then read in the closing '>' to clean up the input stream.
+			// If it was not, the streaming will be done by the tag.
+			if ( closingTag )
+			{
+				int c = in->get();
+				assert( c == '>' );
+				*tag += c;
+
+				// We are done, once we've found our closing tag.
+				return;
+			}
+			else
+			{
+				// If not a closing tag, id it, and stream.
+				const char* tagloc = tag->c_str() + tagIndex;
+				TiXmlNode* node = Identify( tagloc );
+				if ( !node )
+					return;
+				node->StreamIn( in, tag );
+				delete node;
+				node = 0;
+
+				// No return: go around from the beginning: text, closing tag, or node.
+			}
+		}
+	}
+}
+
+
+const char* TiXmlElement::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	TiXmlDocument* document = GetDocument();
+
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT );
+		return false;
+	}
+
+	p = SkipWhiteSpace( p+1 );
+
+	// Read the name.
+	p = ReadName( p, &value );
+	if ( !p || !*p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME );
+		return false;
+	}
+
+	string endTag = "</";
+	endTag += value;
+	endTag += ">";
+
+	// Check for and read attributes. Also look for an empty
+	// tag or an end tag.
+	while ( p && *p )
+	{
+		p = SkipWhiteSpace( p );
+		if ( !p || !*p )
+		{
+			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+			return 0;
+		}
+		if ( *p == '/' )
+		{
+			++p;
+			// Empty tag.
+			if ( *p  != '>' )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY );		
+				return 0;
+			}
+			return (p+1);
+		}
+		else if ( *p == '>' )
+		{
+			// Done with attributes (if there were any.)
+			// Read the value -- which can include other
+			// elements -- read the end tag, and return.
+			++p;
+			p = ReadValue( p );		// Note this is an Element method, and will set the error if one happens.
+			if ( !p || !*p )
+				return 0;
+
+			// We should find the end tag now
+			if ( StringEqual( p, endTag.c_str(), false ) )
+			{
+				p += endTag.length();
+				return p;
+			}
+			else
+			{
+				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG );
+				return 0;
+			}
+		}
+		else
+		{
+			// Try to read an element:
+			TiXmlAttribute attrib;
+			attrib.SetDocument( document );
+			p = attrib.Parse( p );
+
+			if ( !p || !*p )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT );
+				return 0;
+			}
+			SetAttribute( attrib.Name(), attrib.Value() );
+		}
+	}
+	return p;
+}
+
+
+const char* TiXmlElement::ReadValue( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+
+	// Read in text and elements in any order.
+	p = SkipWhiteSpace( p );
+	while ( p && *p )
+	{
+//		string text;
+//		while ( p && *p && *p != '<' )
+//		{
+//			text += (*p);
+//			++p;
+//		}
+//
+//		p = SkipWhiteSpace( p );
+
+		if ( *p != '<' )
+		{
+			// Take what we have, make a text element.
+			TiXmlText* textNode = new TiXmlText( "" );
+
+			if ( !textNode )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+				return 0;
+			}
+
+			p = textNode->Parse( p );
+
+			if ( !textNode->Blank() )
+				LinkEndChild( textNode );
+			else
+				delete textNode;
+		} 
+		else 
+		{
+			// We hit a '<'
+			// Have we hit a new element or an end tag?
+			if ( StringEqual( p, "</", false ) )
+			{
+				return p;
+			}
+			else
+			{
+				TiXmlNode* node = Identify( p );
+				if ( node )
+				{
+					p = node->Parse( p );
+					LinkEndChild( node );
+				}				
+				else
+				{
+					return 0;
+				}
+			}
+		}
+		p = SkipWhiteSpace( p );
+	}
+
+	if ( !p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE );
+	}	
+	return p;
+}
+
+
+void TiXmlUnknown::StreamIn( std::istream* in, std::string* tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();	
+		(*tag) += c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;		
+		}
+	}
+}
+
+
+const char* TiXmlUnknown::Parse( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN );
+		return 0;
+	}
+	++p;
+	value = "";
+
+	while ( p && *p && *p != '>' )
+	{
+		value += *p;
+		++p;
+	}
+
+	if ( !p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_PARSING_UNKNOWN );
+	}
+	if ( *p == '>' )
+		return p+1;
+	return p;
+}
+
+
+void TiXmlComment::StreamIn( std::istream* in, std::string* tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();	
+		(*tag) += c;
+
+		if ( c == '>' 
+			 && tag->at( tag->length() - 2 ) == '-'
+			 && tag->at( tag->length() - 3 ) == '-' )
+		{
+			// All is well.
+			return;		
+		}
+	}
+}
+
+
+const char* TiXmlComment::Parse( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+	value = "";
+
+	p = SkipWhiteSpace( p );
+	const char* startTag = "<!--";
+	const char* endTag   = "-->";
+
+	if ( !StringEqual( p, startTag, false ) )
+	{
+		document->SetError( TIXML_ERROR_PARSING_COMMENT );
+		return 0;
+	}
+	p += strlen( startTag );
+	p = ReadText( p, &value, false, endTag, false );
+	return p;
+}
+
+
+const char* TiXmlAttribute::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p ) return 0;
+
+	// Read the name, the '=' and the value.
+	p = ReadName( p, &name );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p || *p != '=' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+
+	++p;	// skip '='
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+	
+	const char* end;
+
+	if ( *p == '\'' )
+	{
+		++p;
+		end = "\'";
+		p = ReadText( p, &value, false, end, false );
+	}
+	else if ( *p == '"' )
+	{
+		++p;
+		end = "\"";
+		p = ReadText( p, &value, false, end, false );
+	}
+	else
+	{
+		// All attribute values should be in single or double quotes.
+		// But this is such a common error that the parser will try
+		// its best, even without them.
+		value = "";
+		while (    p && *p										// existence
+				&& !isspace( *p ) && *p != '\n' && *p != '\r'	// whitespace
+				&& *p != '/' && *p != '>' )						// tag end
+		{
+			value += *p;
+			++p;
+		}
+	}
+	return p;
+}
+
+
+void TiXmlText::StreamIn( std::istream* in, std::string* tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();	
+		if ( c == '<' )
+			return;
+
+		(*tag) += c;
+		in->get();
+	}
+}
+
+
+
+const char* TiXmlText::Parse( const char* p )
+{
+	value = "";
+
+	//TiXmlDocument* doc = GetDocument();
+	bool ignoreWhite = true;
+//	if ( doc && !doc->IgnoreWhiteSpace() ) ignoreWhite = false;
+
+	const char* end = "<";
+	p = ReadText( p, &value, ignoreWhite, end, false );
+	if ( p )
+		return p-1;	// don't truncate the '<'
+	return 0;
+}
+
+
+void TiXmlDeclaration::StreamIn( std::istream* in, std::string* tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		(*tag) += c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+
+const char* TiXmlDeclaration::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	// Find the beginning, find the end, and look for
+	// the stuff in-between.
+	TiXmlDocument* document = GetDocument();
+	if ( !p || !*p || !StringEqual( p, "<?xml", true ) )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION );
+		return 0;
+	}
+
+	p += 5;
+//	const char* start = p+5;
+//	const char* end  = strstr( start, "?>" );
+
+	version = "";
+	encoding = "";
+	standalone = "";
+
+	while ( p && *p )
+	{
+		if ( *p == '>' )
+		{
+			++p;
+			return p;
+		}
+
+		p = SkipWhiteSpace( p );
+		if ( StringEqual( p, "version", true ) )
+		{
+//			p += 7;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			version = attrib.Value();
+		}
+		else if ( StringEqual( p, "encoding", true ) )
+		{
+//			p += 8;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			encoding = attrib.Value();
+		}
+		else if ( StringEqual( p, "standalone", true ) )
+		{
+//			p += 10;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			standalone = attrib.Value();
+		}
+		else
+		{
+			// Read over whatever it is.
+			while( p && *p && *p != '>' && !isspace( *p ) )
+				++p;
+		}
+	}
+	return 0;
+}
+
+bool TiXmlText::Blank() const
+{
+	for ( unsigned i=0; i<value.size(); i++ )
+		if ( !isspace( value[i] ) )
+			return false;
+	return true;
+}
+
diff --git a/ACM/tinyxml/xmltest.cpp b/ACM/tinyxml/xmltest.cpp
new file mode 100644
index 0000000..7029ac8
--- /dev/null
+++ b/ACM/tinyxml/xmltest.cpp
@@ -0,0 +1,326 @@
+#include "tinyxml.h"
+#include <iostream>
+#include <sstream>
+#include <strstream>
+using namespace std;
+
+int gPass = 0;
+int gFail = 0;
+
+// Utility functions:
+template< class T >
+bool XmlTest( const char* testString, T expected, T found, bool noEcho = false )
+{
+	if ( expected == found ) 
+		cout << "[pass]";
+	else
+		cout << "[fail]";
+
+	if ( noEcho )
+		cout << " " << testString;
+	else
+		cout << " " << testString << " [" << expected << "][" <<  found << "]";
+	cout << "\n";
+
+	bool pass = ( expected == found );
+	if ( pass )
+		++gPass;
+	else
+		++gFail;
+	return pass;
+}
+
+
+//
+// This file demonstrates some basic functionality of TinyXml.
+// Note that the example is very contrived. It presumes you know
+// what is in the XML file. But it does test the basic operations,
+// and show how to add and remove nodes.
+//
+
+int main()
+{
+	//
+	// We start with the 'demoStart' todo list. Process it. And
+	// should hopefully end up with the todo list as illustrated.
+	//
+	const char* demoStart = 
+		"<?xml version=\"1.0\"  standalone='no' >\n"
+		"<!-- Our to do list data -->"
+		"<ToDo>\n"
+			"<!-- Do I need a secure PDA? -->\n"
+			"<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>"
+			"<Item priority=\"2\" distance='none'> Do bills   </Item>"
+			"<Item priority=\"2\" distance='far &amp; back'> Look for Evil Dinosaurs! </Item>"
+		"</ToDo>";
+
+	/*	What the todo list should look like after processing.
+		In stream (no formatting) representation. */
+	const char* demoEnd = 
+		"<?xml version=\"1.0\" standalone=\"no\" ?>"
+		"<!-- Our to do list data -->"
+		"<ToDo>"
+			"<!-- Do I need a secure PDA? -->"
+		    "<Item priority=\"2\" distance=\"close\">Go to the"
+		        "<bold>Toy store!"
+		        "</bold>"
+		    "</Item>"
+		    "<Item priority=\"1\" distance=\"far\">Talk to:"
+		        "<Meeting where=\"School\">"
+		            "<Attendee name=\"Marple\" position=\"teacher\" />"
+		            "<Attendee name=\"Vo&#x82;\" position=\"counselor\" />"
+		        "</Meeting>"
+		        "<Meeting where=\"Lunch\" />"
+		    "</Item>"
+		    "<Item priority=\"2\" distance=\"here\">Do bills"
+		    "</Item>"
+		"</ToDo>";
+
+	// The example parses from the character string (above):
+
+	{
+		// Write to a file and read it back, to check file I/O.
+
+		TiXmlDocument doc( "demotest.xml" );
+		doc.Parse( demoStart );
+
+		if ( doc.Error() )
+		{
+			printf( "Error in %s: %s\n", doc.Value().c_str(), doc.ErrorDesc().c_str() );
+			exit( 1 );
+		}
+		doc.SaveFile();
+	}
+
+	TiXmlDocument doc( "demotest.xml" );
+	bool loadOkay = doc.LoadFile();
+
+	if ( !loadOkay )
+	{
+		printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc().c_str() );
+		exit( 1 );
+	}
+
+	printf( "** Demo doc read from disk: ** \n\n" );
+	doc.Print( stdout );
+
+	TiXmlNode* node = 0;
+	TiXmlElement* todoElement = 0;
+	TiXmlElement* itemElement = 0;
+
+
+	// --------------------------------------------------------
+	// An example of changing existing attributes, and removing
+	// an element from the document.
+	// --------------------------------------------------------
+
+	// Get the "ToDo" element.
+	// It is a child of the document, and can be selected by name.
+	node = doc.FirstChild( "ToDo" );
+	assert( node );
+	todoElement = node->ToElement();
+	assert( todoElement  );
+
+	// Going to the toy store is now our second priority...
+	// So set the "priority" attribute of the first item in the list.
+	node = todoElement->FirstChildElement();	// This skips the "PDA" comment.
+	assert( node );
+	itemElement = node->ToElement();
+	assert( itemElement  );
+	itemElement->SetAttribute( "priority", 2 );
+
+	// Change the distance to "doing bills" from
+	// "none" to "here". It's the next sibling element.
+	itemElement = itemElement->NextSiblingElement();
+	assert( itemElement );
+	itemElement->SetAttribute( "distance", "here" );
+
+	// Remove the "Look for Evil Dinosours!" item.
+	// It is 1 more sibling away. We ask the parent to remove
+	// a particular child.
+	itemElement = itemElement->NextSiblingElement();
+	todoElement->RemoveChild( itemElement );
+
+	itemElement = 0;
+
+	// --------------------------------------------------------
+	// What follows is an example of created elements and text
+	// nodes and adding them to the document.
+	// --------------------------------------------------------
+
+	// Add some meetings.
+	TiXmlElement item( "Item" );
+	item.SetAttribute( "priority", "1" );
+	item.SetAttribute( "distance", "far" );
+
+	TiXmlText text( "Talk to:" );
+
+	TiXmlElement meeting1( "Meeting" );
+	meeting1.SetAttribute( "where", "School" );
+
+	TiXmlElement meeting2( "Meeting" );
+	meeting2.SetAttribute( "where", "Lunch" );
+
+	TiXmlElement attendee1( "Attendee" );
+	attendee1.SetAttribute( "name", "Marple" );
+	attendee1.SetAttribute( "position", "teacher" );
+
+	TiXmlElement attendee2( "Attendee" );
+	attendee2.SetAttribute( "name", "Vo&#x82;" );
+	attendee2.SetAttribute( "position", "counselor" );
+
+	// Assemble the nodes we've created:
+	meeting1.InsertEndChild( attendee1 );
+	meeting1.InsertEndChild( attendee2 );
+
+	item.InsertEndChild( text );
+	item.InsertEndChild( meeting1 );
+	item.InsertEndChild( meeting2 );
+
+	// And add the node to the existing list after the first child.
+	node = todoElement->FirstChild( "Item" );
+	assert( node );
+	itemElement = node->ToElement();
+	assert( itemElement );
+
+	todoElement->InsertAfterChild( itemElement, item );
+
+	printf( "\n** Demo doc processed: ** \n\n" );
+	doc.Print( stdout );
+
+	printf( "** Demo doc processed to stream: ** \n\n" );
+	cout << doc << endl << endl;
+
+	// --------------------------------------------------------
+	// Different tests...do we have what we expect?
+	// --------------------------------------------------------
+
+	int count = 0;
+	TiXmlElement*	element;
+
+	//////////////////////////////////////////////////////
+	cout << "** Basic structure. **\n";
+	ostringstream outputStream( ostringstream::out );
+	outputStream << doc;
+
+	XmlTest( "Output stream correct.", string( demoEnd ), outputStream.str(), true );
+
+	node = doc.RootElement();
+	XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );	
+	XmlTest( "Root element value is 'ToDo'.", string( "ToDo" ), node->Value() );
+	node = node->FirstChild();
+	XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
+	node = node->NextSibling();
+	XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
+	XmlTest( "Value is 'Item'.", string( "Item" ), node->Value() );
+	node = node->FirstChild();
+	XmlTest( "First child exists.", true, ( node != 0 && node->ToText() ) );
+	XmlTest( "Value is 'Go to the'.", string( "Go to the" ), node->Value() );
+
+
+	//////////////////////////////////////////////////////
+	cout << "\n** Iterators. **" << "\n";
+	// Walk all the top level nodes of the document.
+	count = 0;
+	for( node = doc.FirstChild();
+		 node;
+		 node = node->NextSibling() )
+	{
+		count++;
+	}
+	XmlTest( "Top level nodes, using First / Next.", 3, count );
+
+	count = 0;
+	for( node = doc.LastChild();
+		 node;
+		 node = node->PreviousSibling() )
+	{
+		count++;
+	}
+	XmlTest( "Top level nodes, using Last / Previous.", 3, count );
+
+	// Walk all the top level nodes of the document,
+	// using a different sytax.
+	count = 0;
+	for( node = doc.IterateChildren( 0 );
+		 node;
+		 node = doc.IterateChildren( node ) )
+	{
+		count++;
+	}
+	XmlTest( "Top level nodes, using IterateChildren.", 3, count );
+
+	// Walk all the elements in a node.
+	count = 0;
+	for( element = todoElement->FirstChildElement();
+		 element;
+		 element = element->NextSiblingElement() )
+	{
+		count++;
+	}
+	XmlTest( "Children of the 'ToDo' element, using First / Next.",
+			 3, count );
+
+	// Walk all the elements in a node by value.
+	count = 0;
+	for( node = todoElement->FirstChild( "Item" );
+		 node;
+		 node = node->NextSibling( "Item" ) )
+	{
+		count++;
+	}
+	XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count );
+
+	count = 0;
+	for( node = todoElement->LastChild( "Item" );
+		 node;
+		 node = node->PreviousSibling( "Item" ) )
+	{
+		count++;
+	}
+	XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count );
+
+
+	//////////////////////////////////////////////////////
+	cout << "\n** Parsing. **\n";
+	istringstream parse0( "<Element0 attribute0='foo0' attribute1= noquotes attribute2 = '&gt;' />" );
+	TiXmlElement element0( "default" );
+	parse0 >> element0;
+
+	XmlTest( "Element parsed, value is 'Element0'.", string( "Element0" ), element0.Value() );
+	XmlTest( "Reads attribute 'attribute0=\"foo0\"'.", string( "foo0" ), *( element0.Attribute( "attribute0" ) ) );
+	XmlTest( "Reads incorrectly formatted 'attribute1=noquotes'.", string( "noquotes" ), *( element0.Attribute( "attribute1" ) ) );
+	XmlTest( "Read attribute with entity value '>'.", string( ">" ), *( element0.Attribute( "attribute2" ) ) );
+
+	//////////////////////////////////////////////////////
+	cout << "\n** Streaming. **\n";
+
+	// Round trip check: stream in, then stream back out to verify. The stream
+	// out has already been checked, above. We use the output
+
+	istringstream inputStringStream( outputStream.str() );
+	TiXmlDocument document0;
+
+	inputStringStream >> document0;
+
+	ostringstream outputStream0( ostringstream::out );
+	outputStream0 << document0;
+
+	XmlTest( "Stream round trip correct.", string( demoEnd ), outputStream0.str(), true );
+
+	//////////////////////////////////////////////////////
+	cout << "\n** Parsing, no Condense Whitespace **\n";
+	TiXmlBase::SetCondenseWhiteSpace( false );
+
+	istringstream parse1( "<start>This  is    \ntext</start>" );
+	TiXmlElement text1( "text" );
+	parse1 >> text1;
+
+	XmlTest( "Condense white space OFF.", string( "This  is    \ntext" ),
+										  text1.FirstChild()->Value(),
+										  true );
+							
+	cout << endl << "Pass " << gPass << ", Fail " << gFail << endl;	
+	return 0;
+}
+
diff --git a/API b/API
new file mode 100644
index 0000000..c850df5
--- /dev/null
+++ b/API
@@ -0,0 +1,107 @@
+The LAME API
+
+This is the simple interface to the encoding part of libmp3lame.so.
+The library also contains routines for adding id3 tags and 
+mp3 decoding.  These routines are not fully documented,
+but you can figure them out by looking at "include/lame.h" and the
+example frontend encoder/decoder source code in frontend/main.c
+
+All of these steps should be done for every MP3 to be encoded.
+
+
+=========================================================================
+
+1. (optional) Get the version number of the encoder, if you are interested.  
+   void get_lame_version(char *strbuf, size_t buflen, const char *prefix);
+
+
+2. Error messages.  By default, LAME will write error messages to
+stderr using vfprintf().  For GUI applications, this is often a problem
+and you need to set your own error message handlers:
+
+   lame_set_errorf(gfp,error_handler_function);
+   lame_set_debugf(gfp,error_handler_function);
+   lame_set_msgf(gfp,error_handler_function);
+  
+See lame.h for details.
+
+
+3. Initialize the encoder.  sets default for all encoder parameters.
+
+   #include "lame.h"
+   lame_global_flags *gfp;
+   gfp = lame_init();
+
+The default (if you set nothing) is a  J-Stereo, 44.1khz
+128kbps CBR mp3 file at quality 5.  Override various default settings 
+as necessary, for example:
+
+   lame_set_num_channels(gfp,2);
+   lame_set_in_samplerate(gfp,44100);
+   lame_set_brate(gfp,128);
+   lame_set_mode(gfp,1);
+   lame_set_quality(gfp,2);   /* 2=high  5 = medium  7=low */ 
+
+
+See lame.h for the complete list of options.  Note that there are
+some lame_set_*() calls not documented in lame.h.  These functions
+are experimental and for testing only.  They may be removed in
+the future.
+
+
+
+4. Set more internal configuration based on data provided above,
+   as well as checking for problems.  Check that ret_code >= 0.
+
+   ret_code = lame_init_params(gfp);
+
+
+
+5. Encode some data.  input pcm data, output (maybe) mp3 frames.
+This routine handles all buffering, resampling and filtering for you.
+The required mp3buffer_size can be computed from num_samples, 
+samplerate and encoding rate, but here is a worst case estimate:
+mp3buffer_size (in bytes) = 1.25*num_samples + 7200.
+num_samples = the number of PCM samples in each channel.  It is
+not the sum of the number of samples in the L and R channels.
+
+The return code = number of bytes output in mp3buffer.  This can be 0.
+If it is <0, an error occured.  
+
+   int lame_encode_buffer(lame_global_flags *gfp,
+         short int leftpcm[], short int rightpcm[],
+         int num_samples,char *mp3buffer,int  mp3buffer_size);
+
+
+There are also routines for various types of input  
+(float, long, interleaved, etc).  See lame.h for details.
+
+
+6. lame_encode_flush will flush the buffers and may return a 
+final few mp3 frames.  mp3buffer should be at least 7200 bytes.
+return code = number of bytes output to mp3buffer.  This can be 0.
+
+int lame_encode_flush(lame_global_flags *,char *mp3buffer, int mp3buffer_size);
+
+
+7.  Write the Xing VBR/INFO tag to mp3 file.  
+
+void lame_mp3_tags_fid(lame_global_flags *,FILE* fid);
+
+This adds a valid mp3 frame which contains information about the
+bitstream some players may find usefull.  It is used for CBR,ABR and
+VBR.  The routine will attempt to rewind the output stream to the
+beginning.  If this is not possible, (for example, you are encoding to
+stdout) you should specifically disable the tag by calling
+lame_set_bWriteVbrTag(gfp,0) in step 3 above, and call
+lame_mp3_tags_fid() with fid=NULL.  If the rewind fails and
+the tag was not disabled, the first mp3 frame in the bitstream
+will be all 0's.
+
+
+
+8. free the internal data structures.
+
+void lame_close(lame_global_flags *); 
+
+
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..f503049
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,481 @@
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+    		    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License").  Each licensee is
+addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    c) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    d) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..1167a10
--- /dev/null
+++ b/ChangeLog
Binary files differ
diff --git a/ChangeLog.header b/ChangeLog.header
new file mode 100644
index 0000000..7708fa9
--- /dev/null
+++ b/ChangeLog.header
@@ -0,0 +1,13 @@
+
+ ChangeLog for LAME
+-==================-
+
+ - All dates/times are in GMT.
+ - This file contains the complete changelog, even commit logs of
+   non official branches. An entry of the form "filename (branchname):"
+   may not apply to the source you get with this package.
+ - Generated from cvs log entries
+   (cvs2cl --gmt -S --branches --no-wrap --header ChangeLog.header)
+
+-- 
+
diff --git a/DEFINES b/DEFINES
new file mode 100644
index 0000000..b4fab79
--- /dev/null
+++ b/DEFINES
@@ -0,0 +1,45 @@
+$Id: DEFINES,v 1.23 2003/02/07 18:17:41 bouvigne Exp $
+
+USE_FAST_LOG:
+ - use of log/log10 approximation (uses IEEE754 float format)
+   (absolute precision of log10 is then around 1e-6)
+
+KLEMM_36:
+ - portability fixes in the IO code
+
+NON_LINEAR_PSYMODEL
+ - use a non linear psymodel in the GPSYCHO case
+
+USE_GOGO_SUBBAND:
+ ?
+
+NOTABLES (default):
+ ?
+
+NEWS3:
+ ?
+
+NORES_TEST (allways on):
+ - don't let the 2nd granule use bits saved by the 1st granule
+ - useful for testing only
+
+NEW_DRAIN (theres a define above: NEW_DRAINXX):
+ ?
+ comment:
+   mdb_bytes = x/8; m ?= n ?= o ?= 8* mdb_bytes; p ?= mdb_bytes
+   ( ? == [+-] )
+   - optimization should handle this, but it looks ugly
+   - do we lose precision here?
+
+LAME_STD_PRINT:
+ - more verbose output?
+
+PRECOMPUTE (always on, multiple defines):
+ - precomputes blackman window?
+
+USE_GNUC_ASM:
+ - speed optimization
+   (should move into configure.in)
+
+... alot of #if 0 / #if 1 not evaluated ...
+
diff --git a/Dll/BladeMP3EncDLL.c b/Dll/BladeMP3EncDLL.c
new file mode 100644
index 0000000..f09ca39
--- /dev/null
+++ b/Dll/BladeMP3EncDLL.c
@@ -0,0 +1,1021 @@
+/*
+*	Blade DLL Interface for LAME.
+*
+*	Copyright (c) 1999 - 2002 A.L. Faber
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the
+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+* Boston, MA  02111-1307, USA.
+*/
+
+#include <windows.h>
+#include <Windef.h>
+#include "BladeMP3EncDLL.h"
+#include <assert.h>
+#include <stdio.h>
+
+#include <lame.h>
+
+
+#define         Min(A, B)       ((A) < (B) ? (A) : (B))
+#define         Max(A, B)       ((A) > (B) ? (A) : (B))
+
+#define _RELEASEDEBUG 0
+
+// lame_enc DLL version number
+const int MAJORVERSION = 1;
+const int MINORVERSION = 32;
+
+
+// Local variables
+static DWORD				dwSampleBufferSize=0;
+static HANDLE				gs_hModule=NULL;
+static BOOL					gs_bLogFile=FALSE;
+static lame_global_flags*	gfp_save = NULL;
+
+// Local function prototypes
+static void dump_config( 	lame_global_flags*	gfp );
+static void DebugPrintf( const char* pzFormat, ... );
+static void DispErr( char const* strErr );
+static void PresetOptions( lame_global_flags *gfp, LONG myPreset );
+
+
+static void DebugPrintf(const char* pzFormat, ...)
+{
+    char	szBuffer[1024]={'\0',};
+    char	szFileName[MAX_PATH+1]={'\0',};
+    va_list ap;
+
+    // Get the full module (DLL) file name
+    GetModuleFileNameA(	gs_hModule, 
+        szFileName,
+        sizeof( szFileName ) );
+
+    // change file name extention
+    szFileName[ strlen(szFileName) - 3 ] = 't';
+    szFileName[ strlen(szFileName) - 2 ] = 'x';
+    szFileName[ strlen(szFileName) - 1 ] = 't';
+
+    // start at beginning of the list
+    va_start(ap, pzFormat);
+
+    // copy it to the string buffer
+    _vsnprintf(szBuffer, sizeof(szBuffer), pzFormat, ap);
+
+    // log it to the file?
+    if ( gs_bLogFile ) 
+    {	
+        FILE* fp = NULL;
+
+        // try to open the log file
+        fp=fopen( szFileName, "a+" );
+
+        // check file open result
+        if (fp)
+        {
+            // write string to the file
+            fputs(szBuffer,fp);
+
+            // close the file
+            fclose(fp);
+        }
+    }
+
+#if defined _DEBUG || defined _RELEASEDEBUG
+    OutputDebugStringA( szBuffer );
+#endif
+
+    va_end(ap);
+}
+
+
+static void PresetOptions( lame_global_flags *gfp, LONG myPreset )
+{
+    switch (myPreset)
+    {
+        /*-1*/case LQP_NOPRESET:
+            break;
+
+        /*0*/case LQP_NORMAL_QUALITY:
+            /*	lame_set_quality( gfp, 5 );*/
+            break;
+
+        /*1*/case LQP_LOW_QUALITY:
+             lame_set_quality( gfp, 9 );
+             break;
+
+        /*2*/case LQP_HIGH_QUALITY:
+             lame_set_quality( gfp, 2 );
+             break;
+
+        /*3*/case LQP_VOICE_QUALITY:				// --voice flag for experimental voice mode
+             lame_set_mode( gfp, MONO );
+             lame_set_preset( gfp, 56);
+             break;
+
+        /*4*/case LQP_R3MIX:					// --R3MIX
+             lame_set_preset( gfp, R3MIX);
+             break;
+
+        /*5*/case LQP_VERYHIGH_QUALITY:
+             lame_set_quality( gfp, 0 );
+             break;
+
+        /*6*/case LQP_STANDARD:				// --PRESET STANDARD
+            lame_set_preset( gfp, STANDARD);
+            break;
+
+        /*7*/case LQP_FAST_STANDARD:				// --PRESET FAST STANDARD
+            lame_set_preset( gfp, STANDARD_FAST);
+            break;
+
+        /*8*/case LQP_EXTREME:				// --PRESET EXTREME
+            lame_set_preset( gfp, EXTREME);
+            break;
+
+        /*9*/case LQP_FAST_EXTREME:				// --PRESET FAST EXTREME:
+            lame_set_preset( gfp, EXTREME_FAST);
+            break;
+
+        /*10*/case LQP_INSANE:				// --PRESET INSANE
+            lame_set_preset( gfp, INSANE);
+            break;
+
+        /*11*/case LQP_ABR:					// --PRESET ABR
+            // handled in beInitStream
+            break;
+
+        /*12*/case LQP_CBR:					// --PRESET CBR
+            // handled in beInitStream
+            break;
+
+        /*13*/case LQP_MEDIUM:					// --PRESET MEDIUM
+            lame_set_preset( gfp, MEDIUM);
+            break;
+
+        /*14*/case LQP_FAST_MEDIUM:					// --PRESET FAST MEDIUM
+            lame_set_preset( gfp, MEDIUM_FAST);
+            break;
+
+        /*1000*/case LQP_PHONE:
+            lame_set_mode( gfp, MONO );
+            lame_set_preset( gfp, 16);
+            break;
+
+        /*2000*/case LQP_SW:
+            lame_set_mode( gfp, MONO );
+            lame_set_preset( gfp, 24);
+            break;
+
+        /*3000*/case LQP_AM:
+            lame_set_mode( gfp, MONO );
+            lame_set_preset( gfp, 40);
+            break;
+
+        /*4000*/case LQP_FM:
+            lame_set_preset( gfp, 112);
+            break;
+
+        /*5000*/case LQP_VOICE:
+            lame_set_mode( gfp, MONO );
+            lame_set_preset( gfp, 56);
+            break;
+
+        /*6000*/case LQP_RADIO:
+            lame_set_preset( gfp, 112);
+            break;
+
+        /*7000*/case LQP_TAPE:
+            lame_set_preset( gfp, 112);
+            break;
+
+        /*8000*/case LQP_HIFI:
+            lame_set_preset( gfp, 160);
+            break;
+
+        /*9000*/case LQP_CD:
+            lame_set_preset( gfp, 192);
+            break;
+
+        /*10000*/case LQP_STUDIO:
+            lame_set_preset( gfp, 256);
+            break;
+
+    }
+}
+
+
+__declspec(dllexport) BE_ERR	beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream)
+{
+    int actual_bitrate;
+    //2001-12-18
+    int					nDllArgC = 0;
+    BE_CONFIG			lameConfig = { 0, };
+    int					nInitReturn = 0;
+    lame_global_flags*	gfp = NULL;
+
+    // Init the global flags structure
+    gfp = lame_init();
+    *phbeStream = (HBE_STREAM)gfp;
+
+    // clear out structure
+    memset(&lameConfig,0x00,CURRENT_STRUCT_SIZE);
+
+    // Check if this is a regular BLADE_ENCODER header
+    if (pbeConfig->dwConfig!=BE_CONFIG_LAME)
+    {
+        int nCRC=pbeConfig->format.mp3.bCRC;
+        int nVBR=(nCRC>>12)&0x0F;
+
+        // Copy parameter from old Blade structure
+        lameConfig.format.LHV1.dwSampleRate	=pbeConfig->format.mp3.dwSampleRate;
+        //for low bitrates, LAME will automatically downsample for better
+        //sound quality.  Forcing output samplerate = input samplerate is not a good idea 
+        //unless the user specifically requests it:
+        //lameConfig.format.LHV1.dwReSampleRate=pbeConfig->format.mp3.dwSampleRate;
+        lameConfig.format.LHV1.nMode		=(pbeConfig->format.mp3.byMode&0x0F);
+        lameConfig.format.LHV1.dwBitrate	=pbeConfig->format.mp3.wBitrate;
+        lameConfig.format.LHV1.bPrivate		=pbeConfig->format.mp3.bPrivate;
+        lameConfig.format.LHV1.bOriginal	=pbeConfig->format.mp3.bOriginal;
+        lameConfig.format.LHV1.bCRC		=nCRC&0x01;
+        lameConfig.format.LHV1.bCopyright	=pbeConfig->format.mp3.bCopyright;
+
+        // Fill out the unknowns
+        lameConfig.format.LHV1.dwStructSize=CURRENT_STRUCT_SIZE;
+        lameConfig.format.LHV1.dwStructVersion=CURRENT_STRUCT_VERSION;
+
+        // Get VBR setting from fourth nibble
+        if ( nVBR>0 )
+        {
+            lameConfig.format.LHV1.bWriteVBRHeader = TRUE;
+            lameConfig.format.LHV1.bEnableVBR = TRUE;
+            lameConfig.format.LHV1.nVBRQuality = nVBR-1;
+        }
+
+        // Get Quality from third nibble
+        lameConfig.format.LHV1.nPreset=((nCRC>>8)&0x0F);
+
+    }
+    else
+    {
+        // Copy the parameters
+        memcpy(&lameConfig,pbeConfig,pbeConfig->format.LHV1.dwStructSize);
+    }
+
+    // --------------- Set arguments to LAME encoder -------------------------
+
+    // Set input sample frequency
+    lame_set_in_samplerate( gfp, lameConfig.format.LHV1.dwSampleRate );
+
+    // disable INFO/VBR tag by default.  
+    // if this tag is used, the calling program must call beWriteVBRTag()
+    // after encoding.  But the original DLL documentation does not 
+    // require the 
+    // app to call beWriteVBRTag() unless they have specifically
+    // set LHV1.bWriteVBRHeader=TRUE.  Thus the default setting should
+    // be disabled.  
+    lame_set_bWriteVbrTag( gfp, 0 );
+
+    //2001-12-18 Dibrom's ABR preset stuff
+
+    if(lameConfig.format.LHV1.nPreset == LQP_ABR)		// --ALT-PRESET ABR
+    {
+        actual_bitrate = lameConfig.format.LHV1.dwVbrAbr_bps / 1000;
+
+        // limit range
+        if( actual_bitrate > 320)
+        {
+            actual_bitrate = 320;
+        }
+
+        if( actual_bitrate < 8 )
+        {
+            actual_bitrate = 8;
+        }
+
+        lame_set_preset( gfp, actual_bitrate );
+    }    
+
+    // end Dibrom's ABR preset 2001-12-18 ****** START OF CBR
+
+    if(lameConfig.format.LHV1.nPreset == LQP_CBR)		// --ALT-PRESET CBR
+    {
+        actual_bitrate = lameConfig.format.LHV1.dwBitrate;
+        lame_set_preset(gfp, actual_bitrate);
+        lame_set_VBR(gfp, vbr_off);
+    }
+
+    // end Dibrom's CBR preset 2001-12-18
+
+    // The following settings only used when preset is not one of the LAME QUALITY Presets
+    if ( (int)lameConfig.format.LHV1.nPreset < (int) LQP_STANDARD )
+    {
+        switch ( lameConfig.format.LHV1.nMode )
+        {
+        case BE_MP3_MODE_STEREO:
+            lame_set_mode( gfp, STEREO );
+            lame_set_num_channels( gfp, 2 );
+            break;
+        case BE_MP3_MODE_JSTEREO:
+            lame_set_mode( gfp, JOINT_STEREO );
+            lame_set_num_channels( gfp, 2 );
+            break;
+        case BE_MP3_MODE_MONO:
+            lame_set_mode( gfp, MONO );
+            lame_set_num_channels( gfp, 1 );
+            break;
+        case BE_MP3_MODE_DUALCHANNEL: //warning: there is NO dual channel option working in Lame
+            lame_set_force_ms( gfp, 1 );
+            lame_set_mode( gfp, STEREO );
+            lame_set_num_channels( gfp, 2 );
+            break;
+        default:
+            {
+                DebugPrintf("Invalid lameConfig.format.LHV1.nMode, value is %d\n",lameConfig.format.LHV1.nMode);
+                return BE_ERR_INVALID_FORMAT_PARAMETERS;
+            }
+        }
+
+        if ( lameConfig.format.LHV1.bEnableVBR )
+        {
+            /* set VBR quality */
+            lame_set_VBR_q( gfp, lameConfig.format.LHV1.nVBRQuality );
+
+            /* select proper VBR method */
+            switch ( lameConfig.format.LHV1.nVbrMethod)
+            {
+            case VBR_METHOD_NONE:
+                lame_set_VBR( gfp, vbr_off );
+                break;
+
+            case VBR_METHOD_DEFAULT:
+                lame_set_VBR( gfp, vbr_default ); 
+                break;
+
+            case VBR_METHOD_OLD:
+                lame_set_VBR( gfp, vbr_rh ); 
+                break;
+
+            case VBR_METHOD_MTRH:
+            case VBR_METHOD_NEW:
+                /*                                
+                * the --vbr-mtrh commandline switch is obsolete. 
+                * now --vbr-mtrh is known as --vbr-new
+                */
+                lame_set_VBR( gfp, vbr_mtrh ); 
+                break;
+
+            case VBR_METHOD_ABR:
+                lame_set_VBR( gfp, vbr_abr ); 
+                break;
+
+            default:
+                /* unsupported VBR method */
+                assert( FALSE );
+            }
+        }
+        else
+        {
+            /* use CBR encoding method, so turn off VBR */
+            lame_set_VBR( gfp, vbr_off );
+        }
+
+        /* Set bitrate.  (CDex users always specify bitrate=Min bitrate when using VBR) */
+        lame_set_brate( gfp, lameConfig.format.LHV1.dwBitrate );
+
+        /* check if we have to use ABR, in order to backwards compatible, this
+        * condition should still be checked indepedent of the nVbrMethod method
+        */
+        if (lameConfig.format.LHV1.dwVbrAbr_bps > 0 )
+        {
+            /* set VBR method to ABR */
+            lame_set_VBR( gfp, vbr_abr );
+
+            /* calculate to kbps, round to nearest kbps */
+            lame_set_VBR_mean_bitrate_kbps( gfp, ( lameConfig.format.LHV1.dwVbrAbr_bps + 500 ) / 1000 );
+
+            /* limit range */
+            if( lame_get_VBR_mean_bitrate_kbps( gfp ) > 320)
+            {
+                lame_set_VBR_mean_bitrate_kbps( gfp, 320 );
+            }
+
+            if( lame_get_VBR_mean_bitrate_kbps( gfp ) < 8 )
+            {
+                lame_set_VBR_mean_bitrate_kbps( gfp, 8 );
+            }
+        }
+
+    }
+
+    // First set all the preset options
+    if ( LQP_NOPRESET !=  lameConfig.format.LHV1.nPreset )
+    {
+        PresetOptions( gfp, lameConfig.format.LHV1.nPreset );
+    }
+
+
+    // Set frequency resampling rate, if specified
+    if ( lameConfig.format.LHV1.dwReSampleRate > 0 )
+    {
+        lame_set_out_samplerate( gfp, lameConfig.format.LHV1.dwReSampleRate );
+    }
+
+
+    switch ( lameConfig.format.LHV1.nMode )
+    {
+    case BE_MP3_MODE_MONO:
+        lame_set_mode( gfp, MONO );
+        lame_set_num_channels( gfp, 1 );
+        break;
+
+    default:
+        break;
+    }
+
+
+    // Use strict ISO encoding?
+    lame_set_strict_ISO( gfp, ( lameConfig.format.LHV1.bStrictIso ) ? 1 : 0 );
+
+    // Set copyright flag?
+    if ( lameConfig.format.LHV1.bCopyright )
+    {
+        lame_set_copyright( gfp, 1 );
+    }
+
+    // Do we have to tag  it as non original 
+    if ( !lameConfig.format.LHV1.bOriginal )
+    {
+        lame_set_original( gfp, 0 );
+    }
+    else
+    {
+        lame_set_original( gfp, 1 );
+    }
+
+    // Add CRC?
+    if ( lameConfig.format.LHV1.bCRC )
+    {
+        lame_set_error_protection( gfp, 1 );
+    }
+    else
+    {
+        lame_set_error_protection( gfp, 0 );
+    }
+
+    // Set private bit?
+    if ( lameConfig.format.LHV1.bPrivate )
+    {
+        lame_set_extension( gfp, 1 );
+    }
+    else
+    {
+        lame_set_extension( gfp, 0 );
+    }
+
+
+    // Set VBR min bitrate, if specified
+    if ( lameConfig.format.LHV1.dwBitrate > 0 )
+    {
+        lame_set_VBR_min_bitrate_kbps( gfp, lameConfig.format.LHV1.dwBitrate );
+    }
+
+    // Set Maxbitrate, if specified
+    if ( lameConfig.format.LHV1.dwMaxBitrate > 0 )
+    {
+        lame_set_VBR_max_bitrate_kbps( gfp, lameConfig.format.LHV1.dwMaxBitrate );
+    }
+    // Set bit resovoir option
+    if ( lameConfig.format.LHV1.bNoRes )
+    {
+        lame_set_disable_reservoir( gfp,1 );
+    }
+
+    // check if the VBR tag is required
+    if ( lameConfig.format.LHV1.bWriteVBRHeader ) 
+    {
+        lame_set_bWriteVbrTag( gfp, 1 );
+    }
+    else
+    {
+        lame_set_bWriteVbrTag( gfp, 0 );
+    }
+
+    // Override Quality setting, use HIGHBYTE = NOT LOWBYTE to be backwards compatible
+    if (	( lameConfig.format.LHV1.nQuality & 0xFF ) ==
+        ((~( lameConfig.format.LHV1.nQuality >> 8 )) & 0xFF) )
+    {
+        lame_set_quality( gfp, lameConfig.format.LHV1.nQuality & 0xFF );
+    }
+
+    if ( 0 != ( nInitReturn = lame_init_params( gfp ) ) )
+    {
+        return nInitReturn;
+    }
+
+    //LAME encoding call will accept any number of samples.  
+    if ( 0 == lame_get_version( gfp ) )
+    {
+        // For MPEG-II, only 576 samples per frame per channel
+        *dwSamples= 576 * lame_get_num_channels( gfp );
+    }
+    else
+    {
+        // For MPEG-I, 1152 samples per frame per channel
+        *dwSamples= 1152 * lame_get_num_channels( gfp );
+    }
+
+    // Set the input sample buffer size, so we know what we can expect
+    dwSampleBufferSize = *dwSamples;
+
+    // Set MP3 buffer size, conservative estimate
+    *dwBufferSize=(DWORD)( 1.25 * ( *dwSamples / lame_get_num_channels( gfp ) ) + 7200 );
+
+    // For debugging purposes
+    dump_config( gfp );
+
+    // Everything went OK, thus return SUCCESSFUL
+    return BE_ERR_SUCCESSFUL;
+}
+
+
+
+__declspec(dllexport) BE_ERR	beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput)
+{
+    int nOutputSamples = 0;
+
+    lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
+
+    // Init the global flags structure
+    nOutputSamples = lame_encode_flush_nogap( gfp, pOutput, LAME_MAXMP3BUFFER );
+
+    if ( nOutputSamples < 0 )
+    {
+        *pdwOutput = 0;
+        return BE_ERR_BUFFER_TOO_SMALL;
+    }
+    else
+    {
+        *pdwOutput = nOutputSamples;
+    }
+
+    return BE_ERR_SUCCESSFUL;
+}
+
+__declspec(dllexport) BE_ERR	beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput)
+{
+    int nOutputSamples = 0;
+
+    lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
+
+    nOutputSamples = lame_encode_flush( gfp, pOutput, 0 );
+
+    if ( nOutputSamples < 0 )
+    {
+        *pdwOutput = 0;
+        return BE_ERR_BUFFER_TOO_SMALL;
+    }
+    else
+    {
+        *pdwOutput = nOutputSamples;
+    }
+
+    return BE_ERR_SUCCESSFUL;
+}
+
+
+__declspec(dllexport) BE_ERR	beCloseStream(HBE_STREAM hbeStream)
+{
+    lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
+
+    // lame will be close in VbrWriteTag function
+    if ( !lame_get_bWriteVbrTag( gfp ) )
+    {
+        // clean up of allocated memory
+        lame_close( gfp );
+
+        gfp_save = NULL;
+    }
+    else
+    {
+        gfp_save = (lame_global_flags*)hbeStream;
+    }
+
+    // DeInit encoder
+    return BE_ERR_SUCCESSFUL;
+}
+
+
+
+__declspec(dllexport) VOID		beVersion(PBE_VERSION pbeVersion)
+{
+    // DLL Release date
+    char lpszDate[20]	= { '\0', };
+    char lpszTemp[5]	= { '\0', };
+    lame_version_t lv   = { 0, };
+
+
+    // Set DLL interface version
+    pbeVersion->byDLLMajorVersion=MAJORVERSION;
+    pbeVersion->byDLLMinorVersion=MINORVERSION;
+
+    get_lame_version_numerical ( &lv );
+
+    // Set Engine version number (Same as Lame version)
+    pbeVersion->byMajorVersion = lv.major;
+    pbeVersion->byMinorVersion = lv.minor;
+    pbeVersion->byAlphaLevel   = lv.alpha;
+    pbeVersion->byBetaLevel	   = lv.beta;
+
+#ifdef MMX_choose_table
+    pbeVersion->byMMXEnabled=1;
+#else
+    pbeVersion->byMMXEnabled=0;
+#endif
+
+    memset( pbeVersion->btReserved, 0, sizeof( pbeVersion->btReserved ) );
+
+    // Get compilation date
+    strcpy(lpszDate,__DATE__);
+
+    // Get the first three character, which is the month
+    strncpy(lpszTemp,lpszDate,3);
+    lpszTemp[3] = '\0';
+    pbeVersion->byMonth=1;
+
+    // Set month
+    if (strcmp(lpszTemp,"Jan")==0)	pbeVersion->byMonth = 1;
+    if (strcmp(lpszTemp,"Feb")==0)	pbeVersion->byMonth = 2;
+    if (strcmp(lpszTemp,"Mar")==0)	pbeVersion->byMonth = 3;
+    if (strcmp(lpszTemp,"Apr")==0)	pbeVersion->byMonth = 4;
+    if (strcmp(lpszTemp,"May")==0)	pbeVersion->byMonth = 5;
+    if (strcmp(lpszTemp,"Jun")==0)	pbeVersion->byMonth = 6;
+    if (strcmp(lpszTemp,"Jul")==0)	pbeVersion->byMonth = 7;
+    if (strcmp(lpszTemp,"Aug")==0)	pbeVersion->byMonth = 8;
+    if (strcmp(lpszTemp,"Sep")==0)	pbeVersion->byMonth = 9;
+    if (strcmp(lpszTemp,"Oct")==0)	pbeVersion->byMonth = 10;
+    if (strcmp(lpszTemp,"Nov")==0)	pbeVersion->byMonth = 11;
+    if (strcmp(lpszTemp,"Dec")==0)	pbeVersion->byMonth = 12;
+
+    // Get day of month string (char [4..5])
+    pbeVersion->byDay=atoi( lpszDate + 4 );
+
+    // Get year of compilation date (char [7..10])
+    pbeVersion->wYear = atoi( lpszDate + 7 );
+
+    memset( pbeVersion->zHomepage, 0x00, BE_MAX_HOMEPAGE );
+
+    strcpy( pbeVersion->zHomepage, "http://www.mp3dev.org/" );
+}
+
+__declspec(dllexport) BE_ERR	beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, 
+                                              PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput)
+{
+    // Encode it
+    int dwSamples;
+    int	nOutputSamples = 0;
+    lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
+
+    dwSamples = nSamples / lame_get_num_channels( gfp );
+
+    // old versions of lame_enc.dll required exactly 1152 samples
+    // and worked even if nSamples accidently set to 2304 
+    // simulate this behavoir:
+    if ( 1 == lame_get_num_channels( gfp ) && nSamples == 2304)
+    {
+        dwSamples/= 2;
+    }
+
+
+    if ( 1 == lame_get_num_channels( gfp ) )
+    {
+        nOutputSamples = lame_encode_buffer(gfp,pSamples,pSamples,dwSamples,pOutput,0);
+    }
+    else
+    {
+        nOutputSamples = lame_encode_buffer_interleaved(gfp,pSamples,dwSamples,pOutput,0);
+    }
+
+
+    if ( nOutputSamples < 0 )
+    {
+        *pdwOutput=0;
+        return BE_ERR_BUFFER_TOO_SMALL;
+    }
+    else
+    {
+        *pdwOutput = (DWORD)nOutputSamples;
+    }
+
+    return BE_ERR_SUCCESSFUL;
+}
+
+
+// accept floating point audio samples, scaled to the range of a signed 16-bit
+//  integer (within +/- 32768), in non-interleaved channels  -- DSPguru, jd
+__declspec(dllexport) BE_ERR	beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, 
+                                                        PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput)
+{
+    int nOutputSamples;
+    lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
+
+    nOutputSamples = lame_encode_buffer_float(gfp,buffer_l,buffer_r,nSamples,pOutput,0);
+
+    if ( nOutputSamples >= 0 )
+    {
+        *pdwOutput = (DWORD) nOutputSamples;
+    }
+    else
+    {
+        *pdwOutput=0;
+        return BE_ERR_BUFFER_TOO_SMALL;
+    }
+
+    return BE_ERR_SUCCESSFUL;
+}
+
+static int
+maybeSyncWord(FILE* fpStream)
+{
+    unsigned char mp3_frame_header[4];
+    size_t nbytes = fread(mp3_frame_header, 1, sizeof(mp3_frame_header), fpStream);
+    if ( nbytes != sizeof(mp3_frame_header) ) {
+        return -1;
+    }
+    if ( mp3_frame_header[0] != 0xffu ) {
+        return -1; /* doesn't look like a sync word */
+    }
+    if ( (mp3_frame_header[1] & 0xE0u) != 0xE0u ) {
+        return -1; /* doesn't look like a sync word */
+    }
+    return 0;
+}
+
+static int
+skipId3v2(FILE * fpStream, size_t lametag_frame_size)
+{
+    size_t  nbytes;
+    size_t  id3v2TagSize = 0;
+    unsigned char id3v2Header[10];
+
+    /* seek to the beginning of the stream */
+    if (fseek(fpStream, 0, SEEK_SET) != 0) {
+        return -2;  /* not seekable, abort */
+    }
+    /* read 10 bytes in case there's an ID3 version 2 header here */
+    nbytes = fread(id3v2Header, 1, sizeof(id3v2Header), fpStream);
+    if (nbytes != sizeof(id3v2Header)) {
+        return -3;  /* not readable, maybe opened Write-Only */
+    }
+    /* does the stream begin with the ID3 version 2 file identifier? */
+    if (!strncmp((char *) id3v2Header, "ID3", 3)) {
+        /* the tag size (minus the 10-byte header) is encoded into four
+        * bytes where the most significant bit is clear in each byte
+        */
+        id3v2TagSize = (((id3v2Header[6] & 0x7f) << 21)
+            | ((id3v2Header[7] & 0x7f) << 14)
+            | ((id3v2Header[8] & 0x7f) << 7)
+            | (id3v2Header[9] & 0x7f))
+            + sizeof id3v2Header;
+    }
+    /* Seek to the beginning of the audio stream */
+    if ( fseek(fpStream, id3v2TagSize, SEEK_SET) != 0 ) {
+        return -2;
+    }
+    if ( maybeSyncWord(fpStream) != 0) {
+        return -1;
+    }
+    if ( fseek(fpStream, id3v2TagSize+lametag_frame_size, SEEK_SET) != 0 ) {
+        return -2;
+    }
+    if ( maybeSyncWord(fpStream) != 0) {
+        return -1;
+    }
+    /* OK, it seems we found our LAME-Tag/Xing frame again */
+    /* Seek to the beginning of the audio stream */
+    if ( fseek(fpStream, id3v2TagSize, SEEK_SET) != 0 ) {
+        return -2;
+    }
+    return 0;
+}
+
+static BE_ERR
+updateLameTagFrame(lame_global_flags* gfp, FILE* fpStream)
+{
+    size_t n = lame_get_lametag_frame( gfp, 0, 0 ); /* ask for bufer size */
+
+    if ( n > 0 )
+    {
+        unsigned char* buffer = 0;
+        size_t m = 1;
+
+        if ( 0 != skipId3v2(fpStream, n) ) 
+        {
+            DispErr( "Error updating LAME-tag frame:\n\n"
+                     "can't locate old frame\n" );
+            return BE_ERR_INVALID_FORMAT_PARAMETERS;
+        }
+
+        buffer = malloc( n );
+
+        if ( buffer == 0 ) 
+        {
+            DispErr( "Error updating LAME-tag frame:\n\n"
+                     "can't allocate frame buffer\n" );
+            return BE_ERR_INVALID_FORMAT_PARAMETERS;
+        }
+
+        /* Put it all to disk again */
+        n = lame_get_lametag_frame( gfp, buffer, n );
+        if ( n > 0 ) 
+        {
+            m = fwrite( buffer, n, 1, fpStream );        
+        }
+        free( buffer );
+
+        if ( m != 1 ) 
+        {
+            DispErr( "Error updating LAME-tag frame:\n\n"
+                     "couldn't write frame into file\n" );
+            return BE_ERR_INVALID_FORMAT_PARAMETERS;
+        }
+    }
+    return BE_ERR_SUCCESSFUL;
+}
+
+__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream,
+                                            LPCSTR lpszFileName )
+{
+    FILE* fpStream	= NULL;
+    BE_ERR beResult	= BE_ERR_SUCCESSFUL;
+
+    lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
+
+    if ( NULL != gfp )
+    {
+        // Do we have to write the VBR tag?
+        if ( lame_get_bWriteVbrTag( gfp ) )
+        {
+            // Try to open the file
+            fpStream=fopen( lpszFileName, "rb+" );
+
+            // Check file open result
+            if ( NULL == fpStream )
+            {
+                beResult = BE_ERR_INVALID_FORMAT_PARAMETERS;
+                DispErr( "Error updating LAME-tag frame:\n\n"
+                         "can't open file for reading and writing\n" );
+            }
+            else
+            {
+                beResult = updateLameTagFrame( gfp, fpStream );
+
+                // Close the file stream
+                fclose( fpStream );
+            }
+        }
+
+        // clean up of allocated memory
+        lame_close( gfp );
+    }
+    else
+    {
+        beResult = BE_ERR_INVALID_FORMAT_PARAMETERS;
+    }
+
+    // return result
+    return beResult;
+}
+
+// for backwards compatiblity
+__declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName)
+{
+    return beWriteInfoTag( (HBE_STREAM)gfp_save, lpszFileName );
+}
+
+
+BOOL APIENTRY DllMain(HANDLE hModule, 
+                      DWORD  ul_reason_for_call, 
+                      LPVOID lpReserved)
+{
+    gs_hModule=hModule;
+
+    switch( ul_reason_for_call )
+    {
+    case DLL_PROCESS_ATTACH:
+        // Enable debug/logging?
+        gs_bLogFile = GetPrivateProfileIntA("Debug","WriteLogFile",gs_bLogFile,"lame_enc.ini");
+        break;
+    case DLL_THREAD_ATTACH:
+        break;
+    case DLL_THREAD_DETACH:
+        break;
+    case DLL_PROCESS_DETACH:
+        break;
+    }
+    return TRUE;
+}
+
+
+static void dump_config( 	lame_global_flags*	gfp )
+{
+    DebugPrintf("\n\nLame_enc configuration options:\n");
+    DebugPrintf("==========================================================\n");
+
+    DebugPrintf("version                =%d\n",lame_get_version( gfp ) );
+    DebugPrintf("Layer                  =3\n");
+    DebugPrintf("mode                   =");
+    switch ( lame_get_mode( gfp ) )
+    {
+    case STEREO:       DebugPrintf( "Stereo\n" ); break;
+    case JOINT_STEREO: DebugPrintf( "Joint-Stereo\n" ); break;
+    case DUAL_CHANNEL: DebugPrintf( "Forced Stereo\n" ); break;
+    case MONO:         DebugPrintf( "Mono\n" ); break;
+    case NOT_SET:      /* FALLTROUGH */
+    default:           DebugPrintf( "Error (unknown)\n" ); break;
+    }
+
+    DebugPrintf("Input sample rate      =%.1f kHz\n", lame_get_in_samplerate( gfp ) /1000.0 );
+    DebugPrintf("Output sample rate     =%.1f kHz\n", lame_get_out_samplerate( gfp ) /1000.0 );
+
+    DebugPrintf("bitrate                =%d kbps\n", lame_get_brate( gfp ) );
+    DebugPrintf("Quality Setting        =%d\n", lame_get_quality( gfp ) );
+
+    DebugPrintf("Low pass frequency     =%d\n", lame_get_lowpassfreq( gfp ) );
+    DebugPrintf("Low pass width         =%d\n", lame_get_lowpasswidth( gfp ) );
+
+    DebugPrintf("High pass frequency    =%d\n", lame_get_highpassfreq( gfp ) );
+    DebugPrintf("High pass width        =%d\n", lame_get_highpasswidth( gfp ) );
+
+    DebugPrintf("No short blocks        =%d\n", lame_get_no_short_blocks( gfp ) );
+    DebugPrintf("Force short blocks     =%d\n", lame_get_force_short_blocks( gfp ) );
+
+    DebugPrintf("de-emphasis            =%d\n", lame_get_emphasis( gfp ) );
+    DebugPrintf("private flag           =%d\n", lame_get_extension( gfp ) );
+
+    DebugPrintf("copyright flag         =%d\n", lame_get_copyright( gfp ) );
+    DebugPrintf("original flag          =%d\n",	lame_get_original( gfp ) );
+    DebugPrintf("CRC                    =%s\n", lame_get_error_protection( gfp ) ? "on" : "off" );
+    DebugPrintf("Fast mode              =%s\n", ( lame_get_quality( gfp ) )? "enabled" : "disabled" );
+    DebugPrintf("Force mid/side stereo  =%s\n", ( lame_get_force_ms( gfp ) )?"enabled":"disabled" );
+    DebugPrintf("Disable Reservoir      =%d\n", lame_get_disable_reservoir( gfp ) );
+    DebugPrintf("Allow diff-short       =%d\n", lame_get_allow_diff_short( gfp ) );
+    DebugPrintf("Interchannel masking   =%f\n", lame_get_interChRatio( gfp ) );
+    DebugPrintf("Strict ISO Encoding    =%s\n", ( lame_get_strict_ISO( gfp ) ) ?"Yes":"No");
+    DebugPrintf("Scale                  =%5.2f\n", lame_get_scale( gfp ) );
+
+    DebugPrintf("VBR                    =%s, VBR_q =%d, VBR method =",
+        ( lame_get_VBR( gfp ) !=vbr_off ) ? "enabled": "disabled",
+        lame_get_VBR_q( gfp ) );
+
+    switch ( lame_get_VBR( gfp ) )
+    {
+    case vbr_off:	DebugPrintf( "vbr_off\n" );	break;
+    case vbr_mt :	DebugPrintf( "vbr_mt \n" );	break;
+    case vbr_rh :	DebugPrintf( "vbr_rh \n" );	break;
+    case vbr_mtrh:	DebugPrintf( "vbr_mtrh \n" );	break;
+    case vbr_abr: 
+        DebugPrintf( "vbr_abr (average bitrate %d kbps)\n", lame_get_VBR_mean_bitrate_kbps( gfp ) );
+        break;
+    default:
+        DebugPrintf("error, unknown VBR setting\n");
+        break;
+    }
+
+    DebugPrintf("Vbr Min bitrate        =%d kbps\n", lame_get_VBR_min_bitrate_kbps( gfp ) );
+    DebugPrintf("Vbr Max bitrate        =%d kbps\n", lame_get_VBR_max_bitrate_kbps( gfp ) );
+
+    DebugPrintf("Write VBR Header       =%s\n", ( lame_get_bWriteVbrTag( gfp ) ) ?"Yes":"No");
+    DebugPrintf("VBR Hard min           =%d\n", lame_get_VBR_hard_min( gfp ) );
+
+    DebugPrintf("ATH Only               =%d\n", lame_get_ATHonly( gfp ) );
+    DebugPrintf("ATH short              =%d\n", lame_get_ATHshort( gfp ) );
+    DebugPrintf("ATH no                 =%d\n", lame_get_noATH( gfp ) );
+    DebugPrintf("ATH type               =%d\n", lame_get_ATHtype( gfp ) );
+    DebugPrintf("ATH lower              =%f\n", lame_get_ATHlower( gfp ) );
+    DebugPrintf("ATH aa                 =%d\n", lame_get_athaa_type( gfp ) );
+    DebugPrintf("ATH aa  loudapprox     =%d\n", lame_get_athaa_loudapprox( gfp ) );
+    DebugPrintf("ATH aa  sensitivity    =%f\n", lame_get_athaa_sensitivity( gfp ) );
+
+    DebugPrintf("Experimental nspsytune =%d\n", lame_get_exp_nspsytune( gfp ) );
+    DebugPrintf("Experimental X         =%d\n", lame_get_experimentalX( gfp ) );
+    DebugPrintf("Experimental Y         =%d\n", lame_get_experimentalY( gfp ) );
+    DebugPrintf("Experimental Z         =%d\n", lame_get_experimentalZ( gfp ) );
+}
+
+
+static void DispErr(char const* strErr)
+{
+    MessageBoxA(NULL,strErr,"LAME_ENC.DLL",MB_OK|MB_ICONHAND);
+}
diff --git a/Dll/BladeMP3EncDLL.def b/Dll/BladeMP3EncDLL.def
new file mode 100644
index 0000000..4a83415
--- /dev/null
+++ b/Dll/BladeMP3EncDLL.def
@@ -0,0 +1,36 @@
+LIBRARY  lame_enc.DLL
+EXPORTS
+
+beInitStream			@1
+beEncodeChunk			@2
+beDeinitStream			@3
+beCloseStream			@4
+beVersion				@5
+beWriteVBRHeader		@6
+beEncodeChunkFloatS16NI	@7
+beFlushNoGap			@8
+beWriteInfoTag			@9
+
+lame_init						@100
+lame_close						@101
+lame_init_params				@102
+lame_encode_buffer_interleaved	@110
+lame_encode_flush				@120
+lame_mp3_tags_fid				@130
+
+
+lame_set_num_samples			@1000
+lame_get_num_samples			@1001
+lame_set_in_samplerate			@1002
+lame_get_in_samplerate			@1003
+lame_set_num_channels			@1004
+lame_get_num_channels			@1005
+lame_set_scale					@1006
+lame_get_scale					@1007
+lame_set_scale_left				@1008
+lame_get_scale_left				@1009
+lame_set_scale_right			@1010
+lame_get_scale_right			@1011
+lame_set_out_samplerate			@1012
+lame_get_out_samplerate			@1013
+
diff --git a/Dll/BladeMP3EncDLL.h b/Dll/BladeMP3EncDLL.h
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/Dll/BladeMP3EncDLL.h
@@ -0,0 +1,280 @@
+/*
+ * Blade Type of DLL Interface for Lame encoder
+ *
+ * Copyright (c) 1999-2002 A.L. Faber
+ * Based on bladedll.h version 1.0 written by Jukka Poikolainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA  02111-1307, USA.
+ */
+
+#ifndef ___BLADEDLL_H_INCLUDED___
+#define ___BLADEDLL_H_INCLUDED___
+
+#ifdef __GNUC__
+#define ATTRIBUTE_PACKED	__attribute__((packed))
+#else
+#define ATTRIBUTE_PACKED
+#pragma pack(push)
+#pragma pack(1)
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/* encoding formats */
+
+#define		BE_CONFIG_MP3			0										
+#define		BE_CONFIG_LAME			256		
+
+/* type definitions */
+
+typedef		unsigned long			HBE_STREAM;
+typedef		HBE_STREAM				*PHBE_STREAM;
+typedef		unsigned long			BE_ERR;
+
+/* error codes */
+
+#define		BE_ERR_SUCCESSFUL					0x00000000
+#define		BE_ERR_INVALID_FORMAT				0x00000001
+#define		BE_ERR_INVALID_FORMAT_PARAMETERS	0x00000002
+#define		BE_ERR_NO_MORE_HANDLES				0x00000003
+#define		BE_ERR_INVALID_HANDLE				0x00000004
+#define		BE_ERR_BUFFER_TOO_SMALL				0x00000005
+
+/* other constants */
+
+#define		BE_MAX_HOMEPAGE			128
+
+/* format specific variables */
+
+#define		BE_MP3_MODE_STEREO		0
+#define		BE_MP3_MODE_JSTEREO		1
+#define		BE_MP3_MODE_DUALCHANNEL	2
+#define		BE_MP3_MODE_MONO		3
+
+
+
+#define		MPEG1	1
+#define		MPEG2	0
+
+#ifdef _BLADEDLL
+#undef FLOAT
+	#include <Windows.h>
+#endif
+
+#define CURRENT_STRUCT_VERSION 1
+#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG)	// is currently 331 bytes
+
+
+typedef enum
+{
+	VBR_METHOD_NONE			= -1,
+	VBR_METHOD_DEFAULT		=  0,
+	VBR_METHOD_OLD			=  1,
+	VBR_METHOD_NEW			=  2,
+	VBR_METHOD_MTRH			=  3,
+	VBR_METHOD_ABR			=  4
+} VBRMETHOD;
+
+typedef enum 
+{
+	LQP_NOPRESET			=-1,
+
+	// QUALITY PRESETS
+	LQP_NORMAL_QUALITY		= 0,
+	LQP_LOW_QUALITY			= 1,
+	LQP_HIGH_QUALITY		= 2,
+	LQP_VOICE_QUALITY		= 3,
+	LQP_R3MIX				= 4,
+	LQP_VERYHIGH_QUALITY	= 5,
+	LQP_STANDARD			= 6,
+	LQP_FAST_STANDARD		= 7,
+	LQP_EXTREME				= 8,
+	LQP_FAST_EXTREME		= 9,
+	LQP_INSANE				= 10,
+	LQP_ABR					= 11,
+	LQP_CBR					= 12,
+	LQP_MEDIUM				= 13,
+	LQP_FAST_MEDIUM			= 14,
+
+	// NEW PRESET VALUES
+	LQP_PHONE	=1000,
+	LQP_SW		=2000,
+	LQP_AM		=3000,
+	LQP_FM		=4000,
+	LQP_VOICE	=5000,
+	LQP_RADIO	=6000,
+	LQP_TAPE	=7000,
+	LQP_HIFI	=8000,
+	LQP_CD		=9000,
+	LQP_STUDIO	=10000
+
+} LAME_QUALITY_PRESET;
+
+
+
+typedef struct	{
+	DWORD	dwConfig;			// BE_CONFIG_XXXXX
+								// Currently only BE_CONFIG_MP3 is supported
+	union	{
+
+		struct	{
+
+			DWORD	dwSampleRate;		// 48000, 44100 and 32000 allowed
+			BYTE	byMode;			// BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
+			WORD	wBitrate;		// 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
+			BOOL	bPrivate;		
+			BOOL	bCRC;
+			BOOL	bCopyright;
+			BOOL	bOriginal;
+
+			} mp3;					// BE_CONFIG_MP3
+
+			struct
+			{
+			// STRUCTURE INFORMATION
+			DWORD			dwStructVersion;	
+			DWORD			dwStructSize;
+
+			// BASIC ENCODER SETTINGS
+			DWORD			dwSampleRate;		// SAMPLERATE OF INPUT FILE
+			DWORD			dwReSampleRate;		// DOWNSAMPLERATE, 0=ENCODER DECIDES  
+			LONG			nMode;				// BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
+			DWORD			dwBitrate;			// CBR bitrate, VBR min bitrate
+			DWORD			dwMaxBitrate;		// CBR ignored, VBR Max bitrate
+			LONG			nPreset;			// Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
+			DWORD			dwMpegVersion;		// FUTURE USE, MPEG-1 OR MPEG-2
+			DWORD			dwPsyModel;			// FUTURE USE, SET TO 0
+			DWORD			dwEmphasis;			// FUTURE USE, SET TO 0
+
+			// BIT STREAM SETTINGS
+			BOOL			bPrivate;			// Set Private Bit (TRUE/FALSE)
+			BOOL			bCRC;				// Insert CRC (TRUE/FALSE)
+			BOOL			bCopyright;			// Set Copyright Bit (TRUE/FALSE)
+			BOOL			bOriginal;			// Set Original Bit (TRUE/FALSE)
+			
+			// VBR STUFF
+			BOOL			bWriteVBRHeader;	// WRITE XING VBR HEADER (TRUE/FALSE)
+			BOOL			bEnableVBR;			// USE VBR ENCODING (TRUE/FALSE)
+			INT				nVBRQuality;		// VBR QUALITY 0..9
+			DWORD			dwVbrAbr_bps;		// Use ABR in stead of nVBRQuality
+			VBRMETHOD		nVbrMethod;
+			BOOL			bNoRes;				// Disable Bit resorvoir (TRUE/FALSE)
+
+			// MISC SETTINGS
+			BOOL			bStrictIso;			// Use strict ISO encoding rules (TRUE/FALSE)
+			WORD			nQuality;			// Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
+
+			// FUTURE USE, SET TO 0, align strucutre to 331 bytes
+			BYTE			btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
+
+			} LHV1;					// LAME header version 1
+
+		struct	{
+
+			DWORD	dwSampleRate;
+			BYTE	byMode;
+			WORD	wBitrate;
+			BYTE	byEncodingMethod;
+
+		} aac;
+
+	} format;
+		
+} BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED;
+
+
+typedef struct	{
+
+	// BladeEnc DLL Version number
+
+	BYTE	byDLLMajorVersion;
+	BYTE	byDLLMinorVersion;
+
+	// BladeEnc Engine Version Number
+
+	BYTE	byMajorVersion;
+	BYTE	byMinorVersion;
+
+	// DLL Release date
+
+	BYTE	byDay;
+	BYTE	byMonth;
+	WORD	wYear;
+
+	// BladeEnc	Homepage URL
+
+	CHAR	zHomepage[BE_MAX_HOMEPAGE + 1];	
+
+	BYTE	byAlphaLevel;
+	BYTE	byBetaLevel;
+	BYTE	byMMXEnabled;
+
+	BYTE	btReserved[125];
+
+
+} BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED;
+
+#ifndef _BLADEDLL
+
+typedef BE_ERR	(*BEINITSTREAM)			(PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
+typedef BE_ERR	(*BEENCODECHUNK)		(HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
+
+// added for floating point audio  -- DSPguru, jd
+typedef BE_ERR	(*BEENCODECHUNKFLOATS16NI)	(HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
+typedef BE_ERR	(*BEDEINITSTREAM)			(HBE_STREAM, PBYTE, PDWORD);
+typedef BE_ERR	(*BECLOSESTREAM)			(HBE_STREAM);
+typedef VOID	(*BEVERSION)				(PBE_VERSION);
+typedef BE_ERR	(*BEWRITEVBRHEADER)			(LPCSTR);
+typedef BE_ERR	(*BEWRITEINFOTAG)			(HBE_STREAM, LPCSTR );
+
+#define	TEXT_BEINITSTREAM				"beInitStream"
+#define	TEXT_BEENCODECHUNK				"beEncodeChunk"
+#define	TEXT_BEENCODECHUNKFLOATS16NI	"beEncodeChunkFloatS16NI"
+#define	TEXT_BEDEINITSTREAM				"beDeinitStream"
+#define	TEXT_BECLOSESTREAM				"beCloseStream"
+#define	TEXT_BEVERSION					"beVersion"
+#define	TEXT_BEWRITEVBRHEADER			"beWriteVBRHeader"
+#define	TEXT_BEFLUSHNOGAP				"beFlushNoGap"
+#define	TEXT_BEWRITEINFOTAG				"beWriteInfoTag"
+
+
+#else
+
+__declspec(dllexport) BE_ERR	beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
+__declspec(dllexport) BE_ERR	beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
+
+// added for floating point audio  -- DSPguru, jd
+__declspec(dllexport) BE_ERR	beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
+__declspec(dllexport) BE_ERR	beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
+__declspec(dllexport) BE_ERR	beCloseStream(HBE_STREAM hbeStream);
+__declspec(dllexport) VOID		beVersion(PBE_VERSION pbeVersion);
+__declspec(dllexport) BE_ERR	beWriteVBRHeader(LPCSTR lpszFileName);
+__declspec(dllexport) BE_ERR	beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
+__declspec(dllexport) BE_ERR	beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName );
+
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#ifndef __GNUC__
+#pragma pack(pop)
+#endif
+
+#endif
diff --git a/Dll/Example.cpp b/Dll/Example.cpp
new file mode 100644
index 0000000..fec7565
--- /dev/null
+++ b/Dll/Example.cpp
@@ -0,0 +1,288 @@
+/*
+ *	LAME DLL Sample Code.
+ *
+ *	Copyright (c) 2000 A.L. Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA  02111-1307, USA.
+ */
+
+
+#include <windows.h>
+#include <stdio.h>
+#include <io.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include "BladeMP3EncDLL.h"
+
+BEINITSTREAM		beInitStream=NULL;
+BEENCODECHUNK		beEncodeChunk=NULL;
+BEDEINITSTREAM		beDeinitStream=NULL;
+BECLOSESTREAM		beCloseStream=NULL;
+BEVERSION			beVersion=NULL;
+BEWRITEVBRHEADER	beWriteVBRHeader=NULL;
+BEWRITEINFOTAG		beWriteInfoTag=NULL;
+
+
+// Main program
+int main(int argc, char *argv[])
+{	
+	HINSTANCE	hDLL			=NULL;
+	FILE*		pFileIn			=NULL;
+	FILE*		pFileOut		=NULL;
+	BE_VERSION	Version			={0,};
+	BE_CONFIG	beConfig		={0,};
+
+	CHAR		strFileIn[255]	={'0',};
+	CHAR		strFileOut[255]	={'0',};
+
+	DWORD		dwSamples		=0;
+	DWORD		dwMP3Buffer		=0;
+	HBE_STREAM	hbeStream		=0;
+	BE_ERR		err				=0;
+
+	PBYTE		pMP3Buffer		=NULL;
+	PSHORT		pWAVBuffer		=NULL;
+
+	// check number of arguments
+	if(argc != 2)
+	{
+		fprintf(stderr,"Usage: %s <filename.wav>\n", argv[0]);
+		fprintf(stderr,"Descr: Short demo to show how to use the lame_enc.dll library file\n");
+		fprintf(stderr,"Note : WAV file is assumed to to have the following parameters\n");
+		fprintf(stderr,"     : 44100 Hz, stereo, 16 Bits per sample\n");
+		return -1;
+	}
+
+	// Setup the file names
+	strcpy(strFileIn ,argv[1]);
+	strcpy(strFileOut,argv[1]);
+
+	// Add mp3 extention
+	strcat(strFileOut,".mp3");
+
+	// Load lame_enc.dll library (Make sure though that you set the 
+	// project/settings/debug Working Directory correctly, otherwhise the DLL can't be loaded
+
+	hDLL = LoadLibrary("lame_enc.dll");
+
+  	if ( NULL == hDLL )
+  	{
+  		hDLL = LoadLibrary("..\\..\\output\\lame_enc.dll");
+  	}
+
+	if( NULL == hDLL )
+	{
+		fprintf(stderr,"Error loading lame_enc.DLL");
+		return -1;
+	}
+
+	// Get Interface functions from the DLL
+	beInitStream	= (BEINITSTREAM) GetProcAddress(hDLL, TEXT_BEINITSTREAM);
+	beEncodeChunk	= (BEENCODECHUNK) GetProcAddress(hDLL, TEXT_BEENCODECHUNK);
+	beDeinitStream	= (BEDEINITSTREAM) GetProcAddress(hDLL, TEXT_BEDEINITSTREAM);
+	beCloseStream	= (BECLOSESTREAM) GetProcAddress(hDLL, TEXT_BECLOSESTREAM);
+	beVersion		= (BEVERSION) GetProcAddress(hDLL, TEXT_BEVERSION);
+	beWriteVBRHeader= (BEWRITEVBRHEADER) GetProcAddress(hDLL,TEXT_BEWRITEVBRHEADER);
+	beWriteInfoTag  = (BEWRITEINFOTAG) GetProcAddress(hDLL,TEXT_BEWRITEINFOTAG);
+
+	// Check if all interfaces are present
+	if(!beInitStream || !beEncodeChunk || !beDeinitStream || !beCloseStream || !beVersion || !beWriteVBRHeader)
+	{
+		printf("Unable to get LAME interfaces");
+		return -1;
+	}
+
+	// Get the version number
+	beVersion( &Version );
+
+	printf(
+			"lame_enc.dll version %u.%02u (%u/%u/%u)\n"
+			"lame_enc Engine %u.%02u\n"
+			"lame_enc homepage at %s\n\n",	
+			Version.byDLLMajorVersion, Version.byDLLMinorVersion,
+			Version.byDay, Version.byMonth, Version.wYear,
+			Version.byMajorVersion, Version.byMinorVersion,
+			Version.zHomepage);
+
+	// Try to open the WAV file, be sure to open it as a binary file!	
+	pFileIn = fopen( strFileIn, "rb" );
+
+	// Check file open result
+	if(pFileIn == NULL)
+	{
+		fprintf(stderr,"Error opening %s", argv[1]);
+		return -1;
+	}
+
+	// Open MP3 file
+	pFileOut= fopen(strFileOut,"wb+");
+
+	// Check file open result
+	if(pFileOut == NULL)
+	{
+		fprintf(stderr,"Error creating file %s", strFileOut);
+		return -1;
+	}
+
+	memset(&beConfig,0,sizeof(beConfig));					// clear all fields
+
+	// use the LAME config structure
+	beConfig.dwConfig = BE_CONFIG_LAME;
+
+	// this are the default settings for testcase.wav
+	beConfig.format.LHV1.dwStructVersion	= 1;
+	beConfig.format.LHV1.dwStructSize		= sizeof(beConfig);		
+	beConfig.format.LHV1.dwSampleRate		= 44100;				// INPUT FREQUENCY
+	beConfig.format.LHV1.dwReSampleRate		= 0;					// DON"T RESAMPLE
+	beConfig.format.LHV1.nMode				= BE_MP3_MODE_JSTEREO;	// OUTPUT IN STREO
+	beConfig.format.LHV1.dwBitrate			= 128;					// MINIMUM BIT RATE
+	beConfig.format.LHV1.nPreset			= LQP_R3MIX;		// QUALITY PRESET SETTING
+	beConfig.format.LHV1.dwMpegVersion		= MPEG1;				// MPEG VERSION (I or II)
+	beConfig.format.LHV1.dwPsyModel			= 0;					// USE DEFAULT PSYCHOACOUSTIC MODEL 
+	beConfig.format.LHV1.dwEmphasis			= 0;					// NO EMPHASIS TURNED ON
+	beConfig.format.LHV1.bOriginal			= TRUE;					// SET ORIGINAL FLAG
+	beConfig.format.LHV1.bWriteVBRHeader	= TRUE;					// Write INFO tag
+
+//	beConfig.format.LHV1.dwMaxBitrate		= 320;					// MAXIMUM BIT RATE
+//	beConfig.format.LHV1.bCRC				= TRUE;					// INSERT CRC
+//	beConfig.format.LHV1.bCopyright			= TRUE;					// SET COPYRIGHT FLAG	
+//	beConfig.format.LHV1.bPrivate			= TRUE;					// SET PRIVATE FLAG
+//	beConfig.format.LHV1.bWriteVBRHeader	= TRUE;					// YES, WRITE THE XING VBR HEADER
+//	beConfig.format.LHV1.bEnableVBR			= TRUE;					// USE VBR
+//	beConfig.format.LHV1.nVBRQuality		= 5;					// SET VBR QUALITY
+	beConfig.format.LHV1.bNoRes				= TRUE;					// No Bit resorvoir
+
+// Preset Test
+//	beConfig.format.LHV1.nPreset			= LQP_PHONE;
+
+	// Init the MP3 Stream
+	err = beInitStream(&beConfig, &dwSamples, &dwMP3Buffer, &hbeStream);
+
+	// Check result
+	if(err != BE_ERR_SUCCESSFUL)
+	{
+		fprintf(stderr,"Error opening encoding stream (%lu)", err);
+		return -1;
+	}
+
+
+	// Allocate MP3 buffer
+	pMP3Buffer = new BYTE[dwMP3Buffer];
+
+	// Allocate WAV buffer
+	pWAVBuffer = new SHORT[dwSamples];
+
+	// Check if Buffer are allocated properly
+	if(!pMP3Buffer || !pWAVBuffer)
+	{
+		printf("Out of memory");
+		return -1;
+	}
+
+	DWORD dwRead=0;
+	DWORD dwWrite=0;
+	DWORD dwDone=0;
+	DWORD dwFileSize=0;
+
+	// Seek to end of file
+	fseek(pFileIn,0,SEEK_END);
+
+	// Get the file size
+	dwFileSize=ftell(pFileIn);
+
+	// Seek back to start of WAV file,
+	// but skip the first 44 bytes, since that's the WAV header
+	fseek(pFileIn,44,SEEK_SET);
+
+
+	// Convert All PCM samples
+	while ( (dwRead=fread(pWAVBuffer,sizeof(SHORT),dwSamples,pFileIn)) >0 )
+	{
+		// Encode samples
+		err = beEncodeChunk(hbeStream, dwRead, pWAVBuffer, pMP3Buffer, &dwWrite);
+
+		// Check result
+		if(err != BE_ERR_SUCCESSFUL)
+		{
+			beCloseStream(hbeStream);
+			fprintf(stderr,"beEncodeChunk() failed (%lu)", err);
+			return -1;
+		}
+		
+		// write dwWrite bytes that are returned in tehe pMP3Buffer to disk
+		if(fwrite(pMP3Buffer,1,dwWrite,pFileOut) != dwWrite)
+		{
+			fprintf(stderr,"Output file write error");
+			return -1;
+		}
+
+		dwDone += dwRead*sizeof(SHORT);
+
+		printf("Done: %0.2f%%     \r", 100 * (float)dwDone/(float)(dwFileSize));
+	}
+
+	// Deinit the stream
+	err = beDeinitStream(hbeStream, pMP3Buffer, &dwWrite);
+
+	// Check result
+	if(err != BE_ERR_SUCCESSFUL)
+	{
+
+		beCloseStream(hbeStream);
+		fprintf(stderr,"beExitStream failed (%lu)", err);
+		return -1;
+	}
+
+	// Are there any bytes returned from the DeInit call?
+	// If so, write them to disk
+	if( dwWrite )
+	{
+		if( fwrite( pMP3Buffer, 1, dwWrite, pFileOut ) != dwWrite )
+		{
+			fprintf(stderr,"Output file write error");
+			return -1;
+		}
+	}
+
+	// close the MP3 Stream
+	beCloseStream( hbeStream );
+
+	// Delete WAV buffer
+	delete [] pWAVBuffer;
+
+	// Delete MP3 Buffer
+	delete [] pMP3Buffer;
+
+	// Close input file
+	fclose( pFileIn );
+
+	// Close output file
+	fclose( pFileOut );
+
+	if ( beWriteInfoTag )
+	{
+		// Write the INFO Tag
+		beWriteInfoTag( hbeStream, strFileOut );
+	}
+	else
+	{
+		beWriteVBRHeader( strFileOut );
+	}
+
+	// Were done, return OK result
+	return 0;
+}
+
diff --git a/Dll/Example_vc6.dsp b/Dll/Example_vc6.dsp
new file mode 100644
index 0000000..a64bdc6
--- /dev/null
+++ b/Dll/Example_vc6.dsp
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="Example" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Console Application" 0x0103

+

+CFG=Example - Win32 Debug

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "Example_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "Example_vc6.mak" CFG="Example - Win32 Debug"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "Example - Win32 Release" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE "Example - Win32 Debug" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "Example - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\release"

+# PROP Intermediate_Dir "..\obj\release\example"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD BASE RSC /l 0x409 /d "NDEBUG"

+# ADD RSC /l 0x409 /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\output\release"

+

+!ELSEIF  "$(CFG)" == "Example - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\debug"

+# PROP Intermediate_Dir "..\obj\debug\example"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD BASE RSC /l 0x409 /d "_DEBUG"

+# ADD RSC /l 0x409 /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\output\debug"

+

+!ENDIF 

+

+# Begin Target

+

+# Name "Example - Win32 Release"

+# Name "Example - Win32 Debug"

+# Begin Source File

+

+SOURCE=.\Example.cpp

+# End Source File

+# End Target

+# End Project

diff --git a/Dll/Example_vc6.dsw b/Dll/Example_vc6.dsw
new file mode 100644
index 0000000..75d8332
--- /dev/null
+++ b/Dll/Example_vc6.dsw
@@ -0,0 +1,74 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00

+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!

+

+###############################################################################

+

+Project: "Example"=.\Example_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name LameMp3EncDll

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "LameMp3EncDll"=.\LameDll_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name mpglib

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "libmp3lame"=..\libmp3lame\libmp3lame_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Project: "mpglib"=..\mpglib\mpglib_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Global:

+

+Package=<5>

+{{{

+}}}

+

+Package=<3>

+{{{

+}}}

+

+###############################################################################

+

diff --git a/Dll/LameDLLInterface.htm b/Dll/LameDLLInterface.htm
new file mode 100644
index 0000000..a9f2add
--- /dev/null
+++ b/Dll/LameDLLInterface.htm
@@ -0,0 +1,742 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type"
+content="text/html; charset=iso-8859-1">
+<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
+<title>Lame-</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p align="center">&nbsp; </p>
+
+<p align="center"><font size="7">Lame-enc DLL</font> <br>
+<font size="5">Interface version 1.32</font> (and above)<br>
+(Lame engine version: 3.93 or higher) <br>
+<font size="6">Programmers Manual</font></p>
+
+<p align="center"><i>The lame_enc.dll and this manual is
+copyright by Albert L Faber<br>
+Originally the the DLL interface is modeled after the BladeEnc
+DLL interface<br>
+which is copyrighted by Tord Jansson and Jukka Poikolainen<br>
+This document and the DLL interface may be distributed freely</i>
+<br>
+<i>as long as modifications are released under the LGPL license.</i>
+</p>
+
+<p align="center">&nbsp; </p>
+
+<p align="center"><b>Homepage</b>: <a
+href="http://www.cdex.n3.net">http://www.cdex.n3.net</a><br>
+<b>E-mail:</b> mailto: <a
+href="mailto:afaber@users.sourceforge.net">afaber@users.sourceforge.net</a>
+</p>
+
+<p><br>
+<br>
+<br>
+<br>
+</p>
+
+<p><font size="5">Distribution</font> </p>
+
+<p>People and companies&nbsp; who wants to distribute
+lame_enc.dll with their commercial products are free to do so as
+far as I'm concerned (LGPL license), but should be aware that
+lame_enc.dll might infringe certain MP3 related software patents
+held by Fraunhofer IIS in certain countries. </p>
+
+<p><br>
+&nbsp; </p>
+
+<p><font size="5">Disclaimer</font> </p>
+
+<p>lame_enc.dll and this manual is distributed 'as is' with no
+warranty of any kind. The Author is not to be held responsible
+for the result of any use or misuse of this product. <br>
+&nbsp; <br>
+&nbsp; </p>
+
+<p><font size="5">Current Bugs and Limitations</font> </p>
+
+<p>Although the interface is designed to be able to handle
+multiple parallel streams it can't be done yet due to limitations
+in the engine, only one stream is allowed. <br>
+&nbsp; </p>
+
+<p><font size="5">Future Compatibility</font> </p>
+
+<p>This interface should be compatible with all future versions
+of lame_enc.DLL without any need to recompile your programs. You
+should therefore <b>not</b> check the version number upon start
+and prevent users from running your program with a later version
+of lame_enc.DLL. <br>
+&nbsp; </p>
+
+<hr>
+
+<p><font size="5">How to use the DLL</font> </p>
+
+<p>1. Fill in a <a href="#The BE_CONFIG Structure">BE_CONFIG </a>structure
+and send it to <a href="#beInitStream()">beInitStream()</a>. Make
+sure that BE_ERR_SUCCESSFUL is returned. </p>
+
+<p>2. Reserve at least the amount of memory returned in
+dwBufferSize as your output buffer. </p>
+
+<p>3. Call <a href="#beEncodeChunk()">beEncodeChunk()</a> until
+you've encoded everything you want. </p>
+
+<p>4. Call <a href="#beDeinitStream()">beDeinitStream()</a> to
+make sure that all encoded data is flushed out before closing the
+stream. </p>
+
+<p>5. Close the stream using <a href="#beCloseStream()">beCloseStream()
+</a></p>
+
+<p>6. Finally, call the <a href="#beWriteVBRHeader()">beWriteVBRHeader()</a>
+functions, to insert the INFO tag MP3 Header. This is an
+extension of the Xing VBR tag which is also used for CBR
+encodings. This call can only be omitted if the INFO tag was
+explicilty disabled in the BE_CONFIG Structure.</p>
+
+<p>A handy feature is the available <a
+href="#Lame_enc.dll debug option">Lame_enc.dll debug option</a>,
+which will dump the important lame internal settings to a text
+file.<br>
+&nbsp; </p>
+
+<p>&nbsp;</p>
+
+<p><font size="5">Return Values</font> </p>
+
+<p>See the header-file for a complete list of function return
+values. All functions should return BE_ERR_SUCCESSFUL unless
+something went wrong. <br>
+&nbsp; </p>
+
+<hr>
+
+<h1><a name="Type definitions"><font size="5">Type definitions</font></a></h1>
+
+<p>The DLL is by default compiled with the MS Visual C/C++
+compiler, which has the following type definitions:</p>
+
+<table border="0">
+    <tr>
+        <td>Type </td>
+        <td>Description</td>
+    </tr>
+    <tr>
+        <td>CHAR</td>
+        <td>signed char (8 bits)</td>
+    </tr>
+    <tr>
+        <td>BYTE</td>
+        <td>unsigned char (8 bits)</td>
+    </tr>
+    <tr>
+        <td>SHORT</td>
+        <td>signed short (16 bits)</td>
+    </tr>
+    <tr>
+        <td>WORD</td>
+        <td>unsigned short (16 bits)</td>
+    </tr>
+    <tr>
+        <td>INT</td>
+        <td>signed long (32 bits)</td>
+    </tr>
+    <tr>
+        <td>LONG</td>
+        <td>signed long (32 bits)</td>
+    </tr>
+    <tr>
+        <td>BOOL</td>
+        <td>signed long (32 bits) (YES, 32 bits for a one bit
+        value)<br>
+        TRUE = 0<br>
+        FALSE=-1</td>
+    </tr>
+    <tr>
+        <td>DWORD</td>
+        <td>unsigned long (32 bits)</td>
+    </tr>
+    <tr>
+        <td>FLOAT</td>
+        <td>floating point (32 bits)</td>
+    </tr>
+    <tr>
+        <td>DOUBLE</td>
+        <td>float point (64 bits)</td>
+    </tr>
+    <tr>
+        <td>LPCSTR</td>
+        <td>const char* (32 bits pointer to zero terminated
+        character string)</td>
+    </tr>
+</table>
+
+<p>Within the lame_enc.dll All the structure elements are one
+byte alligned (due to backwards compatibility with BladEnc.DLL!</p>
+
+<p>&nbsp;</p>
+
+<hr>
+
+<h1><a name="The BE_CONFIG Structure"><font size="5">The
+BE_CONFIG Structure </font></a></h1>
+
+<p><font size="3">Currently there the BE_CONFIG structure has to
+varians, the old MP3 config structure that is truly compatible
+with the old BladeEnc interface, and the new defined LHV1
+structure, which can set far more options in the lame encoder</font></p>
+
+<p>&nbsp;</p>
+
+<h2><font size="5">The MP3 BE_CONFIG - structure (OBSOLETE)</font></h2>
+
+<p>This is the old structure as it was originally defined by the
+BladeEnc.DLL interface. However, I do highly recommend to use the
+new Lame specific config structure, since it gives you more
+control over the Lame encoder settings.</p>
+
+<p>These are the members of the BE_CONFIG structure you need to
+fill in before you call beInitStream(): <br>
+&nbsp; </p>
+
+<table border="0">
+    <tr>
+        <td><b>dwConfig</b></td>
+        <td>Specifies what kind of output you want. Since only
+        MP3 currently is supported you must set this to <b>BE_CONFIG_MP3</b></td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.dwSampleRate</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+        <td>Samplerate in Hz for MP3 file. This can be set to
+        either <b>32000</b>, <b>44100</b> or <b>48000</b>.</td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.byMode</b></td>
+        <td>Stereomode for MP3 file. This can be either <b>BE_MP3_MODE_STEREO</b>,
+        <b>BE_MP3_MODE_DUALCHANNEL</b> or <b>BE_MP3_MODE_MONO.</b></td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.bitrate</b></td>
+        <td>Bitrate (i.e. size) of MP3 file in kBit/s. Allowed
+        bitrates are: <b>32, 40, 48, 56, 64, 80, 96, 112, 128,
+        160, 192, 224, 256</b> and <b>320</b>.</td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.bCopyright</b></td>
+        <td>If this is set to TRUE the Copyright bit in the MP3
+        stream will be set.</td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.bCRC</b></td>
+        <td>Set this to TRUE in order to enable CRC-checksum in
+        the bitstream.</td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.bOriginal</b></td>
+        <td>If this is set to TRUE the Original bit in the MP3
+        stream will be set.</td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.bPrivate</b></td>
+        <td>If this is set to TRUE the Private bit in the MP3
+        stream will be set.</td>
+    </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<h2><font size="5">The LHV1 BE_CONFIG - structure (recommended)</font></h2>
+
+<p>These are the members of the LHV1 BE_CONFIG structure, you
+need to fill in before you call beInitStream(): <br>
+</p>
+
+<table border="0">
+    <tr>
+        <td><b>dwConfig</b></td>
+        <td>Specifies what kind of output you want. Since only
+        MP3 currently is supported you must set this to <b>BE_CONFIG_LAME</b></td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.dwStructVersion</b></td>
+        <td>Indicates the version number of the structure,
+        current version number is 1</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.dwStructSize</b></td>
+        <td>Specifies the size of the BE_CONFIG structure
+        (currently 331 bytes)</td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.dwSampleRate</b>&nbsp;</td>
+        <td>Samplerate in Hz for MP3 file. This can be set to
+        either:<br>
+        <b>32000</b>, <b>44100</b> or <b>48000</b> for MPEG-I<br>
+        <b>16000</b>, <b>22050</b> or <b>24000</b> for MPEG-I<br>
+        <b>8000</b>, <b>11025</b> or <b>12000</b> for MPEG-II.5</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.dwReSampleRate</b></td>
+        <td>Specifies to which sample rate the input stream has
+        to be resampled, if set to 0, the encoder will decide
+        which ReSample rate to use</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.nMode</b></td>
+        <td>Stereomode for MP3 file. This can be either <b>BE_MP3_MODE_STEREO</b>,
+        <b>BE_MP3_MODE_JSTEREO, BE_MP3_MODE_DUALCHANNEL</b> or <b>BE_MP3_MODE_MONO.</b></td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.dwBitrate</strong></td>
+        <td>For CBR, this specifies the actual bitrate, for VBR,
+        it specifies the minimum bitrate<br>
+        Allowed bitrates are: <b>32, 40, 48, 56, 64, 80, 96, 112,
+        128, 160, 192, 224, 256</b> and <b>320</b>.for MPEG-I<br>
+        Allowed bitrates are: <b>8, 16, 24, 32, 40, 48, 56, 64,
+        80, 96, 112, 128, 144 </b>and<b> 160</b>.for MPEG-II<p><strong>Note:</strong>
+        dwBitrate is used as the minimum bitrate in the case of
+        using a VBR mode.</p>
+        </td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.dwMaxBitrate</strong></td>
+        <td>When VBR mode is enabled, it specifies the maximum
+        allowed bitrate (see also dwBitrate to specify the minium
+        bitrate), for CBR mode this setting is ignored.</td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.nPreset</strong></td>
+        <td>Keep in mind that the presets can overwrite some of
+        the other settings, since it is called right before the
+        encoder is initialized<br>
+        <table border="0">
+            <tr>
+                <td>The nPreset option can be set to one of the
+                following presets values::</td>
+            </tr>
+        </table>
+        <p>LQP_NOPRESET (don't use any presets)<br>
+        LQP_NORMAL_QUALITY (quality is set to 5)<br>
+        LQP_LOW_QUALITY (quality is set to 9)<br>
+        LQP_HIGH_QUALITY (quality is set to 2)<br>
+        LQP_VOICE_QUALITY (use for voice encoding)<br>
+        LQP_R3MIX (r3mix preset option)<br>
+        LQP_VERYHIGH_QUALITY (quality is set to 0)<br>
+        LQP_STANDARD (lame command line alt-preset standard)<br>
+        LQP_FAST_STANDARD (lame command line alt-preset fast
+        standard)<br>
+        LQP_EXTREME (lame command line alt-preset extreme)<br>
+        LQP_FAST_EXTREME (lame command line alt-preset fast
+        extreme)<br>
+        LQP_INSANE (lame command line alt-preset insane)<br>
+        LQP_ABR (lame command line alt-preset abr)<br>
+        LQP_CBR(lame command line alt-preset cbr)<br>
+        <br>
+        <strong>(old lame preset options)</strong><br>
+        LQP_PHONE <br>
+        LQP_SW<br>
+        LQP_AM<br>
+        LQP_FM<br>
+        LQP_VOICE<br>
+        LQP_RADIO<br>
+        LQP_TAPE<br>
+        LQP_HIFI<br>
+        LQP_CD<br>
+        LQP_STUDIO</p>
+        </td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.bCopyright</b></td>
+        <td>If this is set to TRUE the Copyright bit in the MP3
+        stream will be set.</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.bCRC</b></td>
+        <td>Set this to TRUE in order to enable CRC-checksum in
+        the bitstream.</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.bOriginal</b></td>
+        <td>If this is set to TRUE the Original bit in the MP3
+        stream will be set.</td>
+    </tr>
+    <tr>
+        <td><b>format.LHV1.bPrivate</b></td>
+        <td>If this is set to TRUE the Private bit in the MP3
+        stream will be set.</td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.nVbrMethod</strong></td>
+        <td>Sepecifes if the VBR method to use, currently the
+        following settings are supported:<p><font size="3">VBR_METHOD_NONE
+        (don't use VBR, use CBR encoding instead),<br>
+        VBR_METHOD_DEFAULT (default VBR method)<br>
+        VBR_METHOD_OLD (old VBR method, proven to be reliable)<br>
+        VBR_METHOD_NEW (new VBR method, faster than
+        VBR_METHOD_OLD)<br>
+        VBR_METHOD_MTRH (depreciated, same as VBR_METHOD_NEW)<br>
+        VBR_METHOD_ABR (Average Bitrate Encoding, see also </font><strong>format.LHV1.dwVbrAbr_bps</strong><font
+        size="3">)</font></p>
+        </td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.bWriteVBRHeader</strong></td>
+        <td>Sepecifes if the a XING VBR header should be written
+        or not. When this option is enabled, you have to call the
+        <font size="3">beWriteVBRHeader function when encoding
+        has been completed. Keep in mind that the VBR info tag
+        can also be written for CBR encoded files, the TAG info
+        can be useful for additional info like encoder delay and
+        the like.</font></td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.bEnableVBR</strong></td>
+        <td>Specifies if VBR encoding option shall be used or
+        not, possible values are TRUE/FALSE</td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.nVBRQuality</strong></td>
+        <td>Quality option if VBR is enabled (0=highest quality,
+        9 is lowest quality)</td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.dwVbrAbr_bps</strong></td>
+        <td>If the Average Bit Rate is specified, the lame
+        encoder ignores the nVBRQuality settings (However, <strong>bEnableVBR</strong>
+        must be set to TRUE and the <strong>format.LHV1.nVbrMethod
+        </strong>parameter should be set to<strong> </strong><font
+        size="3"><strong>VBR_METHOD_ABR</strong>). The allowed
+        range for the </font><strong>format.LHV1.dwVbrAbr_bps </strong>parameter<strong>
+        </strong>any integer value <font size="3">between:</font><p><strong>MPEG-I:</strong>
+        32000 .. 320000 bps<b><br>
+        </b><strong>MPEG-II:</strong> 8000 .. 160000 bps</p>
+        </td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.bNoBitRes</strong></td>
+        <td>Disables the bit-resorvoir and disables the insertion
+        of padded frames</td>
+    </tr>
+    <tr>
+        <td><strong>format.LHV1.nQuality</strong></td>
+        <td>Quality Setting, HIGH BYTE should be NOT LOW byte,
+        otherwhise quality is set to 5. This is done to be
+        backward compatible. So to set quality to 3, you have to
+        set the nQuality parameter to 0xFC03.</td>
+    </tr>
+    <tr>
+        <td><b>format.mp3.btReserved</b></td>
+        <td>For future use, set all elements to zero</td>
+    </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<p>&nbsp; </p>
+
+<hr>
+
+<h1><a name="beInitStream()"><font size="5">beInitStream()</font></a>
+</h1>
+
+<table border="0" cellspacing="16" width="100%">
+    <tr>
+        <td valign="top" width="20%"><b>Synopsis:</b></td>
+        <td valign="top" width="80%">BE_ERR beInitStream(
+        PBE_CONFIG <i>pbeConfig</i>, PDWORD <i>dwSamples</i>,
+        PDWORD <i>dwBufferSize</i>, PHBE_STREAM <i>phbeStream</i>
+        )</td>
+    </tr>
+    <tr>
+        <td valign="top" width="20%"><b>Parameters:</b></td>
+        <td valign="top" width="80%"><table border="0"
+        cellspacing="10" width="100%">
+            <tr>
+                <td valign="top" width="20%"><i>pbeConfig</i></td>
+                <td>Pointer at the struct containing encoder
+                settings.</td>
+            </tr>
+            <tr>
+                <td valign="top"><i>dwSamples</i></td>
+                <td>Pointer at double word where number of
+                samples to send to each <i>beEncodeChunk()</i> is
+                returned.</td>
+            </tr>
+            <tr>
+                <td valign="top"><i>dwBufferSize</i></td>
+                <td>Pointer at double word where minimum size in
+                bytes of output buffer is returned.</td>
+            </tr>
+            <tr>
+                <td valign="top"><i>phbeStream</i></td>
+                <td>Pointer at integer where Stream handle is
+                returned.</td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top" width="20%"><b>Description:</b></td>
+        <td valign="top" width="80%">This function is the first
+        to call before starting an encoding stream.</td>
+    </tr>
+</table>
+
+<hr>
+
+<h1><a name="beEncodeChunk()"><font size="5">beEncodeChunk()</font>
+</a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+    <tr>
+        <td valign="top" width="20%"><b>Synopsis:</b></td>
+        <td valign="top" width="80%">BE_ERR beEncodeChunk(
+        HBE_STREAM <i>hbeStream</i>, DWORD <i>nSamples</i>,
+        PSHORT <i>pSamples</i>, PBYTE <i>pOutput</i>, PDWORD <i>pdwOutput</i>
+        )</td>
+    </tr>
+    <tr>
+        <td valign="top" width="20%"><b>Parameters:</b></td>
+        <td valign="top"><table border="0" cellspacing="10"
+        width="100%">
+            <tr>
+                <td valign="top" width="20%"><i>hbeStream</i></td>
+                <td width="80%">Handle of the stream.</td>
+            </tr>
+            <tr>
+                <td valign="top" width="90"><i>nSamples</i></td>
+                <td>Number of samples to be encoded for this
+                call. This should be identical to what is
+                returned by <i>beInitStream()</i>, unless you are
+                encoding the last chunk, which might be smaller.</td>
+            </tr>
+            <tr>
+                <td valign="top" width="90"><i>pSamples</i></td>
+                <td>Pointer at the 16-bit signed samples to be
+                encoded. These should be in stereo when encoding
+                a stereo MP3 and mono when encoding a mono MP3.</td>
+            </tr>
+            <tr>
+                <td valign="top" width="90"><i>pOutput</i></td>
+                <td>Where to write the encoded data. This buffer
+                should be at least of the minimum size returned
+                by <i>beInitStream()</i>.</td>
+            </tr>
+            <tr>
+                <td valign="top" width="90"><i>pdwOutput</i></td>
+                <td>Where to return number of bytes of encoded
+                data written. The amount of data written might
+                vary from chunk to chunk.</td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top" width="20%"><b>Description:</b></td>
+        <td valign="top">Encodes a chunk of samples. <i>Please
+        note that if you have set the output to generate mono MP3
+        files you must feed beEncodeChunk() with mono samples!</i></td>
+    </tr>
+</table>
+
+<hr>
+
+<h1><a name="beDeinitStream()"><font size="5">beDeinitStream()</font>
+</a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+    <tr>
+        <td valign="top" width="20%"><b>Synopsis:</b></td>
+        <td valign="top" width="80%">BE_ERR beDeinitStream(
+        HBE_STREAM <i>hbeStream</i>, PBYTE <i>pOutput</i>, PDWORD
+        <i>pdwOutput</i> )</td>
+    </tr>
+    <tr>
+        <td valign="top" width="20%"><b>Parameters:</b></td>
+        <td valign="top"><table border="0" cellspacing="10"
+        width="100%">
+            <tr>
+                <td valign="top" width="20%"><i>hbeStream</i></td>
+                <td width="80%">Handle of the stream.</td>
+            </tr>
+            <tr>
+                <td valign="top"><i>pOutput</i></td>
+                <td>Where to write the encoded data. This buffer
+                should be at least of the minimum size returned
+                by <i>beInitStream()</i>.</td>
+            </tr>
+            <tr>
+                <td><i>pdwOutput</i></td>
+                <td>Where to return number of bytes of encoded
+                data written.</td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top" width="20%"><b>Description:</b></td>
+        <td valign="top">This function should be called after
+        encoding the last chunk in order to flush the encoder. It
+        writes any encoded data that still might be left inside
+        the encoder to the output buffer. This function should
+        NOT be called unless you have encoded all of the chunks
+        in your stream.</td>
+    </tr>
+</table>
+
+<hr>
+
+<h1><a name="beCloseStream()"><font size="5">beCloseStream()</font></a>
+</h1>
+
+<table border="0" cellspacing="16" width="100%">
+    <tr>
+        <td valign="top" width="20%"><b>Synopsis:</b></td>
+        <td valign="top">BE_ERR beCloseStream( HBE_STREAM <i>hbeStream</i>
+        )</td>
+    </tr>
+    <tr>
+        <td valign="top" width="90"><b>Parameters:</b></td>
+        <td valign="top"><table border="0" cellspacing="10"
+        width="100%">
+            <tr>
+                <td width="20%"><i>hbeStream</i></td>
+                <td>Handle of the stream.</td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top" width="90"><b>Description:</b></td>
+        <td valign="top">Last function to be called when finished
+        encoding a stream. Should unlike <i>beDeinitStream()</i>
+        also be called if the encoding is canceled.</td>
+    </tr>
+</table>
+
+<hr>
+
+<h1><a name="beVersion()"><font size="5">beVersion()</font> </a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+    <tr>
+        <td valign="top" width="20%"><b>Synopsis:</b></td>
+        <td valign="top">VOID beVersion( PBE_VERSION <i>pbeVersion</i>
+        )</td>
+    </tr>
+    <tr>
+        <td valign="top"><b>Parameters:</b></td>
+        <td valign="top"><table border="0" cellspacing="10"
+        width="100%">
+            <tr>
+                <td valign="top" width="20%"><i>pbeVersion</i></td>
+                <td>Pointer at struct where version number,
+                release date and URL for homepage is returned.</td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top"><b>Description:</b></td>
+        <td valign="top">Returns information like version numbers
+        (both of the DLL and encoding engine), release date and
+        URL for lame_enc's homepage. All this information should
+        be made available to the user of your product through a
+        dialog box or something similar.</td>
+    </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<hr>
+
+<p>&nbsp;</p>
+
+<h1><a name="beWriteVBRHeader()"><font size="5">beWriteVBRHeader()</font>
+</a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+    <tr>
+        <td valign="top" width="20%"><b>Synopsis:</b></td>
+        <td valign="top">VOID beWriteVBRHeader( LPCSTR <i>pszMP3FileName</i>
+        )</td>
+    </tr>
+    <tr>
+        <td valign="top"><b>Parameters:</b></td>
+        <td valign="top"><table border="0" cellspacing="10"
+        width="100%">
+            <tr>
+                <td valign="top" width="20%"><i>pszMP3FileName</i></td>
+                <td>Const Pointer zero terminated string, that
+                contains the MP3 file name.</td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top"><b>Description:</b></td>
+        <td valign="top">Writes a Xing Header in front of the MP3
+        file. Make sure that the MP3 file is closed, and the the
+        beConfig.format.LHV1.bWriteVBRHeader has been set to
+        TRUE. In addition, it is always save to call
+        beWriteVBRHeader after the encoding has been finished,
+        even when the beConfig.format.LHV1.bWriteVBRHeader is not
+        set to TRUE</td>
+    </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<p>&nbsp;</p>
+
+<hr>
+
+<p>&nbsp;</p>
+
+<h1><a name="Lame_enc.dll debug option">Lame_enc.dll debug option</a></h1>
+
+<p>The lame_enc.dll has a built-in debug option, that dumps all
+the important internal settings to a text file. To enable this
+feature, create a text file in the Windows directory which is
+named lame_enc.ini, and should contain the following two lines</p>
+
+<p>[debug]<br>
+WriteLogFile=1</p>
+
+<p>Save this text file, and each time you encode a file, the
+settings are added to a file name lame_enc.txt, that is located
+in the same directory as the lame_enc.dll</p>
+
+<p>&nbsp;</p>
+
+<p><br>
+&nbsp; </p>
+</body>
+</html>
diff --git a/Dll/LameDll_vc6.dsp b/Dll/LameDll_vc6.dsp
new file mode 100644
index 0000000..dd07c69
--- /dev/null
+++ b/Dll/LameDll_vc6.dsp
@@ -0,0 +1,118 @@
+# Microsoft Developer Studio Project File - Name="LameMp3EncDll" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

+

+CFG=LameMp3EncDll - Win32 Debug

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "LameDll_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "LameDll_vc6.mak" CFG="LameMp3EncDll - Win32 Debug"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "LameMp3EncDll - Win32 Release" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE "LameMp3EncDll - Win32 Debug" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+MTL=midl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "LameMp3EncDll - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\LameMp3EncDll"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /c

+# ADD CPP /nologo /MD /W3 /O2 /I "../include" /I "../" /I "../libmp3lame" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /c

+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32

+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32

+# ADD BASE RSC /l 0x40c /d "NDEBUG"

+# ADD RSC /l 0x40c /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386

+# ADD LINK32 libmp3lame-static.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /out:"..\output\Release\lame_enc.dll" /libpath:"..\output\Release" /opt:NOWIN98

+# SUBTRACT LINK32 /nodefaultlib

+

+!ELSEIF  "$(CFG)" == "LameMp3EncDll - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\LameMp3EncDll"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /GZ /c

+# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../libmp3lame" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /GZ /c

+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32

+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32

+# ADD BASE RSC /l 0x40c /d "_DEBUG"

+# ADD RSC /l 0x40c /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept

+# ADD LINK32 libmp3lame-static.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\output\Debug\lame_enc.dll" /pdbtype:sept /libpath:"..\output\Debug" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none /incremental:no

+

+!ENDIF 

+

+# Begin Target

+

+# Name "LameMp3EncDll - Win32 Release"

+# Name "LameMp3EncDll - Win32 Debug"

+# Begin Group "Source Files"

+

+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

+# Begin Source File

+

+SOURCE=.\BladeMP3EncDLL.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\BladeMP3EncDLL.def

+# PROP Exclude_From_Build 1

+# End Source File

+# End Group

+# Begin Group "Header Files"

+

+# PROP Default_Filter "h;hpp;hxx;hm;inl"

+# Begin Source File

+

+SOURCE=.\BladeMP3EncDLL.h

+# End Source File

+# End Group

+# Begin Group "Resource Files"

+

+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"

+# End Group

+# End Target

+# End Project

diff --git a/Dll/LameDll_vc8.vcproj b/Dll/LameDll_vc8.vcproj
new file mode 100644
index 0000000..d1a3d25
--- /dev/null
+++ b/Dll/LameDll_vc8.vcproj
@@ -0,0 +1,508 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="LameDll_vc8"

+	ProjectGUID="{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}"

+	RootNamespace="LameDll_vc8"

+	Keyword="Win32Proj"

+	TargetFrameworkVersion="131072"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+		<Platform

+			Name="x64"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="4"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame_enc.dll"

+				LinkIncremental="2"

+				GenerateManifest="false"

+				ModuleDefinitionFile="BladeMP3EncDll.def"

+				GenerateDebugInformation="true"

+				SubSystem="2"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../;../include"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame_enc.dll"

+				LinkIncremental="1"

+				GenerateManifest="false"

+				ModuleDefinitionFile="BladeMP3EncDll.def"

+				GenerateDebugInformation="true"

+				SubSystem="2"

+				OptimizeReferences="2"

+				EnableCOMDATFolding="2"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug GTK|Win32"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame_enc.dll"

+				LinkIncremental="2"

+				GenerateManifest="false"

+				ModuleDefinitionFile="BladeMP3EncDll.def"

+				GenerateDebugInformation="true"

+				SubSystem="2"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../;../include"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame_enc.dll"

+				LinkIncremental="1"

+				GenerateManifest="false"

+				ModuleDefinitionFile="BladeMP3EncDll.def"

+				GenerateDebugInformation="true"

+				SubSystem="2"

+				OptimizeReferences="2"

+				EnableCOMDATFolding="2"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug GTK|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame_enc.dll"

+				LinkIncremental="2"

+				GenerateManifest="false"

+				ModuleDefinitionFile="BladeMP3EncDll.def"

+				GenerateDebugInformation="true"

+				SubSystem="2"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source"

+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"

+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

+			>

+			<File

+				RelativePath=".\BladeMP3EncDLL.c"

+				>

+			</File>

+			<File

+				RelativePath=".\BladeMP3EncDLL.def"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header"

+			Filter="h;hpp;hxx;hm;inl;inc;xsd"

+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"

+			>

+			<File

+				RelativePath=".\BladeMP3EncDLL.h"

+				>

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/Dll/MP3export.pas b/Dll/MP3export.pas
new file mode 100644
index 0000000..ab55bba
--- /dev/null
+++ b/Dll/MP3export.pas
@@ -0,0 +1,303 @@
+unit MP3export;
+
+interface
+
+Uses SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
+Forms, Dialogs, StdCtrls;
+
+type
+//type definitions
+//typedef		unsigned long			HBE_STREAM;
+//typedef		HBE_STREAM				*PHBE_STREAM;
+//typedef		unsigned long			BE_ERR;
+  THBE_STREAM = LongWord;
+  PHBE_STREAM = ^PHBE_STREAM;
+  BE_ERR = LongWord;
+
+const
+// encoding formats
+//#define		BE_CONFIG_MP3			0
+//#define		BE_CONFIG_LAME			256
+  BE_CONFIG_MP3	 = 0;
+  BE_CONFIG_LAME = 256;
+
+
+// error codes
+//#define    BE_ERR_SUCCESSFUL		        0x00000000
+//#define    BE_ERR_INVALID_FORMAT		0x00000001
+//#define    BE_ERR_INVALID_FORMAT_PARAMETERS	0x00000002
+//#define    BE_ERR_NO_MORE_HANDLES		0x00000003
+//#define    BE_ERR_INVALID_HANDLE		0x00000004
+BE_ERR_SUCCESSFUL: LongWord = 0;
+BE_ERR_INVALID_FORMAT: LongWord = 1;
+BE_ERR_INVALID_FORMAT_PARAMETERS: LongWord = 2;
+BE_ERR_NO_MORE_HANDLES: LongWord = 3;
+BE_ERR_INVALID_HANDLE: LongWord = 4;
+
+// other constants
+
+BE_MAX_HOMEPAGE	= 256;
+
+// format specific variables
+
+BE_MP3_MODE_STEREO = 0;
+BE_MP3_MODE_DUALCHANNEL = 2;
+BE_MP3_MODE_MONO = 3;
+
+type
+
+  TMP3 = packed record
+           dwSampleRate     : LongWord;
+           byMode           : Byte;
+           wBitRate         : Word;
+           bPrivate         : LongWord;
+           bCRC             : LongWord;
+           bCopyright       : LongWord;
+           bOriginal        : LongWord;
+           end;
+
+  TLHV1 = packed record
+          // STRUCTURE INFORMATION
+            dwStructVersion: DWORD;
+            dwStructSize: DWORD;
+
+          // BASIC ENCODER SETTINGS
+            dwSampleRate: DWORD;	// ALLOWED SAMPLERATE VALUES DEPENDS ON dwMPEGVersion
+            dwReSampleRate: DWORD;	// DOWNSAMPLERATE, 0=ENCODER DECIDES
+            nMode: Integer;	  	// BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
+            dwBitrate: DWORD;		// CBR bitrate, VBR min bitrate
+            dwMaxBitrate: DWORD;	// CBR ignored, VBR Max bitrate
+            nQuality: Integer;   	// Quality setting (NORMAL,HIGH,LOW,VOICE)
+            dwMpegVersion: DWORD;	// MPEG-1 OR MPEG-2
+            dwPsyModel: DWORD;		// FUTURE USE, SET TO 0
+            dwEmphasis: DWORD;		// FUTURE USE, SET TO 0
+
+          // BIT STREAM SETTINGS
+            bPrivate: LONGBOOL;		// Set Private Bit (TRUE/FALSE)
+            bCRC: LONGBOOL;		// Insert CRC (TRUE/FALSE)
+            bCopyright: LONGBOOL;	// Set Copyright Bit (TRUE/FALSE)
+            bOriginal: LONGBOOL;	// Set Original Bit (TRUE/FALSE_
+
+          // VBR STUFF
+            bWriteVBRHeader: LONGBOOL;	// WRITE XING VBR HEADER (TRUE/FALSE)
+            bEnableVBR: LONGBOOL;       // USE VBR ENCODING (TRUE/FALSE)
+            nVBRQuality: Integer;	// VBR QUALITY 0..9
+
+            btReserved: array[0..255] of Byte;	// FUTURE USE, SET TO 0
+            end;
+
+  TAAC = packed record
+           dwSampleRate     : LongWord;
+           byMode           : Byte;
+           wBitRate         : Word;
+           byEncodingMethod : Byte;
+           end;
+
+  TFormat = packed record
+              case byte of
+                1 : (mp3           : TMP3);
+                2 : (lhv1          : TLHV1);
+                3 : (aac           : TAAC);
+              end;
+
+  TBE_Config = packed record
+                 dwConfig   : LongWord;
+                 format     : TFormat;
+                 end;
+
+
+  PBE_Config = ^TBE_Config;
+
+//typedef struct	{
+//	// BladeEnc DLL Version number
+//
+//	BYTE	byDLLMajorVersion;
+//	BYTE	byDLLMinorVersion;
+//
+//	// BladeEnc Engine Version Number
+//
+//	BYTE	byMajorVersion;
+//	BYTE	byMinorVersion;
+//
+//	// DLL Release date
+//
+//	BYTE	byDay;
+//	BYTE	byMonth;
+//	WORD	wYear;
+//
+//	// BladeEnc	Homepage URL
+//
+//	CHAR	zHomepage[BE_MAX_HOMEPAGE + 1];
+//
+//} BE_VERSION, *PBE_VERSION;
+
+  TBE_Version = record
+                  byDLLMajorVersion : Byte;
+                  byDLLMinorVersion : Byte;
+
+                  byMajorVersion    : Byte;
+                  byMinorVersion    : Byte;
+
+                  byDay             : Byte;
+                  byMonth           : Byte;
+                  wYear             : Word;
+
+                  zHomePage         : Array[0..BE_MAX_HOMEPAGE + 1] of Char;
+                  end;
+
+  PBE_Version = ^TBE_Version;
+
+//__declspec(dllexport) BE_ERR	beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
+//__declspec(dllexport) BE_ERR	beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
+//__declspec(dllexport) BE_ERR	beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
+//__declspec(dllexport) BE_ERR	beCloseStream(HBE_STREAM hbeStream);
+//__declspec(dllexport) VOID	beVersion(PBE_VERSION pbeVersion);
+
+{
+Function beInitStream(var pbeConfig: TBE_CONFIG; var dwSample: LongWord; var dwBufferSize: LongWord; var phbeStream: THBE_STREAM ): BE_Err; cdecl; external 'Bladeenc.dll';
+//Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; pSample: PSmallInt;pOutput: PByte; var pdwOutput: LongWord): BE_Err; cdecl; external 'Bladeenc.dll';
+Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; var pSample;var pOutput; var pdwOutput: LongWord): BE_Err; stdcall; cdecl 'Bladeenc.dll';
+Function beDeinitStream(hbeStream: THBE_STREAM; var pOutput; var pdwOutput: LongWord): BE_Err; cdecl; external 'Bladeenc.dll';
+Function beCloseStream(hbeStream: THBE_STREAM): BE_Err; cdecl; external 'Bladeenc.dll';
+Procedure beVersion(var pbeVersion: TBE_VERSION); cdecl; external 'Bladeenc.dll';
+}
+
+Function beInitStream(var pbeConfig: TBE_CONFIG; var dwSample: LongWord; var dwBufferSize: LongWord; var phbeStream: THBE_STREAM ): BE_Err; cdecl; external 'Lame_enc.dll';
+//Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; pSample: PSmallInt;pOutput: PByte; var pdwOutput: LongWord): BE_Err; cdecl; external 'Lame_enc.dll';
+Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; var pSample;var pOutput; var pdwOutput: LongWord): BE_Err; cdecl; external 'Lame_enc.dll';
+Function beDeinitStream(hbeStream: THBE_STREAM; var pOutput; var pdwOutput: LongWord): BE_Err; cdecl; external 'Lame_enc.dll';
+Function beCloseStream(hbeStream: THBE_STREAM): BE_Err; cdecl; external 'Lame_enc.dll';
+Procedure beVersion(var pbeVersion: TBE_VERSION); cdecl; external 'Lame_enc.dll';
+
+Procedure EncodeWavToMP3(fs, fd: Integer);
+implementation
+
+Uses InternetSnd, TraiteWav;
+
+{----------------------------------------}
+Procedure EncodeWavToMP3(fs, fd: Integer);
+var
+  err: Integer;
+  beConfig: TBE_Config;
+  dwSamples, dwSamplesMP3 : LongWord;
+  hbeStream : THBE_STREAM;
+  error: BE_ERR;
+  pBuffer: PSmallInt;
+  pMP3Buffer: PByte;
+  Marque:PChar;
+
+  done: LongWord;
+  dwWrite: LongWord;
+  ToRead: LongWord;
+  ToWrite: LongWord;
+  i:Integer;
+
+begin
+  beConfig.dwConfig := BE_CONFIG_LAME;
+
+{
+  beConfig.Format.mp3.dwSampleRate := WavInfo.SamplesPerSec;
+  beConfig.Format.mp3.byMode := BE_MP3_MODE_STEREO;
+  beConfig.Format.mp3.wBitrate := strToInt(MainFrm.Mp3BitRate.Text);
+  beConfig.Format.mp3.bCopyright := 0;
+  beConfig.Format.mp3.bCRC := $00000000;
+  beConfig.Format.mp3.bOriginal := 0;
+  beConfig.Format.mp3.bPrivate := 0;
+}
+//Structure information
+  beConfig.Format.lhv1.dwStructVersion := 1;
+  beConfig.Format.lhv1.dwStructSize := SizeOf(beConfig);
+//Basic encoder setting
+  beConfig.Format.lhv1.dwSampleRate := WavInfo.SamplesPerSec;
+  beConfig.Format.lhv1.dwReSampleRate := 44100;
+  beConfig.Format.lhv1.nMode := BE_MP3_MODE_STEREO;
+  beConfig.Format.lhv1.dwBitrate := strToInt(MainFrm.Mp3BitRate.Text);
+  beConfig.Format.lhv1.dwMaxBitrate := strToInt(MainFrm.Mp3BitRate.Text);
+  beConfig.Format.lhv1.nQuality := 2;
+  beConfig.Format.lhv1.dwMPegVersion := 1; //MPEG1
+  beConfig.Format.lhv1.dwPsyModel := 0;
+  beConfig.Format.lhv1.dwEmphasis := 0;
+//Bit Stream Settings
+  beConfig.Format.lhv1.bPrivate := False;
+  beConfig.Format.lhv1.bCRC := False;
+  beConfig.Format.lhv1.bCopyright := True;
+  beConfig.Format.lhv1.bOriginal := True;
+//VBR Stuff
+  beConfig.Format.lhv1.bWriteVBRHeader := false;
+  beConfig.Format.lhv1.bEnableVBR := false;
+  beConfig.Format.lhv1.nVBRQuality := 0;
+
+  i := 0;
+  error := beInitStream(beConfig, dwSamples, dwSamplesMP3, hbeStream);
+  if error = BE_ERR_SUCCESSFUL
+    then begin
+         pBuffer := AllocMem(dwSamples*2);
+         pMP3Buffer := AllocMem(dwSamplesMP3);
+         try
+           done := 0;
+
+           error := FileSeek(fs, 0, 0);
+           While (done < TotalSize) do
+             begin
+               if (done + dwSamples*2 < TotalSize)
+                 then ToRead := dwSamples*2
+                 else begin
+                      ToRead := TotalSize-done;
+                      //FillChar(buf[0],dwSamples*2,0);
+                      FillChar(pbuffer^,dwSamples,0);
+                      end;
+
+               //if FileRead(fs, buf[0], toread) = -1
+               if FileRead(fs, pbuffer^, toread) = -1
+                 then raise Exception.Create('Erreur de lecture');
+
+               //error := beEncodeChunk(hbeStream, toRead div 2, Buf[0], TmpBuf[0], toWrite);
+               error := beEncodeChunk(hbeStream, toRead div 2, pBuffer^, pMP3Buffer^, toWrite);
+
+               if error <> BE_ERR_SUCCESSFUL
+                 then begin
+                      beCloseStream(hbeStream);
+                      raise Exception.Create('Echec de l''encodage');
+                      end;
+
+               //if FileWrite(fd, TmpBuf[0], toWrite) = -1
+               if FileWrite(fd, pMP3Buffer^, toWrite) = -1
+                 then raise Exception.Create('Erreur d''écriture');
+
+               done := done + toread;
+               inc(i);
+               if i mod 64 = 0
+                 then begin
+                      MainFrm.ProgressBar1.Position := round(100*done/Totalsize);
+                      Application.ProcessMessages;
+                      end;
+             end;
+
+           error := beDeInitStream(hbeStream, pMP3Buffer^, dwWrite);
+           //error := beDeInitStream(hbeStream, TmpBuf[0], dwWrite);
+
+           if error <> BE_ERR_SUCCESSFUL
+             then begin
+                  beCloseStream(hbeStream);
+                  raise Exception.Create('Echec à la sortie');
+                  end;
+
+           if dwWrite <> 0
+             then begin
+                  //if FileWrite(fd, TmpBuf[0], dwWrite) = -1
+                  if FileWrite(fd, pMP3Buffer^, dwWrite) = -1
+                    then raise Exception.Create('Erreur à la dernière écriture');
+                  end;
+
+           beCloseStream(hbeStream);
+           finally
+             FreeMem(pBuffer);
+             FreeMem(pMP3Buffer);
+             end;
+         end
+    else begin
+
+         end;
+end;
+
+end.
diff --git a/Dll/Makefile.am b/Dll/Makefile.am
new file mode 100644
index 0000000..78f0f6b
--- /dev/null
+++ b/Dll/Makefile.am
@@ -0,0 +1,15 @@
+## $Id: Makefile.am,v 1.9 2006/09/30 09:17:05 bouvigne Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = BladeMP3EncDLL.c \
+	BladeMP3EncDLL.def \
+	BladeMP3EncDLL.h \
+	Example.cpp \
+	Example_vc6.dsp \
+	Example_vc6.dsw \
+	LameDLLInterface.htm \
+	LameDll_vc6.dsp \
+	LameDll_vc8.vcproj \
+	MP3export.pas \
+	Makefile.mingw32
diff --git a/Dll/Makefile.in b/Dll/Makefile.in
new file mode 100644
index 0000000..bd14bcb
--- /dev/null
+++ b/Dll/Makefile.in
@@ -0,0 +1,367 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = Dll
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = BladeMP3EncDLL.c \
+	BladeMP3EncDLL.def \
+	BladeMP3EncDLL.h \
+	Example.cpp \
+	Example_vc6.dsp \
+	Example_vc6.dsw \
+	LameDLLInterface.htm \
+	LameDll_vc6.dsp \
+	LameDll_vc8.vcproj \
+	MP3export.pas \
+	Makefile.mingw32
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Dll/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  Dll/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Dll/Makefile.mingw32 b/Dll/Makefile.mingw32
new file mode 100644
index 0000000..6070f29
--- /dev/null
+++ b/Dll/Makefile.mingw32
@@ -0,0 +1,39 @@
+# This makefile compiles lame_enc.dll with mingw32 (and possibly cygwin)
+# Of course, you must first build ../libmp3lame/libmp3lame.a.
+# liblame_enc.a can be used to link the lame_enc.dll to your programs.
+# Tested with EAC 0.9pb9 (my own favorite, http://www.exactaudiocopy.de/)
+# example.exe compiles and works, too.
+#                                  Vladislav Naumov, <vnaum@inbox.ru>
+#
+# PS: to 'make clean' you need rm. MS's del is unusable.
+# PPS: quick build:
+#      make -fMakefile.mingw32
+
+DLL_NAME = lame_enc
+LAME_SRC_ROOT = ..
+OFILES = BladeMP3EncDLL.o $(DLL_NAME)_exp.o
+CFLAGS = -I$(LAME_SRC_ROOT)/include -I$(LAME_SRC_ROOT)/libmp3lame
+CC = g++
+LD = g++
+LFLAGS = -L$(LAME_SRC_ROOT)/libmp3lame -o $(DLL_NAME).dll -mdll -s
+LIBS = -lmp3lame
+
+all: $(DLL_NAME).dll example.exe
+
+BladeMP3EncDLL.o: BladeMP3EncDLL.c BladeMP3EncDLL.h ../include/lame.h \
+ ../libmp3lame/lame_global_flags.h ../libmp3lame/version.h
+
+$(DLL_NAME).dll : $(OFILES)
+	$(LD) $(LFLAGS) $(OFILES) $(LIBS)
+	
+$(DLL_NAME)_exp.o : BladeMP3EncDLL.o
+	dlltool --input-def BladeMP3EncDLL.def --output-lib lib$(DLL_NAME).a --output-exp $(DLL_NAME)_exp.o --dllname $(DLL_NAME) BladeMP3EncDLL.o
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+example.exe : Example.cpp BladeMP3EncDLL.h
+	$(CC) Example.cpp -o example.exe
+
+clean :
+	rm -f $(DLL_NAME).dll $(OFILES) example.exe
diff --git a/Dll/README b/Dll/README
new file mode 100644
index 0000000..ed8467a
--- /dev/null
+++ b/Dll/README
@@ -0,0 +1,21 @@
+
+This directory contains a Windows DLL interface to the LAME
+encoding engine.
+
+This DLL is compatible with the BladeEnc.dll.  
+See BladeMP3EncDLL.c for details of the calling
+sequence, and BladeMP3EncDLL.h for details of the
+data that must be passed to the DLL.  
+
+As of yet, there is no other documentation. 
+
+To use this DLL as a replacement for BladeEnc.dll, you
+need to populate the 'mp3' struct.  
+
+To use more advanced features of LAME, you need to 
+populate the LHV1 struct instead.
+
+Delphi 4 Users:  Gabriel Gélin <ggelin@alapage.com> has
+contributed a .PAS file, do you can access the DLL from
+Delphi.   See MP3export.pas.
+
diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..c3bdce0
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,124 @@
+First, see the file STYLEGUIDE
+
+************************************************************************
+TESTING
+=======
+If you make changes, please test.  There is a python
+script in the test/ directory which will compare two versions
+of lame using a bunch of CBR and ABR options. To run this
+script, copy your favorite (and short!) wav file to the
+lame/test directory, and run:
+
+% cd lame/test
+% ./lametest.py [-w]  CBRABR.op castanets.wav lame_orig lame_new
+
+
+
+
+
+
+************************************************************************
+LAME API
+
+For a general outline of the code, see the file API.  
+Also, frontend/main.c is a simple front end to libmp3lame.a
+
+The guts of the code are called from lame_encode_buffer().
+
+lame_encode_buffer() handles buffering and resampling, and
+then calls lame_encode_frame() for each frame.  lame_encode_frame()
+looks like this:
+
+lame_encode_frame_mp3():
+   l3psycho_anal()        compute masking thresholds
+   mdct_sub()             compute MDCT coefficients
+   iteration_loop()       choose scalefactors (via iteration)
+                          which determine noise shapping, and 
+                          choose best huffman tables for lossless compression
+
+   format_bitstream       format the bitstream.  when data+headers are complete,
+                          output to internal bit buffer.
+   copy_buffer()          copy internal bit buffer into user's mp3 buffer
+
+************************************************************************
+ADDING NEW OPTIONS
+
+control variable goes in lame_global_flags sturct.
+Assume the variable is called 'new_variable'.
+
+You also need to write (in set_get.c):
+
+lame_set_new_variable()
+lame_get_new_variable()
+
+And then document the variable in the file USAGE as well as the
+output of "lame --longhelp"
+
+And add a "--option" style command line option to enable this variable
+in parse.c
+
+Note: for experimental features that you need to call from the frontend
+but that should not be part of the official API, see the section at
+the end of set_get.c.  These functions should *NOT* be prototyped in
+lame.h (since that would indicate to the world that they are part
+of the API). 
+
+
+************************************************************************
+
+THREADSAFE:
+
+Lame should now be thread safe and re-entrant. 
+The only problem seems to be some OS's allocate small
+stacks (< 128K) to threads launched by applictions, and this
+is not enough for LAME.  Fix is to increase the stack space,
+or move some of our automatic variables onto the heap with
+by using bug-prove malloc()'s and free().
+
+
+
+************************************************************************
+Global Variables:
+
+There are two types of global variables.  All data in
+both strucs is initialized to zero.
+
+1. lame_global_flags *gfp
+
+These are input paramters which are set by the calling program,
+and some information which the calling program may be interested in.
+
+This struct instantiated by the call to lame_init().  
+
+
+2. lame_internal_flags *gfc
+
+Most global variables go here.
+
+All internal data not set by the user.  All 'static' data from
+old non-reentrant code should be moved here.
+
+Defined in util.h.  Data for which the size is known
+in advace should be explicitly declaired (for example,
+float xr[576]);  Data which needs to be malloc'd is
+handled by:  
+
+1.  in lame_init_params(), malloc the data
+2.  be sure to free the data in freegfc()
+
+
+If the data to be malloc'd is large and only used in
+certain conditions (like resampling), use the following:  
+this has the disadvantage that it is hard to catch and return error
+flags all the way back up the call stack.
+
+1. Add an initialization variable to the gfc struct: lame_init_resample
+2. In the resample routine, there should be some code like this:
+
+   if (0==gfc->lame_init_resample) {
+       gfc->lame_init_resample=1;
+      /* initialization code: malloc() data, etc */
+   }
+
+3. The data should be free'd in the routine freegfc().
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..1de17ce
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,210 @@
+LAME 3.xx    January 2001  Mark Taylor (http://www.mp3dev.org)
+
+
+=======================================================================
+Compile time options
+=======================================================================
+There are serveral targets which can be built from this
+source code:
+
+lame, lame.exe  The command line encoder
+
+mp3x            A GTK based graphical MP3 frame analyzer.  For debugging,
+                development, and studing MP3 frames produced by any
+                encoder.
+
+lame_enc.dll    a Windows DLL used by many GUIs which support lame.
+                (Can only be compiled by MSVC???)
+                                 
+
+lame.acm        a Windows ACM codec which can be used by 
+                many windows programs, and any directshow program.
+                See MSVC project files in ACM directory.
+                Right click on lame.inf to install.
+
+lame_enc.dshow  a Windows direct show filter for lame.  Potentially has
+                more flexability than the ACM codec, but code needs some
+                work.  See MSVC project files in dshow directory
+ 
+
+libmp3lame.a    the static encoding library used by all platforms, required
+                by all the above targets.
+
+libmp3lame.so   shared version of libmp3lame.a for *NIX platforms
+
+
+
+The following compile time options can be used.  For libmp3lame.a
+and lame_enc.dll, none are required.  On non-unix systems,
+these options must be set in config.h or in the IDE.  
+On unix systems, they are set via ./configure.  
+
+
+#define HAVE_MPGLIB   compile in mpglib's mp3 *decoding* capibility
+#define HAVE_VORBIS   compile in Vorbis decoding capibility
+                      (you need libvorbis already built)
+#define NOANALYSIS   do not compile in hooks used by the 
+                     MP3 frame analyzer.
+
+
+Options for the command line encoder:
+#define LIBSNDFILE   to use Erik de Castro Lopo's libsndfile
+                     for input.
+#define BRHIST       to allow the optional display of the VBR histogram
+
+
+
+=======================================================================
+Building the software on *NIX platforms using configure:
+=======================================================================
+Run the following commands:
+
+% ./configure
+% make 
+% make install
+
+For a complete list of options, try "./configure --help"
+Some of the more usefull options:
+
+For the encoding library:
+
+  --enable-mp3x               Build the mp3 frame analyzer, 'mp3x'
+
+  --enable-mp3rtp             Build the encode-to-RTP program, 'mp3rtp'
+                              (broken as of August 2001)
+ 
+
+For the LAME front end encoder:
+
+  --with-fileio=lame          Use lame's internal file io routines [default]
+               =sndfile       Use Erik de Castro Lopo's libsndfile 
+                              (Supports many more input formats, but no stdin possible currently)
+
+  --with-sndfile-prefix=DIR   Alternate location for libsndfile
+                              (if --with-fileio=sndfile)
+
+  --enable-brhist             Include the VBR bitrate histogram feature 
+                              (default:yes if any ncurses/termcap available)"
+
+
+Other usefull configure options:
+
+  --enable-debug              Build a debug version
+
+  --enable-expopt             Enable some more optimizations flags for
+                              the compiler, may or may not produce
+                              faster code
+
+  --prefix = PATH             default is /usr/local
+                              (LAME currently installs:
+                                /usr/local/bin/lame
+                                /usr/local/lib/libmp3lame.a
+                                /usr/local/lib/libmp3lame.so
+                                /usr/local/include/lame.h
+
+
+  --with-vorbis                Enable Ogg Vorbis decoding support
+  --with-vorbis-prefix = PATH  specify where to find Vorbis libs
+
+
+Some more advanced ways to influence the build procedure
+(experienced users only, use it at your own risk):
+
+  - If you want to use some custom defines for building (e.g. some out
+    of the file "DEFINES") use:
+
+     * bourne shell or compatible (ash, bash, zsh, ...):
+       CONFIG_DEFS="-Dmy_define" ./configure
+
+     * C shell or compatible (csh, tcsh, ...):
+       setenv CONFIG_DEFS "-Dmy_define"
+       ./configure
+
+  - If you want to use some additional options for the compiler:
+
+    * bourne shell or compatible (ash, bash, zsh, ...):
+      CFLAGS="--my_flag" ./configure
+
+    * C shell or compatible (csh, tcsh, ...):
+      setenv CFLAGS "--my_flag"
+      ./configure
+
+  Or some combination of the above.
+
+  Note:
+    If configure detects the presents of "nasm" some additional speed
+    improvements get compiled in (additional assembler code to detect
+    and use multimedia extensions of the used processor).
+
+
+=======================================================================
+Building the software on *NIX platforms without configure:
+=======================================================================
+% make -f Makefile.unix
+
+
+
+=======================================================================
+Building the software on Windows with MSVC:
+(or MSVC + 3rd party C compiler)
+=======================================================================
+There are MSVC project files, and a Makefile.MSVC included
+with the project.  For production use, be sure to compile
+a "Release" target, with the "maximum speed" compile
+option, and #define NDEBUG.   
+
+It is possible to compile the GTK frame analyzer under windows, see
+README.WINGTK
+
+Various build options can be set in configMS.h
+
+Note: project files for building lame.exe seem to be broken or not
+quite compatable with MSVC6.  The most reliable way to build lame and
+lame_enc.dll is to run the .bat script (comes with MSVC6) which sets
+up your VC environment to work from the command line, and then:
+
+copy configMS.h config.h 
+nmake -f Makefile.MSVC  comp=msvc  asm=no
+
+Project files for the dll, ACM codec and directshow filter 
+seem to be in better sahpe.  
+
+
+
+
+
+
+=======================================================================
+Building the software on Windows with free compilers:
+=======================================================================
+LAME can be compiled with various Windows MSDOS ports (all free)
+of GCC (DJGPP, Mingw32).  See README.DJGPP.  
+
+For Mingw32, you should now be able to use the Unix Makefile that
+comes with LAME.  Try: "make -f Makefile.unix UNAME=MSDOS"
+You may need to remove these lines from brhist.c:
+
+#ifdef _WIN32
+COORD Pos;
+HANDLE CH;
+CONSOLE_SCREEN_BUFFER_INFO CSBI;
+#endif
+
+Mingw32 users may also try to use the unix configure script (explained
+above), it has _untested_ support for Mingw32.
+
+Cygwin users should use the unix configure script (explained above). If
+you have problems with the configure script try:
+      CC=gcc ./configure
+Patches to enable the build of the lame_enc.dll with Cygwin and autoconf /
+automake / libtool are welcome!
+
+To use the Borland C compiler (now free!) see README.B32 and Makefile.B32.
+Borland can also compile the lame_enc.dll, but this is untested.
+
+Can DJGPP or Mingw32 produce lame_enc.dll?
+
+Various build options can be set in configMS.h
+
+
+
diff --git a/INSTALL.configure b/INSTALL.configure
new file mode 100644
index 0000000..50dbe43
--- /dev/null
+++ b/INSTALL.configure
@@ -0,0 +1,183 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..15d7730
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Can I use LAME in my commercial program?  
+
+Yes, you can, under the restrictions of the LGPL.  The easiest
+way to do this is to:
+
+1. Link to LAME as separate library (libmp3lame.a on unix or 
+   lame_enc.dll or libmp3lame.dll on windows)
+
+2. Fully acknowledge that you are using LAME, and give a link
+   to our web site, www.mp3dev.org
+
+3. If you make modifications to LAME, you *must* release these
+   these modifications back to the LAME project, under the LGPL.
diff --git a/Makefile.MSVC b/Makefile.MSVC
new file mode 100644
index 0000000..d193441
--- /dev/null
+++ b/Makefile.MSVC
@@ -0,0 +1,674 @@
+#	Makefile.MSVC: MSVC Makefile for LAME
+#
+#	2000-2007 Robert Hegemann
+#	dedicated to the LAME project http://www.mp3dev.org
+###############################################################################
+
+
+
+#__ readme ____________________________________________________________________
+#	nmake -f Makefile.MSVC
+#		-> build lame, but not mp3x
+#		-> use Robert's code modifications
+#		-> assume MSVC 6.0 compiler available
+#		-> assume NASM available
+#		-> assemble MMX code with NASM
+#		-> no compiler warnings
+#       -> use single precision float
+#
+#	passing arguments, one can modify the default behaviour:
+#	COMP=<not INTEL or BCC>    ->  use MS compiler
+#	WARN=<anything but OFF>    ->  give verbose compiler warnings
+#	ASM=<anything but YES>     ->  no NASM nor MMX
+#	MMX=<anything but YES>     ->  do not assemble MMX code
+#	CFG=<anything but RH>      ->  disable Robert's modifications
+#	CPU=P1                     ->  optimize for Pentium instead of P II/III
+#	CPU=P2                     ->  optimize for Pentium II/III, you need a PII or better
+#	CPU=P3                     ->  optimize for Pentium III, you need a PIII or better
+#	GTK=YES                    ->  have GTK, adds mp3x to default targets
+#	PREC=<anything but SINGLE> ->  use double instead of single float
+#	SNDFILE=<anything but YES> ->  do not use LibSndfile for reading input files
+#
+#	Example:
+#	nmake -f Makefile.MSVC CPU=P1 GTK=YES
+#____________________________________________________________________ readme __
+
+
+
+#	targets <-> DOS filenames
+
+T_LAME = lame.exe
+T_MP3X = mp3x.exe
+T_DLL = libmp3lame.dll
+T_LIB_DYNAMIC = libmp3lame.lib
+T_LIB_STATIC = libmp3lame-static.lib
+T_LEGACY_DLL = lame_enc.dll
+
+TARGET_DIR = .\output\ 
+
+#	default targets
+
+PGM = $(T_LAME)
+
+#	some default settings
+
+!	IF "$(MSVCVER)" != ""
+COMP = MS
+!	IF "$(MSVCVER)" == "Win64"
+!	IF "$(ASM)" == ""
+ASM = NO # or it could be ML64 if we want to use it...
+GTK = NO
+!	ENDIF
+!	ENDIF
+!	ELSE
+!	IF "$(COMP)" == ""
+COMP = MSVC
+!	ENDIF
+!	ENDIF
+
+!	IF "$(ASM)" == ""
+ASM = YES
+!	ENDIF
+
+!	IF "$(MMX)" == ""
+MMX = YES
+!	ENDIF
+
+!	IF "$(CFG)" == ""
+CFG = RH
+!	ENDIF
+
+!	IF "$(CPU)" == ""
+CPU = P2auto
+!if "$(PROCESSOR_LEVEL)"=="6"
+CPU = P6
+!endif
+!	ENDIF
+
+!	IF "$(WARN)" == ""
+WARN = OFF
+!	ENDIF
+
+!	IF "$(PREC)" == ""
+PREC = SINGLE
+!	ENDIF
+
+!	IF "$(SNDFILE)" == ""
+SNDFILE = NO
+!	ENDIF
+
+OFF = win32
+MACHINE = /machine:I386
+LIB_OPTS = /nologo $(MACHINE) 
+
+!	MESSAGE ----------------------------------------------------------------------
+!	IF "$(CFG)" == ""
+!	 MESSAGE building LAME
+!	ELSE
+!	 MESSAGE building LAME featuring $(CFG)
+!	ENDIF
+!	IF "$(ASM)" == "YES"
+!	 MESSAGE + ASM
+!	 IF "$(MMX)" == "YES"
+!	  MESSAGE + MMX
+!	 ENDIF
+!	ENDIF
+!	IF "$(GTK)" == "YES"
+!	 MESSAGE + GTK
+!	ENDIF
+!	IF "$(COMP)" == "INTEL"
+!	 MESSAGE using INTEL COMPILER
+!	 IF "$(CPU)" == "P1"
+!	  MESSAGE + optimizing for Pentium (MMX)
+!	 ELSE
+!	  IF "$(CPU)" == "P2"
+!	   MESSAGE + you need a Pentium II or better
+!	  ELSE
+!	   IF "$(CPU)" == "P3"
+!	    MESSAGE + you need a Pentium III or better
+!	   ELSE
+!	    MESSAGE + optimizing for Pentium II/III
+!	   ENDIF
+!	  ENDIF
+!	 ENDIF
+!	ELSE
+!	 IF "$(MSVCVER)" == "6.0"
+!	  MESSAGE + using MSVC 6.0 32-Bit Compiler
+!	  IF "$(CPU)" == "P1"
+!	   MESSAGE + optimizing for Pentium (MMX) (may slow down PIII a few percent)
+!	  ELSE
+!	   MESSAGE + optimizing for Pentium II/III
+!	  ENDIF
+!	 ELSEIF "$(MSVCVER)" == "8.0"
+!	  MESSAGE + using MSVC 8.0 32-Bit Compiler
+!	  IF "$(CPU)" == "P1"
+!	   MESSAGE + optimizing for Pentium (MMX) (may slow down PIII a few percent)
+!	  ELSE
+!	   MESSAGE + optimizing for Pentium II/III
+!	  ENDIF
+!	 ELSE
+!	  IF "$(MSVCVER)" == "Win64"
+!	   MESSAGE + using MS 64-Bit Compiler
+!	  ELSE
+!	   MESSAGE using MS COMPILER
+!	   IF "$(CPU)" == "P1"
+!	    MESSAGE + optimizing for Pentium (MMX) (may slow down PIII a few percent)
+!	   ELSE
+!	    MESSAGE + optimizing for Pentium II/III
+!	   ENDIF
+!	  ENDIF
+!	 ENDIF
+!	ENDIF
+!	IF "$(PREC)" == "SINGLE"
+!	 MESSAGE + using Single precision
+!	ENDIF
+!	IF "$(SNDFILE)" == "YES"
+!	 MESSAGE + using LibSndfile reading input files
+!	ENDIF
+!	MESSAGE ----------------------------------------------------------------------
+
+!	IF "$(COMP)" != "INTEL"
+!	IF "$(COMP)" != "BCC"
+
+#__ Microsoft C options _______________________________________________________
+#
+#	/O2     maximize speed
+#	/Ob<n>  inline expansion
+#	/Og     enable global optimizations
+#	/Oi     enable intrinsic functions
+#	/Ot     favor code speed
+#	/Oy     enable frame pointer omission
+#	/G5     Pentium optimization
+#	/G6     Pentium II/III optimization
+#	/GA     optimize for Windows Application
+#	/GF     enable read-only string pooling
+#	/Gf     enable string spooling
+#	/Gs     disable stack checking calls
+#	/Gy     separate functions for linker
+#	/QIfdiv generate code for Pentium FDIV fix
+#	/QI0f   generate code for Pentium 0x0f erratum fix
+#
+#	remarks:
+#	 - aliasing options seem to break code
+#	 - try to get the Intel compiler demonstration code!
+#	   ICL produces faster code.
+
+# debugging options
+# CC_OPTS = /nologo /Zi /Ge /GZ
+# LN_OPTS = /nologo /debug:full /debugtype:cv /fixed:no
+
+# profiling options
+# CC_OPTS = /nologo /Zi /O2b2gity /G6As /DNDEBUG
+# LN_OPTS = /nologo /debug:full /debugtype:cv /fixed:no /profile
+
+# release options
+!	IF "$(MSVCVER)" == "Win64"
+CC_OPTS = /nologo /DWin64 /O2b2ity /GAy /Gs1024 /Zp8 /GL /GS- /Zi
+!	ELSEIF "$(MSVCVER)" == "8.0"
+CC_OPTS = /nologo /O2 /Wp64 /Oi /GL /arch:SSE /fp:precise
+!	ELSEif "$(CPU)"=="P6"
+CC_OPTS = /nologo /O2 /Ob2 /GAy /Gs1024 /Zp8 /Zi
+!else
+CC_OPTS = /nologo /O2 /Ob2 /GAy /Gs1024 /QIfdiv /QI0f /YX
+!	ENDIF
+
+!	IF "$(MSVCVER)" == "6.0"
+!	IF "$(CPU)" == "P1"
+CC_OPTS = $(CC_OPTS) /G5
+!	ELSE
+CC_OPTS = $(CC_OPTS) /G6
+!	ENDIF
+!	ENDIF
+
+!	IF "$(WARN)" == "OFF"
+CC_OPTS = $(CC_OPTS) /w
+!	ELSE
+CC_OPTS = $(CC_OPTS) /W$(WARN)
+!	ENDIF
+
+!	IF "$(PREC)" == "SINGLE"
+CC_OPTS = $(CC_OPTS) /DFLOAT8=float /DREAL_IS_FLOAT=1
+!	ENDIF
+
+CC_OPTS = $(CC_OPTS) /DNDEBUG /MD
+
+LN_OPTS = /nologo /opt:NOWIN98 /pdb:none
+LN_DLL = /nologo /DLL /opt:NOWIN98
+
+CC_OUT = /Fo
+LN_OUT = /force /OUT:
+
+CC = cl
+LN = link
+
+#_______________________________________________________ Microsoft C options __
+
+
+!	ELSE
+
+#__ Borland BCC options _______________________________________________________
+#
+#	first draft, DLL not working, generates very slow code!
+BCCINST = C:/Borland/BCC55
+
+CC_OPTS = -pc -q -ff -fp -jb -j1 -tWC -tWM -O2 -OS -I$(BCCINST)/include -DNDEBUG -DWIN32
+# dll >> -tWD
+LN_OPTS = -lGn -lGi -lap -lx -L$(BCCINST)/lib
+# dll >> -Tpd
+!	IF "$(CPU)" == "P1"
+CC_OPTS = $(CC_OPTS) -5
+!	ELSE
+CC_OPTS = $(CC_OPTS) -6
+!	ENDIF
+
+!	IF "$(WARN)" == "OFF"
+CC_OPTS = $(CC_OPTS) -w-
+!	ELSE
+CC_OPTS = $(CC_OPTS)
+!	ENDIF
+
+LN_DLL =
+#$(CCINST)/lib/cw32R.lib
+LN_OUT = -e
+CC_OUT = -o
+
+CC = bcc32
+LN = bcc32
+
+OFF = obj
+
+!	ENDIF
+#_______________________________________________________ Borland BCC options __
+
+
+!	ELSE
+
+#__ Intel 4.5 options _________________________________________________________
+#
+#	/YX         enable automatic precompiled header file creation/usage
+#	/Ox         maximum optimization same as /O2 without /Gfy
+#	/O2         same as /Gfsy /Ob1gyti
+#	/Gd      1) make cdecl the default calling convention
+#	/G5      2) optimized for Pentium
+#	/G6      3) optimized for Pentium II/III
+#	/GA         assume single threaded
+#	/Gs[n]      disable stack checks for functions with <n bytes of locals
+#	/GF         read-only string pooling optimization
+#	/Gy         separate functions for the linker
+#	/Qunroll    unroll loops with default heuristic
+#	/QIfist     enable fast float to int conversion
+#	/QIfdiv     enable patch for Pentium with FDIV erratum
+#	/QI0f       enable patch for Pentium with 0f erratum
+#	/Qip     2) enable single-file IP optimizations (within files)
+#	/Qipo       enable multi-file IP optimizations (between files)
+#	/Qipo_wp 4) enable entire program multi-file IP optimizations
+#	/QaxiMK     automatic use of specialized code for PII/III, MMX, SIMD
+#
+#	remarks:
+#	1) slows speed down, not using
+#	2) faster compared to 3) or 4) on Pentium MMX at 200 MHz
+
+!	IF "$(CPU)" == "P1"
+CC_OPTS = /G5 /QaxiMK /QIfdiv /QI0f
+!	ELSE
+!	IF "$(CPU)" == "P2"
+CC_OPTS = /G6 /Qxi /QaxMK
+!	ELSE
+!	IF "$(CPU)" == "P3"
+CC_OPTS = /G6 /QxiMK
+!	ELSE
+CC_OPTS = /G6 /QaxiMK /QIfdiv /QI0f
+!	ENDIF
+!	ENDIF
+!	ENDIF
+
+!	IF "$(WARN)" == "OFF"
+CC_OPTS = $(CC_OPTS) /w
+!	ELSE
+CC_OPTS = $(CC_OPTS) /W2 /Wport
+!	ENDIF
+
+!	IF "$(PREC)" == "SINGLE"
+CC_OPTS = $(CC_OPTS) /DFLOAT8=float /DREAL_IS_FLOAT=1
+!	ENDIF
+
+CC_OPTS = /nologo /DNDEBUG /YX /GA /Ox /Ob2 \
+          /Qunroll /Qsox- /Qip $(CC_OPTS)
+
+
+LN_OPTS = $(CC_OPTS)
+LN_DLL = /LD
+LN_OUT = /Fe
+CC_OUT = /Fo
+
+CC = icl
+LN = icl
+#_________________________________________________________ Intel 4.5 options __
+
+!	ENDIF
+
+
+
+#__ LIBSNDFILE ________________________________________________________________
+#
+#	uncomment the following if you want LibSndfile for input
+#	It's always a good idea to compile it in!
+#
+!	IF "$(SNDFILE)" == "YES"
+SNDFILE_OPTS = /DLIBSNDFILE
+LIBSNDFILE = $(SNDFILE_DIR)libsndfile.lib
+!   ENDIF
+#________________________________________________________________ LIBSNDFILE __
+
+
+
+#-- MISC --
+BRHIST_SWITCH = /DBRHIST
+
+CPP_OPTS = /DHAVE_CONFIG_H -I.
+
+
+
+#__ FRAME ANALYZER SUPPORT ____________________________________________________
+#
+#	Assuming you have "glib-dev" and "gtk+-dev" installed and the system
+#	DLLs "glib-1.3.dll", "gdk-1.3.dll" and "gtk-1.3.dll" copied into the
+#	"Win\System" folder
+#
+#	To compile in the frame analyzer support, you need the above mentioned
+#	libraries. You can pass the appropriate path to them in GTK_DIRS.
+#
+!	IF "$(GTK)" == "YES"
+!	IF "$(GTK_DIRS)" == ""
+GTK_DIRS = ../3rdparty
+!	ENDIF
+GTK_OPTS = -I$(GTK_DIRS)/glib     \
+           -I$(GTK_DIRS)/gtk+     \
+           -I$(GTK_DIRS)/gtk+/gtk \
+           -I$(GTK_DIRS)/gtk+/gdk
+GTK_LIBS = $(GTK_DIRS)/gtk+/gtk/gtk-1.3.lib \
+           $(GTK_DIRS)/gtk+/gdk/gdk-1.3.lib \
+           $(GTK_DIRS)/glib/glib-1.3.lib
+
+PGM = $(T_MP3X) $(PGM)
+!	ELSE
+!	IF "$(GTK)" == ""
+!	MESSAGE Pass GTK=YES to build the frame analyzer. (requires installed GTK)
+!	ENDIF
+!	ENDIF
+#____________________________________________________ FRAME ANALYZER SUPPORT __
+
+
+
+#__ MPG123 DECODING ___________________________________________________________
+#
+#	uncomment the following if you want decoding support
+#	It's always a good idea to compile it in!
+#
+CPP_OPTS = $(CPP_OPTS) /DHAVE_MPGLIB /DUSE_LAYER_1 /DUSE_LAYER_2
+#___________________________________________________________ MPG123 DECODING __
+
+
+
+#__ Takehiro's IEEE hack ______________________________________________________
+#
+#	uncomment the following to enable Takehiro's IEEE hack
+#	You'll want it on a x86 machine with i387 FPU
+#
+CPP_OPTS = $(CPP_OPTS) /DTAKEHIRO_IEEE754_HACK
+#______________________________________________________ Takehiro's IEEE hack __
+
+
+
+#__ Robert's alternate code ___________________________________________________
+!	IF "$(CFG)" == "RH"
+!	IF "$(MSVCVER)" == "8.0"
+LIB_OPTS = $(LIB_OPTS) /LTCG
+LN_OPTS = $(LN_OPTS) /LTCG
+!   ENDIF
+!	ENDIF
+#___________________________________________________ Robert's alternate code __
+
+
+
+CC_SWITCHES = $(CC_OPTS) $(SNDFILE_OPTS) $(BRHIST_SWITCH) \
+              $(GTK_OPTS) /DBS_FORMAT=BINARY
+
+LN_SWITCHES = $(LN_OPTS)
+
+lame_sources = \
+	frontend/main.c
+
+mpx_sources = \
+	frontend/gpkplotting.c \
+	frontend/gtkanal.c \
+	frontend/mp3x.c
+
+dll_sources = \
+	dll/BladeMP3EncDll.c
+
+common_sources = \
+	frontend/portableio.c \
+	frontend/get_audio.c \
+	frontend/parse.c \
+	frontend/timestatus.c \
+	frontend/lametime.c \
+	frontend/console.c \
+	frontend/brhist.c
+
+lamelib_sources = \
+	libmp3lame/bitstream.c \
+	libmp3lame/encoder.c \
+	libmp3lame/fft.c \
+	libmp3lame/gain_analysis.c \
+	libmp3lame/id3tag.c \
+	libmp3lame/lame.c \
+	libmp3lame/newmdct.c \
+	libmp3lame/psymodel.c \
+	libmp3lame/quantize.c \
+	libmp3lame/quantize_pvt.c \
+	libmp3lame/vector/xmm_quantize_sub.c \
+	libmp3lame/set_get.c \
+	libmp3lame/vbrquantize.c \
+	libmp3lame/reservoir.c \
+	libmp3lame/tables.c \
+	libmp3lame/takehiro.c \
+	libmp3lame/util.c \
+	libmp3lame/mpglib_interface.c \
+	libmp3lame/VbrTag.c \
+	libmp3lame/presets.c \
+	libmp3lame/version.c
+
+mpglib_sources = \
+	mpglib/common.c \
+	mpglib/dct64_i386.c \
+	mpglib/decode_i386.c \
+	mpglib/layer1.c \
+	mpglib/layer2.c \
+	mpglib/layer3.c \
+	mpglib/tabinit.c \
+	mpglib/interface.c
+
+
+!IF "$(MSVCVER)" == "Win64"
+ADDL_OBJ = bufferoverflowU.lib
+!ENDIF
+
+LIB_OBJ = $(lamelib_sources:.c=.obj)
+MPG_OBJ = $(mpglib_sources:.c=.obj)
+CMMN_OBJ = $(common_sources:.c=.obj)
+LAME_OBJ = $(lame_sources:.c=.obj)
+MPX_OBJ = $(mpx_sources:.c=.obj)
+DLL_OBJ = $(dll_sources:.c=.obj)
+
+
+.c.obj:
+	@$(CC) $(CPP_OPTS) $(CC_SWITCHES) -Iinclude -Ilibmp3lame -Impglib \
+	       $(CC_OUT)$@  -c $<
+
+
+#__ MASM ______________________________________________________________________
+#
+#	MASM: Microsoft Assembler
+#
+!	IF "$(ASM)" == "ML64"
+#
+.SUFFIXES : .nas
+.nas.obj:
+	@echo $<
+	@ml64 -Ilibmp3lame\i386 -Sf -DWIN32 -DWIN64 $< -Fo$@
+
+CC_SWITCHES = $(CC_SWITCHES) -DHAVE_NASM
+ASM_OBJ = $(ASM_OBJ) \
+	libmp3lame\i386\cpu_feat.obj \
+	libmp3lame\i386\fft3dn.obj \
+	libmp3lame\i386\fftsse.obj
+
+#	not yet coded
+#CC_SWITCHES = $(CC_SWITCHES) -DUSE_FFTFPU
+#ASM_OBJ = $(ASM_OBJ) libmp3lame\i386\fftfpu.obj
+#______________________________________________________________________ MASM __
+
+
+#__ NASM ______________________________________________________________________
+#
+#	NASM: Netwide Assembler
+#
+!	ELSEIF "$(ASM)" == "YES"
+#
+.SUFFIXES : .nas
+.nas.obj:
+	@echo $<
+	@nasmw -f $(OFF) -i libmp3lame/i386/ -DWIN32 $< -o $@
+
+CC_SWITCHES = $(CC_SWITCHES) /DHAVE_NASM
+ASM_OBJ = $(ASM_OBJ) \
+	libmp3lame\i386\cpu_feat.obj \
+	libmp3lame\i386\fft3dn.obj \
+	libmp3lame\i386\fftsse.obj
+
+#	not yet coded
+#CC_SWITCHES = $(CC_SWITCHES) /DUSE_FFTFPU
+#ASM_OBJ = $(ASM_OBJ) libmp3lame/i386/fftfpu.obj
+#______________________________________________________________________ NASM __
+
+!	ELSE
+!	MESSAGE Pass ASM=YES to build the assembler optimizations
+!	ENDIF
+
+
+#__ MMX _______________________________________________________________________
+#
+#	you need NASM but *not necessarily* a processor with MMX
+#	The above CPU feature detection code allows to run the same
+#	binary on a CPU without MMX too!
+#
+!	IF "$(ASM)" == "YES"
+!	IF "$(MMX)" == "YES"
+CC_SWITCHES = $(CC_SWITCHES) /DMMX_choose_table
+ASM_OBJ = $(ASM_OBJ) libmp3lame/i386/choose_table.obj
+!	ENDIF
+!	ENDIF
+#_______________________________________________________________________ MMX __
+
+!	MESSAGE
+
+no_target_specified :	$(PGM)
+	@echo.
+	@echo --=*  $(PGM) uptodate  *=--
+	@echo.
+
+target_directory :
+	@if not exist $(TARGET_DIR) mkdir $(TARGET_DIR)
+	
+common:	$(CMMN_OBJ)
+	@echo.
+	@echo --- COMMON FRONTEND STUFF UPTODATE ---
+	@echo.
+
+libA:	$(LIB_OBJ)
+	@echo.
+	@echo --- LAME MP3 ENCODING LIBRARY UPTODATE ---
+	@echo.
+
+libB:	$(MPG_OBJ)
+	@echo.
+	@echo --- MPG123 DECODING LIBRARY UPTODATE ---
+	@echo.
+
+lib: $(ASM_OBJ) libA libB
+
+$(T_LAME) : target_directory config.h $(T_LIB_STATIC) common $(LAME_OBJ)
+	@$(LN) $(LN_OUT)$(TARGET_DIR)$@ $(LN_SWITCHES) $(LIBSNDFILE) \
+	       $(TARGET_DIR)$(T_LIB_STATIC) $(CMMN_OBJ) $(LAME_OBJ) $(ADDL_OBJ)
+	@echo.
+	@echo --=*  $(TARGET_DIR)$@ ready  *=--
+	@echo.
+
+$(T_MP3X) : target_directory config.h lib common $(MPX_OBJ)
+	@$(LN) $(LN_OUT)$(TARGET_DIR)$@ $(LN_SWITCHES) $(GTK_LIBS) $(LIBSNDFILE) \
+	       $(TARGET_DIR)$(T_LIB_STATIC) $(CMMN_OBJ) $(MPX_OBJ) $(ADDL_OBJ)
+	@echo.
+	@echo --=*  $(TARGET_DIR)$@ ready  *=--
+	@echo.
+
+$(T_LEGACY_DLL) : target_directory config.h $(DLL_OBJ)
+	@$(LN) $(LN_OUT)$(TARGET_DIR)$@ $(LN_SWITCHES) \
+	       $(TARGET_DIR)$(T_LIB_STATIC) $(LN_DLL) \
+	       $(DLL_OBJ) $(ADDL_OBJ)
+	@echo.
+	@echo --=*  $(TARGET_DIR)$@ ready  *=--
+	@echo.
+
+$(T_DLL) : target_directory config.h $(T_LIB_STATIC) 
+	@$(LN) $(LN_DLL) $(MACHINE) \
+		/DEF:"include\lame.def" \
+		$(ADDL_OBJ) \
+		$(LN_OUT)"$(TARGET_DIR)$@" \
+		$(TARGET_DIR)$(T_LIB_STATIC) libmp3lame\version.obj 
+	@echo.
+	@echo --=*  $(TARGET_DIR)$@ ready  *=--
+	@echo.
+
+$(T_LIB_STATIC) : target_directory lib
+	@lib $(LIB_OPTS) \
+		/OUT:"$(TARGET_DIR)$@" \
+		$(ASM_OBJ) $(LIB_OBJ) $(MPG_OBJ)
+	@echo.
+	@echo --=*  $(TARGET_DIR)$@ ready  *=--
+	@echo.
+		
+config.h : configMS.h
+	@-copy configMS.h config.h
+
+clean:
+	@-del $(TARGET_DIR)$(T_LAME)
+	@-del $(TARGET_DIR)$(T_MP3X)
+	@-del $(TARGET_DIR)$(T_DLL)
+	@-del $(TARGET_DIR)$(T_LIB_STATIC)
+	@-del $(TARGET_DIR)$(T_LIB_DYNAMIC)
+	@-del $(TARGET_DIR)$(T_LEGACY_DLL)
+	@-del lame.pdb
+	@-del icl.pch
+	@-del $(TARGET_DIR)lame_enc.*
+	@-del frontend\*.obj
+	@-del dll\*.obj
+	@-del mpglib\*.obj
+	@-del libmp3lame\*.obj
+	@-del libmp3lame\i386\*.obj
+	@-del libmp3lame\vector\*.obj
+
+
+rebuild: clean all
+
+
+lame	:	$(T_LAME)
+lame_enc:	$(T_LEGACY_DLL)
+dll 	:	$(T_DLL) $(T_LEGACY_DLL) 
+mp3x	:	$(T_MP3X)
+
+
+all :	$(PGM) dll lame_enc 
+	@echo.
+	@echo --=*  all uptodate  *=--
+	@echo.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..c655edb
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,67 @@
+## $Id: Makefile.am,v 1.36.2.2 2010/02/26 22:33:06 robert Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+.PHONY: test
+
+SUBDIRS = mpglib libmp3lame frontend Dll debian doc include misc dshow ACM \
+	mac macosx vc_solution
+
+CLEANFILES = testcase.new.mp3
+
+EXTRA_DIST = \
+	API \
+	DEFINES \
+	HACKING \
+	INSTALL.configure \
+	LICENSE \
+	Makefile.MSVC \
+	Makefile.unix \
+	Makefile.am.global \
+	README.WINGTK \
+	STYLEGUIDE \
+	USAGE \
+	configMS.h \
+	lame.bat \
+	lame.spec.in \
+	lame.spec \
+	lame_projects_vc6.dsp \
+	lame_vc6.dsw \
+	lame_clients_vc6.dsw \
+	lame_vc8.sln \
+	testcase.mp3 \
+	testcase.wav
+
+#
+# The differences depend on the used processor architecture, the used
+# compiler and the used options for the compiler, so make test may
+# show some differences. You should only be concerned if you are a
+# LAME developer and the number of differences change after you
+# modified the source.
+#
+testcase.new.mp3: testcase.wav frontend/lame$(EXEEXT)
+	time frontend/lame$(EXEEXT) --nores $(top_srcdir)/testcase.wav testcase.new.mp3 || $(RM_F) testcase.new.mp3
+
+test: testcase.mp3 testcase.new.mp3
+	@echo
+	@echo "The following output has value only for a LAME-developer, do not make _any_"
+	@echo "assumptions about what this number means. You do not need to care about it."
+	@cmp -l testcase.new.mp3 $(top_srcdir)/testcase.mp3 | wc -l
+
+testupdate: testcase.mp3 testcase.new.mp3
+	cp testcase.new.mp3 $(top_srcdir)/testcase.mp3
+
+testg: frontend/mp3x$(EXEEXT) $(top_srcdir)/../test/castanets.wav
+	frontend/mp3x$(EXEEXT) -h $(top_srcdir)/../test/castanets.wav
+
+update:
+	cd $(top_srcdir) && CVS_RSH=ssh cvs -z3 -q update -dAP || true
+
+diff:
+	cd $(top_srcdir) && CVS_RSH=ssh cvs -z3 diff -u || true
+
+frontend/lame$(EXEEXT):
+	$(MAKE) $(MAKEFLAGS)
+
+frontend/mp3x$(EXEEXT): frontend/lame$(EXEEXT)
+
diff --git a/Makefile.am.global b/Makefile.am.global
new file mode 100644
index 0000000..4f89679
--- /dev/null
+++ b/Makefile.am.global
@@ -0,0 +1,7 @@
+## $Id: Makefile.am.global,v 1.6 2006/06/03 13:07:36 aleidinger Exp $
+
+# global section for every Makefile.am
+
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+
+# end global section
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..54a43cb
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(srcdir)/lame.spec.in $(top_srcdir)/Makefile.am.global \
+	$(top_srcdir)/configure COPYING ChangeLog INSTALL TODO \
+	config.guess config.sub depcomp install-sh ltmain.sh missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = lame.spec
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+SUBDIRS = mpglib libmp3lame frontend Dll debian doc include misc dshow ACM \
+	mac macosx vc_solution
+
+CLEANFILES = testcase.new.mp3
+EXTRA_DIST = \
+	API \
+	DEFINES \
+	HACKING \
+	INSTALL.configure \
+	LICENSE \
+	Makefile.MSVC \
+	Makefile.unix \
+	Makefile.am.global \
+	README.WINGTK \
+	STYLEGUIDE \
+	USAGE \
+	configMS.h \
+	lame.bat \
+	lame.spec.in \
+	lame.spec \
+	lame_projects_vc6.dsp \
+	lame_vc6.dsw \
+	lame_clients_vc6.dsw \
+	lame_vc8.sln \
+	testcase.mp3 \
+	testcase.wav
+
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+	@:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+	else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+	cd $(top_srcdir) && $(AUTOHEADER)
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f config.h stamp-h1
+lame.spec: $(top_builddir)/config.status $(srcdir)/lame.spec.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	test -d $(distdir) || mkdir $(distdir)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && cd $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+	@cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am am--refresh check check-am clean clean-generic \
+	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+	dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
+	distclean-generic distclean-hdr distclean-libtool \
+	distclean-tags distcleancheck distdir distuninstallcheck dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am
+
+
+# end global section
+
+.PHONY: test
+
+#
+# The differences depend on the used processor architecture, the used
+# compiler and the used options for the compiler, so make test may
+# show some differences. You should only be concerned if you are a
+# LAME developer and the number of differences change after you
+# modified the source.
+#
+testcase.new.mp3: testcase.wav frontend/lame$(EXEEXT)
+	time frontend/lame$(EXEEXT) --nores $(top_srcdir)/testcase.wav testcase.new.mp3 || $(RM_F) testcase.new.mp3
+
+test: testcase.mp3 testcase.new.mp3
+	@echo
+	@echo "The following output has value only for a LAME-developer, do not make _any_"
+	@echo "assumptions about what this number means. You do not need to care about it."
+	@cmp -l testcase.new.mp3 $(top_srcdir)/testcase.mp3 | wc -l
+
+testupdate: testcase.mp3 testcase.new.mp3
+	cp testcase.new.mp3 $(top_srcdir)/testcase.mp3
+
+testg: frontend/mp3x$(EXEEXT) $(top_srcdir)/../test/castanets.wav
+	frontend/mp3x$(EXEEXT) -h $(top_srcdir)/../test/castanets.wav
+
+update:
+	cd $(top_srcdir) && CVS_RSH=ssh cvs -z3 -q update -dAP || true
+
+diff:
+	cd $(top_srcdir) && CVS_RSH=ssh cvs -z3 diff -u || true
+
+frontend/lame$(EXEEXT):
+	$(MAKE) $(MAKEFLAGS)
+
+frontend/mp3x$(EXEEXT): frontend/lame$(EXEEXT)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Makefile.unix b/Makefile.unix
new file mode 100644
index 0000000..bac4610
--- /dev/null
+++ b/Makefile.unix
@@ -0,0 +1,624 @@
+# Makefile for LAME 3.xx -*- makefile -*-
+#
+# LAME is reported to work under:
+# Linux (i86), NetBSD 1.3.2 (StrongARM), FreeBSD (i86)
+# Compaq Alpha(OSF, Linux, Tru64 Unix), Sun Solaris, SGI IRIX,
+# OS2 Warp, Macintosh PPC, BeOS, Amiga and even VC++
+#
+
+# these variables are available on command line:
+#
+#   make UNAME=xxxxx ARCH=xxxxx   - specify a type of host
+#   make PGM=lame_exp             - specify a name of an executable file
+#
+# if you have mingw32-gcc, try:
+#   make -fMakefile.unix UNAME=MSDOS
+# or if you get the error
+# "process_begin: CreateProcess((null), copy configMS.h config.h, ...)":
+#   make -fMakefile.unix UNAME=MSDOS NOUNIXCMD=NO
+# or if you have NASM:
+#   make -fMakefile.unix UNAME=MSDOS HAVE_NASM=YES
+#
+
+ifeq ($(UNAME),MSDOS)
+  UNAME ?= UNKNOWN
+  ARCH = x86
+  NOUNIXCMD = YES
+else
+  UNAME = $(shell uname)
+  ARCH = $(shell uname -m)
+  iARCH = $(patsubst i%86,x86,$(ARCH))
+endif
+
+HAVE_NASM = NO
+HAVE_NEWER_GLIBC = NO
+
+# generic defaults. OS specific options go in versious sections below
+PGM = lame
+CC = gcc
+CC_OPTS =  -O
+CPP_OPTS = -Iinclude -Impglib -Ifrontend -Ilibmp3lame
+AR = ar
+RANLIB = ranlib
+GTK =
+GTKLIBS =
+LIBSNDFILE =
+LIBS = -lm
+MP3LIB = libmp3lame/libmp3lame.a
+MP3LIB_SHARED = libmp3lame/libmp3lame.so
+MAKEDEP = -M
+BRHIST_SWITCH =
+LIBTERMCAP =
+RM = rm -f
+
+CPP_OPTS += -DHAVE_CONFIG_H -I.
+
+##########################################################################
+# -DHAVEMPGLIB compiles the mpglib *decoding* library into libmp3lame
+##########################################################################
+CPP_OPTS += -DHAVE_MPGLIB
+
+##########################################################################
+# -DUSE_LAYER_1/2 enables Layer1 or Layer2 *decoding* abilities
+##########################################################################
+CPP_OPTS += -DUSE_LAYER_1 -DUSE_LAYER_2
+
+##########################################################################
+# -DTAKEHIRO_IEEE754_HACK enables Takehiro's IEEE hack
+##########################################################################
+ifeq ($(iARCH),x86)
+	CPP_OPTS += -DTAKEHIRO_IEEE754_HACK
+endif
+
+##########################################################################
+# Define these in the OS specific sections below to compile in code
+# for the optional VBR bitrate histogram.
+# Requires ncurses, but libtermcap also works.
+# If you have any trouble, just dont define these
+#
+# BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_{NCURSES_}TERMCAP_H
+# LIBTERMCAP = -lncurses
+# LIBTERMCAP = -ltermcap
+#
+# or, to try and simulate TERMCAP (ANSI), use:
+# BRHIST_SWITCH = -DBRHIST
+#
+##########################################################################
+
+
+##########################################################################
+# Define these in the OS specific sections below to compile in code for:
+#
+# SNDLIB = -DLIBSNDFILE   to use Erik de Castro Lopo's libsndfile
+# http://www.zip.com.au/~erikd/libsndfile/ instead of LAME's internal
+# routines.  Also set:
+#
+# LIBSNDFILE = -lsndfile
+# or
+# LIBSNDFILE = -L/location_of_libsndfile  -lsndfile
+#
+##########################################################################
+
+
+##########################################################################
+# Define these in the OS specific sections below to compile in code for
+# the GTK mp3 frame analyzer
+#
+# Requires  -DHAVE_MPGLIB
+#
+# GTK = -DHAVE_GTK `gtk-config --cflags`
+# GTKLIBS = `gtk-config --libs`
+#
+##########################################################################
+
+
+
+
+##########################################################################
+# LINUX
+##########################################################################
+ifeq ($(UNAME),Linux)
+#  The frame analyzer depends on gtk1.2. Uncomment the next 2 lines to get it
+#   GTK = -DHAVE_GTK `gtk-config --cflags`
+#   GTKLIBS = `gtk-config --libs`
+# Comment out next 2 lines if you want to remove VBR histogram capability
+   BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_TERMCAP_H
+   LIBTERMCAP = -lncurses
+#  uncomment to use LIBSNDFILE
+#   SNDLIB = -DLIBSNDFILE
+#   LIBSNDFILE=-lsndfile
+
+# suggested for gcc-2.7.x
+#  CC_OPTS =  -O3 -fomit-frame-pointer -funroll-loops -ffast-math  -finline-functions -Wall -pedantic
+#  CC_OPTS =  -O9 -fomit-frame-pointer -fno-strength-reduce -mpentiumpro -ffast-math -finline-functions -funroll-loops -Wall -malign-double -g -march=pentiumpro -mfancy-math-387 -pipe -pedantic
+
+# Suggested for GCC 4.* & machines with sse+sse2+sse3: -Os might reduce
+# the use of the instruction cache and, thus, get better performance,
+# but this should be experimented by the user. Customize at your own
+# convenience.
+#
+#CC_OPTS = -pipe -O3 \
+#	-Wall -Wextra -pedantic \
+#	-Wmissing-declarations -Wfloat-equal -Wshadow \
+#	-Wcast-qual -Wcast-align -Wdisabled-optimization \
+#	-ffast-math -ftree-vectorize -ftree-vect-loop-version \
+#	-mtune=nocona -march=nocona -mfpmath=sse -msse -msse2 -msse3 \
+#	-malign-double -maccumulate-outgoing-args
+
+#  for debugging:
+  CC_OPTS =  -UNDEBUG -O -Wall -pedantic -ggdb -DABORTFP
+
+#  for lots of debugging:
+#   CC_OPTS =  -DDEBUG -UNDEBUG  -O -Wall -pedantic -g -DABORTFP
+
+
+ifeq ($(CFG),RH)
+   GTK = -DHAVE_GTK `gtk-config --cflags`
+   GTKLIBS = `gtk-config --libs`
+  CPP_OPTS += -DFLOAT8=float -DREAL_IS_FLOAT=1 -DHAVE_ICONV -DHAVE_XMMINTRIN_H -D_ALLOW_INTERNAL_OPTIONS
+# these options for gcc-3.2 & AthlonXP
+   CC_OPTS = \
+	-pipe -O3 \
+	-Wall -W -Wmissing-declarations -Wfloat-equal \
+	-Wcast-qual -Wcast-align -Wdisabled-optimization -Wshadow \
+	-march=athlon-xp \
+	-malign-double \
+	-maccumulate-outgoing-args
+#	-Wconversion -Wunreachable-code \
+
+   HAVE_NEWER_GLIBC = YES
+   HAVE_NASM = YES
+endif
+
+ifeq ($(CFG),PFK)
+   CPP_OPTS += -DKLEMM -DKLEMM_00 -DKLEMM_01 -DKLEMM_02 -DKLEMM_03 -DKLEMM_04 -DKLEMM_05 -DKLEMM_06 -DKLEMM_07 -DKLEMM_08 -DKLEMM_09 -DKLEMM_10 -DKLEMM_11 -DKLEMM_12 -DKLEMM_13 -DKLEMM_14 -DKLEMM_15 -DKLEMM_16 -DKLEMM_17 -DKLEMM_18 -DKLEMM_19 -DKLEMM_20 -DKLEMM_21 -DKLEMM_22 -DKLEMM_23 -DKLEMM_24 -DKLEMM_25 -DKLEMM_26 -DKLEMM_27 -DKLEMM_28 -DKLEMM_29 -DKLEMM_30 -DKLEMM_31 -DKLEMM_32 -DKLEMM_33 -DKLEMM_34 -DKLEMM_35 -DKLEMM_36 -DKLEMM_37 -DKLEMM_38 -DKLEMM_39 -DKLEMM_40 -DKLEMM_41 -DKLEMM_42 -DKLEMM_43 -DKLEMM_44 -DKLEMM_45 -DKLEMM_46 -DKLEMM_47 -DKLEMM_48 -DKLEMM_49 -DKLEMM_50
+   CC_OPTS = \
+	-Wall -O9 -fomit-frame-pointer -march=pentium \
+	-finline-functions -fexpensive-optimizations \
+	-funroll-loops -funroll-all-loops -pipe -fschedule-insns2 \
+	-fstrength-reduce \
+	-malign-double -mfancy-math-387 -ffast-math
+
+   HAVE_NEWER_GLIBC = YES
+   HAVE_NASM = YES
+endif
+
+##########################################################################
+# LINUX on Digital/Compaq Alpha CPUs
+##########################################################################
+ifeq ($(ARCH),alpha)
+
+################################################################
+#### Check if 'ccc' is in our path
+####   if not, use 'gcc'
+################################################################
+ifeq ($(shell which ccc 2>/dev/null | grep -c ccc),0)
+
+# double is faster than float on Alpha
+CC_OPTS =       -O4 -pedantic -Wall -fomit-frame-pointer -ffast-math -funroll-loops \
+                -mfp-regs -fschedule-insns -fschedule-insns2 \
+                -finline-functions \
+#                -DFLOAT=double
+# add "-mcpu=21164a -Wa,-m21164a" to optimize for 21164a (ev56) CPU
+
+################################################################
+#### else, use 'ccc'
+################################################################
+else
+
+# Compaq's C Compiler
+CC = ccc
+
+################################################################
+#### set 'CC_OPTS = -arch host -tune host' to generate/tune instructions for this machine
+####     'CC_OPTS += -migrate -fast -inline speed -unroll 0' tweak to run as fast as possible :)
+####     'CC_OPTS += -w0 -pedantic -Wall' set warning and linking flags
+################################################################
+CC_OPTS = -arch host -tune host
+CC_OPTS += -migrate -fast -inline speed -unroll 0
+CC_OPTS += -w0 -pedantic -Wall
+
+
+################################################################
+#### to debug, uncomment
+################################################################
+# For Debugging
+#CC_OPTS += -g3
+
+################################################################
+#### define __DECALPHA__ (i was getting re-declaration warnings
+####   in machine.h
+################################################################
+# Define DEC Alpha
+CPP_OPTS += -D__DECALPHA__
+
+# standard Linux libm
+#LIBS	=	-lm
+# optimized libffm (free fast math library)
+#LIBS	=	-lffm
+# Compaq's fast math library
+LIBS    =       -lcpml
+endif  #  gcc or ccc?
+endif  #  alpha
+endif  #  linux
+
+
+
+##########################################################################
+# FreeBSD
+##########################################################################
+ifeq ($(UNAME),FreeBSD)
+#  remove if you do not have GTK or do not want the GTK frame analyzer
+   GTK = -DHAVE_GTK `gtk12-config --cflags`
+   GTKLIBS = `gtk12-config --libs`
+# Comment out next 2 lines if you want to remove VBR histogram capability
+   BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_TERMCAP_H
+   LIBTERMCAP = -lncurses
+
+endif
+
+
+
+##########################################################################
+# OpenBSD
+##########################################################################
+ifeq ($(UNAME),OpenBSD)
+#  remove if you do not have GTK or do not want the GTK frame analyzer
+   GTK = -DHAVE_GTK `gtk-config --cflags`
+   GTKLIBS = `gtk-config --libs`
+# Comment out next 2 lines if you want to remove VBR histogram capability
+   BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_TERMCAP_H
+   LIBTERMCAP = -lcurses
+endif
+
+
+
+
+##########################################################################
+# SunOS
+##########################################################################
+ifeq ($(UNAME),SunOS)
+   CC = cc
+   CC_OPTS = -O -xCC
+   MAKEDEP = -xM
+# for gcc, use instead:
+#   CC = gcc
+#   CC_OPTS = -O
+#   MAKEDEP = -M
+endif
+
+
+
+##########################################################################
+# SGI
+##########################################################################
+ifeq ($(UNAME),IRIX64)
+   CC = cc
+   CC_OPTS = -O3 -woff all
+
+#optonal:
+#   GTK = -DHAVE_GTK `gtk-config --cflags`
+#   GTKLIBS = `gtk-config --libs`
+#   BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_TERMCAP_H
+#   LIBTERMCAP = -lncurses
+
+endif
+ifeq ($(UNAME),IRIX)
+   CC = cc
+   CC_OPTS = -O3 -woff all
+endif
+
+
+
+##########################################################################
+# Compaq Alpha running Dec Unix (OSF)
+##########################################################################
+ifeq ($(UNAME),OSF1)
+   CC = cc
+   CC_OPTS = -fast -O3 -std -g3 -non_shared
+endif
+
+##########################################################################
+# BeOS
+##########################################################################
+ifeq ($(UNAME),BeOS)
+   CC = $(BE_C_COMPILER)
+   LIBS =
+ifeq ($(ARCH),BePC)
+   CC_OPTS = -O9 -fomit-frame-pointer -march=pentium \
+   -mcpu=pentium -ffast-math -funroll-loops \
+   -fprofile-arcs -fbranch-probabilities
+else
+   CC_OPTS = -opt all
+   MAKEDEP = -make
+endif
+endif
+
+###########################################################################
+# MOSXS (Rhapsody PPC)
+###########################################################################
+ifeq ($(UNAME),Rhapsody)
+   CC = cc
+   LIBS =
+   CC_OPTS = -O9 -ffast-math -funroll-loops -fomit-frame-pointer
+   MAKEDEP = -make
+
+endif
+##########################################################################
+# OS/2
+##########################################################################
+# Properly installed EMX runtime & development package is a prerequisite.
+# tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
+#
+##########################################################################
+ifeq ($(UNAME),OS/2)
+   SHELL=sh
+   CC = gcc
+   CC_OPTS = -O3 -D__OS2__
+   PGM = lame.exe
+   LIBS =
+   RANLIB = touch
+
+# I use the following for slightly better performance on my Pentium-II
+# using pgcc-2.91.66:
+#   CC_OPTS = -O6 -ffast-math -funroll-loops -mpentiumpro -march=pentiumpro -D__OS2__
+# for the unfortunates with a regular pentium (using pgcc):
+# CC_OPTS = -O6 -ffast-math -funroll-loops -mpentium -march=pentium -D__OS2__
+
+# Comment out next 2 lines if you want to remove VBR histogram capability
+   BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_{NCURSES_}TERMCAP_H
+   LIBTERMCAP = -lncurses
+
+# Uncomment & inspect the 2 GTK lines to use MP3x GTK frame analyzer.
+# Properly installed XFree86/devlibs & GTK+ is a prerequisite.
+# The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
+#   GTK = -DHAVE_GTK -IC:/XFree86/include/gtk12 -Zmt -D__ST_MT_ERRNO__ -IC:/XFree86/include/glib12 -IC:/XFree86/include
+#   GTKLIBS = -LC:/XFree86/lib -Zmtd -Zsysv-signals -Zbin-files -lgtk12 -lgdk12 -lgmodule -lglib12 -lXext -lX11 -lshm -lbsd -lsocket -lm
+endif
+
+
+
+###########################################################################
+# MSDOS/Windows
+###########################################################################
+ifeq ($(UNAME),MSDOS)
+  RM =
+  CC_OPTS = \
+       -Wall -pipe -O3 -fomit-frame-pointer -ffast-math -funroll-loops \
+       -fschedule-insns2 -fmove-all-movables -freduce-all-givs         \
+       -mcpu=pentium -march=pentium -mfancy-math-387
+  CC_OPTS += -D_cdecl=__cdecl
+  PGM = lame.exe
+endif
+
+
+
+###########################################################################
+# AmigaOS
+###########################################################################
+# Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
+#
+###########################################################################
+ifeq ($(UNAME),AmigaOS)
+	CC = gcc -noixemul
+	CC_OPTS = -O3 -ffast-math -funroll-loops -m68020-60 -m68881
+	BRHIST_SWITCH = -DBRHIST
+	MAKEDEP = -MM
+	ifeq ($(ARCH),WOS)
+		CC = ppc-amigaos-gcc -warpup
+		CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops \
+		-mmultiple -mcpu=603e
+		AR = ppc-amigaos-ar
+		RANLIB = ppc-amigaos-ranlib
+		LIBS =
+	endif
+	ifeq ($(ARCH),PPC)
+		CC = ppc-amigaos-gcc
+		CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops \
+		-mmultiple -mcpu=603e
+		AR = ppc-amigaos-ar
+		RANLIB = ppc-amigaos-ranlib
+		LIBS =
+	endif
+endif
+
+
+# 10/99 added -D__NO_MATH_INLINES to fix a bug in *all* versions of
+# gcc 2.8+ as of 10/99.
+
+ifeq ($(HAVE_NEWER_GLIBC),YES)
+CC_SWITCHES =
+else
+CC_SWITCHES = -D__NO_MATH_INLINES  # only needed by some older glibc
+endif
+
+CC_SWITCHES += -DNDEBUG $(CC_OPTS) $(SNDLIB) $(BRHIST_SWITCH)
+frontend_sources = \
+	frontend/amiga_mpega.c \
+        frontend/brhist.c \
+	frontend/get_audio.c \
+        frontend/lametime.c \
+        frontend/parse.c \
+	frontend/portableio.c \
+	frontend/timestatus.c \
+	frontend/console.c \
+
+lib_sources = \
+	libmp3lame/bitstream.c \
+	libmp3lame/encoder.c \
+	libmp3lame/fft.c \
+	libmp3lame/gain_analysis.c \
+        libmp3lame/id3tag.c \
+        libmp3lame/lame.c \
+        libmp3lame/newmdct.c \
+	libmp3lame/psymodel.c \
+	libmp3lame/quantize.c \
+	libmp3lame/quantize_pvt.c \
+        libmp3lame/set_get.c \
+	libmp3lame/vbrquantize.c \
+	libmp3lame/reservoir.c \
+	libmp3lame/tables.c \
+	libmp3lame/takehiro.c \
+	libmp3lame/util.c \
+	libmp3lame/mpglib_interface.c \
+        libmp3lame/VbrTag.c \
+        libmp3lame/version.c \
+        libmp3lame/presets.c \
+        libmp3lame/vector/xmm_quantize_sub.c \
+        mpglib/common.c \
+        mpglib/dct64_i386.c \
+        mpglib/decode_i386.c \
+        mpglib/layer1.c \
+        mpglib/layer2.c \
+        mpglib/layer3.c \
+        mpglib/tabinit.c \
+        mpglib/interface.c
+
+
+#ifeq ($(UNAME),MSDOS)
+#  frontend_sources := $(subst /,\,$(frontend_sources))
+#  lib_sources := $(subst /,\,$(lib_sources))
+#endif
+
+frontend_obj = $(frontend_sources:.c=.o)
+lib_obj = $(lib_sources:.c=.o)
+
+DEP = $(frontend_sources:.c=.d) $(lib_sources:.c=.d )
+
+gtk_sources = frontend/gtkanal.c frontend/gpkplotting.c frontend/mp3x.c
+gtk_obj = $(gtk_sources:.c=.gtk.o)
+gtk_dep = $(gtk_sources:.c=.d)
+
+
+
+NASM = nasm
+ASFLAGS=-f elf -i libmp3lame/i386/
+
+# for people with nasmw
+ifeq ($(UNAME),MSDOS)
+ NASM = nasmw
+ ASFLAGS=-f win32 -DWIN32 -i libmp3lame/i386/
+endif
+
+%.o: %.nas
+	$(NASM) $(ASFLAGS) $< -o $@
+%.o: %.s
+	gcc -c $< -o $@
+
+
+#HAVE_NASM = YES
+
+ifeq ($(HAVE_NASM),YES)
+## have NASM
+CC_SWITCHES += -DHAVE_NASM
+lib_obj += libmp3lame/i386/cpu_feat.o
+
+## use MMX extension. you need nasm and MMX supported CPU.
+CC_SWITCHES += -DMMX_choose_table
+lib_obj += libmp3lame/i386/choose_table.o
+
+## use 3DNow! extension. you need nasm and 3DNow! supported CPU.
+lib_obj += libmp3lame/i386/fft3dn.o
+
+## use SSE extension. you need nasm and SSE supported CPU.
+lib_obj += libmp3lame/i386/fftsse.o
+
+## not yet coded
+#CC_SWITCHES += -DUSE_FFTFPU
+#lib_obj += libmp3lame/i386/fftfpu.o
+endif
+
+
+
+#
+# Makefile rules---you probably won't have to modify below this line
+#
+%.o: %.c
+	$(CC) $(CPP_OPTS) $(CC_SWITCHES) -c $< -o $@
+
+%.d: %.c
+  ifeq ($(NOUNIXCMD),YES)
+	$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< > $@
+  else
+	$(SHELL) -ec '$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< | sed '\''s;$*.o;& $@;g'\'' > $@'
+  endif
+
+%.gtk.o: %.c
+	$(CC) $(CPP_OPTS) $(CC_SWITCHES) $(GTK) -c $< -o $@
+
+all: frontend/$(PGM)
+
+
+$(lib_sources) $(frontend_sources) $(gtk_sources) : config.h
+
+config.h: configMS.h
+  ifeq ($(NOUNIXCMD),YES)
+	copy configMS.h config.h
+  else
+	cp configMS.h config.h
+  endif
+
+frontend/$(PGM):	frontend/main.o $(frontend_obj)  $(MP3LIB)
+	$(CC) $(CC_OPTS) -o frontend/$(PGM)  frontend/main.o $(frontend_obj) \
+        $(MP3LIB) $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP)
+
+mp3x:   $(frontend_obj) $(gtk_obj) $(MP3LIB)
+	$(CC) $(CC_OPTS) -o frontend/mp3x $(frontend_obj) $(gtk_obj) \
+        $(MP3LIB) $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP) $(GTKLIBS) 
+
+mp3rtp:	frontend/rtp.o frontend/mp3rtp.o  $(frontend_obj) $(MP3LIB)
+	$(CC) $(CC_OPTS) -o frontend/mp3rtp frontend/mp3rtp.o frontend/rtp.o $(frontend_obj) $(MP3LIB) \
+        $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP)
+
+libmp3lame/libmp3lame.a:  $(lib_obj)
+	echo $(lib_obj)
+	$(AR) cr libmp3lame/libmp3lame.a  $(lib_obj)
+	$(RANLIB) libmp3lame/libmp3lame.a
+
+#shared library.  GNU specific?
+libmp3lame/libmp3lame.so:  $(lib_obj)
+	gcc -shared -Wl,-soname,libmp3lame/libmp3lame.so -o libmp3lame/libmp3lame.so $(lib_obj)
+
+install:  frontend/$(PGM) #libmp3lame.a
+	cp frontend/$(PGM) /usr/bin
+	#cp libmp3lame.a /usr/lib
+	#cp lame.h /usr/lib
+
+clean:
+  ifeq ($(UNAME),MSDOS)
+	-del $(subst /,\,$(frontend_obj))
+	-del $(subst /,\,$(lib_obj))
+	-del $(subst /,\,$(gtk_obj))
+	-del $(subst /,\,$(DEP))
+	-del frontend\$(PGM)
+	-del frontend\main.o
+	-del libmp3lame\libmp3lame.a
+  else
+	-$(RM) $(gtk_obj) $(frontend_obj) $(lib_obj) $(DEP) frontend/$(PGM) \
+          frontend/main.o frontend/lame libmp3lame/libmp3lame.a \
+          frontend/mp3x.o frontend/mp3x
+  endif
+
+
+tags: TAGS
+
+TAGS: ${c_sources}
+	etags -T ${c_sources}
+
+ifneq ($(MAKECMDGOALS),clean)
+  -include $(DEP)
+endif
+
+
+#
+#  testcase.mp3 is a 2926 byte file.  The first number output by
+#  wc is the number of bytes which differ between new output
+#  and 'official' results.
+#
+#  Because of compiler options and effects of roundoff, the
+#  number of bytes which are different may not be zero, but
+#  should be at most 30.
+#
+test: frontend/$(PGM)
+	frontend/$(PGM)  --nores testcase.wav testcase.new.mp3
+	cmp -l testcase.new.mp3 testcase.mp3 | wc -l
diff --git a/README b/README
new file mode 100644
index 0000000..09e7e5f
--- /dev/null
+++ b/README
@@ -0,0 +1,43 @@
+                      LAME 3.xx   
+               LAME Ain't an MP3 Encoder
+                 http://www.mp3dev.org
+	             March 2001
+
+Originally developed by Mike Cheng (www.uq.net.au/~zzmcheng).  Now 
+maintained by Mark Taylor (www.mp3dev.org).
+
+This code is distributed under the GNU LESSER PUBLIC LICENSE
+(LGPL, see www.gnu.org) with the following modification:
+
+1. If you determine that distribution of LAME requires a patent license,
+   and you obtain a patent license, you may distribute LAME even though
+   redistribution of LAME may also require a patent license.  
+
+2. You agree not to enforce any patent claims for any aspect of
+   MPEG audio compression, or any other techniques contained in 
+   the LAME source code. 
+
+
+============================================================================
+
+see the file "INSTALL" for installation (compiling) instructions.  
+see the file "USAGE" for the most up-to-date guide to the command line options.
+see the file "LICENSE" for details on how to use LAME in non-GPL programs.
+see the file "HACKING" if you are interested in working on LAME
+see the file "API" for details of the LAME encoding library API
+
+There is HTML documentation and a man page in the doc directory.
+
+============================================================================
+
+LAME uses the MPGLIB decoding engine, from the MPG123 package, written
+by: Michael Hipp (www.mpg123.de) MPGLIB is released under the GPL.
+
+Copyrights (c) 1999-1007 by The LAME Project
+Copyrights (c) 1999,2000,2001 by Mark Taylor
+Copyrights (c) 1999,2000,2001 by Mark Taylor
+Copyrights (c) 1998 by Michael Cheng
+Copyrights (c) 1995,1996,1997 by Michael Hipp: mpglib
+
+As well as additional copyrights as documented in the source code.  
+
diff --git a/README.WINGTK b/README.WINGTK
new file mode 100644
index 0000000..1ec1cc7
--- /dev/null
+++ b/README.WINGTK
@@ -0,0 +1,67 @@
+            Installation notes on MP3X (the LAME frame analyzer) for WIN32
+
+===========================================================================
+Document History:
+===========================================================================
+
+Initial version by Albert Faber, March 30, 2000
+
+Update by Albert Faber (Sept 07 2000), changed instructions
+to compile with latest glib/gtk libraries.
+
+Update by Albert Faber (Sept 07 2000), changed instructions
+to compile with latest glib/gtk libraries.
+
+Update by Albert Faber (Oct 20 2000), small adaptions to be conform
+the new lame directory structure.
+
+Update by Gabriel Bouvigne (Jan 07 2004), changes to be conform to the
+VC6 worspace structure.
+
+Update by Gabriel Bouvigne (Nov 11 2006), changes to be conform to the
+VC8 worspace structure. Tested with gtk+-dev-1.3.0-20030115 and glib-dev-2.12.4
+
+
+===========================================================================
+How to compile the MP3 frame analyzer (MP3x):
+===========================================================================
+
+You first need to get hold of the latest GTK and GLIB include files and lib
+files. You can download them freely from the WINGTK project WEB site.
+(see http://www.gtk.org, and click on the WINGTK link.)
+
+Download:  glib-dev-VERSION.zip, gtk+-dev-VERSION.zip and extralibs-dev-VERSION.zip
+where VERSION indicates the release data, so it will look something like 20000805
+
+unzip all three zip files in a WinGTK subdirectory, which is created from the lame
+analyzer directory (for example, D:\CVS\lame\WinGtk)
+
+You will end up with the following directory tree
+  D:\CVS\lame\analyzer\WinGtk\src\glib
+  D:\CVS\lame\analyzer\WinGtk\src\gtk+\glib
+  D:\CVS\lame\analyzer\WinGtk\src\gtk+
+
+Set Mp3x as your current active project, recompile everything, and you're done.
+
+
+===========================================================================
+How to run and use the MP3 Frame analyzer
+===========================================================================
+
+To run MP3x.exe, you need
+the GTK DLL files:  Either instal them on your system,
+or put them in the same directory as mp3x.exe resides.
+
+
+
+Example:
+mp3x.exe myfile
+
+myfile can be a mp3 file, or a wav file.
+
+
+
+                                === End of Document ===
+
+
+
diff --git a/STYLEGUIDE b/STYLEGUIDE
new file mode 100644
index 0000000..e955dc5
--- /dev/null
+++ b/STYLEGUIDE
@@ -0,0 +1,187 @@
+* The LAME API is frozen.  Poorly designed as it is, don't change it, 
+  and add to it sparingly.
+
+* Don't take it upon yourself to go through LAME with the sole purpose
+  of updating everything to match this guide.  Especially important:
+  don't change the spacing, indentation, curly braces, etc, 
+  in routines you did not write.
+
+* If you want to make a change which effects many many functions,
+  please check with the maintainer first.
+
+* Respect the indentation of the author of the original function.
+  If the indentation is not consistent, use 4.
+
+* Don't use tabulators (the character with the value '\t') in source code,
+  especially these with a width of unequal 8. Lame sources are using
+  different sizes for tabulators.
+
+* Don't set the macro NDEBUG in alpha versons.
+  NDEBUG should be set for beta versions.
+
+* check important assumptions with an assert()
+
+* use int for all integer quantities.  
+  LAME requires 32 bit ints, so you can assume int is at least 32 bits.  
+  Don't use 'long'.  Don't use 'unsigned' unless ABSOLUTELY necessary.
+  Don't use 'char' just to save bytes.  If 64 bits is required, use int64.
+
+  Annnotation:
+  ISO C calls the 64 bit int type not int64 but int64_t.
+
+* Avoid using float or double, and instead use: (defined in machine.h).  
+
+  FLOAT    for variables which require at least 32bits
+  FLOAT8   for variables which require at least 64bits
+
+  On some machines, 64bit will be faster than 32bit.  Also, some math
+  routines require 64bit float, so setting FLOAT=float will result in a
+  lot of conversions.
+
+  Annotation (pfk):
+  The new ISO C standard passed in autumn 1999 has defined new types for
+  exactly this reason. There are called float_least32_t and float_least64_t
+  and have at least the advantage that you not need to explain their
+  meaning. 
+
+  Annotation (mt):  
+  we will adopt this convention in Jan 1, 2003.
+
+
+* The internal representation of PCM samples in type 'sample_t',
+  currently this is a FLOAT.
+
+* Use SI base units. Lame mixes Hz, kHz, kbps, bps. This is mess.
+
+  Example:
+        float     wavelength_green = 555.e-9;
+        unsigned  data_rate        = 128000;
+        float     lowpass_freq     = 12500.;
+  
+  Converting between user input and internal representation should be done
+  near the user interface, not in the most inner loop of an utility
+  function.
+
+----------------------------------------------------------------------------------
+Edited version of the Linux Kernel Style Guide:
+----------------------------------------------------------------------------------
+
+                Chapter 1: Indentation
+
+Respect the indentation of the author of the original function.
+If the indentation is not consistent, don't change it.  If
+you are so anal-retentive about these things and you can't
+bare to even look at code with poor indentation, change it to 4.
+
+
+                Chapter 2: Placing Braces
+
+The other issue that always comes up in C styling is the placement of
+braces.  Unlike the indent size, there are few technical reasons to
+choose one placement strategy over the other, but the preferred way, as
+shown to us by the prophets Kernighan and Ritchie, is to put the opening
+brace last on the line, and put the closing brace first, thusly:
+
+        if (x is true) {
+                we do y
+        }
+
+However, there is one special case, namely functions: they have the
+opening brace at the beginning of the next line, thus:
+
+        int function(int x)
+        {
+                body of function
+        }
+
+Heretic people all over the world have claimed that this inconsistency
+is ...  well ...  inconsistent, but all right-thinking people know that
+(a) K&R are _right_ and (b) K&R are right.  Besides, functions are
+special anyway (you can't nest them in C). 
+
+Note that the closing brace is empty on a line of its own, _except_ in
+the cases where it is followed by a continuation of the same statement,
+ie a "while" in a do-statement or an "else" in an if-statement, like
+this:
+
+        do {
+                body of do-loop
+        } while (condition);
+
+and
+
+        if (x == y) {
+                ..
+        } else if (x > y) {
+                ...
+        } else {
+                ....
+        }
+                        
+Rationale: K&R. 
+
+Also, note that this brace-placement also minimizes the number of empty
+(or almost empty) lines, without any loss of readability.  Thus, as the
+supply of new-lines on your screen is not a renewable resource (think
+25-line terminal screens here), you have more empty lines to put
+comments on. 
+
+
+                Chapter 3: Naming
+
+C is a Spartan language, and so should your naming be.  Unlike Modula-2
+and Pascal programmers, C programmers do not use cute names like
+ThisVariableIsATemporaryCounter.  A C programmer would call that
+variable "tmp", which is much easier to write, and not the least more
+difficult to understand. 
+
+HOWEVER, while mixed-case names are frowned upon, descriptive names for
+global variables are a must.  To call a global function "foo" is a
+shooting offense. 
+
+GLOBAL variables (to be used only if you _really_ need them) need to
+have descriptive names, as do global functions.  If you have a function
+that counts the number of active users, you should call that
+"count_active_users()" or similar, you should _not_ call it "cntusr()". 
+
+Encoding the type of a function into the name (so-called Hungarian
+notation) is brain damaged - the compiler knows the types anyway and can
+check those, and it only confuses the programmer.  No wonder MicroSoft
+makes buggy programs. 
+
+LOCAL variable names should be short, and to the point.  If you have
+some random integer loop counter, it should probably be called "i". 
+Calling it "loop_counter" is non-productive, if there is no chance of it
+being mis-understood.  Similarly, "tmp" can be just about any type of
+variable that is used to hold a temporary value. 
+
+
+                
+                Chapter 4: Functions
+
+Document functions.  
+
+Keep functions as modular as possible.  But don't adhere to artificial
+line number limitations.  For example, lame_encode_frame() encodes a
+single MP3 frame and is a long sequence of function calls.  It makes
+no sense to break this into two or more routines.
+
+
+
+                Chapter 5: Commenting
+
+Comments are good, but there is also a danger of over-commenting.  NEVER
+try to explain HOW your code works in a comment: it's much better to
+write the code so that the _working_ is obvious, and it's a waste of
+time to explain badly written code. 
+
+Generally, you want your comments to tell WHAT your code does, not HOW. 
+Also, try to avoid putting comments inside a function body: if the
+function is so complex that you need to separately comment parts of it,
+you should probably go back to chapter 4 for a while.  You can make
+small comments to note or warn about something particularly clever (or
+ugly), but try to avoid excess.  Instead, put the comments at the head
+of the function, telling people what it does, and possibly WHY it does
+it. 
+
+
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..33d9575
--- /dev/null
+++ b/TODO
@@ -0,0 +1,162 @@
+1. bug in resample code:  downsampling from 44101 to 44100 causes
+   a seg fault.  Workaround in place for now:  resampling disabled 
+   if input/output samplerates agree to 4 digits.  
+
+
+
+2.  high bitrate encodings have trouble on some hardware players.
+Track this down.  Probably caused by --strictly-enforce-ISO and
+IXMAX_VAL.  Try setting IXMAX_VAL back to 8191 and/or
+maxmp3buf=8*960 to see if there is a working combination.
+
+note: one of the decoder bugs was identified. It is caused by using
+different block sizes on both channels. A parameter need to be
+added to Lame to handle workarounds.
+
+
+3 frontend: code is a complete mess. But it has so many debugged
+  features it will be a lot of work to re-write.
+
+
+4. MSVC project files.  It would be nice to create a working
+   MSVC6 workspace, which included all the projects as possible
+   targets:
+          lame.exe
+          mp3x.exe   (require GTK libs)
+          lame_enc.dll   
+          ACM codec
+          directshow codec
+
+   I think the only MSVC5 project that we need to preserve is
+   for lame_enc.dll, since Albert Faber (still?) doesn't use VC6?
+   But no reason we cant have VC5 and VC6 project files for the dll.
+
+   
+
+   
+
+
+5.
+NOGAP encoding:
+
+-nogap:  more testing, fix options, test id3 tags?
+Can we change id3 tags without reseting the encoder??
+At the end of encoding 1.wav, call lame_get_mf_samples_to_encode()
+to find the number of non encoded buffered PCM samples.  Then
+encode samples from 2.wav until these PCM samples have been
+encoded, *THEN* call lame_encode_flush_nogap() and close
+out file 1.mp3.
+
+
+NOGAP decoding:  
+lame --decode --nogap file1.mp3 file2.mp3 file3.mp3
+should also work.  What needs to be done:
+get_audio.c:  We need a way to open a second mp3 file, without
+              calling lame_decode_init() and reinitializing mpglib.
+              And the mpglib needs to know to look for new Xing
+              tags at the beginning of file2.mp3 and file3.mp3.
+
+
+
+6.
+Does stdin work when LAME is compiled to use libsndfile? 
+(new version of libsndfile will support this - try this out)
+
+
+7. 
+LAME has problems with pure DC input.  i.e. a square wave with
+a frequency well below 20 Hz.  Not very important, but it should
+be fixed.
+
+
+8.
+mgplib has bugs with i-stereo.  flag denoting invalid
+i-stereo value (= frame is m/s stereo) is not correct.  
+
+9.
+lowpass filter: for M/S stereo, use more filtering for the side
+channel, less filtering for mid channel.  We need to first replace
+the polyphase filter with an FIR lowpass filter with finer frequency
+resolution before implementing this. 
+
+10. 
+LAME has a 31 point FIR filter used for resampling, which
+can also be used as a lowpass.  When resampling is done, 
+use that filter to also lowpass instead of the polyphase filter.
+
+11.
+Even when resampling is not needed, should we use an FIR filter
+for the lowpass?  If it is not too much slower, yes.  If it
+is slower, then it should be an option since it will produce
+higher quality.  
+
+12.
+We should consider moving the experts options from the *long
+help* text into an *experts only* help text. The average Joe gets
+knocked down by the huge number of possibilities to setup lame.
+
+
+
+
+50.
+Better tonality estimation.
+Gpsycho uses predictability, and so needs a delay to detect the tonality
+of a sound.
+Nspsytune seems to miss tonals when several of them are too narrow.
+We would probably need the best of both.
+
+
+
+
+60.
+Different ATH handling for sfb21. We are using the minimum value of ath
+in each whole sfb. in sfb21 this leads to very high bitrates.
+We could perhaps use 2 or 3 ath partitions in sfb21
+
+note: partially done
+
+
+
+70.
+Use mixed blocks.
+
+
+
+
+90.
+Use intensity stereo. This is a must-have for low bitrates, but if the
+algorythm is very good it could also be used in every case.
+Note: mpg123 (and all derivatives, like xmms and lame/mpglib)
+have bugs in the intensity stereo decoding.  Bugs have been there
+for years since there are very few intensity stereo mp3's out there.
+
+
+
+
+
+998.
+Merge GOGO's fast assembler routines.
+
+
+
+
+999.
+It would be nice to save some information whilst encoding
+a: wave -> mp3
+	a RIFF/wave can contain LIST chunks with information
+	about author, title, etc. 
+	==> could go into TAG fields of resulting mp3
+b: mp3 -> mp3
+	==> we could copy the TAG directly
+c: mp3 -> wave
+	==> copy TAG into LIST chunk
+
+
+
+1500.
+Integrate plusV extensions
+
+
+
+2000.
+To be able to encode as fast as FastEnc
\ No newline at end of file
diff --git a/USAGE b/USAGE
new file mode 100644
index 0000000..4c1bf32
--- /dev/null
+++ b/USAGE
@@ -0,0 +1,779 @@
+
+% lame [options] inputfile [outputfile]
+
+For more options, just type:
+% lame --help
+
+
+=======================================================================
+Constant Bitrate Examples:
+=======================================================================
+fixed bit rate jstereo 128 kbps encoding:
+% lame sample.wav  sample.mp3      
+
+fixed bit rate jstereo 128 kbps encoding, higher quality:  (recommended)
+% lame -h sample.wav  sample.mp3      
+
+Fast encode, low quality  (no noise shaping)
+% lame -f sample.wav  sample.mp3     
+
+=======================================================================
+Variable Bitrate Examples:
+=======================================================================
+LAME has two types of variable bitrate: ABR and VBR.
+
+ABR is the type of variable bitrate encoding usually found in other
+MP3 encoders, Vorbis and AAC.  The number of bits is determined by
+some metric (like perceptual entropy, or just the number of bits
+needed for a certain set of encoding tables), and it is not based on
+computing the actual encoding/quantization error.  ABR should always
+give results equal or better than CBR:
+
+ABR:   (--abr <x> means encode with an average bitrate of around x kbps)
+lame -h --abr 128  sample.wav sample.mp3
+
+
+VBR is a true variable bitrate mode which bases the number of bits for
+each frame on the measured quantization error relative to the
+estimated allowed masking. There are 10 compression levels defined, 
+ranging from 0=lowest compression to 9 highest compression. The resulting
+filesizes depend on the input material. On typical music you can expect
+-V5 resulting in files averaging 132 kbps, -V2 averaging 200 kbps.
+
+Variable Bitrate (VBR): (use -V n to adjust quality/filesize)
+% lame -V2 sample.wav sample.mp3
+
+
+
+=======================================================================
+LOW BITRATES
+=======================================================================
+At lower bitrates, (like 24 kbps per channel), it is recommended that
+you use a 16 kHz sampling rate combined with lowpass filtering.  LAME,
+as well as commercial encoders (FhG, Xing) will do this automatically.
+However, if you feel there is too much (or not enough) lowpass
+filtering, you may need to try different values of the lowpass cutoff
+and passband width (--resample, --lowpass and --lowpass-width options).
+
+
+=======================================================================
+STREAMING EXAMPLES
+=======================================================================
+
+% cat inputfile | lame [options] - - > output
+
+
+
+
+=======================================================================
+Scripts are included (in the 'misc' subdirectory)
+to run lame on multiple files:
+
+bach script:  mlame     Run "mlame -?" for instructions.
+sh script:    auenc     Run auenc for instructions
+sh script:    mugeco.sh
+
+Pearl script which will re-encode mp3 files and preserve id3 tags:
+lameid3.pl 
+
+Windows scripts:
+lame4dos.bat  
+Lame.vbs   (and an HTML frontend: LameGUI.html)
+
+
+=======================================================================
+options guide:
+=======================================================================
+These options are explained in detail below.
+
+
+Quality related:
+
+-m m/s/j/f/a   mode selection
+-q n           Internal algorithm quality setting 0..9. 
+               0 = slowest algorithms, but potentially highest quality
+               9 = faster algorithms, very poor quality
+-h             same as -q2
+-f             same as -q7
+
+
+Constant Bit Rate (CBR)
+-b  n          set bitrate (8, 16, 24, ..., 320)
+--freeformat   produce a free format bitstream.  User must also specify
+               a bitrate with -b, between 8 and 640 kbps.
+
+Variable Bit Rate (VBR)
+-v             VBR
+--vbr-old      use old variable bitrate (VBR) routine
+--vbr-new      use new variable bitrate (VBR) routine (default)
+-V n           VBR quality setting  (0=highest quality, 9=lowest)
+-b  n          specify a minimum allowed bitrate (8,16,24,...,320)
+-B  n          specify a maximum allowed bitrate (8,16,24,...,320)
+-F             strictly enforce minimum bitrate
+-t             disable VBR informational tag 
+--nohist       disable display of VBR bitrate histogram
+
+--abr n        specify average bitrate desired
+
+
+Operational:
+
+-r              assume input file is raw PCM
+-s  n           input sampling frequency in kHz (for raw PCM input files)
+--resample n    output sampling frequency
+--mp3input      input file is an MP3 file.  decode using mpglib/mpg123
+--ogginput      input file is an Ogg Vorbis file.  decode using libvorbis
+-x              swap bytes of input file
+--scale <arg>   multiply PCM input by <arg>
+--scale-l <arg> scale channel 0 (left) input (multiply PCM data) by <arg>
+--scale-r <arg> scale channel 1 (right) input (multiply PCM data) by <arg>
+-a              downmix stereo input file to mono .mp3
+-e  n/5/c       de-emphasis
+-p              add CRC error protection
+-c              mark the encoded file as copyrighted
+-o              mark the encoded file as a copy
+-S              don't print progress report, VBR histogram
+--strictly-enforce-ISO   comply as much as possible to ISO MPEG spec
+--replaygain-fast   compute RG fast but slightly inaccurately (default)
+--replaygain-accurate   compute RG more accurately and find the peak sample
+--noreplaygain  disable ReplayGain analysis
+--clipdetect    enable --replaygain-accurate and print a message whether
+                clipping occurs and how far the waveform is from full scale
+
+--decode        assume input file is an mp3 file, and decode to wav.
+-t              disable writing of WAV header when using --decode
+                (decode to raw pcm, native endian format (use -x to swap))
+
+
+
+ID3 tagging:
+
+--tt <title>    audio/song title (max 30 chars for version 1 tag)
+--ta <artist>   audio/song artist (max 30 chars for version 1 tag)
+--tl <album>    audio/song album (max 30 chars for version 1 tag)
+--ty <year>     audio/song year of issue (1 to 9999)
+--tc <comment>  user-defined text (max 30 chars for v1 tag, 28 for v1.1)
+--tn <track>    audio/song track number (1 to 255, creates v1.1 tag)
+--tg <genre>    audio/song genre (name or number in list)
+--add-id3v2     force addition of version 2 tag
+--id3v1-only    add only a version 1 tag
+--id3v2-only    add only a version 2 tag
+--space-id3v1   pad version 1 tag with spaces instead of nulls
+--pad-id3v2     same as '--pad-id3v2-size 128'
+--pad-id3v2-size <num> adds version 2 tag, pad with extra <num> bytes
+--genre-list    print alphabetically sorted ID3 genre list and exit
+
+Note: A version 2 tag will NOT be added unless one of the input fields
+won't fit in a version 1 tag (e.g. the title string is longer than 30
+characters), or the '--add-id3v2' or '--id3v2-only' options are used,
+or output is redirected to stdout.
+
+Windows and OS/2-specific options:
+    --priority <type>     sets the process priority
+
+
+options not yet described:
+--nores            disable bit reservoir
+--disptime
+
+--lowpass
+--lowpass-width
+--highpass
+--highpass-width
+
+
+
+
+
+=======================================================================
+Detailed description of all options in alphabetical order
+=======================================================================
+
+
+=======================================================================
+downmix
+=======================================================================
+-a  
+
+mix the stereo input file to mono and encode as mono.  
+
+This option is only needed in the case of raw PCM stereo input 
+(because LAME cannot determine the number of channels in the input file).
+To encode a stereo PCM input file as mono, use "lame -m s -a"
+
+For WAV and AIFF input files, using "-m m" will always produce a
+mono .mp3 file from both mono and stereo input.
+
+
+=======================================================================
+average bitrate encoding (aka Safe VBR)
+=======================================================================
+--abr n
+
+turns on encoding with a targeted average bitrate of n kbps, allowing
+to use frames of different sizes.  The allowed range of n is 8...320 
+kbps, you can use any integer value within that range.
+
+
+
+
+
+=======================================================================
+bitrate
+=======================================================================
+-b  n
+
+For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)
+n =   32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
+
+For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)
+n = 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
+
+For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)
+n = 8, 16, 24, 32, 40, 48, 56, 64
+
+
+The bitrate to be used.  Default is 128 kbps MPEG1, 80 kbps MPEG2.
+
+When used with variable bitrate encodings (VBR), -b specifies the
+minimum bitrate to use.  This is useful only if you need to circumvent
+a buggy hardware device with strange bitrate constrains.
+
+
+=======================================================================
+max bitrate
+=======================================================================
+-B  n
+
+see also option "-b" for allowed bitrates.
+
+Maximum allowed bitrate when using VBR/ABR.
+
+Using -B is NOT RECOMMENDED.  A 128 kbps CBR bitstream, because of the
+bit reservoir, can actually have frames which use as many bits as a
+320 kbps frame.  ABR/VBR modes minimize the use of the bit reservoir, and
+thus need to allow 320 kbps frames to get the same flexability as CBR
+streams.  This is useful only if you need to circumvent a buggy hardware
+device with strange bitrate constrains.
+
+
+
+
+=======================================================================
+copyright
+=======================================================================
+-c   
+
+mark the encoded file as copyrighted
+
+
+
+=======================================================================
+clipping detection
+=======================================================================
+--clipdetect
+
+Enable --replaygain-accurate and print a message whether clipping 
+occurs and how far in dB the waveform is from full scale.
+
+This option is not usable if the MP3 decoder was _explicitly_ disabled 
+in the build of LAME.
+
+See also: --replaygain-accurate
+
+
+
+=======================================================================
+mpglib decode capability
+=======================================================================
+--decode 
+
+This just uses LAME's mpg123/mpglib interface to decode an MP3 file to
+a wav file.  The input file can be any input type supported by
+encoding, including .mp3 (layers 1, 2 and 3) and .ogg.  
+
+If -t is used (disable wav header), LAME will output
+raw pcm in native endian format (use -x to swap bytes).
+
+This option is not usable if the MP3 decoder was _explicitly_ disabled
+in the build of LAME.
+
+
+=======================================================================
+de-emphasis
+=======================================================================
+-e  n/5/c   
+
+  n = (none, default)
+  5 = 0/15 microseconds
+  c = citt j.17
+
+All this does is set a flag in the bitstream.  If you have a PCM
+input file where one of the above types of (obsolete) emphasis has
+been applied, you can set this flag in LAME.  Then the mp3 decoder
+should de-emphasize the output during playback, although most 
+decoders ignore this flag.
+
+A better solution would be to apply the de-emphasis with a standalone
+utility before encoding, and then encode without -e.  
+
+
+
+=======================================================================
+fast mode
+=======================================================================
+-f   
+
+Same as -q 7.  
+
+NOT RECOMMENDED.  Use when encoding speed is critical and encoding
+quality does not matter.  Disable noise shaping.  Psycho acoustics are
+used only for bit allocation and pre-echo detection.
+
+=======================================================================
+strictly enforce VBR minimum bitrate
+=======================================================================
+-F   
+
+strictly enforce VBR minimum bitrate.  With out this optioni, the minimum
+bitrate will be ignored for passages of analog silence.
+
+
+
+=======================================================================
+free format bitstreams
+=======================================================================
+--freeformat   
+
+LAME will produce a fixed bitrate, free format bitstream.
+User must specify the desired bitrate in kbps, which can
+be any integer between 8 and 640.
+
+Not supported by most decoders.  Complient decoders (of which there
+are few) are only required to support up to 320 kbps.  
+
+Decoders which can handle free format:
+
+                     supports up to
+MAD                      640 kbps
+"lame --decode"          550 kbps  
+Freeamp:                 440 kbps
+l3dec:                   310 kbps
+
+
+
+
+
+=======================================================================
+high quality
+=======================================================================
+-h
+
+use some quality improvements.  The same as -q 2.
+
+
+
+=======================================================================
+Modes:
+=======================================================================
+
+-m m           mono
+-m s           stereo
+-m j           joint stereo
+-m f           forced mid/side stereo
+-m d           dual (independent) channels
+-m i           intensity stereo
+-m a           auto
+
+MONO is the default mode for mono input files.  If "-m m" is specified
+for a stereo input file, the two channels will be averaged into a mono
+signal.  
+
+STEREO
+
+JOINT STEREO is the default mode for stereo files with fixed bitrates of
+128 kbps or less.  At higher fixed bitrates, the default is stereo.
+For VBR encoding, jstereo is the default for VBR_q >4, and stereo
+is the default for VBR_q <=4.  You can override all of these defaults
+by specifing the mode on the command line.  
+
+jstereo means the encoder can use (on a frame by frame bases) either
+regular stereo (just encode left and right channels independently)
+or mid/side stereo.  In mid/side stereo, the mid (L+R) and side (L-R)
+channels are encoded, and more bits are allocated to the mid channel
+than the side channel.  This will effectively increase the bandwidth
+if the signal does not have too much stereo separation.  
+
+Mid/side stereo is basically a trick to increase bandwidth.  At 128 kbps,
+it is clearly worth while.  At higher bitrates it is less useful.
+
+For truly mono content, use -m m, which will automatically down
+sample your input file to mono.  This will produce 30% better results
+over -m j.  
+
+Using mid/side stereo inappropriately can result in audible
+compression artifacts.  To much switching between mid/side and regular
+stereo can also sound bad.  To determine when to switch to mid/side
+stereo, LAME uses a much more sophisticated algorithm than that
+described in the ISO documentation.
+
+FORCED MID/SIDE STEREO forces all frames to be encoded mid/side stereo.  It 
+should only be used if you are sure every frame of the input file
+has very little stereo seperation.  
+
+DUAL CHANNELS   Not supported.
+
+INTENSITY STEREO
+
+AUTO
+
+Auto select should select (if input is stereo)
+          8 kbps   Mono
+     16- 96 kbps   Intensity Stereo (if available, otherwise Joint Stereo)
+    112-128 kbps   Joint Stereo -mj
+    160-192 kbps   -mj with variable mid/side threshold
+    224-320 kbps   Independent Stereo -ms
+
+
+
+=======================================================================
+MP3 input file
+=======================================================================
+--mp3input
+
+Assume the input file is a MP3 file.  LAME will decode the input file
+before re-encoding it.  Since MP3 is a lossy format, this is 
+not recommended in general.  But it is useful for creating low bitrate
+mp3s from high bitrate mp3s.  If the filename ends in ".mp3" LAME will assume
+it is an MP3.  For stdin or MP3 files which dont end in .mp3 you need
+to use this switch.
+
+
+=======================================================================
+disable historgram display
+=======================================================================
+--nohist
+
+By default, LAME will display a bitrate histogram while producing
+VBR mp3 files.  This will disable that feature.
+
+
+=======================================================================
+disable ReplayGain analysis
+=======================================================================
+--noreplaygain
+
+By default ReplayGain analysis is enabled. This switch disables it.
+
+See also: --replaygain-accurate, --replaygain-fast
+
+
+=======================================================================
+non-original
+=======================================================================
+-o   
+
+mark the encoded file as a copy
+
+
+
+=======================================================================
+CRC error protection
+=======================================================================
+-p  
+
+turn on CRC error protection.  
+Yes this really does work correctly in LAME.  However, it takes 
+16 bits per frame that would otherwise be used for encoding.
+
+
+=======================================================================
+algorithm quality selection
+=======================================================================
+-q n  
+
+Bitrate is of course the main influence on quality.  The higher the
+bitrate, the higher the quality.  But for a given bitrate,
+we have a choice of algorithms to determine the best
+scalefactors and huffman encoding (noise shaping).
+
+-q 0:  use slowest & best possible version of all algorithms.
+
+-q 2:  recommended.  Same as -h.  -q 0 and -q 1 are slow and may not produce 
+       significantly higher quality.  
+
+-q 5:  default value.  Good speed, reasonable quality
+
+-q 7:  same as -f.  Very fast, ok quality.  (psycho acoustics are
+       used for pre-echo & M/S, but no noise shaping is done.  
+
+-q 9:  disables almost all algorithms including psy-model.  poor quality.
+
+
+
+=======================================================================
+input file is raw pcm
+=======================================================================
+-r  
+
+Assume the input file is raw pcm.  Sampling rate and mono/stereo/jstereo
+must be specified on the command line.  Without -r, LAME will perform
+several fseek()'s on the input file looking for WAV and AIFF headers.
+
+Not supported if LAME is compiled to use LIBSNDFILE.
+
+
+
+=======================================================================
+slightly more accurate ReplayGain analysis and finding the peak sample
+=======================================================================
+--replaygain-accurate
+
+Enable decoding on the fly. Compute "Radio" ReplayGain on the decoded 
+data stream. Find the peak sample of the decoded data stream and store 
+it in the file.
+
+
+ReplayGain analysis does _not_ affect the content of a compressed data
+stream itself, it is a value stored in the header of a sound file. 
+Information on the purpose of ReplayGain and the algorithms used is 
+available from http://www.replaygain.org/
+
+By default, LAME performs ReplayGain analysis on the input data (after
+the user-specified volume scaling). This behaviour might give slightly 
+inaccurate results because the data on the output of a lossy 
+compression/decompression sequence differs from the initial input data. 
+When --replaygain-accurate is specified the mp3 stream gets decoded on
+the fly and the analysis is performed on the decoded data stream. 
+Although theoretically this method gives more accurate results, it has
+several disadvantages:
+  * tests have shown that the difference between the ReplayGain values 
+    computed on the input data and decoded data is usually no greater 
+    than 0.5dB, although the minimum volume difference the human ear 
+    can perceive is about 1.0dB
+  * decoding on the fly significantly slows down the encoding process
+The apparent advantage is that:
+  * with --replaygain-accurate the peak sample is determined and 
+    stored in the file. The knowledge of the peak sample can be useful
+    to decoders (players) to prevent a negative effect called 'clipping'
+    that introduces distortion into sound.
+    
+
+Only the "Radio" ReplayGain value is computed. It is stored in the LAME tag. 
+The analysis is performed with the reference volume equal to 89dB. 
+Note: the reference volume has been changed from 83dB on transition
+from version 3.95 to 3.95.1.
+
+This option is not usable if the MP3 decoder was _explicitly_ disabled 
+in the build of LAME. (Note: if LAME is compiled without the MP3 decoder, 
+ReplayGain analysis is performed on the input data after user-specified 
+volume scaling).
+
+See also: --replaygain-fast, --noreplaygain, --clipdetect
+
+
+=======================================================================
+fast ReplayGain analysis
+=======================================================================
+--replaygain-fast
+
+Compute "Radio" ReplayGain of the input data stream after user-specified
+volume scaling and/or resampling.
+
+ReplayGain analysis does _not_ affect the content of a compressed data
+stream itself, it is a value stored in the header of a sound file. 
+Information on the purpose of ReplayGain and the algorithms used is 
+available from http://www.replaygain.org/
+
+Only the "Radio" ReplayGain value is computed. It is stored in the LAME tag. 
+The analysis is performed with the reference volume equal to 89dB. 
+Note: the reference volume has been changed from 83dB on transition
+from version 3.95 to 3.95.1.
+
+This switch is enabled by default.
+
+See also: --replaygain-accurate, --noreplaygain
+
+
+
+=======================================================================
+output sampling frequency in kHz
+=======================================================================
+--resample  n
+
+where n = 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48
+
+Output sampling frequency.  Resample the input if necessary.  
+
+If not specified, LAME may sometimes resample automatically 
+when faced with extreme compression conditions (like encoding
+a 44.1 kHz input file at 32 kbps).  To disable this automatic
+resampling, you have to use --resamle to set the output samplerate
+equal to the inptu samplerate.  In that case, LAME will not
+perform any extra computations.
+
+
+
+=======================================================================
+sampling frequency in kHz
+=======================================================================
+-s  n
+
+where n = sampling rate in kHz.
+
+Required for raw PCM input files.  Otherwise it will be determined
+from the header information in the input file.
+
+LAME will automatically resample the input file to one of the
+supported MP3 samplerates if necessary.
+
+
+=======================================================================
+silent operation
+=======================================================================
+-S
+
+don't print progress report
+
+=======================================================================
+scale
+=======================================================================
+--scale <arg>
+
+Scales input by <arg>.  This just multiplies the PCM data
+(after it has been converted to floating point) by <arg>.  
+
+<arg> > 1:  increase volume
+<arg> = 1:  no effect
+<arg> < 1:  reduce volume
+
+Use with care, since most MP3 decoders will truncate data
+which decodes to values greater than 32768.  
+
+
+=======================================================================
+strict ISO complience
+=======================================================================
+--strictly-enforce-ISO   
+
+With this option, LAME will enforce the 7680 bit limitation on
+total frame size.  This results in many wasted bits for
+high bitrate encodings.
+
+
+=======================================================================
+disable VBR tag
+=======================================================================
+-t              
+
+Disable writing of the VBR Tag (only valid if -v flag is
+specified) This tag in embedded in frame 0 of the MP3 file.  It lets
+VBR aware players correctly seek and compute playing times of VBR
+files.
+
+When '--decode' is specified (decode mp3 to wav), this flag will 
+disable writing the WAV header.  The output will be raw pcm,
+native endian format.  Use -x to swap bytes.
+
+
+
+=======================================================================
+variable bit rate  (VBR)
+=======================================================================
+-v
+
+Turn on VBR.  There are several ways you can use VBR.  I personally
+like using VBR to get files slightly bigger than 128 kbps files, where
+the extra bits are used for the occasional difficult-to-encode frame.
+For this, try specifying a minimum bitrate to use with VBR:
+
+lame -v      -b 112  input.wav output.mp3
+
+If the file is too big, use -V n, where n = 0...9
+
+lame -v -V n -b 112  input.wav output.mp3
+
+
+If you want to use VBR to get the maximum compression possible,
+and for this, you can try:  
+
+lame -v  input.wav output.mp3
+lame -v -V n input.wav output.mp3         (to vary quality/filesize)
+
+
+
+
+
+
+=======================================================================
+VBR quality setting
+=======================================================================
+-V n       
+
+n = 0...9.  Specifies the value of VBR_q.
+default = 4,  highest quality = 0, smallest files = 9
+
+Using -V 6 or higher (lower quality) is NOT RECOMMENDED.  
+ABR will produce better results.  
+
+
+How is VBR_q used?
+
+The value of VBR_q influences two basic parameters of LAME's psycho
+acoustics:
+ a) the absolute threshold of hearing
+ b) the sample to noise ratio
+The lower the VBR_q value the lower the injected quantization noise
+will be.
+ 
+*NOTE* No psy-model is perfect, so there can often be distortion which
+is audible even though the psy-model claims it is not!  Thus using a
+small minimum bitrate can result in some aggressive compression and
+audible distortion even with -V 0.  Thus using -V 0 does not sound
+better than a fixed 256 kbps encoding.  For example: suppose in the 1 kHz
+frequency band the psy-model claims 20 dB of distortion will not be
+detectable by the human ear, so LAME VBR-0 will compress that
+frequency band as much as possible and introduce at most 20 dB of
+distortion.  Using a fixed 256 kbps framesize, LAME could end up
+introducing only 2 dB of distortion.  If the psy-model was correct,
+they will both sound the same.  If the psy-model was wrong, the VBR-0
+result can sound worse.
+
+
+=======================================================================
+swapbytes   
+=======================================================================
+-x
+
+swap bytes in the input file (and output file when using --decode).
+For sorting out little endian/big endian type problems.  If your
+encodings sound like static, try this first.
+
+=======================================================================
+Window and OS/2 process priority control   
+=======================================================================
+--priority <type>
+
+(Windows and OS/2 only)
+
+Sets the process priority for LAME while running under IBM OS/2.
+This can be very useful to avoid the system becoming slow and/or
+unresponsive. By setting LAME to run in a lower priority, you leave
+more time for the system to update basic processing (drawing windows,
+polling keyboard/mouse, etc). The impact in LAME's performance is 
+minimal if you use priority 0 to 2.
+
+The valid parameters are:
+
+     0 = Low priority (IDLE, delta = 0)
+     1 = Medium priority (IDLE, delta = +31)
+     2 = Regular priority (REGULAR, delta = -31)
+     3 = High priority (REGULAR, delta = 0)
+     4 = Maximum priority (REGULAR, delta = +31) 
+
+Note that if you call '--priority' without a parameter, then 
+priority 0 will be assumed.
+ 
+
+  
+
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..0b8f869
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,88 @@
+dnl acinclude.m4. Change *this* file to add new or change macros.
+dnl When changes have been made, delete aclocal.m4 and run
+dnl "aclocal".
+dnl
+dnl DO NOT change aclocal.m4 !
+dnl
+
+dnl * LA_SEARCH_FILE(variable, filename, PATH)
+dnl * Search "filename" in the specified "PATH", "variable" will 
+dnl * contain the full pathname or the empty string
+dnl * PATH is space-separated list of directories.
+dnl * by Florian Bomers
+
+AC_DEFUN([LA_SEARCH_FILE],[
+  $1=
+  dnl hack: eliminate line feeds in $2
+  for FILE in $2; do
+    for DIR in $3; do
+      dnl use PATH in order
+      if test ".$1"="." && test -f "$DIR/$FILE"; then
+        $1=$DIR
+      fi
+    done
+  done
+])
+
+dnl * LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix)
+dnl * looks for "lib-filename" and "header-filename" in the area of "prefix".
+dnl * if found, "lib-variable" and "include-variable" are set to the
+dnl * respective paths.
+dnl * prefix is a single path
+dnl * libs are searched in prefix, prefix/lib, prefix/.., prefix/../lib
+dnl * headers are searched in prefix, prefix/include, prefix/.., prefix/../include
+dnl * 
+dnl * If one of them is not found, both "lib-variable", "include-variable" are 
+dnl * set to the empty string.
+dnl *
+dnl * TODO: assert function call to verify lib
+dnl *
+dnl * by Florian Bomers
+
+AC_DEFUN([LA_SEARCH_LIB],[
+  dnl look for lib
+  LA_SEARCH_FILE($1, $3, $5 $5/lib $5/.. $5/../lib)
+  dnl look for header.
+  LA_SEARCH_FILE($2, $4, $5 $5/include $5/.. $5/../include)
+  if test ".$1" = "." || test ".$2" = "."; then
+    $1=
+    $2=
+  fi
+])
+
+
+ 
+
+# alex_IEEE854_FLOAT80
+# ------------
+AC_DEFUN([alex_IEEE854_FLOAT80],
+[AC_CACHE_CHECK(for IEEE854 compliant 80 bit floats, alex_cv_ieee854_float80,
+[AC_TRY_RUN([
+int   float2long_IEEE_compliance ( void )
+{
+    struct {
+        long padding; /* to prevent unaligned access */
+        float  f;
+    } s;
+    s.f = 12582912.; if ( *(long*)(&s.f) != 1262485504l ) return 0;
+    s.f = 12615679.; if ( *(long*)(&s.f) != 1262518271l ) return 0;
+    s.f = 13582912.; if ( *(long*)(&s.f) != 1263485504l ) return 0;
+    s.f = 12550145.; if ( *(long*)(&s.f) != 1262452737l ) return 0;
+    s.f = 11582912.; if ( *(long*)(&s.f) != 1261485504l ) return 0;
+    return 1;
+}
+
+int main(void)
+{
+    int retval;
+
+    retval = float2long_IEEE_compliance();
+
+    /* no error return -> success */
+    return !retval;
+}
+], alex_cv_ieee854_float80=yes, alex_cv_ieee854_float80=no,
+[AC_MSG_WARN(can't check for IEEE854 compliant 80 bit floats)]
+)])]) # alex_IEEE854_FLOAT80
+
+
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..0a6eca2
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,7864 @@
+# generated automatically by aclocal 1.10 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_if(m4_PACKAGE_VERSION, [2.61],,
+[m4_fatal([this file was generated for autoconf 2.61.
+You have another version of autoconf.  If you want to use that,
+you should regenerate the build system entirely.], [63])])
+
+# Configure paths for GTK+
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
+dnl
+AC_DEFUN(AM_PATH_GTK,
+[dnl 
+dnl Get the cflags and libraries from the gtk-config script
+dnl
+AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
+            gtk_config_prefix="$withval", gtk_config_prefix="")
+AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
+            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
+		    , enable_gtktest=yes)
+
+  for module in . $4
+  do
+      case "$module" in
+         gthread) 
+             gtk_config_args="$gtk_config_args gthread"
+         ;;
+      esac
+  done
+
+  if test x$gtk_config_exec_prefix != x ; then
+     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
+     fi
+  fi
+  if test x$gtk_config_prefix != x ; then
+     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
+     fi
+  fi
+
+  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
+  min_gtk_version=ifelse([$1], ,0.99.7,$1)
+  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
+  no_gtk=""
+  if test "$GTK_CONFIG" = "no" ; then
+    no_gtk=yes
+  else
+    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
+    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
+    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK is sufficiently new. (Also sanity
+dnl checks the results of gtk-config to some extent
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If gtk-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
+      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+	   (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+	     gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+#endif /* defined (GTK_MAJOR_VERSION) ... */
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+	       major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
+        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$GTK_CONFIG" = "no" ; then
+       echo "*** The gtk-config script installed by GTK could not be found"
+       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GTK_CONFIG environment variable to the"
+       echo "*** full path to gtk-config."
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK test program, checking why..."
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK or finding the wrong"
+          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
+          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
+          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 51 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+	         [m4_ifdef([AC_PROVIDE_$1],
+		           [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	[AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+	     [define([LT_AC_PROG_GCJ],
+		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+m4_if($1,[],[
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  AC_LIBTOOL_LANG_CXX_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+	  AC_LIBTOOL_LANG_F77_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+	  AC_LIBTOOL_LANG_GCJ_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+	AC_LIBTOOL_LANG_RC_CONFIG
+	;;
+
+      *)
+	AC_MSG_ERROR([Unsupported tag name: $tagname])
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognize shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognize a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!).  If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  :
+	else
+	  # We have old collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	_LT_AC_SYS_LIBPATH_AIX
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  freebsd[[12]]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+      case $host_cpu in
+      hppa*64*|ia64*) ;;
+      *)
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  interix[[3-9]]*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+	;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC*)
+        # Portland Group C++ compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  openbsd*)
+    if test -f /usr/libexec/ld.so; then
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	    ;;
+	esac
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+	   _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+	   _LT_AC_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_AC_TAGVAR(predep_objects,$1)=
+  _LT_AC_TAGVAR(postdep_objects,$1)=
+  _LT_AC_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+      program t
+      end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([LT_AC_PROG_SED])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDGIRSTW]]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler.
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  _LT_CC_BASENAME([$compiler])
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix[[3-9]]*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 _LT_AC_SYS_LIBPATH_AIX
+	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
+
+# _AS_TEST_PREPARE
+# ----------------
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[if test -x / >/dev/null 2>&1; then
+  as_executable_p='test -x'
+else
+  as_executable_p='test -f'
+fi
+])])# _AS_TEST_PREPARE
+
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])
+
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+		
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+			 [pkg_failed=yes])
+    fi
+else
+	pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+		[AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+	ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+		[$4])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+
+# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+AC_DEFUN([AM_WITH_DMALLOC],
+[AC_MSG_CHECKING([if malloc debugging is wanted])
+AC_ARG_WITH(dmalloc,
+[  --with-dmalloc          use dmalloc, as in
+			  http://www.dmalloc.com/dmalloc.tar.gz],
+[if test "$withval" = yes; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(WITH_DMALLOC,1,
+	    [Define if using the dmalloc debugging malloc package])
+  LIBS="$LIBS -ldmalloc"
+  LDFLAGS="$LDFLAGS -g"
+else
+  AC_MSG_RESULT(no)
+fi], [AC_MSG_RESULT(no)])
+])
+
+AU_DEFUN([fp_WITH_DMALLOC], [AM_WITH_DMALLOC])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+AC_DEFUN([AM_C_PROTOTYPES],
+[AC_REQUIRE([AC_C_PROTOTYPES])
+if test "$ac_cv_prog_cc_stdc" != no; then
+  U= ANSI2KNR=
+else
+  U=_ ANSI2KNR=./ansi2knr
+fi
+# Ensure some checks needed by ansi2knr itself.
+AC_REQUIRE([AC_HEADER_STDC])
+AC_CHECK_HEADERS([string.h])
+AC_SUBST([U])dnl
+AC_SUBST([ANSI2KNR])dnl
+_AM_SUBST_NOTMAKE([ANSI2KNR])dnl
+])
+
+AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([acinclude.m4])
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..0e30d56
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1407 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2003-07-02'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	if test $UNAME_RELEASE = "V4.0"; then
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+	fi
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha*:OpenVMS:*:*)
+	echo alpha-hp-vms
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit 0 ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit 0 ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit 0 ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c \
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && exit 0
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+		echo rs6000-ibm-aix3.2.5
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit 0 ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    # avoid double evaluation of $set_cc_for_build
+	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit 0 ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    *:UNICOS/mp:*:*)
+	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
+	exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	# GNU/FreeBSD systems have a "k" prefix to indicate we are using
+	# FreeBSD's kernel, but not the complete OS.
+	case ${LIBC} in gnu) kernel_only='k' ;; esac
+	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	exit 0 ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit 0 ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
+    x86:Interix*:[34]*)
+	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+	exit 0 ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit 0 ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit 0 ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit 0 ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0 ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0 ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit 0 ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit 0 ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit 0 ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit 0 ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit 0 ;;
+    i*86:*:5:[78]*)
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit 0 ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit 0 ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit 0 ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit 0 ;;
+    M68*:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit 0 ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit 0 ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit 0 ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit 0 ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit 0 ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Darwin:*:*)
+	case `uname -p` in
+	    *86) UNAME_PROCESSOR=i686 ;;
+	    powerpc) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit 0 ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..710a33d
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,342 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* debug define */
+#undef ABORTFP
+
+/* enable VBR bitrate histogram */
+#undef BRHIST
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* alot of debug output */
+#undef DEBUG
+
+/* allow to compute a more accurate replaygain value */
+#undef DECODE_ON_THE_FLY
+
+/* double is faster than float on Alpha */
+#undef FLOAT
+
+/* float instead of double */
+#undef FLOAT8
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* we link against libefence */
+#undef HAVE_EFENCE
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* add ieee754_float32_t type */
+#undef HAVE_IEEE754_FLOAT32_T
+#ifndef HAVE_IEEE754_FLOAT32_T
+	typedef float ieee754_float32_t;
+#endif
+
+/* add ieee754_float64_t type */
+#undef HAVE_IEEE754_FLOAT64_T
+#ifndef HAVE_IEEE754_FLOAT64_T
+	typedef double ieee754_float64_t;
+#endif
+
+/* system has 80 bit floats */
+#undef HAVE_IEEE854_FLOAT80
+
+/* add ieee854_float80_t type */
+#undef HAVE_IEEE854_FLOAT80_T
+#ifndef HAVE_IEEE854_FLOAT80_T
+	typedef long double ieee854_float80_t;
+#endif
+
+/* add int16_t type */
+#undef HAVE_INT16_T
+#ifndef HAVE_INT16_T
+	typedef short int16_t;
+#endif
+
+/* add int32_t type */
+#undef HAVE_INT32_T
+#ifndef HAVE_INT32_T
+#undef A_INT32_T
+	typedef A_INT32_T int32_t;
+#endif
+
+/* add int64_t type */
+#undef HAVE_INT64_T
+#ifndef HAVE_INT64_T
+#undef A_INT64_T
+	typedef A_INT64_T int64_t;
+#endif
+
+/* add int8_t type */
+#undef HAVE_INT8_T
+#ifndef HAVE_INT8_T
+	typedef char int8_t;
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <linux/soundcard.h> header file. */
+#undef HAVE_LINUX_SOUNDCARD_H
+
+/* Define to 1 if the type `long double' works and has more range or precision
+   than `double'. */
+#undef HAVE_LONG_DOUBLE
+
+/* Define to 1 if the type `long double' works and has more range or precision
+   than `double'. */
+#undef HAVE_LONG_DOUBLE_WIDER
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* build with mpglib support */
+#undef HAVE_MPGLIB
+
+/* have nasm */
+#undef HAVE_NASM
+
+/* Define to 1 if you have the <ncurses/termcap.h> header file. */
+#undef HAVE_NCURSES_TERMCAP_H
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+#undef HAVE_SYS_SOUNDCARD_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* have termcap */
+#undef HAVE_TERMCAP
+
+/* Define to 1 if you have the <termcap.h> header file. */
+#undef HAVE_TERMCAP_H
+
+/* add uint16_t type */
+#undef HAVE_UINT16_T
+#ifndef HAVE_UINT16_T
+	typedef unsigned short uint16_t;
+#endif
+
+/* add uint32_t type */
+#undef HAVE_UINT32_T
+#ifndef HAVE_UINT32_T
+#undef A_UINT32_T
+	typedef A_UINT32_T uint32_t;
+#endif
+
+/* add uint64_t type */
+#undef HAVE_UINT64_T
+#ifndef HAVE_UINT64_T
+#undef A_UINT64_T
+	typedef A_UINT64_T uint64_t;
+#endif
+
+/* add uint8_t type */
+#undef HAVE_UINT8_T
+#ifndef HAVE_UINT8_T
+	typedef unsigned char uint8_t;
+#endif
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <xmmintrin.h> header file. */
+#undef HAVE_XMMINTRIN_H
+
+/* requested by Frank, seems to be temporary needed for a smooth transition */
+#undef LAME_LIBRARY_BUILD
+
+/* set to 1 if you have libsndfile */
+#undef LIBSNDFILE
+
+/* use MMX version of choose_table */
+#undef MMX_choose_table
+
+/* no debug build */
+#undef NDEBUG
+
+/* build without hooks for analyzer */
+#undef NOANALYSIS
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#undef PROTOTYPES
+
+/* The size of `double', as computed by sizeof. */
+#undef SIZEOF_DOUBLE
+
+/* The size of `float', as computed by sizeof. */
+#undef SIZEOF_FLOAT
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `long double', as computed by sizeof. */
+#undef SIZEOF_LONG_DOUBLE
+
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of `unsigned int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_INT
+
+/* The size of `unsigned long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG
+
+/* The size of `unsigned long long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
+
+/* The size of `unsigned short', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_SHORT
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* IEEE754 compatible machine */
+#undef TAKEHIRO_IEEE754_HACK
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* faster log implementation with less but enough precission */
+#undef USE_FAST_LOG
+
+/* build with layer 1 decoding */
+#undef USE_LAYER_1
+
+/* build with layer 2 decoding */
+#undef USE_LAYER_2
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 if on AIX 3.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* we're on DEC Alpha */
+#undef __DECALPHA__
+
+/* work around a glibc bug */
+#undef __NO_MATH_INLINES
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..9d7f733
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1504 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2003-07-04'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k \
+	| m32r | m68000 | m68k | m88k | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| msp430 \
+	| ns16k | ns32k \
+	| openrisc | or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* \
+	| m32r-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| msp430-* \
+	| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nv1)
+		basic_machine=nv1-cray
+		os=-unicosmp
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	or32 | or32-*)
+		basic_machine=or32-unknown
+		os=-coff
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparc | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configMS.h b/configMS.h
new file mode 100644
index 0000000..fb290af
--- /dev/null
+++ b/configMS.h
@@ -0,0 +1,121 @@
+/* The number of bytes in a double.  */
+#define SIZEOF_DOUBLE 8
+
+/* The number of bytes in a float.  */
+#define SIZEOF_FLOAT 4
+
+/* The number of bytes in a int.  */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long.  */
+#define SIZEOF_LONG 4
+
+/* The number of bytes in a long double.  */
+#define SIZEOF_LONG_DOUBLE 12
+
+/* The number of bytes in a short.  */
+#define SIZEOF_SHORT 2
+
+/* The number of bytes in a unsigned int.  */
+#define SIZEOF_UNSIGNED_INT 4
+
+/* The number of bytes in a unsigned long.  */
+#define SIZEOF_UNSIGNED_LONG 4
+
+/* The number of bytes in a unsigned short.  */
+#define SIZEOF_UNSIGNED_SHORT 2
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS
+
+/* Define if you have the <errno.h> header file.  */
+#define HAVE_ERRNO_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#define HAVE_FCNTL_H
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H
+
+/* Name of package */
+#define PACKAGE "lame"
+
+/* Define if compiler has function prototypes */
+#define PROTOTYPES 1
+
+/* enable VBR bitrate histogram */
+#define BRHIST 1
+
+/* IEEE754 compatible machine */
+#define TAKEHIRO_IEEE754_HACK 1
+
+/* faster log implementation with less but enough precission */
+#define USE_FAST_LOG 1
+
+#define HAVE_STRCHR
+#define HAVE_MEMCPY
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#pragma warning( disable : 4305 )
+	typedef __int8  int8_t;
+	typedef __int16 int16_t;
+	typedef __int32 int32_t;
+	typedef __int64 int64_t;
+
+	typedef unsigned __int8  uint8_t;
+	typedef unsigned __int16 uint16_t;
+	typedef unsigned __int32 uint32_t;
+	typedef unsigned __int64 uint64_t;
+
+	typedef float  float32_t;
+	typedef double float64_t;
+#elif defined (__GNUC__)
+#define __int8_t_defined
+#define uint8_t unsigned char
+#define uint16_t unsigned short
+#define uint32_t unsigned int
+#define uint64_t unsigned long long
+
+#define int8_t signed char
+#define int16_t signed short
+#define int32_t signed int
+#define int64_t signed long long
+#endif
+
+typedef long double ieee854_float80_t;
+typedef double      ieee754_float64_t;
+typedef float       ieee754_float32_t;
+
+#ifdef HAVE_MPGLIB
+# define DECODE_ON_THE_FLY 1
+#endif
+
+#ifdef LAME_ACM
+/* memory hacking for driver purposes */
+#define calloc(x,y) acm_Calloc(x,y)
+#define free(x)     acm_Free(x)
+#define malloc(x)   acm_Malloc(x)
+
+#include <stddef.h>
+void *acm_Calloc( size_t num, size_t size );
+void *acm_Malloc( size_t size );
+void acm_Free( void * mem);
+#endif /* LAME_ACM */
+
+#define LAME_LIBRARY_BUILD
+
+
+#ifdef HAVE_NASM
+    #if (defined(__ICL) && (__ICL >= 450))
+        #define HAVE_XMMINTRIN_H
+    #elif defined(_MSC_VER)
+        #include <malloc.h>
+        #ifdef _mm_malloc
+            #define HAVE_XMMINTRIN_H
+        #endif
+    #endif
+#endif
+
+#ifdef _M_X64
+        #define HAVE_XMMINTRIN_H
+#endif
diff --git a/configMac.h b/configMac.h
new file mode 100644
index 0000000..9f19cb3
--- /dev/null
+++ b/configMac.h
@@ -0,0 +1,358 @@
+/* config.h.  Generated by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* debug define */
+/* #undef ABORTFP */
+
+/* enable VBR bitrate histogram */
+#define BRHIST 1
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* alot of debug output */
+/* #undef DEBUG */
+
+/* allow to compute a more accurate replaygain value */
+#undef DECODE_ON_THE_FLY 
+
+/* double is faster than float on Alpha */
+/* #undef FLOAT */
+
+/* float instead of double */
+/* #undef FLOAT8 */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* we link against libefence */
+/* #undef HAVE_EFENCE */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* have working GTK */
+/* #undef HAVE_GTK */
+
+/* add ieee754_float32_t type */
+/* #undef HAVE_IEEE754_FLOAT32_T */
+#ifndef HAVE_IEEE754_FLOAT32_T
+	typedef float ieee754_float32_t;
+#endif
+
+/* add ieee754_float64_t type */
+/* #undef HAVE_IEEE754_FLOAT64_T */
+#ifndef HAVE_IEEE754_FLOAT64_T
+	typedef double ieee754_float64_t;
+#endif
+
+/* system has 80 bit floats */
+#define HAVE_IEEE854_FLOAT80 1
+
+/* add ieee854_float80_t type */
+/* #undef HAVE_IEEE854_FLOAT80_T */
+#ifndef HAVE_IEEE854_FLOAT80_T
+	typedef long double ieee854_float80_t;
+#endif
+
+/* add int16_t type */
+#define HAVE_INT16_T 1
+#ifndef HAVE_INT16_T
+	typedef short int16_t;
+#endif
+
+/* add int32_t type */
+#define HAVE_INT32_T 1
+#ifndef HAVE_INT32_T
+#define A_INT32_T int
+	typedef A_INT32_T int32_t;
+#endif
+
+/* add int64_t type */
+#define HAVE_INT64_T 1
+#ifndef HAVE_INT64_T
+#define A_INT64_T long long
+	typedef A_INT64_T int64_t;
+#endif
+
+/* add int8_t type */
+#define HAVE_INT8_T 1
+#ifndef HAVE_INT8_T
+	typedef char int8_t;
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <linux/soundcard.h> header file. */
+/* #undef HAVE_LINUX_SOUNDCARD_H */
+
+/* Define to 1 if long double works and has more range or precision than
+   double. */
+#define HAVE_LONG_DOUBLE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* build with mpglib support */
+#undef HAVE_MPGLIB 
+
+/* have nasm */
+/* #undef HAVE_NASM */
+
+/* Define to 1 if you have the <ncurses/termcap.h> header file. */
+/* #undef HAVE_NCURSES_TERMCAP_H */
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+/* #undef HAVE_SYS_SOUNDCARD_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* have termcap */
+#define HAVE_TERMCAP 1
+
+/* Define to 1 if you have the <termcap.h> header file. */
+#define HAVE_TERMCAP_H 1
+
+/* add uint16_t type */
+#define HAVE_UINT16_T 1
+#ifndef HAVE_UINT16_T
+	typedef unsigned short uint16_t;
+#endif
+
+/* add uint32_t type */
+#define HAVE_UINT32_T 1
+#ifndef HAVE_UINT32_T
+#define A_UINT32_T unsigned int
+	typedef A_UINT32_T uint32_t;
+#endif
+
+/* add uint64_t type */
+#define HAVE_UINT64_T 1
+#ifndef HAVE_UINT64_T
+#define A_UINT64_T unsigned long long
+	typedef A_UINT64_T uint64_t;
+#endif
+
+/* add uint8_t type */
+#define HAVE_UINT8_T 1
+#ifndef HAVE_UINT8_T
+	typedef unsigned char uint8_t;
+#endif
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* winsock */
+/* #undef HAVE_WINSOCKET */
+
+/* requested by Frank, seems to be temporary needed for a smooth transition */
+#define LAME_LIBRARY_BUILD 1
+
+/* build with libsndfile support */
+/* #undef LIBSNDFILE */
+
+/* use MMX version of choose_table */
+/* #undef MMX_choose_table */
+
+/* no debug build */
+#define NDEBUG 1
+
+/* build without hooks for analyzer */
+/* #undef NOANALYSIS */
+
+/* Name of package */
+#define PACKAGE "lame"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "lame-dev@lists.sf.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "lame"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "lame 3.97"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "lame"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.97"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of a `double', as computed by sizeof. */
+#define SIZEOF_DOUBLE 8
+
+/* The size of a `float', as computed by sizeof. */
+#define SIZEOF_FLOAT 4
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of a `long double', as computed by sizeof. */
+/* #undef SIZEOF_LONG_DOUBLE */
+
+/* The size of a `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of a `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* The size of a `unsigned int', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_INT 4
+
+/* The size of a `unsigned long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG 4
+
+/* The size of a `unsigned long long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG_LONG 8
+
+/* The size of a `unsigned short', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_SHORT 2
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* IEEE754 compatible machine */
+#define TAKEHIRO_IEEE754_HACK 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* faster log implementation with less but enough precission */
+#define USE_FAST_LOG 1
+
+/* build with layer 1 decoding */
+/* #undef USE_LAYER_1 */
+
+/* build with layer 2 decoding */
+#define USE_LAYER_2 1
+
+/* Version number of package */
+#define VERSION "3.97"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#ifdef __APPLE__
+	#ifdef __BIG_ENDIAN__
+		#define WORDS_BIGENDIAN 1
+	#else
+		#undef WORDS_BIGENDIAN
+	#endif
+#else
+	Error this config.h file is only valid for Mac OS. Run ./configure for other OSes 
+#endif
+
+
+/* Define to 1 if on AIX 3.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
+#ifndef _ALL_SOURCE
+/* # undef _ALL_SOURCE */
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* we're on DEC Alpha */
+/* #undef __DECALPHA__ */
+
+/* work around a glibc bug */
+/* #undef __NO_MATH_INLINES */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
diff --git a/configure b/configure
new file mode 100755
index 0000000..048b971
--- /dev/null
+++ b/configure
@@ -0,0 +1,32139 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for lame 3.98.4.
+#
+# Report bugs to <lame-dev@lists.sf.net>.
+#
+# 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 more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes && 	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&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='lame'
+PACKAGE_TARNAME='lame'
+PACKAGE_VERSION='3.98.4'
+PACKAGE_STRING='lame 3.98.4'
+PACKAGE_BUGREPORT='lame-dev@lists.sf.net'
+
+ac_unique_file="libmp3lame/lame.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+MAINTAINER_MODE_TRUE
+MAINTAINER_MODE_FALSE
+MAINT
+am__include
+am__quote
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CPP
+GREP
+EGREP
+SED
+LN_S
+ECHO
+AR
+RANLIB
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+LIBTOOL_DEPS
+U
+ANSI2KNR
+ALLOCA
+GTK_CONFIG
+GTK_CFLAGS
+GTK_LIBS
+PKG_CONFIG
+SNDFILE_CFLAGS
+SNDFILE_LIBS
+LIB_WITH_DECODER_TRUE
+LIB_WITH_DECODER_FALSE
+WITH_BRHIST_TRUE
+WITH_BRHIST_FALSE
+WITH_XMM_TRUE
+WITH_XMM_FALSE
+WITH_VECTOR_TRUE
+WITH_VECTOR_FALSE
+NASM
+HAVE_NASM_TRUE
+HAVE_NASM_FALSE
+INCLUDES
+FRONTEND_LDFLAGS
+FRONTEND_CFLAGS
+FRONTEND_LDADD
+CONFIG_MATH_LIB
+LDADD
+LIB_MAJOR_VERSION
+LIB_MINOR_VERSION
+NASM_FORMAT
+MAKEDEP
+RM_F
+WITH_FRONTEND
+WITH_MP3X
+WITH_MP3RTP
+CPUTYPE
+CPUCCODE
+CONFIG_DEFS
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS
+PKG_CONFIG
+SNDFILE_CFLAGS
+SNDFILE_LIBS'
+
+
+# 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_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_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 lame 3.98.4 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/lame]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of lame 3.98.4:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-largefile     omit support for large files
+  --enable-nasm              Allow the use of nasm if available
+  --disable-cpml              Do not use Compaq's fast Math Library
+  --disable-gtktest       Do not try to compile and run a test GTK program
+  --enable-efence            Use ElectricFence for malloc debugging
+  --disable-analyzer-hooks   Exclude analyzer hooks
+  --disable-decoder          Exclude mpg123 decoder
+  --enable-decode-layer1     Include layer1 decoding default=no
+  --disable-decode-layer2    Exclude layer2 decoding
+  --disable-frontend         Do not build the lame executable default=build
+  --enable-mp3x              Build GTK frame analyzer default=no
+  --enable-mp3rtp            Build mp3rtp default=no
+  --disable-brhist          Include the VBR bitrate histogram feature
+                             default=yes
+  --enable-all-float         Whether to make all floting point variables as float, not double
+                             default=no
+  --enable-expopt=full,norm  Whether to enable experimental optimizations
+                             default=no
+  --enable-debug=alot,norm   Enable debugging (disables optimizations)
+                             default=no
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-dmalloc          use dmalloc, as in
+			  http://www.dmalloc.com/dmalloc.tar.gz
+  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)
+  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)
+  --with-fileio=lame         Use lame's internal file io routines default
+               =sndfile      Use Erik de Castro Lopo's libsndfile
+                             (no stdin possible currently)
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+  PKG_CONFIG  path to pkg-config utility
+  SNDFILE_CFLAGS
+              C compiler flags for SNDFILE, overriding pkg-config
+  SNDFILE_LIBS
+              linker flags for SNDFILE, overriding pkg-config
+
+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 <lame-dev@lists.sf.net>.
+_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
+lame configure 3.98.4
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_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 lame $as_me 3.98.4, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+am__api_version='1.10'
+
+# 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_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    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'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+done
+IFS=$as_save_IFS
+
+fi
+
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+echo "${ECHO_T}$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ 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
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='lame'
+ VERSION='3.98.4'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ 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_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    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_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  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
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+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 <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+{ echo "$as_me:$LINENO: checking for AIX" >&5
+echo $ECHO_N "checking for AIX... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef _AIX
+  yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+cat >>confdefs.h <<\_ACEOF
+#define _ALL_SOURCE 1
+_ACEOF
+
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+rm -f conftest*
+
+
+{ echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6; }
+if test "${ac_cv_search_strerror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char strerror ();
+int
+main ()
+{
+return strerror ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' cposix; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_strerror=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_strerror+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_strerror+set}" = set; then
+  :
+else
+  ac_cv_search_strerror=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6; }
+ac_res=$ac_cv_search_strerror
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ 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 <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_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 <string.h>
+
+_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 <stdlib.h>
+
+_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 <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for minix/config.h" >&5
+echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking minix/config.h usability" >&5
+echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <minix/config.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking minix/config.h presence" >&5
+echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <minix/config.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for minix/config.h" >&5
+echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_minix_config_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6; }
+
+fi
+if test $ac_cv_header_minix_config_h = yes; then
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+if test "$MINIX" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_SOURCE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_1_SOURCE 2
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _MINIX 1
+_ACEOF
+
+fi
+
+case $host_os in
+  *cygwin* ) CYGWIN=yes;;
+         * ) CYGWIN=no;;
+esac
+
+# AC_DISABLE_SHARED
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 5166 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat >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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    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_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  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
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (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); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CXXFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ 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; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+fi
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  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_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_F77="$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
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+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_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_F77="$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_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  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
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 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); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ 	]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDGIRSTW]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
+else
+  { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ 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_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    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_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  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
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    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_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  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
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ 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_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    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_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  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
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7434: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7438: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic='-qnocommon'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7724: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7728: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works=yes
+       fi
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7828: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:7832: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L=yes
+  	  hardcode_libdir_flag_spec='-L$libdir'
+  	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc=no
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec=''
+      link_all_deplibs=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	hardcode_direct=yes
+	export_dynamic_flag_spec='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld='+b $libdir'
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var" || \
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* 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_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $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 shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* 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_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $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 dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 10177 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 10277 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which library types will actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    fix_srcfile_path \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+  withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  :
+	else
+	  # We have old collect2
+	  hardcode_direct_CXX=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L_CXX=yes
+	  hardcode_libdir_flag_spec_CXX='-L$libdir'
+	  hardcode_libdir_separator_CXX=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag_CXX="-z nodefs"
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	no_undefined_flag_CXX=' ${wl}-bernotok'
+	allow_undefined_flag_CXX=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	whole_archive_flag_spec_CXX='$convenience'
+	archive_cmds_need_lc_CXX=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag_CXX=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      archive_cmds_need_lc_CXX=no
+      hardcode_direct_CXX=no
+      hardcode_automatic_CXX=yes
+      hardcode_shlibpath_var_CXX=unsupported
+      whole_archive_flag_spec_CXX=''
+      link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_CXX=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC*)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_CXX=:
+
+      case $host_cpu in
+      hppa*64*|ia64*) ;;
+      *)
+	export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  interix[3-9]*)
+    hardcode_direct_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	link_all_deplibs_CXX=yes
+	;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	archive_cmds_need_lc_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC*)
+        # Portland Group C++ compiler
+	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  no_undefined_flag_CXX=' -zdefs'
+	  archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    ld_shlibs_CXX=no
+    ;;
+  openbsd*)
+    if test -f /usr/libexec/ld.so; then
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx*)
+	allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx*)
+	allow_undefined_flag_CXX=' -expect_unresolved \*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        archive_cmds_need_lc_CXX=yes
+	no_undefined_flag_CXX=' -zdefs'
+	archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-R$libdir'
+	hardcode_shlibpath_var_CXX=no
+	case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+	    ;;
+	esac
+	link_all_deplibs_CXX=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+    no_undefined_flag_CXX='${wl}-z,text'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    no_undefined_flag_CXX='${wl}-z,text'
+    allow_undefined_flag_CXX='${wl}-z,nodefs'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+    export_dynamic_flag_spec_CXX='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           lt_prog_compiler_pic_CXX='-qnocommon'
+           lt_prog_compiler_wl_CXX='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12697: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:12701: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12801: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:12805: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+	pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var_CXX" || \
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    fix_srcfile_path_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+      program t
+      end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      else
+	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_F77='-qnocommon'
+         lt_prog_compiler_wl_F77='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-KPIC'
+	lt_prog_compiler_static_F77='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-fpic'
+	lt_prog_compiler_static_F77='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_F77='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_F77='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_F77='-Kconform_pic'
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_F77=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14363: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:14367: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_F77=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_F77=yes
+       fi
+     else
+       lt_prog_compiler_static_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_static_works_F77" = xyes; then
+    :
+else
+    lt_prog_compiler_static_F77=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14467: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:14471: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  enable_shared_with_static_runtimes_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  old_archive_From_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  export_dynamic_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  thread_safe_flag_spec_F77=
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_flag_spec_ld_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_direct_F77=no
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  link_all_deplibs_F77=unknown
+  hardcode_automatic_F77=no
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  always_export_symbols_F77=no
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_F77=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_F77=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_F77=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_F77=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_F77='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_F77=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_F77=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs_F77=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_F77=
+      export_dynamic_flag_spec_F77=
+      whole_archive_flag_spec_F77=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_F77=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_F77=yes
+  	  hardcode_libdir_flag_spec_F77='-L$libdir'
+  	  hardcode_libdir_separator_F77=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_F77='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_F77="-z nodefs"
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_F77=' ${wl}-bernotok'
+	  allow_undefined_flag_F77=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_F77='$convenience'
+	  archive_cmds_need_lc_F77=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_F77=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_F77=' '
+      allow_undefined_flag_F77=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_F77='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_F77=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_F77=no
+      hardcode_direct_F77=no
+      hardcode_automatic_F77=yes
+      hardcode_shlibpath_var_F77=unsupported
+      whole_archive_flag_spec_F77=''
+      link_all_deplibs_F77=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_F77=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	hardcode_direct_F77=yes
+	export_dynamic_flag_spec_F77='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_F77=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+	  hardcode_direct_F77=no
+	  hardcode_shlibpath_var_F77=no
+	  ;;
+	*)
+	  hardcode_direct_F77=yes
+	  export_dynamic_flag_spec_F77='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_F77=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_F77=yes
+	hardcode_shlibpath_var_F77=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_F77='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_F77='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_F77='$CC -r -o $output$reload_objs'
+	  hardcode_direct_F77=no
+        ;;
+	motorola)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_F77=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_F77='${wl}-z,text'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_F77='${wl}-z,text'
+      allow_undefined_flag_F77='${wl}-z,nodefs'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_F77
+	pic_flag=$lt_prog_compiler_pic_F77
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+        allow_undefined_flag_F77=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_F77=no
+        else
+	  archive_cmds_need_lc_F77=yes
+        fi
+        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+   test -n "$runpath_var_F77" || \
+   test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_F77 \
+    CC_F77 \
+    LD_F77 \
+    lt_prog_compiler_wl_F77 \
+    lt_prog_compiler_pic_F77 \
+    lt_prog_compiler_static_F77 \
+    lt_prog_compiler_no_builtin_flag_F77 \
+    export_dynamic_flag_spec_F77 \
+    thread_safe_flag_spec_F77 \
+    whole_archive_flag_spec_F77 \
+    enable_shared_with_static_runtimes_F77 \
+    old_archive_cmds_F77 \
+    old_archive_from_new_cmds_F77 \
+    predep_objects_F77 \
+    postdep_objects_F77 \
+    predeps_F77 \
+    postdeps_F77 \
+    compiler_lib_search_path_F77 \
+    archive_cmds_F77 \
+    archive_expsym_cmds_F77 \
+    postinstall_cmds_F77 \
+    postuninstall_cmds_F77 \
+    old_archive_from_expsyms_cmds_F77 \
+    allow_undefined_flag_F77 \
+    no_undefined_flag_F77 \
+    export_symbols_cmds_F77 \
+    hardcode_libdir_flag_spec_F77 \
+    hardcode_libdir_flag_spec_ld_F77 \
+    hardcode_libdir_separator_F77 \
+    hardcode_automatic_F77 \
+    module_cmds_F77 \
+    module_expsym_cmds_F77 \
+    lt_cv_prog_compiler_c_o_F77 \
+    fix_srcfile_path_F77 \
+    exclude_expsyms_F77 \
+    include_expsyms_F77; do
+
+    case $var in
+    old_archive_cmds_F77 | \
+    old_archive_from_new_cmds_F77 | \
+    archive_cmds_F77 | \
+    archive_expsym_cmds_F77 | \
+    module_cmds_F77 | \
+    module_expsym_cmds_F77 | \
+    old_archive_from_expsyms_cmds_F77 | \
+    export_symbols_cmds_F77 | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16654: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:16658: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+	lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_GCJ='-qnocommon'
+         lt_prog_compiler_wl_GCJ='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-KPIC'
+	lt_prog_compiler_static_GCJ='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-fpic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_GCJ='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_GCJ='-Kconform_pic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16944: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:16948: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_GCJ=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_GCJ=yes
+       fi
+     else
+       lt_prog_compiler_static_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+    :
+else
+    lt_prog_compiler_static_GCJ=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17048: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:17052: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_GCJ=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_GCJ=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_GCJ=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_GCJ=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_GCJ=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs_GCJ=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_GCJ=
+      export_dynamic_flag_spec_GCJ=
+      whole_archive_flag_spec_GCJ=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_GCJ=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_GCJ=yes
+  	  hardcode_libdir_flag_spec_GCJ='-L$libdir'
+  	  hardcode_libdir_separator_GCJ=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_GCJ="-z nodefs"
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_GCJ=' ${wl}-bernotok'
+	  allow_undefined_flag_GCJ=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_GCJ='$convenience'
+	  archive_cmds_need_lc_GCJ=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_GCJ=no
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ=''
+      link_all_deplibs_GCJ=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_GCJ=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_GCJ=:
+
+	hardcode_direct_GCJ=yes
+	export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_GCJ=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_GCJ=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+	  hardcode_direct_GCJ=no
+	  hardcode_shlibpath_var_GCJ=no
+	  ;;
+	*)
+	  hardcode_direct_GCJ=yes
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_GCJ=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_GCJ=yes
+	hardcode_shlibpath_var_GCJ=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_GCJ='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+	  hardcode_direct_GCJ=no
+        ;;
+	motorola)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_GCJ=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_GCJ='${wl}-z,text'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_GCJ='${wl}-z,text'
+      allow_undefined_flag_GCJ='${wl}-z,nodefs'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+	pic_flag=$lt_prog_compiler_pic_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_GCJ=no
+        else
+	  archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var_GCJ" || \
+   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    fix_srcfile_path_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    fix_srcfile_path_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	;;
+
+      *)
+	{ { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CFLAGS="${ac_save_CFLAGS}"
+
+# increase this when the shared lib becomes totally incompatible
+LIB_MAJOR_VERSION=0
+
+# increase this when changes are made, but they are upward compatible
+# to previous versions
+LIB_MINOR_VERSION=0
+
+if test "${ac_cv_cygwin}" = "yes"; then
+	if test "${CC}" != "gcc"; then
+		{ { echo "$as_me:$LINENO: error: Please use
+			   CC=gcc ./configure
+			Abort this configure run and add \"CC=gcc\" or you will
+			see errors and no lame.exe will be build." >&5
+echo "$as_me: error: Please use
+			   CC=gcc ./configure
+			Abort this configure run and add \"CC=gcc\" or you will
+			see errors and no lame.exe will be build." >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+if test "${GCC}" = "yes"; then
+	{ echo "$as_me:$LINENO: checking version of GCC" >&5
+echo $ECHO_N "checking version of GCC... $ECHO_C" >&6; }
+	GCC_version=`${CC} --version | sed -n '1s/^[^ ]* (.*) //;s/ .*$//;1p'`
+	{ echo "$as_me:$LINENO: result: ${GCC_version}" >&5
+echo "${ECHO_T}${GCC_version}" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for function prototypes" >&5
+echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; }
+if test "$ac_cv_prog_cc_c89" != no; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define PROTOTYPES 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define __PROTOTYPES 1
+_ACEOF
+
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+if test "$ac_cv_prog_cc_stdc" != no; then
+  U= ANSI2KNR=
+else
+  U=_ ANSI2KNR=./ansi2knr
+fi
+# Ensure some checks needed by ansi2knr itself.
+
+
+for ac_header in string.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+if test "${ac_cv_header_dmalloc_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for dmalloc.h" >&5
+echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_dmalloc_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_dmalloc_h" >&5
+echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking dmalloc.h usability" >&5
+echo $ECHO_N "checking dmalloc.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <dmalloc.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking dmalloc.h presence" >&5
+echo $ECHO_N "checking dmalloc.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <dmalloc.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: dmalloc.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: dmalloc.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: dmalloc.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: dmalloc.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: dmalloc.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: dmalloc.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: dmalloc.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dmalloc.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: dmalloc.h: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for dmalloc.h" >&5
+echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_dmalloc_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_dmalloc_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_dmalloc_h" >&5
+echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6; }
+
+fi
+
+
+if test "${ac_cv_header_dmalloc_h}" = "yes"; then
+	{ echo "$as_me:$LINENO: checking if malloc debugging is wanted" >&5
+echo $ECHO_N "checking if malloc debugging is wanted... $ECHO_C" >&6; }
+
+# Check whether --with-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then
+  withval=$with_dmalloc; if test "$withval" = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_DMALLOC 1
+_ACEOF
+
+  LIBS="$LIBS -ldmalloc"
+  LDFLAGS="$LDFLAGS -g"
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+
+{ 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 <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_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 <string.h>
+
+_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 <stdlib.h>
+
+_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 <ctype.h>
+#include <stdlib.h>
+#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
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in \
+		 errno.h \
+		 fcntl.h \
+		 limits.h \
+		 stdint.h \
+		 string.h \
+		 sys/soundcard.h \
+		 sys/time.h \
+		 unistd.h \
+		 xmmintrin.h \
+		 linux/soundcard.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+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 ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset cs;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_inline=$ac_kw
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+    ;;
+esac
+
+if test ${cross_compiling} = "no"; then
+	{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+	&& BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_bigendian=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_bigendian=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	# It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+  # try to guess the endianness by grepping values into an object file
+  ac_cv_c_bigendian=unknown
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$ac_cv_c_bigendian" = unknown; then
+    ac_cv_c_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    ac_cv_c_bigendian=unknown
+  fi
+fi
+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
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long int l;
+    char c[sizeof (long int)];
+  } u;
+  u.l = 1;
+  return u.c[sizeof (long int) - 1] == 1;
+
+  ;
+  return 0;
+}
+_ACEOF
+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
+  ac_cv_c_bigendian=no
+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_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+  yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+  no)
+     ;;
+  *)
+    { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+fi
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_largefile_CC=' -n32'; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_file_offset_bits=no; break
+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
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_file_offset_bits=64; break
+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
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -f conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_large_files=no; break
+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
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_large_files=1; break
+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
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -f conftest*
+  fi
+fi
+
+
+{ echo "$as_me:$LINENO: checking for short" >&5
+echo $ECHO_N "checking for short... $ECHO_C" >&6; }
+if test "${ac_cv_type_short+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef short ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_short=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_short=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
+echo "${ECHO_T}$ac_cv_type_short" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_short+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_short=$ac_lo;;
+'') if test "$ac_cv_type_short" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (short)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_short=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef short ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_short=`cat conftest.val`
+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 )
+if test "$ac_cv_type_short" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (short)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_short=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for unsigned short" >&5
+echo $ECHO_N "checking for unsigned short... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned_short+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef unsigned short ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_unsigned_short=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_unsigned_short=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_short" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of unsigned short" >&5
+echo $ECHO_N "checking size of unsigned short... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned_short+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned_short=$ac_lo;;
+'') if test "$ac_cv_type_unsigned_short" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_short=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned short ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_unsigned_short=`cat conftest.val`
+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 )
+if test "$ac_cv_type_unsigned_short" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_short=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6; }
+if test "${ac_cv_type_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_int=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_int=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') if test "$ac_cv_type_int" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_int=`cat conftest.val`
+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 )
+if test "$ac_cv_type_int" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for unsigned int" >&5
+echo $ECHO_N "checking for unsigned int... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef unsigned int ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_unsigned_int=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_unsigned_int=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_int" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_int" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of unsigned int" >&5
+echo $ECHO_N "checking size of unsigned int... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned_int=$ac_lo;;
+'') if test "$ac_cv_type_unsigned_int" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_int=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned int ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_unsigned_int=`cat conftest.val`
+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 )
+if test "$ac_cv_type_unsigned_int" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_int=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6; }
+if test "${ac_cv_type_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_long=`cat conftest.val`
+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 )
+if test "$ac_cv_type_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for unsigned long" >&5
+echo $ECHO_N "checking for unsigned long... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef unsigned long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_unsigned_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_unsigned_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_long" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of unsigned long" >&5
+echo $ECHO_N "checking size of unsigned long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned_long=$ac_lo;;
+'') if test "$ac_cv_type_unsigned_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_unsigned_long=`cat conftest.val`
+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 )
+if test "$ac_cv_type_unsigned_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_long=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
+if test "${ac_cv_type_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef long long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_long_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_long_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of long long" >&5
+echo $ECHO_N "checking size of long long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') if test "$ac_cv_type_long_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_long_long=`cat conftest.val`
+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 )
+if test "$ac_cv_type_long_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for unsigned long long" >&5
+echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef unsigned long long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_unsigned_long_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_unsigned_long_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of unsigned long long" >&5
+echo $ECHO_N "checking size of unsigned long long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned_long_long=$ac_lo;;
+'') if test "$ac_cv_type_unsigned_long_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_long_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef unsigned long long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_unsigned_long_long=`cat conftest.val`
+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 )
+if test "$ac_cv_type_unsigned_long_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_unsigned_long_long=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for float" >&5
+echo $ECHO_N "checking for float... $ECHO_C" >&6; }
+if test "${ac_cv_type_float+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef float ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_float=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_float=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_float" >&5
+echo "${ECHO_T}$ac_cv_type_float" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of float" >&5
+echo $ECHO_N "checking size of float... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_float+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef float ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef float ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef float ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef float ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef float ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_float=$ac_lo;;
+'') if test "$ac_cv_type_float" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (float)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (float)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_float=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef float ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_float=`cat conftest.val`
+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 )
+if test "$ac_cv_type_float" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (float)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (float)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_float=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5
+echo "${ECHO_T}$ac_cv_sizeof_float" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_FLOAT $ac_cv_sizeof_float
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for double" >&5
+echo $ECHO_N "checking for double... $ECHO_C" >&6; }
+if test "${ac_cv_type_double+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef double ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_double=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_double=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_double" >&5
+echo "${ECHO_T}$ac_cv_type_double" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of double" >&5
+echo $ECHO_N "checking size of double... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_double+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_double=$ac_lo;;
+'') if test "$ac_cv_type_double" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (double)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (double)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_double=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef double ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_double=`cat conftest.val`
+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 )
+if test "$ac_cv_type_double" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (double)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (double)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_double=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5
+echo "${ECHO_T}$ac_cv_sizeof_double" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_DOUBLE $ac_cv_sizeof_double
+_ACEOF
+
+
+
+if test $ac_cv_sizeof_short -eq 0 \
+    -o $ac_cv_sizeof_unsigned_short -eq 0 \
+    -o $ac_cv_sizeof_int -eq 0 \
+    -o $ac_cv_sizeof_unsigned_int -eq 0 \
+    -o $ac_cv_sizeof_long -eq 0 \
+    -o $ac_cv_sizeof_unsigned_long -eq 0 \
+    -o $ac_cv_sizeof_long_long -eq 0 \
+    -o $ac_cv_sizeof_unsigned_long_long -eq 0 \
+    -o $ac_cv_sizeof_float -eq 0 \
+    -o $ac_cv_sizeof_double -eq 0; then
+	echo '*** I have a problem determining the size of some variable types. Either'
+	echo '*** you compiler is broken, or your system+compiler combination is not'
+	echo '*** supportet by the "autoconf" framework we use to generate this'
+	echo '*** configure script.'
+	exit 1
+fi
+
+
+
+  { echo "$as_me:$LINENO: checking for long double with more range or precision than double" >&5
+echo $ECHO_N "checking for long double with more range or precision than double... $ECHO_C" >&6; }
+if test "${ac_cv_type_long_double_wider+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 <float.h>
+	    long double const a[] =
+	      {
+		 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON,
+		 LDBL_MIN, LDBL_MAX, LDBL_EPSILON
+	      };
+	    long double
+	    f (long double x)
+	    {
+	       return ((x + (unsigned long int) 10) * (-1 / x) + a[0]
+			+ (x ? f (x) : 'c'));
+	    }
+
+int
+main ()
+{
+static int test_array [1 - 2 * !((0 < ((DBL_MAX_EXP < LDBL_MAX_EXP)
+		   + (DBL_MANT_DIG < LDBL_MANT_DIG)
+		   - (LDBL_MAX_EXP < DBL_MAX_EXP)
+		   - (LDBL_MANT_DIG < DBL_MANT_DIG)))
+	    && (int) LDBL_EPSILON == 0
+	  )];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_long_double_wider=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_long_double_wider=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double_wider" >&5
+echo "${ECHO_T}$ac_cv_type_long_double_wider" >&6; }
+  if test $ac_cv_type_long_double_wider = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LONG_DOUBLE_WIDER 1
+_ACEOF
+
+  fi
+
+    ac_cv_c_long_double=$ac_cv_type_long_double_wider
+    if test $ac_cv_c_long_double = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LONG_DOUBLE 1
+_ACEOF
+
+    fi
+
+if test "${ac_cv_c_have_long_double}" = "yes" ; then
+	{ echo "$as_me:$LINENO: checking for long double" >&5
+echo $ECHO_N "checking for long double... $ECHO_C" >&6; }
+if test "${ac_cv_type_long_double+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef long double ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_long_double=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_long_double=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5
+echo "${ECHO_T}$ac_cv_type_long_double" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of long double" >&5
+echo $ECHO_N "checking size of long double... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_long_double+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long double ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_double=$ac_lo;;
+'') if test "$ac_cv_type_long_double" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long double)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long_double=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long double ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_sizeof_long_double=`cat conftest.val`
+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 )
+if test "$ac_cv_type_long_double" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long double)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long_double=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double
+_ACEOF
+
+
+fi
+
+{ echo "$as_me:$LINENO: checking for uint8_t" >&5
+echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_uint8_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef uint8_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_uint8_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_uint8_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint8_t" >&6; }
+if test $ac_cv_type_uint8_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT8_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for int8_t" >&5
+echo $ECHO_N "checking for int8_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_int8_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int8_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_int8_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_int8_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_int8_t" >&5
+echo "${ECHO_T}$ac_cv_type_int8_t" >&6; }
+if test $ac_cv_type_int8_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT8_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for uint16_t" >&5
+echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_uint16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef uint16_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_uint16_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_uint16_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint16_t" >&6; }
+if test $ac_cv_type_uint16_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT16_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for int16_t" >&5
+echo $ECHO_N "checking for int16_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_int16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int16_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_int16_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_int16_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5
+echo "${ECHO_T}$ac_cv_type_int16_t" >&6; }
+if test $ac_cv_type_int16_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT16_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for uint32_t" >&5
+echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_uint32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef uint32_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_uint32_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_uint32_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint32_t" >&6; }
+if test $ac_cv_type_uint32_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT32_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for int32_t" >&5
+echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int32_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_int32_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_int32_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int32_t" >&6; }
+if test $ac_cv_type_int32_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT32_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for uint64_t" >&5
+echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_uint64_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef uint64_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_uint64_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_uint64_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint64_t" >&6; }
+if test $ac_cv_type_uint64_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT64_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for int64_t" >&5
+echo $ECHO_N "checking for int64_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_int64_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int64_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_int64_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_int64_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5
+echo "${ECHO_T}$ac_cv_type_int64_t" >&6; }
+if test $ac_cv_type_int64_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT64_T 1
+_ACEOF
+
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test "${HAVE_INT32_T}" = yes; then
+	cat >>confdefs.h <<\_ACEOF
+#define A_UINT32_T unsigned int32_t
+_ACEOF
+
+else
+	if test "${ac_cv_sizeof_unsigned_short}" = "4"; then
+		cat >>confdefs.h <<\_ACEOF
+#define A_UINT32_T unsigned short
+_ACEOF
+
+	else
+		if test "${ac_cv_sizeof_unsigned_int}" = "4"; then
+			cat >>confdefs.h <<\_ACEOF
+#define A_UINT32_T unsigned int
+_ACEOF
+
+		else
+			if test "${ac_cv_sizeof_unsigned_long}" = "4"; then
+				cat >>confdefs.h <<\_ACEOF
+#define A_UINT32_T unsigned long
+_ACEOF
+
+			else
+				{ { echo "$as_me:$LINENO: error: CHECK_TYPE_uint32_t - please report to lame-dev@lists.sourceforge.net" >&5
+echo "$as_me: error: CHECK_TYPE_uint32_t - please report to lame-dev@lists.sourceforge.net" >&2;}
+   { (exit 1); exit 1; }; }
+			fi
+		fi
+	fi
+fi
+
+
+
+
+if test "${ac_cv_sizeof_short}" = "4"; then
+	cat >>confdefs.h <<\_ACEOF
+#define A_INT32_T short
+_ACEOF
+
+else
+	if test "${ac_cv_sizeof_int}" = "4"; then
+		cat >>confdefs.h <<\_ACEOF
+#define A_INT32_T int
+_ACEOF
+
+	else
+		if test "${ac_cv_sizeof_long}" = "4"; then
+			cat >>confdefs.h <<\_ACEOF
+#define A_INT32_T long
+_ACEOF
+
+		else
+			{ { echo "$as_me:$LINENO: error: CHECK_TYPE_int32_t - please report to lame-dev@lists.sourceforge.net" >&5
+echo "$as_me: error: CHECK_TYPE_int32_t - please report to lame-dev@lists.sourceforge.net" >&2;}
+   { (exit 1); exit 1; }; }
+		fi
+	fi
+fi
+
+
+
+
+if test "${HAVE_INT64_T}" = yes; then
+        cat >>confdefs.h <<\_ACEOF
+#define A_UINT64_T unsigned int64_t
+_ACEOF
+
+else
+	if test "${ac_cv_sizeof_unsigned_int}" = "8"; then
+		cat >>confdefs.h <<\_ACEOF
+#define A_UINT64_T unsigned int
+_ACEOF
+
+	else
+		if test "${ac_cv_sizeof_unsigned_long}" = "8"; then
+			cat >>confdefs.h <<\_ACEOF
+#define A_UINT64_T unsigned long
+_ACEOF
+
+		else
+			if test "${ac_cv_sizeof_unsigned_long_long}" = "8"; then
+				cat >>confdefs.h <<\_ACEOF
+#define A_UINT64_T unsigned long long
+_ACEOF
+
+			else
+				{ { echo "$as_me:$LINENO: error: CHECK_TYPE_uint64_t - please report to lame-dev@lists.sourceforge.net" >&5
+echo "$as_me: error: CHECK_TYPE_uint64_t - please report to lame-dev@lists.sourceforge.net" >&2;}
+   { (exit 1); exit 1; }; }
+			fi
+		fi
+	fi
+fi
+
+
+
+
+if test "${ac_cv_sizeof_int}" = "8"; then
+	cat >>confdefs.h <<\_ACEOF
+#define A_INT64_T int
+_ACEOF
+
+else
+	if test "${ac_cv_sizeof_long}" = "8"; then
+		cat >>confdefs.h <<\_ACEOF
+#define A_INT64_T long
+_ACEOF
+
+	else
+		if test "${ac_cv_sizeof_long_long}" = "8"; then
+			cat >>confdefs.h <<\_ACEOF
+#define A_INT64_T long long
+_ACEOF
+
+		else
+			{ { echo "$as_me:$LINENO: error: CHECK_TYPE_int64_t - please report to lame-dev@lists.sourceforge.net" >&5
+echo "$as_me: error: CHECK_TYPE_int64_t - please report to lame-dev@lists.sourceforge.net" >&2;}
+   { (exit 1); exit 1; }; }
+		fi
+	fi
+fi
+
+
+
+
+{ echo "$as_me:$LINENO: checking for IEEE854 compliant 80 bit floats" >&5
+echo $ECHO_N "checking for IEEE854 compliant 80 bit floats... $ECHO_C" >&6; }
+if test "${alex_cv_ieee854_float80+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { echo "$as_me:$LINENO: WARNING: can't check for IEEE854 compliant 80 bit floats" >&5
+echo "$as_me: WARNING: can't check for IEEE854 compliant 80 bit floats" >&2;}
+
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int   float2long_IEEE_compliance ( void )
+{
+    struct {
+        long padding; /* to prevent unaligned access */
+        float  f;
+    } s;
+    s.f = 12582912.; if ( *(long*)(&s.f) != 1262485504l ) return 0;
+    s.f = 12615679.; if ( *(long*)(&s.f) != 1262518271l ) return 0;
+    s.f = 13582912.; if ( *(long*)(&s.f) != 1263485504l ) return 0;
+    s.f = 12550145.; if ( *(long*)(&s.f) != 1262452737l ) return 0;
+    s.f = 11582912.; if ( *(long*)(&s.f) != 1261485504l ) return 0;
+    return 1;
+}
+
+int main(void)
+{
+    int retval;
+
+    retval = float2long_IEEE_compliance();
+
+    /* no error return -> success */
+    return !retval;
+}
+
+_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
+  alex_cv_ieee854_float80=yes
+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 )
+alex_cv_ieee854_float80=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $alex_cv_ieee854_float80" >&5
+echo "${ECHO_T}$alex_cv_ieee854_float80" >&6; }
+if test "${alex_cv_ieee854_float80}" = "yes" ; then
+	if test "${ac_cv_c_long_double}" = "yes" ; then
+		{ echo "$as_me:$LINENO: checking for ieee854_float80_t" >&5
+echo $ECHO_N "checking for ieee854_float80_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_ieee854_float80_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef ieee854_float80_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_ieee854_float80_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_ieee854_float80_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_ieee854_float80_t" >&5
+echo "${ECHO_T}$ac_cv_type_ieee854_float80_t" >&6; }
+if test $ac_cv_type_ieee854_float80_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_IEEE854_FLOAT80_T 1
+_ACEOF
+
+long double
+fi
+
+
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_IEEE854_FLOAT80 1
+_ACEOF
+
+	fi
+fi
+{ echo "$as_me:$LINENO: checking for ieee754_float64_t" >&5
+echo $ECHO_N "checking for ieee754_float64_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_ieee754_float64_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef ieee754_float64_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_ieee754_float64_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_ieee754_float64_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_ieee754_float64_t" >&5
+echo "${ECHO_T}$ac_cv_type_ieee754_float64_t" >&6; }
+if test $ac_cv_type_ieee754_float64_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_IEEE754_FLOAT64_T 1
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking for ieee754_float32_t" >&5
+echo $ECHO_N "checking for ieee754_float32_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_ieee754_float32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef ieee754_float32_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_ieee754_float32_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_ieee754_float32_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_ieee754_float32_t" >&5
+echo "${ECHO_T}$ac_cv_type_ieee754_float32_t" >&6; }
+if test $ac_cv_type_ieee754_float32_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_IEEE754_FLOAT32_T 1
+_ACEOF
+
+
+fi
+
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LAME_LIBRARY_BUILD 1
+_ACEOF
+
+
+
+if test ${cross_compiling} = "yes"; then
+	{ echo "$as_me:$LINENO: WARNING:
+  **************************************************************************
+  *                                                                        *
+  * You are cross compiling:                                               *
+  *   - I did not have a change to determine                               *
+  *     + the size of:                                                     *
+  *       - short                                                          *
+  *       - unsigned short                                                 *
+  *       - int                                                            *
+  *       - unsigned int                                                   *
+  *       - long                                                           *
+  *       - unsigned long                                                  *
+  *       - float                                                          *
+  *       - double                                                         *
+  *       - long double                                                    *
+  *     + the endianess of the system                                      *
+  *   - You have to provide appropriate defines for them in config.h, e.g. *
+  *     + define SIZEOF_SHORT to 2 if the size of a short is 2             *
+  *     + define WORDS_BIGENDIAN if your system is a big endian system     *
+  *                                                                        *
+  **************************************************************************" >&5
+echo "$as_me: WARNING:
+  **************************************************************************
+  *                                                                        *
+  * You are cross compiling:                                               *
+  *   - I did not have a change to determine                               *
+  *     + the size of:                                                     *
+  *       - short                                                          *
+  *       - unsigned short                                                 *
+  *       - int                                                            *
+  *       - unsigned int                                                   *
+  *       - long                                                           *
+  *       - unsigned long                                                  *
+  *       - float                                                          *
+  *       - double                                                         *
+  *       - long double                                                    *
+  *     + the endianess of the system                                      *
+  *   - You have to provide appropriate defines for them in config.h, e.g. *
+  *     + define SIZEOF_SHORT to 2 if the size of a short is 2             *
+  *     + define WORDS_BIGENDIAN if your system is a big endian system     *
+  *                                                                        *
+  **************************************************************************" >&2;}
+fi
+
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_time=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_time=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ echo "$as_me:$LINENO: checking for working alloca.h" >&5
+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; }
+if test "${ac_cv_working_alloca_h+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 <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+			  if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_working_alloca_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_working_alloca_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA_H 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for alloca" >&5
+echo $ECHO_N "checking for alloca... $ECHO_C" >&6; }
+if test "${ac_cv_func_alloca_works+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.  */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+				    if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_alloca_works=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_alloca_works=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA 1
+_ACEOF
+
+else
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+cat >>confdefs.h <<\_ACEOF
+#define C_ALLOCA 1
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; }
+if test "${ac_cv_os_cray+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+echo "${ECHO_T}$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  return find_stack_direction () < 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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
+  ac_cv_c_stack_direction=1
+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_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+
+
+for ac_func in gettimeofday strtol
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+if test "X${ac_cv_func_strtol}" != "Xyes"; then
+	{ { echo "$as_me:$LINENO: error: function strtol is mandatory" >&5
+echo "$as_me: error: function strtol is mandatory" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+SOCKETFUNCTION=unknown
+
+for ac_func in socket
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test $ac_cv_func_socket = no; then
+	# maybe it is in libsocket
+	{ echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
+echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; }
+if test "${ac_cv_lib_socket_socket+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket  $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 socket ();
+int
+main ()
+{
+return socket ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_socket_socket=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_socket_socket=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; }
+if test $ac_cv_lib_socket_socket = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_SOCKET 1
+_ACEOF
+
+	LIBS="$LIBS -lsocket"
+fi
+
+	if test "X${ac_cv_lib_socket_socket}" != "Xyes"; then
+		SOCKETFUNCTION=NO
+	else
+		case ${host_os} in
+		*solaris*)
+			LIBS="$LIBS -lnsl"
+			;;
+		esac
+	fi
+fi
+
+CFLAGS=${CFLAGS}
+CONFIG_DEFS=${CONFIG_DEFS}
+NASM=
+INCLUDES="-I\$(top_srcdir)/include -I\$(srcdir)"
+FRONTEND_LDFLAGS=
+FRONTEND_CFLAGS=
+LIB_SOURCES=
+MAKEDEP="-M"
+RM_F="rm -f"
+
+# Check whether --enable-nasm was given.
+if test "${enable_nasm+set}" = set; then
+  enableval=$enable_nasm; ASM_FOR_ARCH="i386"
+else
+  ASM_FOR_ARCH=""
+fi
+
+
+
+
+for ac_header in termcap.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in ncurses/termcap.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to lame-dev@lists.sf.net ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking for initscr in -ltermcap" >&5
+echo $ECHO_N "checking for initscr in -ltermcap... $ECHO_C" >&6; }
+if test "${ac_cv_lib_termcap_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltermcap  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
+int
+main ()
+{
+return initscr ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_termcap_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_termcap_initscr=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_termcap_initscr" >&6; }
+if test $ac_cv_lib_termcap_initscr = yes; then
+  HAVE_TERMCAP="termcap"
+fi
+
+{ echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5
+echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_curses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
+int
+main ()
+{
+return initscr ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_curses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_curses_initscr=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; }
+if test $ac_cv_lib_curses_initscr = yes; then
+  HAVE_TERMCAP="curses"
+fi
+
+{ echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
+echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
+int
+main ()
+{
+return initscr ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_ncurses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_ncurses_initscr=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; }
+if test $ac_cv_lib_ncurses_initscr = yes; then
+  HAVE_TERMCAP="ncurses"
+fi
+
+
+{ echo "$as_me:$LINENO: checking for cos in -lm" >&5
+echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_cos+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* 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 cos ();
+int
+main ()
+{
+return cos ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_cos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_cos=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_m_cos" >&6; }
+if test $ac_cv_lib_m_cos = yes; then
+  USE_LIBM="-lm"
+fi
+
+{ echo "$as_me:$LINENO: checking for cos in -lffm" >&5
+echo $ECHO_N "checking for cos in -lffm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ffm_cos+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lffm  $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 cos ();
+int
+main ()
+{
+return cos ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_ffm_cos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_ffm_cos=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ffm_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_ffm_cos" >&6; }
+if test $ac_cv_lib_ffm_cos = yes; then
+  USE_LIBM="-lffm -lm"
+fi
+
+# Check whether --enable-cpml was given.
+if test "${enable_cpml+set}" = set; then
+  enableval=$enable_cpml; CONFIG_CPML="no"
+else
+  CONFIG_CPML="yes"
+fi
+
+if test "${CONFIG_CPML}" = yes; then
+      { echo "$as_me:$LINENO: checking for cos in -lcpml" >&5
+echo $ECHO_N "checking for cos in -lcpml... $ECHO_C" >&6; }
+if test "${ac_cv_lib_cpml_cos+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcpml  $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 cos ();
+int
+main ()
+{
+return cos ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_cpml_cos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_cpml_cos=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_cpml_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_cpml_cos" >&6; }
+if test $ac_cv_lib_cpml_cos = yes; then
+  USE_LIBM="-lcpml"
+fi
+
+fi
+CONFIG_MATH_LIB="${USE_LIBM}"
+
+
+
+# Check whether --with-gtk-prefix was given.
+if test "${with_gtk_prefix+set}" = set; then
+  withval=$with_gtk_prefix; gtk_config_prefix="$withval"
+else
+  gtk_config_prefix=""
+fi
+
+
+# Check whether --with-gtk-exec-prefix was given.
+if test "${with_gtk_exec_prefix+set}" = set; then
+  withval=$with_gtk_exec_prefix; gtk_config_exec_prefix="$withval"
+else
+  gtk_config_exec_prefix=""
+fi
+
+# Check whether --enable-gtktest was given.
+if test "${enable_gtktest+set}" = set; then
+  enableval=$enable_gtktest;
+else
+  enable_gtktest=yes
+fi
+
+
+  for module in .
+  do
+      case "$module" in
+         gthread)
+             gtk_config_args="$gtk_config_args gthread"
+         ;;
+      esac
+  done
+
+  if test x$gtk_config_exec_prefix != x ; then
+     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
+     fi
+  fi
+  if test x$gtk_config_prefix != x ; then
+     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
+     fi
+  fi
+
+  # Extract the first word of "gtk-config", so it can be a program name with args.
+set dummy gtk-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_GTK_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $GTK_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_GTK_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no"
+  ;;
+esac
+fi
+GTK_CONFIG=$ac_cv_path_GTK_CONFIG
+if test -n "$GTK_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $GTK_CONFIG" >&5
+echo "${ECHO_T}$GTK_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  min_gtk_version=1.2.0
+  { echo "$as_me:$LINENO: checking for GTK - version >= $min_gtk_version" >&5
+echo $ECHO_N "checking for GTK - version >= $min_gtk_version... $ECHO_C" >&6; }
+  no_gtk=""
+  if test "$GTK_CONFIG" = "no" ; then
+    no_gtk=yes
+  else
+    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
+    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
+    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+      rm -f conf.gtktest
+      if test "$cross_compiling" = yes; then
+  echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If gtk-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
+      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    }
+#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+	   (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+	     gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+#endif /* defined (GTK_MAJOR_VERSION) ... */
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+	       major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
+        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "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 )
+no_gtk=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+     HAVE_GTK="yes"
+  else
+     { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+     if test "$GTK_CONFIG" = "no" ; then
+       echo "*** The gtk-config script installed by GTK could not be found"
+       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GTK_CONFIG environment variable to the"
+       echo "*** full path to gtk-config."
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK test program, checking why..."
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+
+int
+main ()
+{
+ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+   echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK or finding the wrong"
+          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	 echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
+          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
+          echo "*** may want to edit the gtk-config script: $GTK_CONFIG"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     HAVE_GTK="no"
+  fi
+
+
+  rm -f conf.gtktest
+
+
+{ echo "$as_me:$LINENO: checking use of ElectricFence malloc debugging" >&5
+echo $ECHO_N "checking use of ElectricFence malloc debugging... $ECHO_C" >&6; }
+# Check whether --enable-efence was given.
+if test "${enable_efence+set}" = set; then
+  enableval=$enable_efence; CONFIG_EFENCE="${enableval}"
+else
+  CONFIG_EFENCE="no"
+fi
+
+
+case "${CONFIG_EFENCE}" in
+yes)
+	{ echo "$as_me:$LINENO: checking for EF_Print in -lefence" >&5
+echo $ECHO_N "checking for EF_Print in -lefence... $ECHO_C" >&6; }
+if test "${ac_cv_lib_efence_EF_Print+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lefence  $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 EF_Print ();
+int
+main ()
+{
+return EF_Print ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_efence_EF_Print=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_efence_EF_Print=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_efence_EF_Print" >&5
+echo "${ECHO_T}$ac_cv_lib_efence_EF_Print" >&6; }
+if test $ac_cv_lib_efence_EF_Print = yes; then
+  HAVE_EFENCE="-lefence"
+fi
+
+	if test "x${HAVE_EFENCE}" != "x-lefence"; then
+		{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	else
+		LDADD="${LDADD} ${HAVE_EFENCE}"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EFENCE 1
+_ACEOF
+
+		{ echo "$as_me:$LINENO: result: ${CONFIG_EFENCE}" >&5
+echo "${ECHO_T}${CONFIG_EFENCE}" >&6; }
+	fi
+	;;
+no)
+	{ echo "$as_me:$LINENO: result: ${CONFIG_EFENCE}" >&5
+echo "${ECHO_T}${CONFIG_EFENCE}" >&6; }
+	;;
+*)
+	{ { echo "$as_me:$LINENO: error: bad value �${CONFIG_EFENCE}� for efence option" >&5
+echo "$as_me: error: bad value �${CONFIG_EFENCE}� for efence option" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+esac
+
+
+WARNING=
+
+# Check whether --with-fileio was given.
+if test "${with_fileio+set}" = set; then
+  withval=$with_fileio; CONFIG_FILEIO="${withval}"
+else
+  CONFIG_FILEIO="lame"
+fi
+
+
+if test "${CONFIG_FILEIO}" = "sndfile" ; then
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  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
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	else
+		{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+		PKG_CONFIG=""
+	fi
+
+fi
+
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for SNDFILE" >&5
+echo $ECHO_N "checking for SNDFILE... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$SNDFILE_CFLAGS"; then
+        pkg_cv_SNDFILE_CFLAGS="$SNDFILE_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sndfile >= 1.0.2\"") >&5
+  ($PKG_CONFIG --exists --print-errors "sndfile >= 1.0.2") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_SNDFILE_CFLAGS=`$PKG_CONFIG --cflags "sndfile >= 1.0.2" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$SNDFILE_LIBS"; then
+        pkg_cv_SNDFILE_LIBS="$SNDFILE_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sndfile >= 1.0.2\"") >&5
+  ($PKG_CONFIG --exists --print-errors "sndfile >= 1.0.2") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_SNDFILE_LIBS=`$PKG_CONFIG --libs "sndfile >= 1.0.2" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        SNDFILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sndfile >= 1.0.2"`
+        else
+	        SNDFILE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sndfile >= 1.0.2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$SNDFILE_PKG_ERRORS" >&5
+
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+                HAVE_SNDFILE="no"
+elif test $pkg_failed = untried; then
+	HAVE_SNDFILE="no"
+else
+	SNDFILE_CFLAGS=$pkg_cv_SNDFILE_CFLAGS
+	SNDFILE_LIBS=$pkg_cv_SNDFILE_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	HAVE_SNDFILE="yes"
+fi
+fi
+
+{ echo "$as_me:$LINENO: checking use of file io" >&5
+echo $ECHO_N "checking use of file io... $ECHO_C" >&6; }
+
+if test "${CONFIG_FILEIO}" = "sndfile" ; then
+  if test "${HAVE_SNDFILE}" = "yes" -o "x${SNDFILE_LIBS}" != "x" \
+    -o "x${SNDFILE_CFLAGS}" != "x"; then
+    SNDFILE_LIBS=`echo ${SNDFILE_LIBS}`
+    SNDFILE_CFLAGS=`echo ${SNDFILE_CFLAGS}`
+
+    if test -n "${SNDFILE_LIBS}" ; then
+      FRONTEND_LDFLAGS="${SNDFILE_LIBS} ${FRONTEND_LDFLAGS}"
+    fi
+    FRONTEND_LDADD="-lsndfile ${FRONTEND_LDADD}"
+
+    if test -n "${SNDFILE_CFLAGS}" ; then
+      INCLUDES="${SNDFILE_CFLAGS} ${INCLUDES}"
+    fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LIBSNDFILE 1
+_ACEOF
+
+  else
+    # default
+    CONFIG_FILEIO="lame"
+    WARNING="${WARNING} Could not find any sndfile lib on system."
+  fi
+else
+  CONFIG_FILEIO="lame"
+fi
+{ echo "$as_me:$LINENO: result: ${CONFIG_FILEIO}" >&5
+echo "${ECHO_T}${CONFIG_FILEIO}" >&6; }
+if test "x${WARNING}" != "x" ; then
+  { echo "$as_me:$LINENO: WARNING: $WARNING" >&5
+echo "$as_me: WARNING: $WARNING" >&2;}
+fi
+
+
+{ echo "$as_me:$LINENO: checking use of analyzer hooks" >&5
+echo $ECHO_N "checking use of analyzer hooks... $ECHO_C" >&6; }
+# Check whether --enable-analyzer-hooks was given.
+if test "${enable_analyzer_hooks+set}" = set; then
+  enableval=$enable_analyzer_hooks; CONFIG_ANALYZER="${enableval}"
+else
+  CONFIG_ANALYZER="yes"
+fi
+
+
+case "${CONFIG_ANALYZER}" in
+yes)
+	;;
+no)
+
+cat >>confdefs.h <<\_ACEOF
+#define NOANALYSIS 1
+_ACEOF
+
+	;;
+*)
+	{ { echo "$as_me:$LINENO: error: bad value �${CONFIG_ANALYZER}� for analyzer-hooks option" >&5
+echo "$as_me: error: bad value �${CONFIG_ANALYZER}� for analyzer-hooks option" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+esac
+{ echo "$as_me:$LINENO: result: $CONFIG_ANALYZER" >&5
+echo "${ECHO_T}$CONFIG_ANALYZER" >&6; }
+
+
+{ echo "$as_me:$LINENO: checking use of mpg123 decoder" >&5
+echo $ECHO_N "checking use of mpg123 decoder... $ECHO_C" >&6; }
+# Check whether --enable-decoder was given.
+if test "${enable_decoder+set}" = set; then
+  enableval=$enable_decoder; CONFIG_DECODER="${enableval}"
+else
+  CONFIG_DECODER="yes"
+fi
+
+# Check whether --enable-decode-layer1 was given.
+if test "${enable_decode_layer1+set}" = set; then
+  enableval=$enable_decode_layer1; CONFIG_DECODER_L1="${enableval}"
+else
+  CONFIG_DECODER_L1="no"
+fi
+
+# Check whether --enable-decode-layer2 was given.
+if test "${enable_decode_layer2+set}" = set; then
+  enableval=$enable_decode_layer2; CONFIG_DECODER_L2="${enableval}"
+else
+  CONFIG_DECODER_L2="yes"
+fi
+
+
+ if test "x${CONFIG_DECODER}" = "xyes"; then
+  LIB_WITH_DECODER_TRUE=
+  LIB_WITH_DECODER_FALSE='#'
+else
+  LIB_WITH_DECODER_TRUE='#'
+  LIB_WITH_DECODER_FALSE=
+fi
+
+
+if test "${CONFIG_DECODER}" != "no" ; then
+	CONFIG_DECODER="yes (Layer"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MPGLIB 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define DECODE_ON_THE_FLY 1
+_ACEOF
+
+
+	if test "${CONFIG_DECODER_L1}" != "no"; then
+		CONFIG_DECODER="${CONFIG_DECODER} 1,"
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_LAYER_1 1
+_ACEOF
+
+	fi
+	if test "${CONFIG_DECODER_L2}" != "no"; then
+		CONFIG_DECODER="${CONFIG_DECODER} 2,"
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_LAYER_2 1
+_ACEOF
+
+	fi
+	CONFIG_DECODER="${CONFIG_DECODER} 3)"
+fi
+{ echo "$as_me:$LINENO: result: $CONFIG_DECODER" >&5
+echo "${ECHO_T}$CONFIG_DECODER" >&6; }
+
+
+{ echo "$as_me:$LINENO: checking if the lame frontend should be build" >&5
+echo $ECHO_N "checking if the lame frontend should be build... $ECHO_C" >&6; }
+# Check whether --enable-frontend was given.
+if test "${enable_frontend+set}" = set; then
+  enableval=$enable_frontend; WITH_FRONTEND="${enableval}"
+else
+  WITH_FRONTEND=yes
+fi
+
+if test "x${WITH_FRONTEND}" = "xyes"; then
+	WITH_FRONTEND=lame${ac_exeext}
+	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+	WITH_FRONTEND=
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking if mp3x is requested" >&5
+echo $ECHO_N "checking if mp3x is requested... $ECHO_C" >&6; }
+# Check whether --enable-mp3x was given.
+if test "${enable_mp3x+set}" = set; then
+  enableval=$enable_mp3x; WITH_MP3X="${enableval}"
+else
+  WITH_MP3X=no
+fi
+
+if test "x${WITH_MP3X}" = "xyes"; then
+	WITH_MP3X=mp3x${ac_exeext}
+	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+	WITH_MP3X=
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test "${HAVE_GTK}" = "no"; then
+	if test "x${WITH_MP3X}" = "xmp3x"; then
+		{ echo "$as_me:$LINENO: WARNING: can't build mp3x" >&5
+echo "$as_me: WARNING: can't build mp3x" >&2;}
+		WITH_MP3X=
+	fi
+	if test "x${CONFIG_ANALYZER}" != "xyes"; then
+		{ echo "$as_me:$LINENO: WARNING: can't build mp3x because of disabled analyzer hooks" >&5
+echo "$as_me: WARNING: can't build mp3x because of disabled analyzer hooks" >&2;}
+		WITH_MP3X=
+	fi
+fi
+
+{ echo "$as_me:$LINENO: checking if mp3rtp is requested" >&5
+echo $ECHO_N "checking if mp3rtp is requested... $ECHO_C" >&6; }
+# Check whether --enable-mp3rtp was given.
+if test "${enable_mp3rtp+set}" = set; then
+  enableval=$enable_mp3rtp; WITH_MP3RTP="${enableval}"
+else
+  WITH_MP3RTP=no
+fi
+
+if test "x${WITH_MP3RTP}" = "xyes"; then
+	if test ${SOCKETFUNCTION} = NO; then
+		{ { echo "$as_me:$LINENO: error: function socket is mandatory for mp3rtp" >&5
+echo "$as_me: error: function socket is mandatory for mp3rtp" >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+	WITH_MP3RTP=mp3rtp${ac_exeext}
+	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+	WITH_MP3RTP=
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+#
+# this is from vorbis
+#
+case $host in
+*86-*-linux*)
+	# glibc < 2.1.3 has a serious FP bug in the math inline header
+	# that will cripple Vorbis.  Look to see if the magic FP stack
+	# clobber is missing in the mathinline header, thus indicating
+	# the buggy version
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+		#define __LIBC_INTERNAL_MATH_INLINES 1
+	     	#define __OPTIMIZE__
+		#include <math.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "log10.*fldlg2.*fxch" >/dev/null 2>&1; then
+  bad=maybe
+else
+  bad=no
+fi
+rm -f conftest*
+
+
+	{ echo "$as_me:$LINENO: checking glibc mathinline bug" >&5
+echo $ECHO_N "checking glibc mathinline bug... $ECHO_C" >&6; }
+	if test ${bad} = "maybe" ;then
+	      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+				#define __LIBC_INTERNAL_MATH_INLINES 1
+			     	#define __OPTIMIZE__
+				#include <math.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "log10.*fldlg2.*fxch.*st\([0123456789]*\)" >/dev/null 2>&1; then
+  bad=no
+else
+  bad=yes
+fi
+rm -f conftest*
+
+	fi
+	{ echo "$as_me:$LINENO: result: ${bad}" >&5
+echo "${ECHO_T}${bad}" >&6; }
+	if test ${bad} = "yes" ;then
+ { echo "$as_me:$LINENO: WARNING:                                                         " >&5
+echo "$as_me: WARNING:                                                         " >&2;}
+ { echo "$as_me:$LINENO: WARNING: ********************************************************" >&5
+echo "$as_me: WARNING: ********************************************************" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * The glibc headers on this machine have a serious bug *" >&5
+echo "$as_me: WARNING: * The glibc headers on this machine have a serious bug *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * in /usr/include/bits/mathinline.h  This bug affects  *" >&5
+echo "$as_me: WARNING: * in /usr/include/bits/mathinline.h  This bug affects  *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * all floating point code, not only LAME, but all code *" >&5
+echo "$as_me: WARNING: * all floating point code, not only LAME, but all code *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * built on this machine. Upgrading to glibc 2.1.3 is   *" >&5
+echo "$as_me: WARNING: * built on this machine. Upgrading to glibc 2.1.3 is   *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * strongly urged to correct the problem.               *" >&5
+echo "$as_me: WARNING: * strongly urged to correct the problem.               *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: *Note: that upgrading glibc will not fix any previously*" >&5
+echo "$as_me: WARNING: *Note: that upgrading glibc will not fix any previously*" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * built programs; this is a compile-time bug.          *" >&5
+echo "$as_me: WARNING: * built programs; this is a compile-time bug.          *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * To work around the problem for this build of LAME,   *" >&5
+echo "$as_me: WARNING: * To work around the problem for this build of LAME,   *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * autoconf is disabling all math inlining.  This will  *" >&5
+echo "$as_me: WARNING: * autoconf is disabling all math inlining.  This will  *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * hurt LAME performace but is necessary for LAME to    *" >&5
+echo "$as_me: WARNING: * hurt LAME performace but is necessary for LAME to    *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * work correctly.  Once glibc is upgraded, rerun       *" >&5
+echo "$as_me: WARNING: * work correctly.  Once glibc is upgraded, rerun       *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: * configure and make to build with inlining.           *" >&5
+echo "$as_me: WARNING: * configure and make to build with inlining.           *" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ********************************************************" >&5
+echo "$as_me: WARNING: ********************************************************" >&2;}
+ { echo "$as_me:$LINENO: WARNING:                                                         " >&5
+echo "$as_me: WARNING:                                                         " >&2;}
+
+
+cat >>confdefs.h <<\_ACEOF
+#define __NO_MATH_INLINES 1
+_ACEOF
+
+	fi;;
+esac
+
+
+{ echo "$as_me:$LINENO: checking use of VBR bitrate histogram" >&5
+echo $ECHO_N "checking use of VBR bitrate histogram... $ECHO_C" >&6; }
+if test "x${HAVE_TERMCAP}" != "x"; then
+  TERMCAP_DEFAULT="yes"
+else
+  TERMCAP_DEFAULT="no"
+fi
+# Check whether --enable-brhist was given.
+if test "${enable_brhist+set}" = set; then
+  enableval=$enable_brhist; CONFIG_BRHIST="${enableval}"
+else
+  CONFIG_BRHIST="yes"
+fi
+
+if test "${CONFIG_BRHIST}" != "no" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BRHIST 1
+_ACEOF
+
+
+	if test "${TERMCAP_DEFAULT}" = "yes" ; then
+		FRONTEND_LDADD="-l${HAVE_TERMCAP} ${FRONTEND_LDADD}"
+		CONFIG_BRHIST="yes, with ${HAVE_TERMCAP}"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TERMCAP 1
+_ACEOF
+
+	else
+		CONFIG_BRHIST="yes, simulated termcap"
+	fi
+fi
+{ echo "$as_me:$LINENO: result: ${CONFIG_BRHIST}" >&5
+echo "${ECHO_T}${CONFIG_BRHIST}" >&6; }
+ if test "${CONFIG_BRHIST}" != "no"; then
+  WITH_BRHIST_TRUE=
+  WITH_BRHIST_FALSE='#'
+else
+  WITH_BRHIST_TRUE='#'
+  WITH_BRHIST_FALSE=
+fi
+
+
+
+
+WITH_VECTOR=no
+case $host_cpu in
+x86_64|amd64)
+	CPUTYPE="no"
+	if test $ac_cv_header_xmmintrin_h = yes ; then
+		WITH_XMM=yes
+		WITH_VECTOR=yes
+	fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define TAKEHIRO_IEEE754_HACK 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_FAST_LOG 1
+_ACEOF
+
+	;;
+*86)
+	CPUTYPE="i386"
+	if test $ac_cv_header_xmmintrin_h = yes ; then
+		WITH_XMM=yes
+		WITH_VECTOR=yes
+	fi
+
+	# use internal knowledge of the IEEE 754 layout
+
+cat >>confdefs.h <<\_ACEOF
+#define TAKEHIRO_IEEE754_HACK 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_FAST_LOG 1
+_ACEOF
+
+	;;
+powerpc)
+	CPUTYPE="no"
+
+	# use internal knowledge of the IEEE 754 layout
+
+cat >>confdefs.h <<\_ACEOF
+#define TAKEHIRO_IEEE754_HACK 1
+_ACEOF
+
+
+	# The following should not get enabled on a G5. HOWTO check for a G5?
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_FAST_LOG 1
+_ACEOF
+
+	;;
+*)
+	CPUTYPE="no"
+	;;
+esac
+
+# which vector code do we support to build on this machine?
+ if test "x${WITH_XMM}" = "xyes"; then
+  WITH_XMM_TRUE=
+  WITH_XMM_FALSE='#'
+else
+  WITH_XMM_TRUE='#'
+  WITH_XMM_FALSE=
+fi
+
+
+# needs to be defined to link in the internal vector lib
+ if test "x${WITH_VECTOR}" = "xyes"; then
+  WITH_VECTOR_TRUE=
+  WITH_VECTOR_FALSE='#'
+else
+  WITH_VECTOR_TRUE='#'
+  WITH_VECTOR_FALSE=
+fi
+
+{ echo "$as_me:$LINENO: checking if I have to build the internal vector lib" >&5
+echo $ECHO_N "checking if I have to build the internal vector lib... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: ${WITH_VECTOR}" >&5
+echo "${ECHO_T}${WITH_VECTOR}" >&6; }
+
+{ echo "$as_me:$LINENO: checking for FLOAT8 as float" >&5
+echo $ECHO_N "checking for FLOAT8 as float... $ECHO_C" >&6; }
+# Check whether --enable-all-float was given.
+if test "${enable_all_float+set}" = set; then
+  enableval=$enable_all_float; CONFIG_ALLFLOAT="${enableval}"
+else
+  CONFIG_ALLFLOAT="no"
+fi
+
+case "${CONFIG_ALLFLOAT}" in
+no)
+	;;
+yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define FLOAT8 float
+_ACEOF
+
+	;;
+*)
+	{ { echo "$as_me:$LINENO: error: bad value �${CONFIG_ALLFLOAT}� for all-float option" >&5
+echo "$as_me: error: bad value �${CONFIG_ALLFLOAT}� for all-float option" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+esac
+{ echo "$as_me:$LINENO: result: ${CONFIG_ALLFLOAT}" >&5
+echo "${ECHO_T}${CONFIG_ALLFLOAT}" >&6; }
+
+
+
+# Extract the first word of "nasm", so it can be a program name with args.
+set dummy nasm; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_NASM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $NASM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NASM="$NASM" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NASM="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_NASM" && ac_cv_path_NASM="no"
+  ;;
+esac
+fi
+NASM=$ac_cv_path_NASM
+if test -n "$NASM"; then
+  { echo "$as_me:$LINENO: result: $NASM" >&5
+echo "${ECHO_T}$NASM" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+case "${NASM}" in
+no)
+	;;
+*)
+	{ echo "$as_me:$LINENO: checking for assembler routines for this processor type" >&5
+echo $ECHO_N "checking for assembler routines for this processor type... $ECHO_C" >&6; }
+	for recurse_over in ${ASM_FOR_ARCH}
+	do
+		if test "${CPUTYPE}" = "${recurse_over}"; then
+			include_asm_routines="yes"
+		fi
+
+		case $host_os in
+		*darwin*)
+			# currently we have problems because of a wrong
+			# libtool hack in the darwin case (for nasm code)
+			include_asm_routines="no"
+			;;
+		esac
+	done
+	if test "x${include_asm_routines}" = "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_NASM 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define MMX_choose_table 1
+_ACEOF
+
+	else
+		include_asm_routines="no"
+		NASM="no"
+	fi
+	{ echo "$as_me:$LINENO: result: ${include_asm_routines}" >&5
+echo "${ECHO_T}${include_asm_routines}" >&6; }
+	;;
+esac
+ if test "${NASM}" != "no"; then
+  HAVE_NASM_TRUE=
+  HAVE_NASM_FALSE='#'
+else
+  HAVE_NASM_TRUE='#'
+  HAVE_NASM_FALSE=
+fi
+
+
+case $host_os in
+	*cygwin*|*mingw32*)
+		CYGWIN=yes
+		NASM_FORMAT="-f win32 -DWIN32"
+		;;
+	*darwin*)
+		NASM_FORMAT="-f macho"
+		;;
+	*)
+		CYGWIN=no
+		NASM_FORMAT="-f elf"
+		;;
+esac
+
+#
+# 'expopt' is used for "additional optimizations", not for optimizations which
+# are marked as "experimental" in the guide for the compiler.
+# They are "experimental" here in the LAME project (at least
+# "--enable-expopt=full").
+#
+{ echo "$as_me:$LINENO: checking for additional optimizations" >&5
+echo $ECHO_N "checking for additional optimizations... $ECHO_C" >&6; }
+# Check whether --enable-expopt was given.
+if test "${enable_expopt+set}" = set; then
+  enableval=$enable_expopt; CONFIG_EXPOPT="${enableval}"
+else
+  CONFIG_EXPOPT="no"
+fi
+
+
+if test "x$GCC" = "xyes"; then
+	# gcc defaults. OS specific options go in versious sections below
+	# from the gcc man pages:  "there is no reason to use -pedantic"
+	if test "x${with_gnu_ld}" = "xyes"; then
+		CFLAGS="-Wall -pipe ${CFLAGS}"
+	else
+		# some vendor ld's don't like '-pipe'
+		CFLAGS="-Wall ${CFLAGS}"
+	fi
+
+	# GCC version specific generic options
+	case "${GCC_version}" in
+	2.96*)
+        	# for buggy version of gcc shipped with RH7.1, back of on some
+        	# optimizations
+        	OPTIMIZATION="-O -fomit-frame-pointer -ffast-math \
+			-funroll-loops"
+		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
+			-fsched-interblock -fbranch-count-reg -fforce-addr \
+			-fforce-mem"
+        	;;
+	3.0*)
+		# -funroll-loops seems to produce buggy code with gcc 3.0.3
+		OPTIMIZATION="-O -fomit-frame-pointer -ffast-math"
+		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
+			-fbranch-count-reg -fforce-addr -fforce-mem"
+		;;
+	3.*|4.0.*|4.1.*)
+		# -fomit-frame-pointer seems to be buggy on cygwin
+		case ${host_os} in
+		*cygwin*)
+			OMIT_FRAME_POINTER=
+			;;
+		*)
+			OMIT_FRAME_POINTER=-fomit-frame-pointer
+			;;
+		esac
+
+		OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math"
+		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
+			-fbranch-count-reg -fforce-addr -fforce-mem"
+		;;
+	4.*)
+		OPTIMIZATION="-O3 -fomit-frame-pointer -ffast-math"
+		OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
+		;;
+	*)
+		# default
+		OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math \
+			-funroll-loops"
+		OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
+		;;
+	esac
+
+
+	# GCC version independend generic options
+	OPTIMIZATION_NORM="-fschedule-insns2"
+
+
+	# generic CPU specific options
+	case ${host_cpu} in
+	sparc)
+		case "${GCC_version}" in
+		3.0*)
+			;;
+		3.*|4.*)
+			# doesn't work on 3.0.x, but on 3.[12] and
+			# hopefully on every other release after that too
+			if test -x /usr/bin/isalist; then
+				/usr/bin/isalist | grep sparcv8plus \
+					>/dev/null 2>&1 && \
+					OPTIMIZATION="${OPTIMIZATION} \
+						-mcpu=ultrasparc \
+						-mtune=ultrasparc"
+			fi
+			;;
+		esac
+		;;
+	*86)
+		case "${GCC_version}" in
+		3.*|4.*)
+			OPTIMIZATION="${OPTIMIZATION} \
+				-maccumulate-outgoing-args"
+			;;
+		esac
+		;;
+	esac
+
+	expopt_msg_result_printed=no
+	case "${CONFIG_EXPOPT}" in
+	no)
+		# if someone supplies own CFLAGS, we don't add our own
+		if test "x${ac_save_CFLAGS}" != "x"; then
+			OPTIMIZATION=""
+		fi
+		;;
+	norm|yes)
+		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM}"
+		;;
+	full)
+		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM} \
+			${OPTIMIZATION_FULL}"
+
+		# some hardware dependend options
+		case "${GCC_version}" in
+		2.9*|3.*|4.0.*|4.1.*)
+			# "new" GCC, use some "new" CPU specific optimizations
+			case ${host_cpu} in
+			*486)
+				OPTIMIZATION="${OPTIMIZATION} -mcpu=i486 \
+					-mfancy-math-387"
+				;;
+			*586)
+				OPTIMIZATION="${OPTIMIZATION} -mcpu=pentium \
+					-march=pentium -mfancy-math-387"
+				;;
+			*686)
+				OPTIMIZATION="${OPTIMIZATION} -mcpu=pentiumpro \
+					-march=pentiumpro -mfancy-math-387 \
+					-malign-double"
+				;;
+			*86)
+				OPTIMIZATION="${OPTIMIZATION} -mfancy-math-387"
+				;;
+			alpha*)
+				OPTIMIZATION="${OPTIMIZATION} -mfp-regs"
+
+cat >>confdefs.h <<\_ACEOF
+#define FLOAT double
+_ACEOF
+
+				# add "-mcpu=21164a -Wa,-m21164a" to optimize
+				# for 21164a (ev56) CPU
+				;;
+			*)
+				OPTIMIZATION="${OPTIMIZATION} -fdelayed-branch"
+				;;
+			esac
+			;;
+		4.*)
+			case ${host_cpu} in
+			*486)
+				OPTIMIZATION="${OPTIMIZATION} -march=i486"
+				;;
+			*586)
+				OPTIMIZATION="${OPTIMIZATION} -march=i586 \
+					-mtune=native"
+				;;
+			*686)
+				OPTIMIZATION="${OPTIMIZATION} -march=i686 \
+					-mtune=native"
+				;;
+			*86)
+				OPTIMIZATION="${OPTIMIZATION} -march=generic \
+					-mtune=native"
+				;;
+			esac
+			;;
+		*)
+			# no special optimization for other versions
+			{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+			expopt_msg_result_printed=yes
+			{ echo "$as_me:$LINENO: WARNING: LAME doesn't know about your version (${GCC_version}) of gcc" >&5
+echo "$as_me: WARNING: LAME doesn't know about your version (${GCC_version}) of gcc" >&2;}
+			;;
+		esac
+		;;
+	*)
+		{ { echo "$as_me:$LINENO: error: bad value �${CONFIG_EXPOPT}� for expopt option" >&5
+echo "$as_me: error: bad value �${CONFIG_EXPOPT}� for expopt option" >&2;}
+   { (exit 1); exit 1; }; }
+		;;
+	esac
+
+	if test "${expopt_msg_result_printed}" = "no" ; then
+		{ echo "$as_me:$LINENO: result: ${CONFIG_EXPOPT}" >&5
+echo "${ECHO_T}${CONFIG_EXPOPT}" >&6; }
+	fi
+else
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+
+
+{ echo "$as_me:$LINENO: checking for debug options" >&5
+echo $ECHO_N "checking for debug options... $ECHO_C" >&6; }
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+  enableval=$enable_debug; CONFIG_DEBUG="${enableval}"
+else
+  CONFIG_DEBUG="no"
+fi
+
+
+if test "x$GCC" = "xyes"; then
+	DEBUG_NORM_OPT="-O -g -Wall"
+	DEBUG_ANOYING="-Wbad-function-cast -Wcast-align \
+		-Wcast-qual -Wchar-subscripts -Wconversion \
+		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+		-Wredundant-decls -Wshadow -Wstrict-prototypes \
+		-Wwrite-strings -Winline \
+		-Wformat -Wswitch -Waggregate-return -Wmissing-noreturn \
+		-Wimplicit-int -fno-builtin"
+
+	case "${CONFIG_DEBUG}" in
+	no)
+
+cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+
+		;;
+	norm|yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define ABORTFP 1
+_ACEOF
+
+		OPTIMIZATION="${DEBUG_NORM_OPT}"
+		;;
+	anoying)
+
+cat >>confdefs.h <<\_ACEOF
+#define ABORTFP 1
+_ACEOF
+
+		OPTIMIZATION="${DEBUG_NORM_OPT} ${DEBUG_ANOYING}"
+		;;
+	alot)
+
+cat >>confdefs.h <<\_ACEOF
+#define ABORTFP 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define DEBUG 1
+_ACEOF
+
+		OPTIMIZATION="${DEBUG_NORM_OPT}"
+		;;
+	*)
+		{ { echo "$as_me:$LINENO: error: bad value �${CONFIG_DEBUG}� for debug option" >&5
+echo "$as_me: error: bad value �${CONFIG_DEBUG}� for debug option" >&2;}
+   { (exit 1); exit 1; }; }
+	esac
+
+	{ echo "$as_me:$LINENO: result: ${CONFIG_DEBUG}" >&5
+echo "${ECHO_T}${CONFIG_DEBUG}" >&6; }
+else
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+
+##########################################################################
+# LINUX on Digital/Compaq Alpha CPUs
+##########################################################################
+case $host in
+alpha*-*-linux*)
+
+################################################################
+#### Check if 'ccc' is in our path
+################################################################
+if test "`which ccc 2>/dev/null | grep -c ccc`" != "0" ; then
+	# Compaq's C Compiler
+	CC=ccc
+
+################################################################
+#### set 'OPTIMIZATION = -arch host -tune host'
+####              to generate/tune instructions for this machine
+####     'OPTIMIZATION += -migrate -fast -inline speed -unroll 0'
+####              tweak to run as fast as possible :)
+####     'OPTIMIZATION += -w0'
+####              set warning and linking flags
+################################################################
+	OPTIMIZATION="-arch host -tune host"
+	OPTIMIZATION="-migrate -fast -inline speed -unroll 0 $OPTIMIZATION"
+	OPTIMIZATION="-w0 $OPTIMIZATION"
+
+
+################################################################
+#### to debug, uncomment
+################################################################
+	# For Debugging
+	#OPTIMIZATION="-g3 $OPTIMIZATION"
+
+################################################################
+#### define __DECALPHA__ (i was getting re-declaration warnings
+####   in machine.h
+################################################################
+	# Define DEC Alpha
+
+cat >>confdefs.h <<\_ACEOF
+#define __DECALPHA__ 1
+_ACEOF
+
+fi  #  gcc or ccc?
+;; # alpha
+
+
+##########################################################################
+# SunOS
+##########################################################################
+sparc-*-sunos4*)
+	if test CC = "cc"; then
+		OPTIMIZATION="-O -xCC"
+		MAKEDEP="-xM"
+		# for gcc, use instead:
+		#   CC="gcc"
+		#   OPTIMIZATION="-O"
+		#   MAKEDEP="-M"
+{ echo "$as_me:$LINENO: WARNING: Please contact lame@lists.sourceforge.net with the output of the configure run and the file config.cache. Thank you for your cooperation." >&5
+echo "$as_me: WARNING: Please contact lame@lists.sourceforge.net with the output of the configure run and the file config.cache. Thank you for your cooperation." >&2;}
+	fi
+;; #SunOS
+
+##########################################################################
+# SGI
+##########################################################################
+*-sgi-irix*)
+	if test CC = "cc"; then
+		OPTIMIZATION="-O3 -woff all"
+	fi
+;; # SGI
+
+##########################################################################
+# Compaq Alpha running Dec Unix (OSF)
+##########################################################################
+alpha*-dec-osf*)
+	if test CC = "cc"; then
+		OPTIMIZATION="-fast -O3 -std -g3 -non_shared"
+	fi
+;; #OSF
+esac
+
+# todo: include the following tests in the case-list
+UNAME=`uname`
+ARCH=`uname -m`
+
+###########################################################################
+# MOSXS (Rhapsody PPC)
+###########################################################################
+if test "$UNAME" = "Rhapsody"; then
+#   CC="cc"   # should be handled already by autoconf
+   MAKEDEP="-make"
+fi
+
+###########################################################################
+# MAC OSX  Darwin PPC
+###########################################################################
+if test "$UNAME" = "Darwin"; then
+   MAKEDEP="-make"
+   CFLAGS="$CFLAGS -fno-common"
+fi
+
+
+##########################################################################
+# OS/2
+##########################################################################
+# Properly installed EMX runtime & development package is a prerequisite.
+# tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
+#
+##########################################################################
+if test "$UNAME" = "OS/2"; then
+   SHELL=sh
+   #CC=gcc # should already be handled by configure
+
+   # file extension should already be handled by automake (I don't know,
+   # please  give feedback!
+   #FILE_EXTENSION=".exe"
+
+# Uncomment & inspect the GTK lines to use MP3x GTK frame analyzer.
+# Properly installed XFree86/devlibs & GTK+ is a prerequisite.
+# The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
+#   AC_DEFINE(HAVE_GTK, 1, have GTK)
+#   AC_DEFINE(__ST_MT_ERRNO__, 1)
+#   INCLUDES="-IC:/XFree86/include/gtk12 -IC:/XFree86/include/glib12 \
+#             -IC:/XFree86/include $INCLUDES"
+#   FRONTEND_LDFLAGS="-LC:/XFree86/lib -lgtk12 -lgdk12 -lgmodule -lglib12 \
+#             -lXext -lX11 -lshm -lbsd -lsocket -lm $FRONTEND_LDFLAGS"
+#   FRONTEND_CFLAGS="-Zmtd -Zsysv-signals -Zbin-files $FRONTEND_CFLAGS"
+fi
+
+###########################################################################
+# AmigaOS
+###########################################################################
+# Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
+#
+###########################################################################
+if test "$UNAME" = "AmigaOS" ; then
+	CC="gcc -noixemul"
+	OPTIMIZATION="$OPTIMIZATION -m68020-60 -m68881"
+	MAKEDEP="-MM"
+	if test "$ARCH" = "WOS"; then
+		CC="ppc-amigaos-gcc -warpup"
+		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
+		AR="ppc-amigaos-ar"
+		RANLIB="ppc-amigaos-ranlib"
+	fi
+	if test "$ARCH",PPC; then
+		CC="ppc-amigaos-gcc"
+		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
+		AR="ppc-amigaos-ar"
+		RANLIB="ppc-amigaos-ranlib"
+	fi
+fi
+
+
+CFLAGS="${OPTIMIZATION} ${CFLAGS}"
+LDADD="${LDADD}"
+FRONTEND_LDADD="${FRONTEND_LDADD} ${CONFIG_MATH_LIB}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_config_files="$ac_config_files Makefile libmp3lame/Makefile libmp3lame/i386/Makefile libmp3lame/vector/Makefile frontend/Makefile mpglib/Makefile doc/Makefile doc/html/Makefile doc/man/Makefile include/Makefile Dll/Makefile misc/Makefile debian/Makefile dshow/Makefile ACM/Makefile ACM/ADbg/Makefile ACM/ddk/Makefile ACM/tinyxml/Makefile lame.spec mac/Makefile macosx/Makefile macosx/English.lproj/Makefile macosx/LAME.xcodeproj/Makefile vc_solution/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}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${LIB_WITH_DECODER_TRUE}" && test -z "${LIB_WITH_DECODER_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"LIB_WITH_DECODER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"LIB_WITH_DECODER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WITH_BRHIST_TRUE}" && test -z "${WITH_BRHIST_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WITH_BRHIST\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WITH_BRHIST\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WITH_XMM_TRUE}" && test -z "${WITH_XMM_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WITH_XMM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WITH_XMM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WITH_VECTOR_TRUE}" && test -z "${WITH_VECTOR_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WITH_VECTOR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WITH_VECTOR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_NASM_TRUE}" && test -z "${HAVE_NASM_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_NASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_NASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by lame $as_me 3.98.4, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+lame config.status 3.98.4
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "libmp3lame/Makefile") CONFIG_FILES="$CONFIG_FILES libmp3lame/Makefile" ;;
+    "libmp3lame/i386/Makefile") CONFIG_FILES="$CONFIG_FILES libmp3lame/i386/Makefile" ;;
+    "libmp3lame/vector/Makefile") CONFIG_FILES="$CONFIG_FILES libmp3lame/vector/Makefile" ;;
+    "frontend/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/Makefile" ;;
+    "mpglib/Makefile") CONFIG_FILES="$CONFIG_FILES mpglib/Makefile" ;;
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+    "doc/html/Makefile") CONFIG_FILES="$CONFIG_FILES doc/html/Makefile" ;;
+    "doc/man/Makefile") CONFIG_FILES="$CONFIG_FILES doc/man/Makefile" ;;
+    "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+    "Dll/Makefile") CONFIG_FILES="$CONFIG_FILES Dll/Makefile" ;;
+    "misc/Makefile") CONFIG_FILES="$CONFIG_FILES misc/Makefile" ;;
+    "debian/Makefile") CONFIG_FILES="$CONFIG_FILES debian/Makefile" ;;
+    "dshow/Makefile") CONFIG_FILES="$CONFIG_FILES dshow/Makefile" ;;
+    "ACM/Makefile") CONFIG_FILES="$CONFIG_FILES ACM/Makefile" ;;
+    "ACM/ADbg/Makefile") CONFIG_FILES="$CONFIG_FILES ACM/ADbg/Makefile" ;;
+    "ACM/ddk/Makefile") CONFIG_FILES="$CONFIG_FILES ACM/ddk/Makefile" ;;
+    "ACM/tinyxml/Makefile") CONFIG_FILES="$CONFIG_FILES ACM/tinyxml/Makefile" ;;
+    "lame.spec") CONFIG_FILES="$CONFIG_FILES lame.spec" ;;
+    "mac/Makefile") CONFIG_FILES="$CONFIG_FILES mac/Makefile" ;;
+    "macosx/Makefile") CONFIG_FILES="$CONFIG_FILES macosx/Makefile" ;;
+    "macosx/English.lproj/Makefile") CONFIG_FILES="$CONFIG_FILES macosx/English.lproj/Makefile" ;;
+    "macosx/LAME.xcodeproj/Makefile") CONFIG_FILES="$CONFIG_FILES macosx/LAME.xcodeproj/Makefile" ;;
+    "vc_solution/Makefile") CONFIG_FILES="$CONFIG_FILES vc_solution/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
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+am__isrc!$am__isrc$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
+MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
+MAINT!$MAINT$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$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
+DEPDIR!$DEPDIR$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+SED!$SED$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; 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
+_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 <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+LIBTOOL_DEPS!$LIBTOOL_DEPS$ac_delim
+U!$U$ac_delim
+ANSI2KNR!$ANSI2KNR$ac_delim
+ALLOCA!$ALLOCA$ac_delim
+GTK_CONFIG!$GTK_CONFIG$ac_delim
+GTK_CFLAGS!$GTK_CFLAGS$ac_delim
+GTK_LIBS!$GTK_LIBS$ac_delim
+PKG_CONFIG!$PKG_CONFIG$ac_delim
+SNDFILE_CFLAGS!$SNDFILE_CFLAGS$ac_delim
+SNDFILE_LIBS!$SNDFILE_LIBS$ac_delim
+LIB_WITH_DECODER_TRUE!$LIB_WITH_DECODER_TRUE$ac_delim
+LIB_WITH_DECODER_FALSE!$LIB_WITH_DECODER_FALSE$ac_delim
+WITH_BRHIST_TRUE!$WITH_BRHIST_TRUE$ac_delim
+WITH_BRHIST_FALSE!$WITH_BRHIST_FALSE$ac_delim
+WITH_XMM_TRUE!$WITH_XMM_TRUE$ac_delim
+WITH_XMM_FALSE!$WITH_XMM_FALSE$ac_delim
+WITH_VECTOR_TRUE!$WITH_VECTOR_TRUE$ac_delim
+WITH_VECTOR_FALSE!$WITH_VECTOR_FALSE$ac_delim
+NASM!$NASM$ac_delim
+HAVE_NASM_TRUE!$HAVE_NASM_TRUE$ac_delim
+HAVE_NASM_FALSE!$HAVE_NASM_FALSE$ac_delim
+INCLUDES!$INCLUDES$ac_delim
+FRONTEND_LDFLAGS!$FRONTEND_LDFLAGS$ac_delim
+FRONTEND_CFLAGS!$FRONTEND_CFLAGS$ac_delim
+FRONTEND_LDADD!$FRONTEND_LDADD$ac_delim
+CONFIG_MATH_LIB!$CONFIG_MATH_LIB$ac_delim
+LDADD!$LDADD$ac_delim
+LIB_MAJOR_VERSION!$LIB_MAJOR_VERSION$ac_delim
+LIB_MINOR_VERSION!$LIB_MINOR_VERSION$ac_delim
+NASM_FORMAT!$NASM_FORMAT$ac_delim
+MAKEDEP!$MAKEDEP$ac_delim
+RM_F!$RM_F$ac_delim
+WITH_FRONTEND!$WITH_FRONTEND$ac_delim
+WITH_MP3X!$WITH_MP3X$ac_delim
+WITH_MP3RTP!$WITH_MP3RTP$ac_delim
+CPUTYPE!$CPUTYPE$ac_delim
+CPUCCODE!$CPUCCODE$ac_delim
+CONFIG_DEFS!$CONFIG_DEFS$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` = 48; 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-2.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 <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+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
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  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
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
+ac_dB='\\)[	 (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+	t rset
+	:rset
+	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
+	t ok
+	d
+	:ok
+	s/[\\&,]/\\&/g
+	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[	 #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
+/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+  if test x"$ac_file" != x-; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f $ac_file
+      mv "$tmp/config.h" $ac_file
+    fi
+  else
+    echo "/* $configure_input  */"
+    cat "$ac_result"
+  fi
+  rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`$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'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  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; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+
+  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
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..2424a27
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,1177 @@
+dnl $Id: configure.in,v 1.134.2.3 2010/03/22 20:25:26 robert Exp $
+dnl
+dnl
+dnl don't forget to set ASM_FOR_ARCH to a space delimited list of
+dnl processor architectures, for which assembler routines exist
+dnl
+dnl
+dnl Exported and configured variables:
+dnl CC
+dnl CFLAGS
+dnl LDFLAGS
+dnl LDADD
+dnl NASM
+
+dnl extra vars for frontend:
+dnl FRONTEND_LDFLAGS
+dnl FRONTEND_CFLAGS
+dnl FRONTEND_LDADD
+
+AC_PREREQ(2.59)
+AC_INIT([lame],[3.98.4],[lame-dev@lists.sf.net])
+AC_CONFIG_SRCDIR([libmp3lame/lame.c])
+
+dnl check system
+AC_CANONICAL_HOST
+
+dnl automake
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE
+AM_MAKE_INCLUDE
+
+dnl check environment
+AC_AIX
+AC_ISC_POSIX
+AC_MINIX
+case $host_os in
+  *cygwin* ) CYGWIN=yes;;
+         * ) CYGWIN=no;;
+esac
+
+dnl libtool
+# AC_DISABLE_SHARED
+AC_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+CFLAGS="${ac_save_CFLAGS}"
+
+# increase this when the shared lib becomes totally incompatible
+LIB_MAJOR_VERSION=0
+
+# increase this when changes are made, but they are upward compatible
+# to previous versions
+LIB_MINOR_VERSION=0
+
+dnl # work around for a bug, don't know where it is exactly
+if test "${ac_cv_cygwin}" = "yes"; then
+	if test "${CC}" != "gcc"; then
+		AC_MSG_ERROR([Please use]
+			[   CC=gcc ./configure]
+			[Abort this configure run and add "CC=gcc" or you will]
+			[see errors and no lame.exe will be build.])
+	fi
+fi
+
+dnl check programs
+AC_PROG_CC()
+
+if test "${GCC}" = "yes"; then
+	AC_MSG_CHECKING(version of GCC)
+	GCC_version=`${CC} --version | sed -n '1s/^[[^ ]]* (.*) //;s/ .*$//;1p'`
+	AC_MSG_RESULT(${GCC_version})
+fi
+
+dnl more automake stuff
+AM_C_PROTOTYPES
+
+AC_CHECK_HEADER(dmalloc.h)
+if test "${ac_cv_header_dmalloc_h}" = "yes"; then
+	AM_WITH_DMALLOC
+fi
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS( \
+		 errno.h \
+		 fcntl.h \
+		 limits.h \
+		 stdint.h \
+		 string.h \
+		 sys/soundcard.h \
+		 sys/time.h \
+		 unistd.h \
+		 xmmintrin.h \
+		 linux/soundcard.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+if test ${cross_compiling} = "no"; then
+	AC_C_BIGENDIAN
+fi
+
+AC_SYS_LARGEFILE
+
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(unsigned short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(unsigned int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(unsigned long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_SIZEOF(unsigned long long)
+AC_CHECK_SIZEOF(float)
+AC_CHECK_SIZEOF(double)
+
+if test $ac_cv_sizeof_short -eq 0 \
+    -o $ac_cv_sizeof_unsigned_short -eq 0 \
+    -o $ac_cv_sizeof_int -eq 0 \
+    -o $ac_cv_sizeof_unsigned_int -eq 0 \
+    -o $ac_cv_sizeof_long -eq 0 \
+    -o $ac_cv_sizeof_unsigned_long -eq 0 \
+    -o $ac_cv_sizeof_long_long -eq 0 \
+    -o $ac_cv_sizeof_unsigned_long_long -eq 0 \
+    -o $ac_cv_sizeof_float -eq 0 \
+    -o $ac_cv_sizeof_double -eq 0; then
+	echo '*** I have a problem determining the size of some variable types. Either'
+	echo '*** you compiler is broken, or your system+compiler combination is not'
+	echo '*** supportet by the "autoconf" framework we use to generate this'
+	echo '*** configure script.'
+	exit 1
+fi
+
+AC_C_LONG_DOUBLE
+if test "${ac_cv_c_have_long_double}" = "yes" ; then
+	AC_CHECK_SIZEOF(long double)
+fi
+
+AC_CHECK_TYPES([uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t])
+
+AH_VERBATIM([HAVE_UINT8_T],
+[/* add uint8_t type */
+#undef HAVE_UINT8_T
+#ifndef HAVE_UINT8_T
+	typedef unsigned char uint8_t;
+#endif])
+
+AH_VERBATIM([HAVE_INT8_T],
+[/* add int8_t type */
+#undef HAVE_INT8_T
+#ifndef HAVE_INT8_T
+	typedef char int8_t;
+#endif])
+
+AH_VERBATIM([HAVE_UINT16_T],
+[/* add uint16_t type */
+#undef HAVE_UINT16_T
+#ifndef HAVE_UINT16_T
+	typedef unsigned short uint16_t;
+#endif])
+
+AH_VERBATIM([HAVE_INT16_T],
+[/* add int16_t type */
+#undef HAVE_INT16_T
+#ifndef HAVE_INT16_T
+	typedef short int16_t;
+#endif])
+
+if test "${HAVE_INT32_T}" = yes; then
+	AC_DEFINE(A_UINT32_T,unsigned int32_t)
+else
+	if test "${ac_cv_sizeof_unsigned_short}" = "4"; then
+		AC_DEFINE(A_UINT32_T,unsigned short)
+	else
+		if test "${ac_cv_sizeof_unsigned_int}" = "4"; then
+			AC_DEFINE(A_UINT32_T,unsigned int)
+		else
+			if test "${ac_cv_sizeof_unsigned_long}" = "4"; then
+				AC_DEFINE(A_UINT32_T,unsigned long)
+			else
+				AC_MSG_ERROR([CHECK_TYPE_uint32_t - please report to lame-dev@lists.sourceforge.net])
+			fi
+		fi
+	fi
+fi
+
+AH_VERBATIM([HAVE_UINT32_T],
+[/* add uint32_t type */
+#undef HAVE_UINT32_T
+#ifndef HAVE_UINT32_T
+#undef A_UINT32_T
+	typedef A_UINT32_T uint32_t;
+#endif])
+
+if test "${ac_cv_sizeof_short}" = "4"; then
+	AC_DEFINE(A_INT32_T,short)
+else
+	if test "${ac_cv_sizeof_int}" = "4"; then
+		AC_DEFINE(A_INT32_T,int)
+	else
+		if test "${ac_cv_sizeof_long}" = "4"; then
+			AC_DEFINE(A_INT32_T,long)
+		else
+			AC_MSG_ERROR([CHECK_TYPE_int32_t - please report to lame-dev@lists.sourceforge.net])
+		fi
+	fi
+fi
+
+AH_VERBATIM([HAVE_INT32_T],
+[/* add int32_t type */
+#undef HAVE_INT32_T
+#ifndef HAVE_INT32_T
+#undef A_INT32_T
+	typedef A_INT32_T int32_t;
+#endif])
+
+if test "${HAVE_INT64_T}" = yes; then
+        AC_DEFINE(A_UINT64_T,unsigned int64_t)
+else
+	if test "${ac_cv_sizeof_unsigned_int}" = "8"; then
+		AC_DEFINE(A_UINT64_T,unsigned int)
+	else
+		if test "${ac_cv_sizeof_unsigned_long}" = "8"; then
+			AC_DEFINE(A_UINT64_T,unsigned long)
+		else
+			if test "${ac_cv_sizeof_unsigned_long_long}" = "8"; then
+				AC_DEFINE(A_UINT64_T,unsigned long long)
+			else
+				AC_MSG_ERROR([CHECK_TYPE_uint64_t - please report to lame-dev@lists.sourceforge.net])
+			fi
+		fi
+	fi
+fi
+
+AH_VERBATIM([HAVE_UINT64_T],
+[/* add uint64_t type */
+#undef HAVE_UINT64_T
+#ifndef HAVE_UINT64_T
+#undef A_UINT64_T
+	typedef A_UINT64_T uint64_t;
+#endif])
+
+if test "${ac_cv_sizeof_int}" = "8"; then
+	AC_DEFINE(A_INT64_T,int)
+else
+	if test "${ac_cv_sizeof_long}" = "8"; then
+		AC_DEFINE(A_INT64_T,long)
+	else
+		if test "${ac_cv_sizeof_long_long}" = "8"; then
+			AC_DEFINE(A_INT64_T,long long)
+		else
+			AC_MSG_ERROR([CHECK_TYPE_int64_t - please report to lame-dev@lists.sourceforge.net])
+		fi
+	fi
+fi
+
+AH_VERBATIM([HAVE_INT64_T],
+[/* add int64_t type */
+#undef HAVE_INT64_T
+#ifndef HAVE_INT64_T
+#undef A_INT64_T
+	typedef A_INT64_T int64_t;
+#endif])
+
+alex_IEEE854_FLOAT80
+if test "${alex_cv_ieee854_float80}" = "yes" ; then
+	if test "${ac_cv_c_long_double}" = "yes" ; then
+		AC_CHECK_TYPES(ieee854_float80_t, long double)
+		AH_VERBATIM([HAVE_IEEE854_FLOAT80_T],
+[/* add ieee854_float80_t type */
+#undef HAVE_IEEE854_FLOAT80_T
+#ifndef HAVE_IEEE854_FLOAT80_T
+	typedef long double ieee854_float80_t;
+#endif])
+
+		AC_DEFINE(HAVE_IEEE854_FLOAT80, 1, [system has 80 bit floats])
+	fi
+fi
+AC_CHECK_TYPES([ieee754_float64_t, ieee754_float32_t])
+
+AH_VERBATIM([HAVE_IEEE754_FLOAT64_T],
+[/* add ieee754_float64_t type */
+#undef HAVE_IEEE754_FLOAT64_T
+#ifndef HAVE_IEEE754_FLOAT64_T
+	typedef double ieee754_float64_t;
+#endif])
+
+AH_VERBATIM([HAVE_IEEE754_FLOAT32_T],
+[/* add ieee754_float32_t type */
+#undef HAVE_IEEE754_FLOAT32_T
+#ifndef HAVE_IEEE754_FLOAT32_T
+	typedef float ieee754_float32_t;
+#endif])
+
+AC_DEFINE(LAME_LIBRARY_BUILD, 1, [requested by Frank, seems to be temporary needed for a smooth transition])
+
+
+if test ${cross_compiling} = "yes"; then
+	AC_MSG_WARN([]
+  [**************************************************************************]
+  [*                                                                        *]
+  [* You are cross compiling:                                               *]
+  [*   - I did not have a change to determine                               *]
+  [*     + the size of:                                                     *]
+  [*       - short                                                          *]
+  [*       - unsigned short                                                 *]
+  [*       - int                                                            *]
+  [*       - unsigned int                                                   *]
+  [*       - long                                                           *]
+  [*       - unsigned long                                                  *]
+  [*       - float                                                          *]
+  [*       - double                                                         *]
+  [*       - long double                                                    *]
+  [*     + the endianess of the system                                      *]
+  [*   - You have to provide appropriate defines for them in config.h, e.g. *]
+  [*     + define SIZEOF_SHORT to 2 if the size of a short is 2             *]
+  [*     + define WORDS_BIGENDIAN if your system is a big endian system     *]
+  [*                                                                        *]
+  [**************************************************************************])
+fi
+
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_CHECK_FUNCS(gettimeofday strtol)
+
+if test "X${ac_cv_func_strtol}" != "Xyes"; then
+	AC_MSG_ERROR([function strtol is mandatory])
+fi
+
+dnl Check if we are on a mingw system, which needs libwsock32
+SOCKETFUNCTION=unknown
+AC_CHECK_FUNCS(socket)
+if test $ac_cv_func_socket = no; then
+	# maybe it is in libsocket
+	AC_CHECK_LIB(socket, socket, [AC_DEFINE(HAVE_SOCKET)
+	LIBS="$LIBS -lsocket"])
+	if test "X${ac_cv_lib_socket_socket}" != "Xyes"; then
+		SOCKETFUNCTION=NO
+	else
+		case ${host_os} in
+		*solaris*)
+			LIBS="$LIBS -lnsl"
+			;;
+		esac
+	fi
+fi
+
+dnl Initialize configuration variables for the Makefile
+CFLAGS=${CFLAGS}
+CONFIG_DEFS=${CONFIG_DEFS}
+NASM=
+INCLUDES="-I\$(top_srcdir)/include -I\$(srcdir)"
+FRONTEND_LDFLAGS=
+FRONTEND_CFLAGS=
+LIB_SOURCES=
+MAKEDEP="-M"
+RM_F="rm -f"
+
+AC_ARG_ENABLE(nasm,
+  [  --enable-nasm              Allow the use of nasm if available],
+  ASM_FOR_ARCH="i386", ASM_FOR_ARCH="")
+
+dnl Checks for libraries.
+
+AC_CHECK_HEADERS(termcap.h)
+AC_CHECK_HEADERS(ncurses/termcap.h)
+AC_CHECK_LIB(termcap, initscr, HAVE_TERMCAP="termcap")
+AC_CHECK_LIB(curses, initscr, HAVE_TERMCAP="curses")
+AC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="ncurses")
+ 
+dnl math lib
+AC_CHECK_LIB(m, cos, USE_LIBM="-lm")
+dnl free fast math library
+AC_CHECK_LIB(ffm, cos, USE_LIBM="-lffm -lm")
+dnl Compaq fast math library.
+AC_ARG_ENABLE(cpml,
+  [  --disable-cpml              Do not use Compaq's fast Math Library],
+  CONFIG_CPML="no", CONFIG_CPML="yes")
+if test "${CONFIG_CPML}" = yes; then
+      AC_CHECK_LIB(cpml, cos, USE_LIBM="-lcpml")
+fi
+CONFIG_MATH_LIB="${USE_LIBM}"
+
+dnl configure use of features
+
+AM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no")
+
+dnl ElectricFence malloc debugging
+AC_MSG_CHECKING(use of ElectricFence malloc debugging)
+AC_ARG_ENABLE(efence,
+  [  --enable-efence            Use ElectricFence for malloc debugging],
+  CONFIG_EFENCE="${enableval}", CONFIG_EFENCE="no")
+
+case "${CONFIG_EFENCE}" in
+yes)
+	AC_CHECK_LIB(efence, EF_Print, HAVE_EFENCE="-lefence")
+	if test "x${HAVE_EFENCE}" != "x-lefence"; then
+		AC_MSG_RESULT(yes, but libefence not found)
+	else
+		LDADD="${LDADD} ${HAVE_EFENCE}"
+		AC_DEFINE(HAVE_EFENCE, 1, we link against libefence)
+		AC_MSG_RESULT(${CONFIG_EFENCE})
+	fi
+	;;
+no)
+	AC_MSG_RESULT(${CONFIG_EFENCE})
+	;;
+*)
+	AC_MSG_ERROR(bad value �${CONFIG_EFENCE}� for efence option)
+	;;
+esac
+
+
+dnl libsndfile
+WARNING=
+AC_ARG_WITH(fileio, 
+  [  --with-fileio=lame         Use lame's internal file io routines [default]]
+  [             =sndfile      Use Erik de Castro Lopo's libsndfile]
+  [                           (no stdin possible currently)],
+  CONFIG_FILEIO="${withval}", CONFIG_FILEIO="lame")
+
+if test "${CONFIG_FILEIO}" = "sndfile" ; then
+  PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
+fi
+
+AC_MSG_CHECKING(use of file io)
+
+if test "${CONFIG_FILEIO}" = "sndfile" ; then
+  if test "${HAVE_SNDFILE}" = "yes" -o "x${SNDFILE_LIBS}" != "x" \
+    -o "x${SNDFILE_CFLAGS}" != "x"; then
+    SNDFILE_LIBS=`echo ${SNDFILE_LIBS}`
+    SNDFILE_CFLAGS=`echo ${SNDFILE_CFLAGS}`
+
+    if test -n "${SNDFILE_LIBS}" ; then
+      FRONTEND_LDFLAGS="${SNDFILE_LIBS} ${FRONTEND_LDFLAGS}"
+    fi
+    FRONTEND_LDADD="-lsndfile ${FRONTEND_LDADD}"
+
+    if test -n "${SNDFILE_CFLAGS}" ; then
+      INCLUDES="${SNDFILE_CFLAGS} ${INCLUDES}"
+    fi
+
+    AC_DEFINE(LIBSNDFILE, 1, set to 1 if you have libsndfile)
+  else
+    # default
+    CONFIG_FILEIO="lame"
+    WARNING="${WARNING} Could not find any sndfile lib on system."
+  fi
+else
+  CONFIG_FILEIO="lame"
+fi 
+AC_MSG_RESULT(${CONFIG_FILEIO})
+if test "x${WARNING}" != "x" ; then
+  AC_MSG_WARN($WARNING)
+fi
+
+
+dnl check if we should remove hooks for analyzer code in library
+dnl default library must include these hooks
+AC_MSG_CHECKING(use of analyzer hooks)
+AC_ARG_ENABLE(analyzer-hooks,
+  [  --disable-analyzer-hooks   Exclude analyzer hooks],
+  CONFIG_ANALYZER="${enableval}", CONFIG_ANALYZER="yes")
+
+case "${CONFIG_ANALYZER}" in
+yes)
+	;;
+no)
+	AC_DEFINE(NOANALYSIS, 1, build without hooks for analyzer)
+	;;
+*)
+	AC_MSG_ERROR(bad value �${CONFIG_ANALYZER}� for analyzer-hooks option)
+	;;
+esac
+AC_MSG_RESULT($CONFIG_ANALYZER)
+
+
+dnl mpg123 decoder
+AC_MSG_CHECKING(use of mpg123 decoder)
+AC_ARG_ENABLE(decoder, 
+  [  --disable-decoder          Exclude mpg123 decoder],
+  CONFIG_DECODER="${enableval}", CONFIG_DECODER="yes")
+AC_ARG_ENABLE(decode-layer1, 
+  [  --enable-decode-layer1     Include layer1 decoding [default=no]],
+  CONFIG_DECODER_L1="${enableval}", CONFIG_DECODER_L1="no")
+AC_ARG_ENABLE(decode-layer2, 
+  [  --disable-decode-layer2    Exclude layer2 decoding],
+  CONFIG_DECODER_L2="${enableval}", CONFIG_DECODER_L2="yes")
+
+AM_CONDITIONAL(LIB_WITH_DECODER, test "x${CONFIG_DECODER}" = "xyes")
+
+if test "${CONFIG_DECODER}" != "no" ; then
+	CONFIG_DECODER="yes (Layer"
+	AC_DEFINE(HAVE_MPGLIB, 1, build with mpglib support)
+	AC_DEFINE(DECODE_ON_THE_FLY, 1, allow to compute a more accurate replaygain value)
+  
+	if test "${CONFIG_DECODER_L1}" != "no"; then
+		CONFIG_DECODER="${CONFIG_DECODER} 1,"
+		AC_DEFINE(USE_LAYER_1, 1, build with layer 1 decoding)
+	fi
+	if test "${CONFIG_DECODER_L2}" != "no"; then
+		CONFIG_DECODER="${CONFIG_DECODER} 2,"
+		AC_DEFINE(USE_LAYER_2, 1, build with layer 2 decoding)
+	fi
+	CONFIG_DECODER="${CONFIG_DECODER} 3)"
+fi
+AC_MSG_RESULT($CONFIG_DECODER)
+
+
+AC_MSG_CHECKING(if the lame frontend should be build)
+AC_ARG_ENABLE(frontend,
+  [  --disable-frontend         Do not build the lame executable [default=build]],
+    WITH_FRONTEND="${enableval}", WITH_FRONTEND=yes)
+if test "x${WITH_FRONTEND}" = "xyes"; then
+	WITH_FRONTEND=lame${ac_exeext}
+	AC_MSG_RESULT(yes)
+else
+	WITH_FRONTEND=
+	AC_MSG_RESULT(no)
+fi
+
+
+
+AC_MSG_CHECKING(if mp3x is requested)
+AC_ARG_ENABLE(mp3x,
+  [  --enable-mp3x              Build GTK frame analyzer [default=no]],
+    WITH_MP3X="${enableval}", WITH_MP3X=no)
+if test "x${WITH_MP3X}" = "xyes"; then
+	WITH_MP3X=mp3x${ac_exeext}
+	AC_MSG_RESULT(yes)
+else
+	WITH_MP3X=
+	AC_MSG_RESULT(no)
+fi
+
+if test "${HAVE_GTK}" = "no"; then
+	if test "x${WITH_MP3X}" = "xmp3x"; then
+		AC_MSG_WARN(can't build mp3x, no GTK installed)
+		WITH_MP3X=
+	fi
+	if test "x${CONFIG_ANALYZER}" != "xyes"; then
+		AC_MSG_WARN(can't build mp3x because of disabled analyzer hooks)
+		WITH_MP3X=
+	fi
+fi
+
+AC_MSG_CHECKING(if mp3rtp is requested)
+AC_ARG_ENABLE(mp3rtp,
+  [  --enable-mp3rtp            Build mp3rtp [default=no]],
+    WITH_MP3RTP="${enableval}", WITH_MP3RTP=no)
+if test "x${WITH_MP3RTP}" = "xyes"; then
+	if test ${SOCKETFUNCTION} = NO; then
+		AC_MSG_ERROR([function socket is mandatory for mp3rtp])
+	fi
+	WITH_MP3RTP=mp3rtp${ac_exeext}
+	AC_MSG_RESULT(yes)
+else
+	WITH_MP3RTP=
+	AC_MSG_RESULT(no)
+fi
+
+
+#
+# this is from vorbis
+#
+dnl check GLIBC
+case $host in 
+*86-*-linux*)
+	# glibc < 2.1.3 has a serious FP bug in the math inline header
+	# that will cripple Vorbis.  Look to see if the magic FP stack
+	# clobber is missing in the mathinline header, thus indicating
+	# the buggy version
+
+	AC_EGREP_CPP(log10.*fldlg2.*fxch,[
+		#define __LIBC_INTERNAL_MATH_INLINES 1
+	     	#define __OPTIMIZE__
+		#include <math.h>
+		],bad=maybe,bad=no)
+
+	AC_MSG_CHECKING(glibc mathinline bug)
+	if test ${bad} = "maybe" ;then
+	      AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
+				[
+				#define __LIBC_INTERNAL_MATH_INLINES 1
+			     	#define __OPTIMIZE__
+				#include <math.h>
+				],bad=no,bad=yes)
+	fi
+	AC_MSG_RESULT(${bad})
+	if test ${bad} = "yes" ;then
+ AC_MSG_WARN([                                                        ])
+ AC_MSG_WARN([********************************************************])
+ AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
+ AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
+ AC_MSG_WARN([* all floating point code, not only LAME, but all code *])
+ AC_MSG_WARN([* built on this machine. Upgrading to glibc 2.1.3 is   *])
+ AC_MSG_WARN([* strongly urged to correct the problem.               *])
+ AC_MSG_WARN([*Note: that upgrading glibc will not fix any previously*])
+ AC_MSG_WARN([* built programs; this is a compile-time bug.          *])
+ AC_MSG_WARN([* To work around the problem for this build of LAME,   *])
+ AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
+ AC_MSG_WARN([* hurt LAME performace but is necessary for LAME to    *])
+ AC_MSG_WARN([* work correctly.  Once glibc is upgraded, rerun       *])
+ AC_MSG_WARN([* configure and make to build with inlining.           *])
+ AC_MSG_WARN([********************************************************])
+ AC_MSG_WARN([                                                        ])
+
+	AC_DEFINE(__NO_MATH_INLINES, 1, work around a glibc bug)
+	fi;;
+esac
+
+
+dnl configure use of VBR bitrate histogram
+dnl todo: always use yes as default, use simulation instead ?
+AC_MSG_CHECKING(use of VBR bitrate histogram)
+if test "x${HAVE_TERMCAP}" != "x"; then
+  TERMCAP_DEFAULT="yes"
+else
+  TERMCAP_DEFAULT="no"
+fi
+AC_ARG_ENABLE(brhist, 
+  [  --disable-brhist          Include the VBR bitrate histogram feature]
+  [                           [default=yes]],
+  CONFIG_BRHIST="${enableval}", CONFIG_BRHIST="yes")
+if test "${CONFIG_BRHIST}" != "no" ; then
+	AC_DEFINE(BRHIST, 1, enable VBR bitrate histogram)
+
+	if test "${TERMCAP_DEFAULT}" = "yes" ; then
+		FRONTEND_LDADD="-l${HAVE_TERMCAP} ${FRONTEND_LDADD}"
+		CONFIG_BRHIST="yes, with ${HAVE_TERMCAP}"
+		AC_DEFINE(HAVE_TERMCAP, 1, have termcap)
+	else
+		CONFIG_BRHIST="yes, simulated termcap"
+	fi
+fi
+AC_MSG_RESULT(${CONFIG_BRHIST})
+AM_CONDITIONAL(WITH_BRHIST, test "${CONFIG_BRHIST}" != "no")
+
+
+
+dnl ### processor specific options ###
+WITH_VECTOR=no
+case $host_cpu in
+x86_64|amd64)
+	CPUTYPE="no"
+	if test $ac_cv_header_xmmintrin_h = yes ; then
+		WITH_XMM=yes
+		WITH_VECTOR=yes
+	fi
+
+	AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
+	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enoug
+h precission)
+	;;
+*86)
+	CPUTYPE="i386"
+	if test $ac_cv_header_xmmintrin_h = yes ; then
+		WITH_XMM=yes
+		WITH_VECTOR=yes
+	fi
+
+	# use internal knowledge of the IEEE 754 layout
+	AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
+	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
+	;;
+powerpc)
+	CPUTYPE="no"
+
+	# use internal knowledge of the IEEE 754 layout
+	AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
+
+	# The following should not get enabled on a G5. HOWTO check for a G5?
+	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
+	;;
+*)
+	CPUTYPE="no"
+	;;
+esac
+
+# which vector code do we support to build on this machine?
+AM_CONDITIONAL(WITH_XMM, test "x${WITH_XMM}" = "xyes")
+
+# needs to be defined to link in the internal vector lib
+AM_CONDITIONAL(WITH_VECTOR, test "x${WITH_VECTOR}" = "xyes")
+AC_MSG_CHECKING(if I have to build the internal vector lib)
+AC_MSG_RESULT(${WITH_VECTOR})
+
+AC_MSG_CHECKING(for FLOAT8 as float)
+AC_ARG_ENABLE(all-float,
+  [  --enable-all-float         Whether to make all floting point variables as float, not double]
+  [                           [default=no]],   
+    CONFIG_ALLFLOAT="${enableval}", CONFIG_ALLFLOAT="no")
+case "${CONFIG_ALLFLOAT}" in
+no)
+	;;
+yes)
+	AC_DEFINE(FLOAT8, float, float instead of double)
+	;;
+*)
+	AC_MSG_ERROR(bad value �${CONFIG_ALLFLOAT}� for all-float option)
+	;;
+esac
+AC_MSG_RESULT(${CONFIG_ALLFLOAT})
+
+
+
+AC_PATH_PROG(NASM, nasm, no)
+case "${NASM}" in
+no)
+	;;
+*)
+	AC_MSG_CHECKING(for assembler routines for this processor type)
+	for recurse_over in ${ASM_FOR_ARCH}
+	do
+		if test "${CPUTYPE}" = "${recurse_over}"; then
+			include_asm_routines="yes"
+		fi
+
+		case $host_os in
+		*darwin*)
+			# currently we have problems because of a wrong
+			# libtool hack in the darwin case (for nasm code)
+			include_asm_routines="no"
+			;;
+		esac
+	done
+	if test "x${include_asm_routines}" = "xyes"; then
+		AC_DEFINE(HAVE_NASM, 1, have nasm)
+		AC_DEFINE(MMX_choose_table, 1, use MMX version of choose_table)
+	else
+		include_asm_routines="no"
+		NASM="no"
+	fi
+	AC_MSG_RESULT(${include_asm_routines})
+	;;
+esac
+AM_CONDITIONAL(HAVE_NASM, test "${NASM}" != "no")
+
+case $host_os in
+	*cygwin*|*mingw32*)
+		CYGWIN=yes
+		NASM_FORMAT="-f win32 -DWIN32"
+		;;
+	*darwin*)
+		NASM_FORMAT="-f macho"
+		;;
+	*)
+		CYGWIN=no
+		NASM_FORMAT="-f elf"
+		;;
+esac
+
+#
+# 'expopt' is used for "additional optimizations", not for optimizations which
+# are marked as "experimental" in the guide for the compiler.
+# They are "experimental" here in the LAME project (at least
+# "--enable-expopt=full").
+#
+AC_MSG_CHECKING(for additional optimizations)
+AC_ARG_ENABLE(expopt,
+  [  --enable-expopt=full,norm  Whether to enable experimental optimizations]
+  [                           [default=no]],   
+    CONFIG_EXPOPT="${enableval}", CONFIG_EXPOPT="no")
+
+if test "x$GCC" = "xyes"; then
+	# gcc defaults. OS specific options go in versious sections below
+	# from the gcc man pages:  "there is no reason to use -pedantic"
+	if test "x${with_gnu_ld}" = "xyes"; then
+		CFLAGS="-Wall -pipe ${CFLAGS}"
+	else
+		# some vendor ld's don't like '-pipe'
+		CFLAGS="-Wall ${CFLAGS}"
+	fi
+
+	# GCC version specific generic options
+	case "${GCC_version}" in
+	2.96*)
+        	# for buggy version of gcc shipped with RH7.1, back of on some
+        	# optimizations
+        	OPTIMIZATION="-O -fomit-frame-pointer -ffast-math \
+			-funroll-loops"
+		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
+			-fsched-interblock -fbranch-count-reg -fforce-addr \
+			-fforce-mem"
+        	;;
+	3.0*)
+		# -funroll-loops seems to produce buggy code with gcc 3.0.3
+		OPTIMIZATION="-O -fomit-frame-pointer -ffast-math"
+		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
+			-fbranch-count-reg -fforce-addr -fforce-mem"
+		;;
+	3.*|4.0.*|4.1.*)
+		# -fomit-frame-pointer seems to be buggy on cygwin
+		case ${host_os} in
+		*cygwin*)
+			OMIT_FRAME_POINTER=
+			;;
+		*)
+			OMIT_FRAME_POINTER=-fomit-frame-pointer
+			;;
+		esac
+
+		OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math"
+		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
+			-fbranch-count-reg -fforce-addr -fforce-mem"
+		;;
+	4.*)
+		OPTIMIZATION="-O3 -fomit-frame-pointer -ffast-math"
+		OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
+		;;
+	*)
+		# default
+		OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math \
+			-funroll-loops"
+		OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
+		;;
+	esac
+
+
+	# GCC version independend generic options
+	OPTIMIZATION_NORM="-fschedule-insns2"
+
+
+	# generic CPU specific options
+	case ${host_cpu} in
+	sparc)
+		case "${GCC_version}" in
+		3.0*)
+			;;
+		3.*|4.*)
+			# doesn't work on 3.0.x, but on 3.[12] and
+			# hopefully on every other release after that too
+			if test -x /usr/bin/isalist; then
+				/usr/bin/isalist | grep sparcv8plus \
+					>/dev/null 2>&1 && \
+					OPTIMIZATION="${OPTIMIZATION} \
+						-mcpu=ultrasparc \
+						-mtune=ultrasparc"
+			fi
+			;;
+		esac
+		;;
+	*86)
+		case "${GCC_version}" in
+		3.*|4.*)
+			OPTIMIZATION="${OPTIMIZATION} \
+				-maccumulate-outgoing-args"
+			;;
+		esac
+		;;
+	esac
+
+	expopt_msg_result_printed=no
+	case "${CONFIG_EXPOPT}" in
+	no)
+		# if someone supplies own CFLAGS, we don't add our own
+		if test "x${ac_save_CFLAGS}" != "x"; then 
+			OPTIMIZATION=""
+		fi
+		;;
+	norm|yes)
+		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM}"
+		;;
+	full)
+		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM} \
+			${OPTIMIZATION_FULL}"
+
+		# some hardware dependend options
+		case "${GCC_version}" in
+		2.9*|3.*|4.0.*|4.1.*)
+			# "new" GCC, use some "new" CPU specific optimizations
+			# use -mtune instead of -m486 or -mcpu= etc, since they are
+			# deprecated by GCC <rbrito>
+			case ${host_cpu} in
+			*486)
+				OPTIMIZATION="${OPTIMIZATION} -mcpu=i486 \
+					-mfancy-math-387"
+				;;
+			*586)
+				OPTIMIZATION="${OPTIMIZATION} -mcpu=pentium \
+					-march=pentium -mfancy-math-387"
+				;;
+			*686)
+				OPTIMIZATION="${OPTIMIZATION} -mcpu=pentiumpro \
+					-march=pentiumpro -mfancy-math-387 \
+					-malign-double"
+				;;
+			*86)
+				OPTIMIZATION="${OPTIMIZATION} -mfancy-math-387"
+				;;
+			alpha*)
+				OPTIMIZATION="${OPTIMIZATION} -mfp-regs"
+				AC_DEFINE(FLOAT, double, double is faster than float on Alpha)
+				# add "-mcpu=21164a -Wa,-m21164a" to optimize
+				# for 21164a (ev56) CPU
+				;;
+			*)
+				OPTIMIZATION="${OPTIMIZATION} -fdelayed-branch"
+				;;
+			esac
+			;;
+		4.*)
+			case ${host_cpu} in
+			*486)
+				OPTIMIZATION="${OPTIMIZATION} -march=i486"
+				;;
+			*586)
+				OPTIMIZATION="${OPTIMIZATION} -march=i586 \
+					-mtune=native"
+				;;
+			*686)
+				OPTIMIZATION="${OPTIMIZATION} -march=i686 \
+					-mtune=native"
+				;;
+			*86)
+				OPTIMIZATION="${OPTIMIZATION} -march=generic \
+					-mtune=native"
+				;;
+			esac
+			;;
+		*)
+			# no special optimization for other versions
+			AC_MSG_RESULT(no)
+			expopt_msg_result_printed=yes
+			AC_MSG_WARN(LAME doesn't know about your version (${GCC_version}) of gcc, please report it to lame-dev@lists.sourceforge.net. Please make sure you try the latest LAME version first!)
+			;;
+		esac
+		;;
+	*)
+		AC_MSG_ERROR(bad value �${CONFIG_EXPOPT}� for expopt option)
+		;;
+	esac
+
+	if test "${expopt_msg_result_printed}" = "no" ; then
+		AC_MSG_RESULT(${CONFIG_EXPOPT})
+	fi
+else
+	AC_MSG_RESULT(no)
+fi
+
+
+
+
+
+AC_MSG_CHECKING(for debug options)
+AC_ARG_ENABLE(debug,
+  [  --enable-debug=alot,norm   Enable debugging (disables optimizations)]
+  [                           [default=no]],
+    CONFIG_DEBUG="${enableval}", CONFIG_DEBUG="no")
+
+if test "x$GCC" = "xyes"; then
+	DEBUG_NORM_OPT="-O -g -Wall"
+	DEBUG_ANOYING="-Wbad-function-cast -Wcast-align \
+		-Wcast-qual -Wchar-subscripts -Wconversion \
+		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+		-Wredundant-decls -Wshadow -Wstrict-prototypes \
+		-Wwrite-strings -Winline \
+		-Wformat -Wswitch -Waggregate-return -Wmissing-noreturn \
+		-Wimplicit-int -fno-builtin"
+
+	case "${CONFIG_DEBUG}" in
+	no)
+		AC_DEFINE(NDEBUG, 1, no debug build)
+		;;
+	norm|yes)
+		AC_DEFINE(ABORTFP, 1, debug define)
+		OPTIMIZATION="${DEBUG_NORM_OPT}"
+		;;
+	anoying)
+		AC_DEFINE(ABORTFP, 1, debug define)
+		OPTIMIZATION="${DEBUG_NORM_OPT} ${DEBUG_ANOYING}"
+		;;
+	alot)
+		AC_DEFINE(ABORTFP, 1, debug define)
+		AC_DEFINE(DEBUG, 1, alot of debug output)
+		OPTIMIZATION="${DEBUG_NORM_OPT}"
+		;;
+	*)
+		AC_MSG_ERROR(bad value �${CONFIG_DEBUG}� for debug option)
+	esac
+
+	AC_MSG_RESULT(${CONFIG_DEBUG})
+else
+	AC_MSG_RESULT(no)
+fi
+
+
+
+dnl ###  system specific options  ###
+
+##########################################################################
+# LINUX on Digital/Compaq Alpha CPUs
+##########################################################################
+case $host in
+alpha*-*-linux*)
+
+################################################################
+#### Check if 'ccc' is in our path
+################################################################
+if test "`which ccc 2>/dev/null | grep -c ccc`" != "0" ; then
+	# Compaq's C Compiler
+	CC=ccc
+
+################################################################
+#### set 'OPTIMIZATION = -arch host -tune host' 
+####              to generate/tune instructions for this machine
+####     'OPTIMIZATION += -migrate -fast -inline speed -unroll 0' 
+####              tweak to run as fast as possible :)
+####     'OPTIMIZATION += -w0' 
+####              set warning and linking flags
+################################################################
+	OPTIMIZATION="-arch host -tune host"
+	OPTIMIZATION="-migrate -fast -inline speed -unroll 0 $OPTIMIZATION"
+	OPTIMIZATION="-w0 $OPTIMIZATION"
+
+
+################################################################
+#### to debug, uncomment
+################################################################
+	# For Debugging
+	#OPTIMIZATION="-g3 $OPTIMIZATION"
+
+################################################################
+#### define __DECALPHA__ (i was getting re-declaration warnings
+####   in machine.h
+################################################################
+	# Define DEC Alpha
+	AC_DEFINE(__DECALPHA__, 1, we're on DEC Alpha)
+fi  #  gcc or ccc?
+;; # alpha
+
+
+##########################################################################
+# SunOS
+##########################################################################
+sparc-*-sunos4*)
+	if test CC = "cc"; then
+		OPTIMIZATION="-O -xCC"
+		MAKEDEP="-xM"
+		# for gcc, use instead:
+		#   CC="gcc"
+		#   OPTIMIZATION="-O"
+		#   MAKEDEP="-M"
+AC_MSG_WARN([Please contact lame@lists.sourceforge.net with the output of the configure run and the file config.cache. Thank you for your cooperation.])
+	fi
+;; #SunOS
+
+##########################################################################
+# SGI
+##########################################################################
+*-sgi-irix*)
+	if test CC = "cc"; then
+		OPTIMIZATION="-O3 -woff all"
+	fi
+;; # SGI
+
+##########################################################################
+# Compaq Alpha running Dec Unix (OSF)
+##########################################################################
+alpha*-dec-osf*)
+	if test CC = "cc"; then
+		OPTIMIZATION="-fast -O3 -std -g3 -non_shared"
+	fi
+;; #OSF
+esac
+
+# todo: include the following tests in the case-list
+UNAME=`uname`
+ARCH=`uname -m`
+
+###########################################################################
+# MOSXS (Rhapsody PPC)
+###########################################################################
+if test "$UNAME" = "Rhapsody"; then
+#   CC="cc"   # should be handled already by autoconf
+   MAKEDEP="-make"
+fi
+
+###########################################################################
+# MAC OSX  Darwin PPC
+###########################################################################
+if test "$UNAME" = "Darwin"; then
+   MAKEDEP="-make"
+   CFLAGS="$CFLAGS -fno-common"
+fi
+
+
+##########################################################################
+# OS/2
+##########################################################################
+# Properly installed EMX runtime & development package is a prerequisite.
+# tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
+#
+##########################################################################
+if test "$UNAME" = "OS/2"; then
+   SHELL=sh
+   #CC=gcc # should already be handled by configure
+
+   # file extension should already be handled by automake (I don't know,
+   # please  give feedback!
+   #FILE_EXTENSION=".exe"
+
+# Uncomment & inspect the GTK lines to use MP3x GTK frame analyzer.
+# Properly installed XFree86/devlibs & GTK+ is a prerequisite.
+# The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
+#   AC_DEFINE(HAVE_GTK, 1, have GTK)
+#   AC_DEFINE(__ST_MT_ERRNO__, 1)
+#   INCLUDES="-IC:/XFree86/include/gtk12 -IC:/XFree86/include/glib12 \
+#             -IC:/XFree86/include $INCLUDES"
+#   FRONTEND_LDFLAGS="-LC:/XFree86/lib -lgtk12 -lgdk12 -lgmodule -lglib12 \
+#             -lXext -lX11 -lshm -lbsd -lsocket -lm $FRONTEND_LDFLAGS"
+#   FRONTEND_CFLAGS="-Zmtd -Zsysv-signals -Zbin-files $FRONTEND_CFLAGS"
+fi
+
+###########################################################################
+# AmigaOS
+###########################################################################
+# Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
+#
+###########################################################################
+if test "$UNAME" = "AmigaOS" ; then
+	CC="gcc -noixemul"
+	OPTIMIZATION="$OPTIMIZATION -m68020-60 -m68881"
+	MAKEDEP="-MM"
+	if test "$ARCH" = "WOS"; then
+		CC="ppc-amigaos-gcc -warpup"
+		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
+		AR="ppc-amigaos-ar"
+		RANLIB="ppc-amigaos-ranlib"
+	fi
+	if test "$ARCH",PPC; then
+		CC="ppc-amigaos-gcc"
+		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
+		AR="ppc-amigaos-ar"
+		RANLIB="ppc-amigaos-ranlib"
+	fi
+fi
+
+
+CFLAGS="${OPTIMIZATION} ${CFLAGS}"
+LDADD="${LDADD}"
+FRONTEND_LDADD="${FRONTEND_LDADD} ${CONFIG_MATH_LIB}"
+
+
+AC_SUBST(INCLUDES)
+
+AC_SUBST(FRONTEND_LDFLAGS)
+AC_SUBST(FRONTEND_CFLAGS)
+AC_SUBST(FRONTEND_LDADD)
+AC_SUBST(CONFIG_MATH_LIB)
+AC_SUBST(LDADD)
+
+AC_SUBST(LIB_MAJOR_VERSION)
+AC_SUBST(LIB_MINOR_VERSION)
+
+AC_SUBST(NASM)
+AC_SUBST(NASM_FORMAT)
+
+AC_SUBST(MAKEDEP)
+AC_SUBST(RM_F)
+
+AC_SUBST(LIBTOOL_DEPS)
+
+AC_SUBST(WITH_FRONTEND)
+AC_SUBST(WITH_MP3X)
+AC_SUBST(WITH_MP3RTP)
+
+AC_SUBST(CPUTYPE)
+AC_SUBST(CPUCCODE)
+
+AC_SUBST(CONFIG_DEFS)
+
+AC_CONFIG_FILES([Makefile libmp3lame/Makefile libmp3lame/i386/Makefile libmp3lame/vector/Makefile frontend/Makefile mpglib/Makefile doc/Makefile doc/html/Makefile doc/man/Makefile include/Makefile Dll/Makefile misc/Makefile debian/Makefile dshow/Makefile ACM/Makefile ACM/ADbg/Makefile ACM/ddk/Makefile ACM/tinyxml/Makefile lame.spec mac/Makefile macosx/Makefile macosx/English.lproj/Makefile macosx/LAME.xcodeproj/Makefile] vc_solution/Makefile)
+
+AC_OUTPUT
diff --git a/debian/Makefile.am b/debian/Makefile.am
new file mode 100644
index 0000000..d1daff0
--- /dev/null
+++ b/debian/Makefile.am
@@ -0,0 +1,19 @@
+## $Id: Makefile.am,v 1.5.10.1 2010/03/21 12:28:44 robert Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	changelog \
+	compat \
+	control \
+	copyright \
+	libmp3lame0-dev.docs \
+	libmp3lame0-dev.files \
+	libmp3lame0.files \
+	lame.docs \
+	lame.files \
+	rules
+
+dist-hook:
+	chmod +x $(distdir)/rules
+
diff --git a/debian/Makefile.in b/debian/Makefile.in
new file mode 100644
index 0000000..26a608e
--- /dev/null
+++ b/debian/Makefile.in
@@ -0,0 +1,374 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = debian
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	changelog \
+	compat \
+	control \
+	copyright \
+	libmp3lame0-dev.docs \
+	libmp3lame0-dev.files \
+	libmp3lame0.files \
+	lame.docs \
+	lame.files \
+	rules
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  debian/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  debian/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	$(MAKE) $(AM_MAKEFLAGS) \
+	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
+	  dist-hook
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	dist-hook distclean distclean-generic distclean-libtool \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am
+
+
+# end global section
+
+dist-hook:
+	chmod +x $(distdir)/rules
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..fd3507a
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,242 @@
+lame (3.98.3) unstable; urgency=low
+
+  * New upstream bugfix version.
+  * debian/rules:
+    + remove excessive quoting from the LDFLAGS variable.
+    + remove useless comments from the file, to make it tidier.
+    + make the detection of the cross-compilation more robust.
+    + avoid passing -O2 to CFLAGS, so that we can optimize for size.
+  * debian/control:
+    + add ${misc:Depends} to each binary package (due to debhelper).
+  * debian/copyright:
+    + update copyright years.
+    + add the © symbol, since (C) may not have legal value.
+    + update reference to a versioned LGPL.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Wed, 24 Feb 2010 04:51:34 -0300
+
+lame (3.98.1) unstable; urgency=low
+
+  * New upstream version:
+    + Fix executable stacks (Thanks to Gentoo people);
+    + Fix for text relocations (Thanks to the PaX Team and Gentoo people).
+  * changes are now (mostly) committed to changelog.
+  * debian/rules: include -Wl,--as-needed for the loader at compile time.
+  * Numerous improvements thanks to Fabian Greffrath. Sincere thanks.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Sat, 12 Jul 2008 09:14:54 -0300
+
+lame (3.98) unstable; urgency=low
+
+  * Preparation for the final release.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Sun, 29 Jun 2008 18:29:09 -0300
+
+lame (3.98~beta8+cvs20080624) unstable; urgency=low
+
+  * Preparation for the new upstream release (lame 3.98 final).
+  * debian/control: eliminate build dependency on gtk1.2-dev.
+  * debian/rules: include -Wextra in the CFLAGS variable.
+  * debian/rules: explicitly disable some features from the build.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Tue, 24 Jun 2008 15:16:22 -0300
+
+lame (3.98~beta8+cvs20080514) unstable; urgency=low
+
+  * Fixing debian packaging details.
+  * debian/rules: put detection of architectures for cross-compilation.
+  * debian/rules: included support for noopt option.
+  * debian/rules: take more care of building everything under debian/tmp.
+  * debian/control: updated to Standards-Version 3.7.3 (no changes).
+  * debian/control: put correctly Conflicts: and Replaces in libmp3lame0{,-dev}.
+  * debian/lame.docs: remove TODO and sort by name.
+  * debian/libmp3lame0-dev.docs: include TODO.
+  * debian/libmp3lame0-dev: include liblame0.so in the package.
+  * debian/watch: include watchfile.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Wed, 14 May 2008 01:44:46 -0300
+
+lame (3.98~alpha1) unstable; urgency=low
+
+  * New upstream release with various improvements;
+  * Use libsndfile for input files;
+  * Remove the parts that depend on gtk-1.2;
+  * debian/rules: remove the DH_COMPAT variable;
+  * debian/control: use ${binary:Version} to be up-to-date;
+  * debian/control: use debhelper version >= 5;
+	
+ -- Rogério Brito <rbrito@users.sf.net>  Wed, 09 Jan 2008 17:12:19 -0200
+
+lame (3.98~alpha0) unstable; urgency=low
+
+  * debian/copyright: updated FSF real address;
+  * debian/rules: small fixes;
+  * doc/man/lame.1: used accented characters in troff format.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Mon, 10 Oct 2005 03:33:31 -0300
+
+lame (3.97-8) unstable; urgency=low
+
+  * debian/rules: enable full optimization, now that it works with GCC 4.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Mon,  5 Sep 2005 01:24:44 -0300
+
+lame (3.97-7) unstable; urgency=low
+
+  * debian/control: make libmp3lame0 provide and replace liblame0.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Tue, 16 Aug 2005 04:36:46 -0300
+
+lame (3.97-6) unstable; urgency=low
+
+  * debian/control: make libmp3lame0 provide liblame0 for legacy apps;
+  * debian/control: fix typo in description of libmp3lame0-dev;
+  * debian/libmp3lame0-dev.files: don't ship shared libraries.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Tue, 16 Aug 2005 04:03:42 -0300
+
+lame (3.97-5) unstable; urgency=low
+
+  * debian/control: fix use of SONAME in the package;
+  * debian/liblame0.*: renamed to libmp3lame0.* as per above;
+  * debian/liblame-dev: idem;
+  * debian/rules: incorporate some changes by Christian Marillat.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Mon, 15 Aug 2005 00:47:25 -0300
+
+lame (3.97-4) unstable; urgency=low
+
+  * debian/control: exclude libsndfile0-dev as a build dependency.
+  * debian/control: include libgtk1.2-dev as a build dependency.
+  * debian/rules: s/--with-fileio=sndfile/--with-fileio=lame/, since
+    grabbing input from stdin is a very important feature.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Fri,  5 Aug 2005 02:01:40 -0300
+
+lame (3.97-3) unstable; urgency=low
+
+  * doc/man/lame.1: document the --{un,}signed options.
+  * doc/man/lame.1: document the --{big,little}-endian options.
+  * debian/control: include libsndfile0-dev as a build dependency.
+  * debian/rules: s/--with-fileio=lame/--with-fileio=sndfile/ .
+	
+ -- Rogério Brito <rbrito@users.sf.net>  Wed,  3 Aug 2005 21:35:17 -0300
+
+lame (3.97-2) unstable; urgency=low
+
+  * debian/rules: use dh_installman instead of dh_installmanpages.
+  * doc/man/lame.1: escape minus signals with backslash.
+	
+ -- Rogério Brito <rbrito@users.sf.net>  Wed, 27 Jul 2005 04:58:39 -0300
+
+lame (3.97-1) unstable; urgency=low
+
+  * Preparation for the beta release of lame 3.97.
+  * Still more improvements to come.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Tue, 26 Jul 2005 18:16:34 -0300
+
+lame (3.97-0.2) unstable; urgency=low
+
+  * Fixed debian/control according to the Debian Library Packaging Guide
+
+ -- Jack Bates <ms419@freezone.co.uk>  Thu, 12 May 2005 13:41:28 -0700
+
+lame (3.97-0.1) unstable; urgency=low
+
+  * Preparation for new upstream release.
+  * debian/control: modified short descriptions to be lower case.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Fri, 18 Mar 2005 01:18:42 -0300
+
+lame (3.96-0.1) unstable; urgency=low
+ 
+  * Update debian packaging for lame 3.96
+ 
+ -- Geoffrey T. Dairiki <dairiki@dairiki.org>  Fri, 9 Apr 2004 10:28:12 -0700
+
+lame (3.94-0.1) unstable; urgency=low
+
+  * Update packaging for lame 3.94 alpha 14;
+  * Made progress to make the package as lintian-clean as possible:
+  * debian/copyright: removed the traces of the skeleton file;
+  * debian/rules: avoid using --host, as per warning of ./configure;
+  * debian/rules: use trick to avoind generating a library with rpath;
+  * debian/lame.docs: avoid generating duplicate html documentation;
+  * debian/control: added dependency on debhelper >= 3;
+  * still more work left, but progressing anyway (i.e., changes listed in
+    /usr/share/doc/debian-policy/upgrading-checklist.txt.gz should be
+    applied).
+
+ -- Rogério Brito <rbrito@users.sf.net>  Tue, 15 Jul 2003 19:30:42 -0300
+
+lame (3.93-0.1) unstable; urgency=low
+
+  * Prevent lame 3.93 shipping and still building a 3.92 debian package;
+  * Use --enable-nasm, as is shouldn't break compilation on non-x86;
+  * Use --enable-expopt, to get a bit more of speed.
+
+ -- Rogério Brito <rbrito@users.sf.net>  Sun, 25 Aug 2002 18:58:16 -0300
+
+lame (3.92-1) unstable; urgency=low
+
+  * New upstream release.
+  * Closes: #578135.
+
+ -- Rogério Brito <linuxsup@ig.com.br>  Sun, 28 Jul 2002 03:08:04 -0300
+
+lame (3.91-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Rogerio Brito <linuxsup@ig.com.br>  Sun, 20 Jan 2002 20:50:19 -0200
+
+lame (3.90.1-0) unstable; urgency=low
+
+  * New upstream release.
+  * debian/control: nasm is only a build-dependency on x86;
+  * debian/control: added debhelper to build-dependency list;
+  * debian/control: changed description of the binary packages;
+  * debian/rules: enabled experimental/agressive optimizations;
+  * debian/rules: effectively spread the installed files in binary packages;
+  * debian/rules: now dh_makeshlibs creates good postinst and prerm scripts;
+  * Changed the lame-dev package to liblame0-dev;
+  * Removed references to lame-extras, since it doesn't exist anymore;
+  * Added LICENCE to copyright and excluded it from the binary package;
+  * Removed INSTALL from the binary package;
+  * lame is now almost lintian clean (the only problem remaining is
+    an rpath in liblame build process).
+
+ -- Rogerio Brito <linuxsup@ig.com.br>  Fri, 28 Dec 2001 04:08:57 -0200
+
+lame (3.90-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Viral <viral@debian.org>  Tue, 21 Aug 2001 13:50:14 +0530
+
+lame (3.89-1) unstable; urgency=low
+
+  * New upstream version.
+  * Added --host=$$(dpkg-architecture -qDEB_HOST_GNU_TYPE) to configure.
+  * Added liblame0 package.
+  * Added doc-base entry.
+  * Actual ChangeLog is installed now instead of history.html
+  
+ -- Viral <viral@debian.org>  Sun, 22 Jul 2001 03:07:30 +0530
+
+lame (3.88-0) unstable; urgency=low
+
+  * Updated debian/ directory to use configure.
+
+ -- Ingo Saitz <Ingo.Saitz@stud.uni-hannover.de>  Mon, 11 Dec 2000 08:43:26 +0100
+
+lame (3.86-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Stefan Karrmann <S.Karrmann@gmx.net>  Thu, 31 Aug 2000 22:15:07 +0200
+
+Local variables:
+mode: debian-changelog
+End:
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..0245f1f
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,51 @@
+Source: lame
+Section: sound
+Priority: optional
+Maintainer: Rogério Brito <rbrito@users.sf.net>
+Bugs: mailto:lame-dev@lists.sourceforge.net
+Homepage: http://lame.sourceforge.net/
+Build-Depends: debhelper (>= 5), libncurses5-dev, nasm [i386], libsndfile1-dev
+Standards-Version: 3.7.3
+
+Package: lame
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: open source MP3 encoder
+ Lame is a program which can be used to create compressed
+ audio files. (Lame aint MP3 encoder). These audio files
+ can be played back by popular mp3 players such as mpg123.
+ To read from stdin, use "-" for <infile>. To write to
+ stdout, use a "-" for <outfile>.
+ .
+ This package contains the frontend encoder binary.
+
+Package: libmp3lame0
+Architecture: any
+Section: libs
+Conflicts: liblame0
+Replaces: liblame0
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: shared libraries for MP3 encoding
+ Lame is a program which can be used to create compressed
+ audio files. (Lame aint MP3 encoder). These audio files
+ can be played back by popular mp3 players such as mpg123.
+ To read from stdin, use "-" for <infile>. To write to
+ stdout, use a "-" for <outfile>.
+ .
+ This package contains the dynamic library.
+
+Package: libmp3lame0-dev
+Architecture: any
+Section: libdevel
+Depends: libmp3lame0 (= ${binary:Version}), ${misc:Depends}
+Conflicts: liblame-dev
+Replaces: liblame-dev
+Description: development files for lame
+ Lame is a program which can be used to create compressed
+ audio files. (Lame aint MP3 encoder). These audio files
+ can be played back by popular mp3 players such as mpg123.
+ To read from stdin, use "-" for <infile>. To write to
+ stdout, use a "-" for <outfile>.
+ .
+ This package contains the static library and header files
+ for development with lame.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..8866cc9
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,56 @@
+This package was originally debianized by Stefan Karrmann <S.Karrmann@gmx.net>
+on Thu, 31 Aug 2000 22:15:07 +0200.
+
+The current maintainer is Rogério Brito <rbrito@users.sf.net>.
+
+It was downloaded from the CVS repository at <http://sf.net/projects/lame>.
+
+Upstream Authors: please, see the file html/contributors.html for a
+list of contributors to the lame project.
+
+Copyright: 1999-2010 see html/contributors.html
+
+    LAME is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    LAME is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the
+    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+    MA 02110-1301, USA.
+
+Additionally, the original software's LICENCE file contains the following:
+
+- - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - -
+Can I use LAME in my commercial program?  
+
+Yes, you can, under the restrictions of the LGPL.  The easiest
+way to do this is to:
+
+1. Link to LAME as separate library (libmp3lame.a on unix or 
+   lame_enc.dll on windows)
+
+2. Fully acknowledge that you are using LAME, and give a link
+   to our web site, www.mp3dev.org
+
+3. If you make modifications to LAME, you *must* release these
+   these modifications back to the LAME project, under the LGPL.
+
+*** IMPORTANT NOTE ***
+
+The decoding functions provided in LAME use the mpglib decoding engine which
+is under the GPL.  They may not be used by any program not released under the
+GPL unless you obtain such permission from the MPG123 project (www.mpg123.de).
+- - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - -
+
+On Debian systems, the complete text of the GNU Library General Public
+License can be found in `/usr/share/common-licenses/LGPL-2'.
+
+The Debian packaging is Copyright © 2005-2010, Rogério Brito <rbrito@users.sf.net>
+and is licensed under the same license as the upstream software.
diff --git a/debian/lame.docs b/debian/lame.docs
new file mode 100644
index 0000000..45d9e7d
--- /dev/null
+++ b/debian/lame.docs
@@ -0,0 +1 @@
+USAGE
diff --git a/debian/lame.files b/debian/lame.files
new file mode 100644
index 0000000..5d06f7f
--- /dev/null
+++ b/debian/lame.files
@@ -0,0 +1,2 @@
+usr/bin/lame
+usr/share/doc/lame/html/*.html
diff --git a/debian/lame.manpages b/debian/lame.manpages
new file mode 100644
index 0000000..ba8addd
--- /dev/null
+++ b/debian/lame.manpages
@@ -0,0 +1 @@
+doc/man/lame.1
diff --git a/debian/libmp3lame0-dev.docs b/debian/libmp3lame0-dev.docs
new file mode 100644
index 0000000..34e69c2
--- /dev/null
+++ b/debian/libmp3lame0-dev.docs
@@ -0,0 +1,5 @@
+API
+HACKING
+README
+STYLEGUIDE
+TODO
diff --git a/debian/libmp3lame0-dev.files b/debian/libmp3lame0-dev.files
new file mode 100644
index 0000000..7a32f3c
--- /dev/null
+++ b/debian/libmp3lame0-dev.files
@@ -0,0 +1,3 @@
+usr/include/lame/lame.h
+usr/lib/*.{a,la}
+usr/lib/libmp3lame*.so
diff --git a/debian/libmp3lame0.files b/debian/libmp3lame0.files
new file mode 100644
index 0000000..f5235c2
--- /dev/null
+++ b/debian/libmp3lame0.files
@@ -0,0 +1 @@
+usr/lib/libmp3lame.so.*
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..0284e97
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,85 @@
+#!/usr/bin/make -f
+# Uncomment this to turn on verbose mode.
+#export DHVERBOSE=1
+
+# Variables for cross compiling
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+	confflags += --build=$(DEB_HOST_GNU_TYPE)
+else
+	confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+CFLAGS = -g -Wall -Wextra
+LDFLAGS= -Wl,--as-needed
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	./configure \
+		--prefix=/usr \
+		--mandir=/usr/share/man \
+		--with-fileio=sndfile \
+		--without-vorbis \
+		--enable-nasm \
+		--with-pic \
+		--disable-mp3x \
+		--disable-mp3rtp \
+		--disable-gtktest \
+		--enable-expopt=full \
+		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
+
+	touch configure-stamp
+
+build: configure-stamp build-stamp
+build-stamp:
+	dh_testdir
+
+	$(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	[ ! -f Makefile ] || $(MAKE) distclean
+	dh_clean confcache libmp3lame/i386/choose_table.nas.lst \
+	libmp3lame/i386/cpu_feat.nas.lst libmp3lame/i386/scalar.nas.lst
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_movefiles --sourcedir=debian/tmp
+	dh_installdocs
+	dh_installman
+	dh_installchangelogs ChangeLog
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..f8daf85
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=3
+
+http://sf.net/lame/lame-([\d.]*).tar.gz
diff --git a/depcomp b/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..c452a6a
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,5 @@
+## $Id: Makefile.am,v 1.2 2001/01/15 15:16:08 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+SUBDIRS = html man
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..035c897
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,515 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = doc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+SUBDIRS = html man
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/html/Makefile.am b/doc/html/Makefile.am
new file mode 100644
index 0000000..1d9a0b9
--- /dev/null
+++ b/doc/html/Makefile.am
@@ -0,0 +1,23 @@
+## $Id: Makefile.am,v 1.5 2008/06/28 22:36:22 robert Exp $
+
+AUTOMAKE_OPTIONS = foreign ansi2knr
+
+docdir = $(datadir)/doc
+pkgdocdir = $(docdir)/$(PACKAGE)
+htmldir = $(docdir)/html
+pkghtmldir = $(pkgdocdir)/html
+
+pkghtml_DATA = \
+        basic.html \
+	contributors.html \
+	examples.html \
+	history.html \
+	id3.html \
+	index.html \
+	lame.css \
+	modes.html \
+	node6.html \
+	switchs.html
+
+EXTRA_DIST = $(pkghtml_DATA)
+
diff --git a/doc/html/Makefile.in b/doc/html/Makefile.in
new file mode 100644
index 0000000..29cc565
--- /dev/null
+++ b/doc/html/Makefile.in
@@ -0,0 +1,396 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc/html
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkghtmldir)"
+pkghtmlDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkghtml_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = $(datadir)/doc
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = $(docdir)/html
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign ansi2knr
+pkgdocdir = $(docdir)/$(PACKAGE)
+pkghtmldir = $(pkgdocdir)/html
+pkghtml_DATA = \
+        basic.html \
+	contributors.html \
+	examples.html \
+	history.html \
+	id3.html \
+	index.html \
+	lame.css \
+	modes.html \
+	node6.html \
+	switchs.html
+
+EXTRA_DIST = $(pkghtml_DATA)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/html/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  doc/html/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-pkghtmlDATA: $(pkghtml_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(pkghtmldir)" || $(MKDIR_P) "$(DESTDIR)$(pkghtmldir)"
+	@list='$(pkghtml_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(pkghtmlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkghtmldir)/$$f'"; \
+	  $(pkghtmlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkghtmldir)/$$f"; \
+	done
+
+uninstall-pkghtmlDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkghtml_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(pkghtmldir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(pkghtmldir)/$$f"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(pkghtmldir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkghtmlDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkghtmlDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-pkghtmlDATA install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-pkghtmlDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/html/basic.html b/doc/html/basic.html
new file mode 100644
index 0000000..85c0939
--- /dev/null
+++ b/doc/html/basic.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>Basic command line switch reference</TITLE>
+<META NAME="description" CONTENT="Command line switch reference">
+<META NAME="keywords" CONTENT="lame">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT=#000000
+        BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C
+        ALINK=#995500>
+<H1>Basic command line switch reference</H1>
+<br>
+Only the most usual switches are described here. However those should be sufficient 
+for the vast majority of users. 
+<P> 
+<TABLE CELLPADDING=3 BORDER="1">
+  <TR VALIGN="TOP"> 
+    <TD ALIGN="LEFT" nowrap><b>switch</b></TD>
+    <TD ALIGN="LEFT" nowrap><b>parameter</b></TD>
+  </TR>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-abr">--abr</a></kbd></td>
+    <td align="LEFT" nowrap>average bitrate encoding</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#b">-b</a></kbd></td>
+    <td align="LEFT" nowrap>bitrate (8...320)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-decode">--decode</a></kbd></td>
+    <td align="LEFT" nowrap>decoding only</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#f">-f</a></kbd></td>
+    <td align="LEFT" nowrap> fast mode</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#h">-h</a></kbd></td>
+    <td align="LEFT" nowrap>high quality</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-help">--help</a></kbd></td>
+    <td align="LEFT" nowrap> help</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#m">-m m</a></kbd></td>
+    <td align="LEFT" nowrap>mono mode</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#V">-V</a></kbd></td>
+    <td align="LEFT" nowrap>VBR quality setting (0...9)</td>
+  </tr>
+</TABLE>
+<BR>
+<dl> 
+  <dt><strong>* <kbd>--abr n</kbd><a name="-abr">&nbsp;&nbsp;&nbsp;&nbsp;average 
+    bitrate encoding</a></strong> 
+</dl>
+<dl> 
+  <dd>Turns on encoding with a targeted average bitrate of n kbits, allowing to 
+    use frames of different sizes. The allowed range of n is 8-320, you can use 
+    any integer value within that range. 
+  <dt><br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+</dl>
+<dl> 
+  <dt><strong>* <kbd>-b n</kbd><a name="b">&nbsp;&nbsp;&nbsp;&nbsp;bitrate</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd>For MPEG1 (sampling frequencies of 32, 44.1 and 48 kHz)<br>
+    n = 32,40,48,56,64,80,96,112,128,160,192,224,256,320<br>
+    <br>
+    For MPEG2 (sampling frequencies of 16, 22.05 and 24 kHz)<br>
+    n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160<br>
+    <br>
+    Default is 128 kbs for MPEG1 and 80 kbs for MPEG2. 
+  <dt><br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+</dl>
+<dl> 
+  <dt><strong>* <kbd>--decode</kbd><a name="-decode">&nbsp;&nbsp;&nbsp;&nbsp;decoding 
+    only</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Uses LAME for decoding to a WAV file. The input file can be any input type 
+    supported by encoding, including layer I,II,III (MP3). 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-f</kbd><a name="f">&nbsp;&nbsp;&nbsp;&nbsp;fast mode</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> This switch forces the encoder to use a faster encoding mode, but with 
+    a lower quality. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-h</kbd><a name="h">&nbsp;&nbsp;&nbsp;&nbsp;high quality</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> Use some quality improvements. Encoding will be slower, but the result 
+    will be of higher quality.<br>
+    This switch is always enabled when using VBR. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--help</kbd><a name="-help">&nbsp;&nbsp;&nbsp;&nbsp;help</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> Display a list of all available options. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-m m</kbd><a name="m">&nbsp;&nbsp;&nbsp;&nbsp;mono 
+    mode</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>The input will be encoded as a mono signal. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-V 0...9</kbd><a name="V">&nbsp;&nbsp;&nbsp;&nbsp;VBR quality 
+    setting</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Enable VBR (Variable BitRate) and specifies the value of VBR quality.<br>
+    default=4<br>
+    0=highest quality. 
+</dl>
+</BODY>
+</HTML>
diff --git a/doc/html/contributors.html b/doc/html/contributors.html
new file mode 100644
index 0000000..aad9eff
--- /dev/null
+++ b/doc/html/contributors.html
@@ -0,0 +1,173 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0051)http://internet.roadrunner.com/~mt/mp3/history.html -->
+<HTML><HEAD><TITLE>Contributors</TITLE>
+<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
+<META content="MSHTML 5.00.2014.210" name=GENERATOR><link rel="stylesheet" href="lame.css"></HEAD>
+<BODY aLink=#bbbbbb bgColor=#ffffff link=#888888 text=#000000 vLink=#555555>
+<CENTER>
+  <H1>Contributors</H1>
+</CENTER>
+<HR>
+<H4>The following people contributed to the LAME development:</H4>
+<p> Lauri Ahonen<br>
+  Sakari Ailus<br>
+  Tero Auvinen<br>
+  Michal Bacik<br>
+  Alex Ballegooy<br>
+  Wilfried Behne<br>
+  Bob Bell<br>
+  Simon Blandford<br>
+  Segher Boessenkool<br>
+  Florian Bome<br>
+  Lionel Bonnet<br>
+  Gabriel Bouvigne<br>
+  Rog&eacute;rio Theodoro de Brito<br>
+  Erik de Castro Lopo<br>
+  David Chandler<br>
+  Michael Cheng<br>
+  John Dahlstrom<br>
+  Goran Dokic<br>
+  James Droppo<br>
+  Sergey Dubov<br>
+  Dominique Duvivier<br>
+  John Edwards<br>
+  Alvaro Martinez Echevarria<br>
+  Joakim Enerstam<br>
+  Albert Faber<br>
+  Nils Faerber<br>
+  Sami Farin<br>
+  Mikhail M. Fedotov<br>
+  Joseph Fourier<br>
+  Jani Frilander<br>
+  Richard Gorton<br>
+  Casper Gripenberg<br>
+  Steffan Haeuser<br>
+  Jeremy Hall<br>
+  Paul Hartman<br>
+  John Hayward-Warburton<br>
+  Peder Hedlund <br>
+  Robert Hegemann<br>
+  Mathew Hendry<br>
+  Magnus Holmgren <br>
+  Vitaly Ivanov<br>
+  Ben "Jacobs"<br>
+  Tamito Kajiyama<br>
+  Ti Kan <br>
+  Mo Katz<br>
+  Iwasa Kazmi<br>
+  Ralf Kempkens <br>
+  Frank Klemm<br>
+  Aleksander Korzynski<br>
+  Joachim Kuebart <br>
+  Leonid Kulakov<br>
+  Dmitry Kutsanov<br>
+  Jarmo Laakkonen <br>
+  An van Lam<br>
+  Dennis Lambe Jr<br>
+  Juha Laukala<br>
+  Greg Lehey <br>
+  Felix von Leitner<br>
+  Rafael Luebbert<br>
+  Macik<br>
+  Lars Magne Ingebrigtsen<br>
+  Scott Manley<br>
+  Vladimir Marek<br>
+  Goran Markovic<br>
+  Sergey A. Maslyakov<br>
+  Chris Matrakidis<br>
+  Greg Maxwell<br>
+  Chris Miller<br>
+  Scott Miller<br>
+  Darin Morrison<br>
+  Tomasz Motylewski<br>
+  Kimmo Mustonen <br>
+  Dan Nelson<br>
+  Nyaochi<br>
+  Anton Oleynikov<br>
+  Mike Oliphant<br>
+  Andr&eacute; Osterhues<br>
+  Johannes Overmann<br>
+  Gian-Carlo Pascutto<br>
+  Jan Peman<br>
+  Jan Rafaj<br>
+  Gertjan van Ratingen<br>
+  Miguel Revilla Rodriguez<br>
+  Shawn Riley<br>
+  Tim Ruddick<br>
+  Ingo Saitz<br>
+  Conrad Sanderson<br>
+  Sergey Sapelin<br>
+  William Schelter<br>
+  Justin Schoeman<br>
+  Anton Sergunov<br>
+  Naoki Shibata<br>
+  Sigbjørn Skjæret<br>
+  Nathan Slingerland<br>
+  Patrick De Smet<br>
+  Acy Stapp<br>
+  Mark Stephens<br>
+  Jonathan Stott<br>
+  Alexander Stumpf <br>
+  Stephane Tavenard<br>
+  Mark Taylor<br>
+  Mikhail Teterin <br>
+  Brad Threatt<br>
+  Takehiro Tominaga<br>
+  Warren Toomey<br>
+  Atro Tossavainen <br>
+  Roel Van Den Berghe<br>
+  Kyle VanderBeek<br>
+  Linus Walleij<br>
+  Martin Weghofer<br>
+  William Welch<br>
+  Gerhard Wesp<br>
+  Alfred Weyers<br>
+  Christopher Wise<br>
+  Ethan Yeo<br>
+  Chuck Zenkus </p>
+<p>&nbsp;</p>
+<h4>Original ISO contributors:</h4>
+<p>Bill Aspromonte<br>
+  Shaun Astarabadi<br>
+  R. Bittner<br>
+  Karlheinz Brandenburg<br>
+  W. Joseph Carter<br>
+  Jack Chang<br>
+  Mike Coleman<br>
+  Johnathan Devine<br>
+  Ernst Eberlein<br>
+  Dan Ellis<br>
+  Peter Farrett<br>
+  Jean-Georges Fritsch<br>
+  Vlad Fruchter<br>
+  Hendrik Fuchs<br>
+  Bernhard Grill<br>
+  Amit Gulati<br>
+  Munsi Haque<br>
+  Chuck Hsiao<br>
+  Toshiyuki Ishino<br>
+  Masahiro Iwadare<br>
+  Earl Jennings<br>
+  James Johnston<br>
+  Leon v.d. Kerkhof<br>
+  Don Lee<br>
+  Mike Li<br>
+  Yu-Tang Lin<br>
+  Soren Neilsen<br>
+  Simao F. Campos Neto<br>
+  Mark Paley<br>
+  Davis Pan<br>
+  Tan Ah Peng<br>
+  Kevin Peterson<br>
+  Juan Pineda<br>
+  Ernst F. Schroeder<br>
+  Peter Siebert<br>
+  Jens Spille<br>
+  John Stewart<br>
+  Sam Stewart<br>
+  Al Tabayoyon<br>
+  Kathy Wang<br>
+  Franz-Otto Witte<br>
+  Douglas Wong</p>
+</BODY>
+</HTML>
diff --git a/doc/html/examples.html b/doc/html/examples.html
new file mode 100644
index 0000000..ebe5df8
--- /dev/null
+++ b/doc/html/examples.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+   <META NAME="description" CONTENT="Some examples">
+   <META NAME="keywords" CONTENT="lame">
+   <META NAME="resource-type" CONTENT="document">
+   <META NAME="distribution" CONTENT="global">
+   <META NAME="GENERATOR" CONTENT="Mozilla/4.08 [en] (X11; I; Linux 2.0.36 i686) [Netscape]">
+   <TITLE>Some command line examples</TITLE>
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT="#000000" BGCOLOR="#F9FBFB" LINK="#006666" VLINK="#4C4C4C" ALINK="#995500">
+<H1><FONT FACE="Helvetica">Some command line examples</FONT></H1>
+<UL>
+  <LI> Fixed bit rate 128kbps encoding:<br>
+    <kbd>lame sample.wav sample.mp3</kbd><br>
+    <br>
+  </LI>
+  <LI> Fixed bit rate jstereo 128kbps encoding, high quality (recommended):<br>
+    <kbd>lame -h sample.wav sample.mp3</kbd><br>
+    <br>
+  </LI>
+  <LI> Average bit rate 112kbps encoding:<br>
+    <kbd>lame --abr 112 sample.wav sample.mp3</kbd><br>
+    <br>
+  </LI>
+  <LI>Fast encode, low quality (no psycho-acoustics):<br>
+    <kbd>lame -f sample.wav sample.mp3<br>
+    <br>
+    </kbd></LI>
+  <LI>Variable bitrate (use -V n to adjust quality/filesize):<br>
+    <kbd>lame -h -V 6 sample.wav sample.mp3<br>
+    <br>
+    </kbd></LI>
+  <LI>Streaming mono 22.05 kHz raw pcm, 24 kbps output:<br>
+    <kbd>cat inputfile | lame -r -m m -b 24 -s 22.05 -- > output<br>
+    <br>
+    </kbd></LI>
+  <LI>Streaming mono 44.1 kHz raw pcm, with downsampling to 22.05 kHz:<br>
+    <kbd>cat inputfile | lame -r -m m -b 24 --resample 22.05 -- > output</kbd></LI>
+</UL>
+</BODY>
+</HTML>
diff --git a/doc/html/history.html b/doc/html/history.html
new file mode 100644
index 0000000..34775f5
--- /dev/null
+++ b/doc/html/history.html
@@ -0,0 +1,3291 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+            "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+  <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; I; Linux 2.2.12-20 i686) [Netscape]">
+
+  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+  <title>LAME Changelog</title>
+
+
+</head>
+
+
+<body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" alink="#bbbbbb" link="#888888" vlink="#555555">
+
+<center>
+<h1>History</h1>
+
+</center>
+
+Starting with LAME 3.0: <br>
+
+<font color="#ff0000">red = features and bug fixes which
+affect quality</font> <br>
+
+<font color="#3366ff">blue = features and bug fixes which
+affect speed</font> <br>
+
+black = usability, portability, other
+<hr>
+
+<hr>
+<h3>LAME 3.98.4 &nbsp; &nbsp;March 22 2010</h3>
+<ul>
+  <li>Joseph Flynn
+    <ul>
+      <li>Improvements for LAME DirectShow filter:
+    <ul>
+      <li>Added support for the DirectShow IAMStreamConfig Interface to the LAME encoder filter output pin.
+      </li>
+      <li>Modified the DirectShow filter registration section so that the LAME Encoder filter is correctly registered in the Audio Compressors filter category. This will allow third-party encoding applications using the DirectShow System Device Enumerator Interface to correctly detect the LAME encoder when querying the Audio Compressors filter group.
+      </li>
+      <li>Modified the filter registration information so that the MP3 audio subtype is correctly reported as being supported on the encoder output pin. This will allow third-party encoding applications using the DirectShow IFilterMapper2 Interface to recognize that the LAME encoder supports MP3 output.
+      </li>
+      <li>Altered the Filter Merit Value that was being used when the filter was registered so that it is now using the standard DirectShow compressor filter merit value of MERIT_DO_NOT_USE (0x200000). Previously, the filter was being registered using a value of MERIT_SW_COMPRESSOR (0x100000), which was at a lower priority (i.e. worse priority) than MERIT_DO_NOT_USE. This prevented the LAME Encoder filter from being selected for use by some third-party encoding applications.
+      </li>
+      <li>Added code to calculate the frame length of the audio frames used for the nBlockSize element of the WAVEFORMATEX output structure. Previously this value was simply hard-coded to 1.
+      </li>
+    </ul>
+      </li>
+    </ul>
+  </li>
+
+  <li>Robert Hegemann
+    <ul>
+      <li><font color="#ff0000">Fix for Bugtracker item <i>[ 2973877 ] A problem regarding the new drain code</i></font>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<h3>LAME 3.98.3 &nbsp; &nbsp;February 27 2010</h3>
+<ul>
+  <li>Rog&eacute;rio Brito:
+    <ul>
+      <li>Update the debian packaging for the new release.
+      </li>
+    </ul>
+  </li>
+  <li>Robert Hegemann
+    <ul>
+      <li>The <b>ignore-tag-errors</b> switch had no effect when embedding album art, fixed.</li>
+      <li>Library API change: lame_decode functions are now obsolete but still present, please use hip_decode instead.
+      The reason for this change is: lame_decode functions use a single global variable within the library
+      to store decoder setup, hip_decode functions don't.
+      The encoder now uses hip_decode internally and it is now possible to use <b>clipdetect</b>
+      feature while reencoding mp3 to mp3.
+      </li>
+      <li>Workaround for FFMPEG bug, which uses to call lame_encode_flush more than once in a loop.
+      </li>
+      <li>Windows: program icon and version info added (when building with VC9)
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2688413 ] lib name problem in Microsoft Visual Studio 6</i>
+      </li>
+      <li>Fix for Bugtracker items <i>[ 2051870, 2423650, 2928684 ] several small documentation issues</i>
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2723518 ] resampling in 3.98 and 3.99alpha</i>
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2891879 ] Because of Windows API change, there was a problem with the <b>prority</b> switch.</i>
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2893101 ] Access Violation in BladeMP3EncDLL if UNICODE was defined.</i>
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2887359 ] Wrong length in ID3v2 tag when num_samples isn't set</i>
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2872590 ] LameTAG: "Music length" missmatch in LAME 3.98</i>
+      </li>
+      <li>Fix for Bugtracker item <i>[ 2824296 ] wrong enc_padding value in LAME 3.99a and 3.98.3 (from CVS)</i>
+      </li>
+      <li><font color="#ff0000">Revisiting the FhG decoder problem (FhG V1.5 build 50, ships with MS Windows):
+      enabling the new-drain-code seems to solve that issue better, than restricting the buffer size (see below: 3.98 beta 1, May 16 2007).</font>
+      </li>
+      <li>Patch submitted by Bernhard Doebler, tracker item <i>[ 2807676 ] Error when building Lame with NASM support</i>
+      </li>
+      <li>Patch submitted by Mancuso Raffaele, tracker item <i>[ 2406420 ] compile lame_enc.dll under cygwin</i>
+      </li>
+    </ul>
+  </li>
+</ul>  
+  
+<h3>LAME 3.98.2 &nbsp; &nbsp;September 22 2008</h3>
+<ul>
+  <li>Robert Hegemann</li>
+  <ul>
+    <li>Fix for Bugtracker item <i>[ 2123206 ] lame 3.98.1 segfaults with -h</i>
+  </li>
+  </ul>
+</ul>
+  
+<h3>LAME 3.98.1 &nbsp; &nbsp;September 21 2008</h3>
+<ul>
+  <li>Rog&eacute;rio Brito:
+    <ul>
+      <li>More fixes for the abx tool for Unix systems:
+	<ul>
+	  <li>Plugged a memory leak.</li>
+	  <li>Fixed an endianness problem: users of big-endian machines
+	  can now do abx tests.</li>
+	</ul>
+      </li>
+      <li>Fixed history's HTML doctype</li>
+      <li>
+	Fixed history so that it <em>finally</em> validates
+	at <a href="http://validator.w3.org/">W3's validator</a>
+      </li>
+      <li>
+	Fixed compilation of frontend <code>mp3rtp.c</code>. Thanks to Kris Karas.
+	Bugtracker item <i>[ 2015432 ] mp3rtp missing uint16_t in lame 3.98</i>
+      </li>
+    </ul>
+  </li>
+  <li>Robert Hegemann:
+    <ul>
+    <li>Fix for Bugtracker item <i>[ 2031704 ] --id3v1-only didnt work in 3.98-final</i></li>
+    <li>Fix for Bugtracker item <i>[ 2022035 ] encoder_padding value and resampling</i></li>
+    <li>Fix for Bugtracker item <i>[ 2029282 ] Frequency filtering API broken in 3.98</i></li>
+    <li>Fix for Bugtracker item <i>[ 2039648 ] potential memory leak in parse_args() function in parse.c</i></li>
+    <li>Fix for some tagging issues:
+    <ul>
+    <li>Made search for ID3v1 genres more sloppy, abbrevations may match more often as some simple typos.
+        Examples:<ul><li>--tg "Alt. Rock" matches genre "Alternate Rock"</li>
+                 <li>--tg "acapela" matches genre "A Cappella"</li>
+                 </ul></li>
+    <li>New switch --pad-id3v2-size "n": adds ID3v2 tag with n padding bytes.</li>
+    </ul></li>
+    </ul>
+  </li>
+</ul>
+
+<h3>LAME 3.98 &nbsp; &nbsp;July 4 2008</h3>
+<ul>
+  <li>Anton Sergunov:
+    <ul>
+      <li>Frontend DirectShow: enabling LAME dshow filter to connect to "File Writer Filter".
+      </li>
+    </ul>
+  </li>
+  <li>Rog&eacute;rio Brito:
+    <ul>
+      <li>Updates to the Debian Packaging</li>
+      <li>Fixes to the abx tool for Unix systems (so that more people
+      can evaluate LAME's compression against the original files)</li>
+    </ul>
+  </li>
+  <li>Alexander Leidinger:
+    <ul>
+      <li>explicitely link the math lib to the lame lib</li>
+      <li>add switch to disable the use of the compaq optimized math lib</li>
+    </ul>
+  </li>
+</ul>
+
+<h3>LAME 3.98 beta 8&nbsp; &nbsp;April 13 2008</h3>
+<ul>
+  <li>Robert Hegemann:
+    <ul>
+      <li>LAME now accepts a floating point value in the range [0,...,10[ as VBR quality setting, like <b>-V5.678</b>
+      </li>
+      <li>Found and fixed some suspicious code in additive masking calculation for VBR-NEW
+      </li>
+      <li>bug-fix:<font color="#ff0000">experimental code was defaulted by accident for VBR-NEW</font>
+      </li>
+      <li>fix for some endianess problem on big-endian machines
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<h3>LAME 3.98 beta 7&nbsp; &nbsp;April 6 2008</h3>
+
+<ul>
+  <li>Robert Hegemann:
+    <ul>
+      <li>libmp3lame API: allow frontends to separately retrieve LAME/Xing and ID3 data, because the old library automatism 
+          makes it impossible to make fully buffered encodes.
+      </li>
+      <li>libmp3lame API: added some experimental unicode ID3 tagging code.
+      </li>
+      <li>frontends: write itself final ID3 tags and LAME/Xing header frame
+      </li>
+      <li>lame_enc.dll: writes itself final LAME/Xing header frame
+      </li>
+      <li>Latest changes to the new VBR psymodel:
+        <ul>
+          <li>uses a different spreading function
+          </li>
+          <li><font color="#ff0000">bug-fix for out-of-bounds array access (program stack corruption possible)</font>
+          </li>
+        </ul>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<h3>LAME 3.98 beta 6&nbsp; &nbsp;December 16 2007</h3>
+
+<ul>
+  <li>Robert Hegemann:
+    <ul>
+    
+      <li>Feature request <i>[ 1811483 ] WAVE_FORMAT_EXTENSIBLE support (PCM)</i>
+      </li>
+      
+      <li><font color="#ff0000">Fix for some rare scalefactor selection issue the newer vbr code had at low compression levels
+      </font></li>
+      
+      <li>Fix for Bugtracker item<i>[ 1813496 ] AIFF parsing bug</i>
+      </li>
+      
+      <li>Latest changes to the new VBR code:
+      <ul>
+      
+      <li><font color="#3366ff">it now has its own psy model, a derivation from NSPSY.</font>
+      </li>
+      
+      <li><font color="#ff0000">some more tuning has been done for this new psy model.</font>
+        Many thanks to Horst Albrecht and Myles Thaiss.
+      </li>
+      
+      <li><font color="#ff0000">the "out-of-bits" strategy is reworked</font>
+      </li>
+      
+      </ul>
+      
+      <li><font color="#ff0000">It was possible, that the "interchannel masking effects feature"
+        was used by the dual-channel-mode for bi-lingual encodings too. It was meant to work
+        on stereo L/R channels only.</font>
+      </li>
+      
+    </ul>
+  </li>
+</ul>
+
+<h3>LAME 3.98 beta 5&nbsp; &nbsp;August 12 2007</h3>
+
+<ul>
+
+  <li>Jonathan Stott:
+  
+    <ul>
+
+      <li>Bug tracker items: <i>[ 1590693 ] ID3v2 tag not writing, [ 1636267 ] ID3v2 tags overwritten</i><br>
+      If the output file is opened 'write-only', then LAME can't update the LAME tag.
+      In this case LAME silently overwrote the first bytes of the file and an
+      optional ID3v2 tag disappeared. Now an error message will be printed and
+      no data is written in this case.       
+      </li>
+      
+    </ul>
+
+  </li>
+  
+  <li>Robert Hegemann:
+    <ul>
+    
+        <li>Fix for Bugtracker item <i>[ 1719593 ] Track numbers > 255 not allowed even with --id3v2-only</i>
+        
+        <li>Fix for Bugtracker item <i>[ 1742623 ] fail(lame --mp3input -m m -b 128 --resample 8 *.mp3 **.mp3)</i><br>
+        The problem here was, the input files are MPEG-1 Layer2 files named as MP3s. Even if you leave out
+        the --mp3input switch LAME tried to decode the input files as Layer3 files because of the file name
+        extension and because it found some valid looking Layer3 synchronization header.
+        The fixed LAME version does not assume the file name extension is always correct and treats the files
+        depending on the first found MPEG sync word. The files in question are now correctly detected as
+        Layer2 files and transcoding does succeed.
+        </li>
+        
+        <li>Fix for Bugtracker item <i>[ 1445175 ] Input being stdin fails in Windows on WAV files</i><br>
+        The problem here was, seeking on pipes shows some different behaviour depending on C-Library
+        implementations. The workaround tries to detect it's working on a pipe and doing some
+        reading instead of seeking in that case.
+        </li>
+        
+        <li>Fixing some memory leak in the 'lame_enc.dll'.
+        </li>
+        
+        <li>Fix for Bugtracker items <i>[ 1160757, 1160741 ] --little-endian / --big-endian not working</i><br>
+        These switches where originally intended to be used together with Libsndfile only.
+        </li>
+        
+        <li>Fix for Bugtracker item <i>[ 1746336 ] Incorrect Bitrate with ABR und --resample, LAME 3.98b4</i><br>
+        Some earlier bug-fix had some typo. As a result, when adding a '--resample 123' switch, 
+        the average bitrate rised upto maximum bitrate.
+        </li>
+        
+    </ul>
+  </li>
+  
+</ul>
+
+<h3>LAME 3.98 beta 4&nbsp; &nbsp;June 23 2007</h3>
+
+<ul>
+
+  <li>Dennis Lambe Jr: Added support for total track count (id3v2) in the frontend
+  </li>
+  
+  <li>Nyaochi:
+    <ul>
+
+      <li>Ability to set user-defined ID3v2.3 frame</li>
+      
+      <li>Ability to include albumArt in ID3v2.3 tag</li>
+      
+    </ul>
+
+  </li>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li>Bugfix: the "play length in ms", which is stored in the ID3v2 tag TLEN, was not correctly computed.
+                Some hardware and software players were confused by this garbage data.</li>
+      
+      <li><font color="#ff0000">Out of bits strategy for the newer VBR code overhauled</font></li> 
+      
+      <li>LAME API: the ID3 tag functions do not store the pointers passed anymore,
+      they do make deep copies of strings passed as parameters.
+      </li>
+      
+      <li>Changes in LAME frontend switches regarding ID3 tags:
+      <br><tt>--tg "MyGenre"</tt> will route unknown ID3v1 genres to "Other" for ID3v1 tags
+      and will be stored as plain text "MyGenre" for ID3v2 tags. Genres given by known
+      ID3v1 numbers will be stored as its corresponding text in ID3v2 tags.
+      <br><tt>--tn "02/02"</tt> will store the track number specified as plain text as-is
+      for ID3v2 tags.
+      </li>
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.98 beta 3&nbsp; &nbsp;May 22 2007</h3>
+
+<ul>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li>Fixes regarding max number of bits limitation</li>
+      
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.98 beta 2&nbsp; &nbsp;May 20 2007</h3>
+
+<ul>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li>Bug tracker item: <i>[ 1693461 ];</i>
+      Fixed memory leaks in ACM codec</li>
+      
+      <li>Fixed encoding of non-standard sampling rates in CBR</li>
+
+      <li><font color="#ff0000">Improved VBR strategy when running out of bits</font></li>
+      
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.98 beta 1&nbsp; &nbsp;May 16 2007</h3>
+
+<ul>
+
+  <li>Alexander Leidinger:
+    <ul>
+
+      <li>Add TLEN (ID3v2) support (Submitted by: Linus Walleij).</li>
+
+      <li>Add number of total tracks per album (ID3v2) support
+(Submitted by: Kyle VanderBeek).</li>
+
+      <li>Some seatbelts for overflowing arrays in the ID3v2
+support.</li>
+
+      <li>Update the RPM spec (Submitted by: Kyle VanderBeek).</li>
+
+      <li>Fix some mem-leaks in the error case.</li>
+
+      <li>Update to newer autotools versions.</li>
+
+      <li>Update to use a recent libsndfile (submitted by
+libsndfile author).</li>
+
+      <li><font color="#3366ff">Intrinsics support
+enabled for gcc</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li><font color="#3366ff">The newer VBR code is now LAME's default
+       VBR routine</font></li>
+
+      <li><font color="#ff0000">Fixed: in case of
+not enough bits the new vbr code incorrectly used old vbr routine</font></li>
+
+      <li><font color="#ff0000">Improved ATH
+adjustment in low volume cases</font></li>
+
+      <li><font color="#ff0000">Fixed (PSY model): mapping from convolution bands
+      to partition bands was broken since we replaced tables by own calculation
+      several years ago</font></li>
+
+      <li><font color="#ff0000">Fixed (PSY model): loss of fraction in equal loudness weighting</font></li>
+
+      <li><font color="#ff0000">Fixed (PSY model): in NSPSY highpass filter, out of bounds access in fircoef</font></li>
+
+      <li><font color="#ff0000">Known problem samples for the new VBR code:
+      many of them are at an acceptable quality level now;</font>
+      with a big <b>'Thank You'</b> to Francis Niechcial</li>
+
+      <li><font color="#ff0000">Modified VBR strategy to handle out of bits cases</font></li>
+
+      <li>Restricted bitreservoir size for 320 kbps frames to
+      the size used for sideinfo, because of decoding problems
+      with FhG decoders installed on almost every Windows system</li>
+
+      <li>LAME aborts on unsupported input files
+      or unrecognized parameter options passed more often now </li>
+
+      <li>Bug tracker item: <i>[ 1596306 ] "fatal error during initialization";</i>
+      an invalid MPEG samplerate was returned by optimum_samplefreq function</li>
+
+      <li>Bug tracker item: <i>[ 1585942 ] lame not --silent when TERM not set;</i>
+      in case LAME was build with TERMCAP defined and no TERM
+      environment is defined, now we do not issue an error message and
+      silently fallback to the default behaviour as if LAME was
+      compiled without TERMCAP defined.</li>
+
+      <li>Bug tracker item: <i>[ 1711980 ] LAME writes invalid Xing header when ID3 tags exist;</i>
+      LAME was sometimes writing an invalid Xing/Info header</li>
+
+      <li>Feature request: <i>[ 1588283 ] Flushing output stream in lame.exe;</i>
+          'flush' option added</li>
+
+      <li><font color="#3366ff">Added FFTSSE and FFT3DNOW assembler code from
+          Lame4 branch</font></li>
+
+      <li>Changes in lame frontend switches:
+       -k removed, add lowpass and highpass switches if you need to change
+       them; --short/noshort/allshort - degraded into DEVELOPER ONLY switches
+          normal users shouldn't use them; -X -Z degraded to
+          DEVELOPER ONLY switches, -X is too tough to communicate to
+          end users and -Z isn't used actualy</li>
+
+      <li>Fixed some console printing problems</li>
+
+      <li>Windows: ACM code now uses LAME library API only, all
+      references to private include files are removed</li>
+
+      <li>Windows: DirectShow code now uses LAME library API only, all
+      references to private include files are removed</li>
+
+      <li>Windows: disabled code that resets processor affinity,
+      because this doesn't belong to LAME, but seems to work around
+      some problems the parent process has (in most cases EAC)</li>
+
+    </ul>
+
+  </li>
+
+  <li>John33:
+    <ul>
+
+      <li>Fixed mp2 and mp3 decoding: For mp3 and mp2 decoding,
+this now yields the same output as foobar2000 but the error checking
+remains unchanged</li>
+
+    </ul>
+
+  </li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>VC8 project files</li>
+
+      <li>Added support for x64 under VC8</li>
+
+      <li>Restricted MPEG 2.5 to 64kbps frames</li>
+
+    </ul>
+
+  </li>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li><font color="#3366ff">SSE version of FFT</font></li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.97&nbsp; &nbsp;September 24 2006</h3>
+
+<ul>
+
+  <li>3.97 beta 3 becomes 3.97 </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.97 beta 3&nbsp; &nbsp;August 19 2006</h3>
+
+<ul>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li><font color="#ff0000">Workaround against a
+short blocks detection issue</font></li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.97 beta 2&nbsp; &nbsp;November 26 2005</h3>
+
+<ul>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>Fixed an initialization error when input is not using a
+standard sampling frequency</li>
+
+      <li>Fixed a possible assertion failure in very low bitrate
+encoding</li>
+
+      <li><font color="#ff0000">Slight change
+regarding ATH adjustment with V5</font></li>
+
+      <li><font color="#ff0000">Reinstated bit
+reservoir for 320kbps CBR</font></li>
+
+      <li><font color="#3366ff">ReplayGain analysis
+should now be faster when encountering silent parts</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li>Fixed a possible link problem of assembly code</li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.97 beta 1&nbsp; &nbsp;September 12 2005</h3>
+
+<ul>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li>Fixed an out of array access in mp3rtp </li>
+
+      <li><font color="#ff0000">Fixed a quality
+setting in DLL</font></li>
+
+      <li>Fixed display when using --silent</li>
+
+    </ul>
+
+  </li>
+
+  <li>Vitaly Ivanov:
+    <ul>
+
+      <li>Updated DirectShow interface</li>
+
+    </ul>
+
+  </li>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li><font color="#ff0000">Fixed an out of
+array access</font></li>
+
+      <li><font color="#ff0000">Fixed some small
+rounding problem in vbr-new quantization routines</font></li>
+
+      <li><font color="#ff0000">Fixed a bug in
+vbr-new regarding high frequencies (sfb21) when using -Y</font></li>
+
+      <li><font color="#ff0000">Fixed a few bugs in
+vbr-new when using -Y</font></li>
+
+      <li><font color="#ff0000">Updated scalefactors
+allocation scheme in vbr-new</font></li>
+
+      <li>Fixed mingw32 configure problems</li>
+
+      <li>Resolved some compiler warnings</li>
+
+      <li>Updated command-line visualisation</li>
+
+    </ul>
+
+  </li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>Changed some FLOAT8 to FLOAT</li>
+
+      <li>Added project files for VC7</li>
+
+      <li><font color="#ff0000">Reworked -q1 and -q0</font></li>
+
+      <li><font color="#ff0000">Updated presets</font></li>
+
+      <li><font color="#ff0000">Fixed an error in
+ISO quantization on systems not using the IEEE754 hack</font></li>
+
+      <li><font color="#3366ff">Faster quantization</font></li>
+
+      <li><font color="#3366ff">SSE version of
+init_xrpow</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Rog&eacute;rio Brito:
+    <ul>
+
+      <li>Updated Debian packaging</li>
+
+      <li>Documentation work</li>
+
+    </ul>
+
+  </li>
+
+  <li>Chris Miller:
+    <ul>
+
+      <li>Support for x64 platform SDK in makefile.msvc</li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.96.1 &nbsp; &nbsp;July 25 2004</h3>
+
+<ul>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li><font color="#ff0000">Fixed a rare bug in
+vbr-new (could lead to crashes or data corruption)</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>some fixes in ACM codec</li>
+
+      <li>fixed padding when encoding to 320kbps</li>
+
+      <li><font color="#ff0000">fixed block size
+selection for mid and side channels</font></li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.96 &nbsp; &nbsp;April 11 2004</h3>
+
+<ul>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li><font color="#ff0000">new quantization
+selection mode (used in ABR/CBR)</font></li>
+
+      <li><font color="#ff0000">set sfscale for
+ABR/CBR up to 160kbps</font></li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.96 beta 2 &nbsp; &nbsp;March 28 2004</h3>
+
+<ul>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li><font color="#3366ff">removed unnecessary
+integer convertion in resampling</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li><font color="#ff0000">reworked scalefactor
+allocation in vbr-new</font></li>
+
+      <li>fixed a freeformat decoding problem</li>
+
+    </ul>
+
+  </li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li><font color="#ff0000">updated minimal
+bitrate for V1 and V2</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Aleksander Korzynski:
+    <ul>
+
+      <li>added ability to disable ReplayGain analysis</li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.96 beta &nbsp; &nbsp;March 7 2004</h3>
+
+<ul>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li>fixed decoding issue</li>
+
+    </ul>
+
+  </li>
+
+  <li>Aleksander Korzynski:
+    <ul>
+
+      <li>changed internal ReplayGain handling</li>
+
+      <li>fixed some issues when ReplayGain is used with
+resampling</li>
+
+    </ul>
+
+  </li>
+
+  <li>Robert Hegemann:
+    <ul>
+
+      <li>added standard ISO quantization for vbr-new, used at
+lower quality settings</li>
+
+      <li><font color="#3366ff">faster count_bits
+for vbr-new</font></li>
+
+      <li><font color="#3366ff">faster
+find_scalefac_ave function for vbr-new</font></li>
+
+      <li><font color="#ff0000">fixed an out of
+array access in psychoacoustic models; this bug could make some psy
+calculations worthless and sometimes let lame crash</font></li>
+
+      <li><font color="#ff0000">fixed an error on
+silent scalefactor bands; this bug resulted in huffman data overrun
+problems while decoding, resulting in audible glitches</font></li>
+
+      <li>fixed a freeformat decoding bug</li>
+
+    </ul>
+
+  </li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li><font color="#ff0000">adjusted short block
+thresholds</font></li>
+
+      <li>fixed some array addressing bugs</li>
+
+      <li>made ReplayGain analysis reentrant</li>
+
+    </ul>
+
+  </li>
+
+  <li>David Chandler: fixed a crash in quantize_xrpow </li>
+
+  <li>Michal Bacik: fixed a crash when using 8kHz </li>
+
+  <li>Goran Markovic: fixed some decoding bugs </li>
+
+  <li>John Edwards: fixed a too small buffer in ReplayGain code</li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.95.1 &nbsp; &nbsp;January 12 2004</h3>
+
+<ul>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>fixed a crash when using vbr-new</li>
+
+      <li>changed ReplayGain reference level to 89dB</li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.95 &nbsp; &nbsp;January 11 2004</h3>
+
+<ul>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li><font color="#ff0000">fixed lowpass values
+when using vbr with mono files</font></li>
+
+      <li><font color="#3366ff">faster quantization
+loops</font></li>
+
+      <li><font color="#3366ff">faster count_bits</font></li>
+
+      <li>fixed a buffer requirement error in ACM codec</li>
+
+    </ul>
+
+  </li>
+
+  <li>Takehiro TOMINAGA:
+    <ul>
+
+      <li>fixed mpglib and other decoding support code to prevent
+the crash when invalid mp3 input</li>
+
+    </ul>
+
+  </li>
+
+  <li>removed Layer I decoding support</li>
+
+  <li><font color="#3366ff">use FastLog and IEEE 754
+hack on PowerPC too (approx. 10 percent faster)</font></li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.94 beta December 15 2003</h3>
+
+<ul>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li><font color="#ff0000">fixed block
+switching of nspsytune</font></li>
+
+      <li><font color="#ff0000">best huffman divide
+in the inner loop.</font> This should improve the quality, but
+PAINFULLY slow. So it is not enabled by default. Use -q0 to use it.</li>
+
+      <li>Changed -q option mapping. "-q2" until version 3.93 is
+now "-q3".</li>
+
+      <li><font color="#ff0000">saving bits by
+better scalefactor storing</font></li>
+
+      <li>removed Vorbis support</li>
+
+      <li><font color="#ff0000">substep quantization.</font>This
+should help breaking the SFB21 bloating problem</li>
+
+      <li><font color="#ff0000">made psychoacoustic
+model aware of ATH adjustements</font></li>
+
+      <li><font color="#ff0000">use ATH value as
+short block masking lower limit</font></li>
+
+      <li><font color="#ff0000">several fixes in
+psychoacoustic model</font></li>
+
+      <li>more robust decoding</li>
+
+    </ul>
+
+  </li>
+
+  <li>Mark Taylor / Gabriel Bouvigne: fixed issues in VBR header</li>
+
+  <li>Mark Taylor: workaround against some hardware decoder
+defficiencies</li>
+
+  <li>Aleksander Korzynski: ability to compute the "Radio"
+ReplayGain and detect clipping on the fly. The ReplayGain value is
+stored in the Lame tag.</li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li><font color="#ff0000">work on presets</font></li>
+
+      <li><font color="#ff0000">use presets by
+default for cbr/abr</font></li>
+
+      <li><font color="#ff0000">use presets by
+default for vbr</font></li>
+
+      <li><font color="#ff0000">analog silence
+detection in partitionned sfb21</font></li>
+
+      <li><font color="#3366ff">do not compute noise
+in upper 0 part of the spectrum</font></li>
+
+      <li><font color="#3366ff">only compute noise
+in modified scalefactor bands</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Guillaume Lessard:
+    <ul>
+
+      <li>nogap related changes</li>
+
+    </ul>
+
+  </li>
+
+  <li>Alexander Leidinger:
+    <ul>
+
+      <li>prevent closing the input fd prematurely if the input
+is a named pipe</li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.93.1 &nbsp; &nbsp;December 1 2002</h3>
+
+<ul>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>preset medium added to the dll interface</li>
+
+      <li><font color="#ff0000">fix for abr/cbr
+presets</font></li>
+
+      <li><font color="#ff0000">fix -q0 switch</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Alexander Leidinger: fix link problem on systems where
+socket() resides in libsocket</li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.93 &nbsp; &nbsp;November 16 2002</h3>
+
+<ul>
+
+  <li>Takehiro Tominaga:
+    <ul>
+
+      <li><font color="#ff0000">bit allocation for
+pre-echo control improved for single channel encodings</font></li>
+
+      <li><font color="#ff0000">substep noise shaping</font></li>
+
+      <li><font color="#3366ff">optimizations by
+changing data structure</font></li>
+
+      <li><font color="#ff0000">noise shaping model
+2 fix</font></li>
+
+      <li><font color="#3366ff">nspsytune FIR filter
+clean up</font></li>
+
+      <li><font color="#ff0000">fix small psymodel
+bugs(DC current estimation, preecho detection of non-VBR mode, and
+nspsymode initialization)</font></li>
+
+      <li>portability fixes for Tru64 UNIX</li>
+
+    </ul>
+
+  </li>
+
+  <li>Albert Faber: some fixes in the DLL</li>
+
+  <li>Simon Blandford: fixes for channel scaling in mono mode</li>
+
+  <li><font color="#3366ff">Dominique Duvivier: some
+optimizations and a faster log10 function</font></li>
+
+  <li>Mark Taylor:
+    <ul>
+
+      <li>some tag related fixes in the direct show filter and in
+the ACM codec</li>
+
+      <li><font color="#3366ff">fixed a mono
+encoding bug found by Justin Schoeman</font></li>
+
+      <li>calc_noise bug fix</li>
+
+      <li>other fixes</li>
+
+    </ul>
+
+  </li>
+
+  <li>Alexander Leidinger:
+    <ul>
+
+      <li>update to autoconf 2.53, rewrite some configure tests</li>
+
+      <li>Akos Maroy: determine gcc version even with gcc 3.1</li>
+
+      <li>Andrew Bachmann: compile shared libs on BeOS (and
+perhaps other arches)</li>
+
+      <li>ultrasparc switches for gcc 3.1</li>
+
+      <li>fixes for SunOS 4.x</li>
+
+      <li>fixes for 64bit arches</li>
+
+      <li>CFLAGS fix for IRIX</li>
+
+      <li>don't override CFLAGS if exptopt isn't requested</li>
+
+    </ul>
+
+  </li>
+
+  <li>Robert Hegeman:
+    <ul>
+
+      <li><font color="#3366ff">some fixes</font></li>
+
+      <li><font color="#ff0000">some fixes for VBR</font></li>
+
+    </ul>
+
+  </li>
+
+  <li>Gabriel Bouvigne:
+    <ul>
+
+      <li>--noasm switch. Might help Cyrix/Via users</li>
+
+      <li><font color="#ff0000">presets and
+alt-presets merged</font></li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.92 &nbsp; &nbsp;April 14 2002</h3>
+
+<ul>
+
+  <li><font color="#ff0000">Alexander
+Leidinger:&nbsp; add non linear psymodel (compile time option,
+disabled by default)</font>, workaround a bug in gcc 3.0.3
+(compiler options, based upon suggestions from various people, see
+archives and changelog for more)</li>
+
+  <li>Steve Lhomme:&nbsp; ACM wrapper (MS-Windows codec)</li>
+
+  <li><font color="#3366ff">Steve Lhomme:&nbsp;
+less memory copying on stereo (interleaved) input</font></li>
+
+  <li> <font color="#ff0000">Takehiro Tominaga:
+Inter-channel masking, enables with --interch x option</font></li>
+
+  <li> For buggy versions of gcc compiler (2.96*), back off on
+some of the advanced compiler options<br>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.91 &nbsp; &nbsp;December 29 2001</h3>
+
+<ul>
+
+  <li><font color="#ff0000">Darin
+Morrison:&nbsp; Bugfix for --alt-preset (for content with low
+volume, clean vocals), only important for the "fast standard" preset</font>
+  </li>
+
+  <li>Alexander Leidinger:
+    <ul>
+
+      <li>add some missing files to the distribution</li>
+
+      <li>add --alt-preset to the man page</li>
+
+    </ul>
+
+  </li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.90 &nbsp; &nbsp;December 21 2001</h3>
+
+<ul>
+
+  <li><font color="#ff0000">Many small improvements
+and bug fixes not added to history</font></li>
+
+  <li><font color="#ff0000">John
+Dahlstrom:&nbsp; more fine tuning on the auto adjustment of the ATH</font></li>
+
+  <li><font color="#3366ff">Robert
+Hegemann:&nbsp; small speed and quality improvements for the old
+VBR code (--vbr-old).</font> </li>
+
+  <li><font color="#ff0000">Robert
+Hegemann:&nbsp; some short block bug fixes</font> </li>
+
+  <li><font color="#ff0000">Robert
+Hegemann:&nbsp; Big improvements to --vbr-mtrh, now encodes much
+more frequencies over 16khz</font> </li>
+
+  <li><font color="#ff0000">Robert
+Hegemann:&nbsp; --vbr-new code disabled (outdated and lower
+quality) and replaced with --vbr-mtrh (Both --vbr-new and --vbr-mtrh
+now default to mtrh)</font> </li>
+
+  <li>Robert Hegemann:&nbsp; reordering of --longhelp to give
+more information, --extrahelp dropped </li>
+
+  <li>Darin Morrison:&nbsp; Totally revamped and extremely
+high quality unified preset system and other general quality
+improvements now available with --alt-presets:
+    <ul>
+
+      <li> <font color="#ff0000">some improvements
+to psychoacoustics (vast improvements over default L.A.M.E. modes) when
+--alt-preset is used including:</font>
+
+      <ul>
+
+        <li> <font color="#ff0000">Improved tuning
+of short block usage.</font></li>
+
+        <li> <font color="#ff0000">Improved
+quantization selection usage (the -X modes), now adapts between
+appropriate modes on the fly. Also helps on "dropout" problems and with
+pre-echo cases.</font></li>
+
+        <li> <font color="#ff0000">Improved joint
+stereo usage. Thresholds are better tuned now and fix some "dropout"
+problems L.A.M.E. suffers from on clips like serioustrouble.</font></li>
+
+        <li> <font color="#ff0000">Improved noise
+shaping usage. Now switches between noise shaping modes on the fly
+(toggles -Z on and off when appropriate) which allows lower bitrates
+but without the quality compromise.</font></li>
+
+        <li> <font color="#ff0000">Clips vastly
+improved over default L.A.M.E. modes (vbr/cbr/abr, including --r3mix):
+castanets, florida_seq, death2, fatboy, spahm, gbtinc, ravebase, short,
+florida_seq, hihat, bassdrum, 2nd_vent_clip, serioustrouble, bloodline,
+and others. No degraded clips known.</font></li>
+
+        <li> VBR bitrates are now more "stable" with less
+fluctuation -- not dipping too low on some music and not increasing too
+high unnecessarily on other music. "--alt-preset standard" provides
+bitrates roughly within the range of 180-220kbps, often averaging close
+to 192kbps.</li>
+
+      </ul></li>
+
+      <li> --alt-presets replace the --dm-presets and "metal"
+preset is removed and replaced with generic abr and cbr presets.</li>
+
+      <li> --alt-preset extreme (note the 'e') replaces xtreme to
+help eliminate some confusion</li>
+
+      <li> --alt-preset vbr modes now have a fast option which
+offers almost no compromise in speed.</li>
+
+      <li> --alt-preset standard (and "fast standard") are now
+much lower in bitrate, matching --r3mix with an overall average, though
+offering higher quality especially on difficult test samples.</li>
+
+      <li> --alt-presets are no longer just "presets" as in a
+collection of switches, instead they are now quality "modes" because of
+special code level tunings (those mentioned above).</li>
+
+      <li> Use --alt-preset help for more information.</li>
+
+    </ul>
+
+  </li>
+
+  <li>Roel VdB: more tuning on the --r3mix preset </li>
+
+  <li>Jon Dee, Roel VdB:&nbsp; INFO tag</li>
+
+  <li>Alexander Leidinger, mp3gain@hotmail.com:&nbsp; added
+--scale-l and --scale-r to scale stereo channels independantly </li>
+
+  <li>Takehiro Tominaga:&nbsp; <font color="#ff0000">new
+noise shaping mode, offering more "cutting edge" shaping according to
+masking, enabled via -q0</font> </li>
+
+  <li>Mark Taylor:&nbsp; More work on --nogap </li>
+
+  <li>Gabriel Bouvigne:&nbsp; Small changes to abr code for
+more accurate final bitrate </li>
+
+  <li>Gabriel Bouvigne, mp3gain@hotmail.com:&nbsp;
+Preliminary <a href="http://www.replaygain.org">
+ReplayGain</a> analysis code added (not functional yet) </li>
+
+  <li>Gabriel Bouvigne, Alexander Leidinger:&nbsp;
+Documentation updates </li>
+
+  <li>John Dahlstrom, DSPguru@math.com:&nbsp; floating point
+interface function in the Windows DLL</li>
+
+</ul>
+
+<br>
+
+<h3>LAME 3.89beta&nbsp; &nbsp;July 5 2001</h3>
+
+<ul>
+
+  <li> John Stewart:&nbsp; long filename support for Win9x/NT.</li>
+
+  <li> Takehiro Tominaga:&nbsp; LAME can calculate the CRC of
+VBR header, so now "lame -pv" works fine.</li>
+
+  <li><font color="#ff0000">Robert
+Hegemann:&nbsp; Improvements of the new VBR code (--vbr-mtrh).</font></li>
+
+  <li><font color="#3366ff">Robert Hegemann: New VBR
+code (--vbr-mtrh) is now defaulted to get more feedback. The VBR speed
+is now on par with CBR. We will use the old VBR code in the release.</font></li>
+
+  <li><font color="#ff0000">Gabriel Bouvigne: Change
+of the maximum frame size limit. LAME should now be more friendly with
+hardware players.</font></li>
+
+  <li>Gabriel Bouvigne: Size of VBR is now more balanced
+according to the -V value.</li>
+
+  <li>Alexander Leidinger: Finished the implementation of the
+set/get functions.</li>
+
+  <li>John Dahlstrom: LAME now handles 24bits input</li>
+
+  <li>Mark Taylor: bugs in lame --decode causing truncation of
+mp3 file fixed</li>
+
+  <li>Mark Taylor: preliminary --nogap support</li>
+
+  <li>"Final" API completed: shared library safe! &nbsp;This
+API is frozen and should be backwords compatiable with future versions
+of libmp3lame.so, but we will continue to add new functionality.
+&nbsp;<br>
+
+  </li>
+
+</ul>
+
+<h3> LAME 3.88beta&nbsp;&nbsp; March 25 2001</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">A lot of work that was
+never added to the History!</font></li>
+
+  <li> <font color="#ff0000">Frank Klemm and
+Gabriel Bouvigne:&nbsp; New ATH formula.&nbsp; Big improvement
+for high bitrate encodings.</font></li>
+
+  <li> <font color="#ff0000">Takehiro Tominaga:
+Temporal masking</font></li>
+
+  <li> <font color="#ff0000">Gabriel Bouvigne/Mark
+Taylor: auto adjustment of ATH</font></li>
+
+  <li> <font color="#ff0000">Robert
+Hegemann:&nbsp; Better outer_loop stopping criterion.&nbsp;
+Enabled with -q2 or better.</font></li>
+
+  <li> <font color="#ff0000">Robert Hegemann/Naoki
+Shibata:&nbsp; slow/carefull noise shaping.&nbsp;
+-q3..9:&nbsp; amplify all distorted bands.&nbsp; -q2: amplify
+distorted bands within 50%.&nbsp; -q1-0:&nbsp; amplify only
+most distorted band at each iteration.</font></li>
+
+  <li> <font color="#ff0000">Takehiro Tominaga:
+Interframe, shortblock temporal masking.</font></li>
+
+  <li> Takehiro Tominaga:&nbsp; LAME restructured into a
+shared library and front end application.&nbsp; Slight changes to
+the API. More changes are coming to turn LAME into a true shared
+library (right now you have to recompile if you upgrade the library :-(</li>
+
+  <li> <font color="#000000">Naoki Shibata:</font>
+
+    <ul>
+
+      <li> <font color="#ff0000">improvements to
+	  psychoacoustics</font><font color="#000000">
+	  (--nspsytune)</font>
+
+      <li> <font color="#ff0000">BUG in long block
+	  pre echo control fixed </font><font color="#000000">
+	  (some out of range array access in M/S psychoacoustics)</font></li>
+
+    </ul>
+  </li>
+
+  <li> <font color="#000000">Ralf
+Kempkens:&nbsp;&nbsp;&nbsp; Visual Basic Script for lame,
+suggested to put it on your Windows Desktop and you can drag'n'drop
+Waves to encode on it.</font></li>
+
+  <li> <font color="#000000">Alexander
+Stumpf:&nbsp;&nbsp;&nbsp; improved lame.bat for 4Dos users</font></li>
+
+  <li> <font color="#000000">Mark Taylor: Several
+bugs fixed in the resampling code.</font></li>
+
+  <li> <font color="#000000">Frank Klemm, Robert
+Hegemann:&nbsp;&nbsp;&nbsp; added assembler code for CPU
+feature detection on runtime (MMX, 3DNow, SIMD)</font></li>
+
+  <li> <font color="#3366ff">Takehiro Tominaga:
+3DNow FFT code.</font></li>
+
+  <li> <font color="#000000">Florian Bome,
+Alexander Leidinger:&nbsp;&nbsp;&nbsp; more work on
+configure stuff</font></li>
+
+  <li> <font color="#000000">Alexander
+Leidinger:&nbsp;&nbsp; automake/libtool generated Makefiles and
+TONS of other work.</font></li>
+
+  <li> <font color="#000000">Alexander
+Leidinger:&nbsp;&nbsp; Much work towards shared library style
+API.</font></li>
+
+  <li> <font color="#000000">Anonymous: New more
+efficient RTP code.</font></li>
+
+  <li> <font color="#ff0000">Mark Taylor:
+psycho-acoustic data now computed for all scalefactor bands (up to 24
+kHz)</font></li>
+
+  <li> <font color="#ff0000">Mark Taylor, Takehiro
+Tominaga: All ISO table data replaced by formulas - should improve
+MPEG2.5 results for which we never had correct table data.</font></li>
+
+</ul>
+
+<h3> LAME 3.87alpha&nbsp; September 25 2000</h3>
+
+<ul>
+
+  <li> Mark Taylor:&nbsp; Bug fixed in LAME/mpglib error
+recovery when encountering a corrupt&nbsp; MP3 frame during
+*decoding*.</li>
+
+  <li> Albert Faber:&nbsp; added LayerI+II decoding support</li>
+
+  <li> <font color="#000000">Frank Klemm:&nbsp;
+added improved CRC calculation</font></li>
+
+  <li> <font color="#000000">Frank Klemm:
+substantial code cleanup/improvements</font></li>
+
+  <li> Robert Hegemann:&nbsp; Bug fixes
+
+  <ul>
+
+    <li> <font color="#ff0000">in huffman_init</font>,
+could lead to segmentation faults (only in rare cases, most likely at
+lower sample rates)</li>
+
+    <li> <font color="#ff0000">M/S switching at
+lower sample rates</font> (the fact there is no 2nd granule was
+ignored)</li>
+
+  </ul>
+  </li>
+  <li> <font color="#3366ff">Robert
+Hegemann:&nbsp; speed up in&nbsp; VBR</font></li>
+
+  <li> Jarmo Laakkonen:&nbsp; Amiga/GCC settings for
+Makefile.unix.</li>
+
+  <li> Magnus Holmgren:&nbsp; README and Makefile for (free)
+Borland C++&nbsp; compiler. Will also compile lame_enc.dll, but
+this is untested.</li>
+
+  <li> Florian Bome:&nbsp;&nbsp; LAME finally has
+a&nbsp; ./configure script!!</li>
+
+</ul>
+
+<h3> LAME 3.86beta&nbsp; August 6 2000</h3>
+
+<ul>
+
+  <li> Christopher Wise:&nbsp; A makefile for DJGPP, the DOS
+version of gcc.&nbsp; Now most windows users should be able to
+compile LAME with minimal effort.</li>
+
+  <li> <font color="#ff0000">Robert
+Hegemann:&nbsp; old VBR:&nbsp;&nbsp; fixed some bugs and
+Takehiro's scalefac_scale feature (not yet on by&nbsp;
+default.)&nbsp; older LAME versions did not allow to spent more
+than 2500 bits of 4095 possible bits to a granule per channel, now
+fixed.</font></li>
+
+  <li> Robert Hegemann:&nbsp; new VBR:&nbsp;&nbsp;
+analog silence treatment like in old VBR</li>
+
+  <li> William Welch:&nbsp; Improved options for Linux/Alpha
+gcc and ccc compilers in Makefile.</li>
+
+  <li> Mathew Hendry:&nbsp; setting appropriate CRC bit for
+additional Xing-VBR tagging frame</li>
+
+  <li> Don Melton:&nbsp; added ID3 version 2 TAG support</li>
+
+  <li> <font color="#000000">John Dahlstrom: fixed
+bug allowing timing information (for status in command line encoder) to
+overflow.</font></li>
+
+  <li> <font color="#000000">Tamito KAJIYAMA, Fixed
+several bugs in the LAME/Vorbis interface.</font></li>
+
+  <li> <font color="#000000">Mark Taylor:&nbsp;
+lame --decode will recognize <a href="http://albumid.cjb.net">Album
+ID tags</a></font></li>
+
+  <li> <font color="#ff0000">Naoki
+Shibata:&nbsp; Additive masking and other improvements to psycho
+acoustics.&nbsp; (not yet on by default)</font></li>
+
+</ul>
+
+<h3> LAME 3.85beta&nbsp;&nbsp; July 3 2000</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; mid/side stereo demasking thresholds updated.</font></li>
+
+  <li> Takehiro Tominaga: New short block MDCT coefficient data
+structure.&nbsp; Should allow for future speed improvements.</li>
+
+  <li> Robert Hegemann:&nbsp; fixed bug in old VBR routine,
+the --noath mode messed up the VBR routine resulting in very large files</li>
+
+  <li> Robert Hegemann: found bugs in some sections when using 32
+bit floating point.&nbsp; Default is now back to 64bit floating
+point.</li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; Modified PE formula to use ATH.</font></li>
+
+  <li> <font color="#000000">S.T.L.:&nbsp;
+README.DJGPP - instructions for compiling LAME with DJGPP, the dos
+version of gcc.</font></li>
+
+</ul>
+
+<h3> LAME 3.84beta&nbsp; June 30&nbsp; 2000</h3>
+
+<ul>
+
+  <li> Mark Weinstein:&nbsp; .wav file output (with --decode
+option) was writing the wrong filesize in the .wav file.&nbsp; Now
+fixed.</li>
+
+  <li> Mark Taylor:&nbsp; (optional) Vorbis support, both
+encoding and decoding.&nbsp; LAME can now produce .ogg files, or
+even re-encode your entire .ogg collection into
+mp3.&nbsp;&nbsp; (Just kidding: it is always a bad idea to
+convert from one lossy format to another)</li>
+
+  <li> ?: Bug fixed causing VBR to crash under
+windows.&nbsp;&nbsp; (pretab[] array overflow)</li>
+
+  <li> Sergey Sapelin: Another bug found in the mpg123 MPEG2
+tables.&nbsp; Now fixed for the mpg123 based decoder in LAME.</li>
+
+  <li> Marco Remondini:&nbsp; VBR histogram works in
+win32.&nbsp; compile with -DBRHIST -DNOTERMCAP</li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; LAME CBR will now use scalefac_scale to expand the
+dynamic range of the scalefactors.</font></li>
+
+  <li> <font color="#000000">Iwasa Kazmi:&nbsp;
+Library improvements:&nbsp; exit()'s, printf, fprintf's are being
+replaced by interceptable macros.</font></li>
+
+</ul>
+
+<h3> LAME 3.83beta&nbsp; May 19&nbsp; 2000</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Mark Taylor:&nbsp;
+Bug in buffering routines:&nbsp; in some cases, could cause
+MDCT&nbsp; to read past end of buffer.&nbsp; Rare in MPEG2,
+even more rare for MPEG1, but potentially serious!</font></li>
+
+  <li> Mark Taylor:&nbsp; MDCT/polyphase filterbank was not
+being "primed" properly.&nbsp; Does not effect output unless you
+set the encoder delay lower than the default of 576 samples.</li>
+
+  <li> <font color="#ff0000">Mark Taylor:&nbsp;
+"vdbj" and "Caster"&nbsp; found several VBR bugs (now
+fixed):&nbsp;&nbsp; 1.&nbsp; Analog silence detection only
+checked frequencies up to 16 kHz.&nbsp; 2.&nbsp; VBR mode could
+still somehow avoid -F mode.&nbsp; 3.&nbsp; VBR mode would
+ignore noise above 16 kHz (scalefactor band 22), Now calc_noise1 will
+compute the noise in this band when in VBR mode.&nbsp; Not
+calculated in CBR&nbsp; mode since CBR algorithm has no way of
+using this information.</font></li>
+
+  <li> Mark Taylor:&nbsp; scalefactor band 22 info
+(masking(=ATH),&nbsp; noise and energy) now displayed in frame
+analyzer.</li>
+
+  <li> <font color="#ff0000">VBR code ATH tuning
+was disabled by accident in 3.81, now fixed.</font></li>
+
+  <li> <font color="#000000">Mark Taylor:&nbsp;
+lame --decode will produce .wav files.&nbsp; (oops - size is off by
+a factor of 4)</font></li>
+
+</ul>
+
+<h3> LAME 3.82beta&nbsp;&nbsp; May 11 2000</h3>
+
+<ul>
+
+  <li> Robert Hegemann:&nbsp; Fixed bug in high bitrate joint
+stereo encodings.</li>
+
+  <li> <font color="#3366ff">Naoki
+Shibata:&nbsp; new long block MDCT routine</font></li>
+
+</ul>
+
+<h3> LAME 3.81beta&nbsp; May 8 2000</h3>
+
+<ul>
+
+  <li> all ISO code removed!</li>
+
+  <li> <font color="#3366ff">Takehiro Tominaga and
+Naoki Shibata:&nbsp; new window subband routines.</font></li>
+
+  <li> <font color="#000000">Naoki
+Shibata:&nbsp; Bug fix in mpglib (decoding) lib:&nbsp; in some
+cases, MDCT coefficients from previous granule was incorrectly used for
+the next granule.</font></li>
+
+  <li> <font color="#ff0000">ISO 7680 bit buffer
+limitation removed.&nbsp; It can be reactivated with
+"--strictly-enforce-ISO"&nbsp; Please report any trouble with high
+bitrates.</font></li>
+
+</ul>
+
+<h3> LAME 3.80beta&nbsp; May 6 2000</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; more efficient and faster huffman encoding!</font></li>
+
+  <li> <font color="#ff0000">Takehiro Tominaga and
+Mark Taylor:&nbsp; much improved short block compression!</font></li>
+
+  <li> <font color="#000000">Tomasz Motylewski and
+Mark Taylor:&nbsp; MPEG2.5 now supported!</font></li>
+
+  <li> <font color="#000000">Mark Taylor:
+incorporated Takehiro's bitstream.c!&nbsp; bitstream.c used by
+default, but old ISO bitstream code can also be used.</font></li>
+
+  <li> <font color="#ff0000">Scott&nbsp; Manley
+and Mark Taylor:&nbsp; good resampling routine finaly in
+LAME.&nbsp; uses a 19 point FIR filter with Blackman
+window.&nbsp; Very slow for non integer resampling ratios.</font></li>
+
+  <li> <font color="#000000">Iwasa Kazmi:&nbsp;
+fixed SIGBUS error:&nbsp; VBR and id3 tags were using data after it
+was free()'d.</font></li>
+
+  <li> <font color="#ff0000">Robert
+Hegemann:&nbsp; Improved VBR tuning.&nbsp; #define
+RH_QUALITY_CONTROL and #RH_SIDE_VBR now the defaults.</font></li>
+
+  <li> <font color="#000000">Robert
+Hegemann:&nbsp;&nbsp; LAME version string now added to
+ancillary data.</font></li>
+
+  <li> Kimmo Mustonen:&nbsp; VBR histogram support for Amiga.</li>
+
+  <li> Casper Gripenberg:&nbsp; VBR stats (but not histogram)
+for DOS verson.</li>
+
+  <li> Robert Hegemann:&nbsp; rare VBR overflow bug fixed.</li>
+
+  <li> Zack:&nbsp; -F option strictly enforces the VBR min
+bitrate.&nbsp; Without -F, LAME will ignore the minimum bitrate
+when encoding analog silence.</li>
+
+  <li> Shawn Riley:&nbsp; User can now specify a compression
+ratio (--comp &lt;arg&gt;) instead of a bit rate.&nbsp;
+Default settings based on a compression ratio of 11.0</li>
+
+  <li> Mark Taylor:&nbsp; free format bitstreams can be
+created with --freeformat, and specify any integer bitrate from 8 to
+320kbs with -b.</li>
+
+  <li> Mark Taylor: lame be used as a decoder (output raw pcm
+only):&nbsp; lame --decode input.mp3 output.pcm</li>
+
+</ul>
+
+<h3> LAME 3.70&nbsp;&nbsp; April 6 2000</h3>
+
+<ul>
+
+  <li> "LAME 3.69beta" becomes LAME 3.70 "stable"</li>
+
+</ul>
+
+<h3> LAME 3.69beta&nbsp;&nbsp; April 6 2000</h3>
+
+<ul>
+
+  <li> "spahm":&nbsp; default mode selection bug
+fixed.&nbsp; In some cases, lame was defaulting to regular stereo
+instead of jstereo when the user did not specify a mode.</li>
+
+</ul>
+
+<h3> LAME 3.68beta&nbsp; April 4 2000</h3>
+
+<ul>
+
+  <li> Mark Taylor: mono encoding bug in DLL fixed.</li>
+
+  <li> Ingo Saitz: bug in --cwlimit argument parsing fixed.</li>
+
+  <li> <font color="#ff0000">Scott Manly: bug in
+4-point resample code fixed.</font></li>
+
+</ul>
+
+<h3> LAME 3.67beta&nbsp; March 27 2000</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Robert
+Hegemann:&nbsp; jstereo now enabled for MPEG2 encodings</font></li>
+
+  <li> Mark Taylor: old M/S stereo mode which used L/R maskings
+has been removed.</li>
+
+  <li> Mark Taylor: Xing MPEG2 VBR headers now working.</li>
+
+  <li> <font color="#ff0000">Mark Taylor:&nbsp;
+When quantized coefficients are all 0 in a band, set scalefactors to 0
+also to save a few bits.</font></li>
+
+  <li> <font color="#000000">Ingo Saitz:&nbsp;
+Problems with framesize calculation when using -f fast-math option
+fixed.</font></li>
+
+</ul>
+
+<h3> LAME 3.66beta March 21 2000</h3>
+
+<ul>
+
+  <li> Bug fixes in BladeEnc DLL, possible click in last mp3
+frame, VBR historgram display, byteswapping option, ASM quantize
+routines work for both float and double.</li>
+
+</ul>
+
+<h3> LAME 3.65beta&nbsp;&nbsp; March 17 2000</h3>
+
+<ul>
+
+  <li> Enabled ASM version of quantize_xrpow() - accidently
+disabled in lame3.64.</li>
+
+</ul>
+
+<h3> LAME 3.64beta&nbsp; March 16 2000</h3>
+
+<ul>
+
+  <li> Don Melton:&nbsp; id3v1.1 tags &amp; id3 bugfixes</li>
+
+  <li> <font color="#ff0000">Gabriel
+Bouvigne:&nbsp; L/R matching block type fix</font></li>
+
+  <li> <font color="#ff0000">Bug fixed which was
+allowing quantized values to exceed the maximum when not using -h</font></li>
+
+  <li> <font color="#3366ff">Mark Taylor: Fitlers
+based on polyphase filterbank.&nbsp; should be slightly better
+since the responce is independent of the blocktype, and they are
+slightly faster.</font></li>
+
+  <li> Mark Taylor: API:&nbsp; the API changed slightly - and
+this should be the final version. There is a new routine:
+lame_encode_buffer() which takes an arbritray sized input buffer,
+resamples &amp; filters if necessary, encodes, and returns the
+mp3buffer.&nbsp; There are also several new #defines, so it is
+possible to compile a simple encoding library with no decoding or file
+I/O or command line parsing.&nbsp; see the file API for details.</li>
+
+  <li> Mark Taylor: MSVC stuff:&nbsp; lame.exe (with and
+    without the frame analyzer) and the CDex lame_enc.dll
+    should compile under MSVC.&nbsp; The MSVC5 project files may need
+    some tweaking.&nbsp; In particular,
+    you need to make sure LAMEPARSE, LAMESNDFILE and HAVEMPGLIB
+    are defined.&nbsp; (and HAVEGTK for the GTK stuff).</li>
+</ul>
+
+<h3> LAME 3.63beta&nbsp; February 20&nbsp; 2000</h3>
+
+<ul>
+
+  <li> Robert Hegemann:&nbsp; FPE with -h fixed?</li>
+
+  <li> Mathey Hendry:&nbsp; FPE error catching for Cygwin,
+FPE fix for vbr mode and output to /dev/null</li>
+
+  <li> Jeremy Hall:&nbsp; Fixed problems with input files
+where the number of samples is not known.</li>
+
+  <li> <font color="#3366ff">Mathew
+Hendry:&nbsp; ASM quantize_xrpow() for GNU i386</font></li>
+
+  <li> <font color="#3366ff">Wilfried
+Behne&nbsp; quantize_xrpow ()for PowerPC and non-ASM</font></li>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; GOGO FFTs&nbsp; (not yet used?)</font></li>
+
+</ul>
+
+<h3> LAME 3.62beta&nbsp;&nbsp; February 9 2000</h3>
+
+<ul>
+
+  <li> <font color="#000000">Iwasa Kazmi:&nbsp;
+frame analyzer short block display of single subblocks (press
+1,2&nbsp; or 3)</font></li>
+
+  <li> <font color="#000000">Ingo Saitz:&nbsp;
+--help option added, with output to stdout</font></li>
+
+  <li> <font color="#ff0000">Alfred Weyers: short
+block AAC spreading function bug fixed</font></li>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; new scalefac data structure - improves performance!</font></li>
+
+  <li> <font color="#ff0000">Lionel
+Bonnet:&nbsp; Bug fixed in MPEG2 scalefactor routine: scalefactors
+were being severly limited.</font></li>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; faster FFT routines from.&nbsp; These routines
+are also compatible with the GOGO routines, in case someone is
+interested in porting them back to LAME.</font></li>
+
+  <li> <font color="#3366ff">Sigbj&oslash;rn
+Skj&aelig;ret, Takehiro Tominaga:&nbsp; faster pow() code.</font></li>
+
+  <li> <font color="#ff0000">Joachim
+Kuebart:&nbsp; Found some unitialized variables that were effecting
+quality for encodings which did not use the -h option (now fixed).</font></li>
+
+  <li> Mark Taylor: More modularization work.&nbsp;&nbsp;
+It is now possible to use LAME as a library where you can set the
+encoding parameters directly and do your own file
+i/o.&nbsp;&nbsp; The calling program is now it's own mp3
+output.&nbsp; For an example of the LAME API, see main.c, or
+mp3rtp.c or mp3x.c.&nbsp; These can all be compiled as stand alone
+programs which link with libmp3lame.a.</li>
+
+  <li> Felix vos Leitner:&nbsp; mp3rtp fixes.&nbsp;
+mp3rtp is a standalone program which will encode and stream with RTP.</li>
+
+  <li> Robert Hegemann:&nbsp; Information written to stderr
+displaying exactly which type of lowpass filter (if any) is being used.</li>
+
+  <li> Iwasa Kazmi:&nbsp; mpglib (the mpg123 decoder) scsfi
+decoding fixes.</li>
+
+  <li> Takehiro Tominaga:&nbsp; More mpglib scsfi decoding
+fixes.</li>
+
+</ul>
+
+<h3> LAME 3.61beta&nbsp; January 14 2000</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Mark Taylor: Fixed bug
+with lowpass filters when using VBR with a 64kbs or lower min bitrate
+setting.</font></li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; more efficient huffman encoding splitting.</font></li>
+
+</ul>
+
+<h3> LAME 3.60beta&nbsp;&nbsp; January 9 2000</h3>
+
+<ul>
+
+  <li> Mark Taylor: Distribution now comes with self
+test.&nbsp; Needs work to be automated, see 'make test' in Makefile.</li>
+
+  <li> <font color="#ff0000">Mark Taylor: AAC
+spreading function now the default</font></li>
+
+  <li> Gabriel Bouvigne: updated HTML docs</li>
+
+  <li> Felix von Leitner: compute correct file length from Xing
+header (if present) when input file is a mp3 file</li>
+
+  <li> Felix von Leitner: mp3rtp (standalone) program now
+included.&nbsp; Not yet tested.&nbsp; mp3rtp
+ip:port:ttl&nbsp; &lt;infile&gt;&nbsp;&nbsp;
+/dev/null will stream directly to ip:port using&nbsp; RTP.</li>
+
+</ul>
+
+<h3> LAME 3.59beta&nbsp; January 4 2000</h3>
+
+<ul>
+
+  <li> Takehiro Tominaga:&nbsp; --noath option.&nbsp;
+Disables ATH maskings.</li>
+
+  <li> Gabriel Bouvigne:&nbsp; updated HTML docs.</li>
+
+  <li> Iwasa Kazmi:&nbsp; makefile fixes</li>
+
+  <li> Mark Taylor:&nbsp; Fixed bug where first frame of data
+was always overwritten with 0's.&nbsp; Thanks to 'gol'</li>
+
+  <li> <font color="#ff0000">Mark Taylor:&nbsp;
+bug fixes in mid/side masking ratios (thanks to Menno Bakker)</font></li>
+
+  <li> Mark Taylor:&nbsp; replaced norm_l, norm_s table data
+with formulas.</li>
+
+</ul>
+
+<h3> LAME 3.58beta&nbsp; December 13 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Segher
+Boessenkool:&nbsp; More accurate quantization procedure!&nbsp;
+Enabled with -h.</font></li>
+
+  <li> <font color="#3366ff">Mathew Hendry, Acy
+Stapp and Takehiro Tominaga: ASM optimizations for quantize_xrpow and
+quantize_xrpow_ISO.</font></li>
+
+  <li> Chuck Zenkus:&nbsp; "encoder inside" logo on web page</li>
+
+  <li> Mark Taylor:&nbsp;&nbsp; a couple people have
+asked for this.&nbsp;&nbsp; Allow LAME to overide
+VBR_min_bitrate if analog_silence detected.&nbsp;&nbsp;
+Analog_silence defined a la Robert:&nbsp;&nbsp;
+energy&nbsp; &lt; ATH.</li>
+
+  <li> An Van Lam: Valid bitrates were being printed for layer 2,
+not layer 3!</li>
+
+  <li> Ethan Yeo:&nbsp; Makefile.MSVC updated</li>
+
+  <li> Mark Stephens:&nbsp; updated all MSVC project files</li>
+
+  <li> Robert Hegemann:&nbsp; lowpass and highpass filters
+can be enabled with --lowpass, --highpass</li>
+
+  <li> <font color="#ff0000">Mark Taylor:&nbsp;
+MS switching is now smoother: ms_ratio average over 4 granules</font></li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; Scalefactor pre-emphasis fixed (and now turned back
+on)</font></li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; Bug in M/S maskings:&nbsp; switch to turn on
+stereo demasking code was buggy.</font></li>
+
+</ul>
+
+<h3> LAME 3.57beta&nbsp; November 22 1999</h3>
+
+<ul>
+
+  <li> Sigbj&oslash;rn Skj&aelig;ret, patch to allow
+encoding from 8bit input files when using LIBSNDFILE</li>
+
+  <li> Mark Taylor: Automatic downsampling to nearest valid
+samplerate.</li>
+
+  <li> Mark Taylor: Scalefactor bands demarked on MDCT plot in
+frameanalyzer</li>
+
+  <li> Mark Taylor: Scalefactor preemphasis disabled for
+now.&nbsp;&nbsp; The algorithm was often doing more harm than
+good.</li>
+
+</ul>
+
+<h3> LAME 3.56beta&nbsp; November 19 1999</h3>
+
+<ul>
+
+  <li> Kimmo Mustonen: portabilty code cleanup.</li>
+
+  <li> Vladimir Marek: id3 genre patch.</li>
+
+  <li> Conrad Sanderson: new applypatch script.</li>
+
+  <li> Mark Taylor: Initial window type now "STOP_TYPE" to reduce
+initial attenuation.&nbsp; This is needed because the new encoder
+delay is so short.&nbsp; With a NORM_TYPE, the first 240 samples
+would be attenuated.</li>
+
+  <li> Mark Taylor: Padding at end of file now adjusted
+(hopefully!) to produce as little padding as possible while still
+guarantee all input samples are encoded.</li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; Reduced shortblock extra bit allocation formulas by
+10% since new huffman coding is at least 10% more efficient.</font></li>
+
+</ul>
+
+<h3> LAME 3.55beta&nbsp; November 11 1999</h3>
+
+<ul>
+
+  <li> Albert Faber:&nbsp; updated BladeEnc.dll</li>
+
+  <li> Mark Taylor: Simple lowpass filter added to linear
+downsampling routine.</li>
+
+  <li> Nils Faerber: updated man page.</li>
+
+  <li> Mark Taylor: All floating point variables are delcared
+FLOAT or&nbsp; FLOAT8.&nbsp; Change the definition of FLOAT8 in
+machine.h to run at 32bit preceision.</li>
+
+  <li> Mark Taylor: Bug (introduced in 3.54beta) in
+stereo-&gt;mono downsampling fixed.</li>
+
+</ul>
+
+<h3> LAME 3.54beta&nbsp; November 8 1999</h3>
+
+<ul>
+
+  <li> Mark Taylor: Encoder delay is now 48 samples.&nbsp;
+Can be adjusted to 1160 to sync with FhG (see ENCDELAY in
+encoder.h)&nbsp; This is kind of amazing, since if Takehiro put his
+MDCT/filterbank routine in a decoder, we could have a total&nbsp;
+delay of only 96 samples.</li>
+
+  <li> <font color="#ff0000">Mark Taylor: More
+inconstancies found and fixed in MPEG2 tables.</font></li>
+
+  <li> Mark Taylor: Resampling from an MP3 input file now
+works.&nbsp; But we still dont have a lowpass filter so dont expect
+good results.</li>
+
+</ul>
+
+<h3> LAME 3.53beta&nbsp; November 8 1999</h3>
+
+<ul>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; Fixed MPEG2 problem in new MDCT routines.&nbsp;
+Takehiro's combined filterbank/MDCT routine is now the
+default.&nbsp; Removes all buffering from psymodel.c and the
+filterbanks/MDCT routines.</font></li>
+
+</ul>
+
+<h3> LAME 3.52beta&nbsp; November 8 1999</h3>
+
+<ul>
+
+  <li> By permission of copyright holders of all GPL code in
+LAME,&nbsp; all GPL code is now released under a modified version
+of the LGPL (see the README file)</li>
+
+  <li> By popular demand, all C++ comments changed to C style
+comments</li>
+
+  <li> Mark Taylor: Linear resampling now works.&nbsp; Use
+--resample to set an output samplerate different from the input
+samplerate.&nbsp; (doesn't seem to work with mp3 input files, and
+there is no lowpass filter, so dont expect good results just yet)</li>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; Faster Huffman encoding routines</font></li>
+
+</ul>
+
+<font color="#3366ff">The following changes are disabled
+because of MPEG2 problems.&nbsp; But to try them, set MDCTDELAY=48
+in encoder.h, instead of MDCTDELAY=528.:</font>
+<ul>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; New MDCT routines with shorter delay (48 samples
+instead of 528) and even faster than the old routines.</font></li>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; Removed extra buffering in psymodel.c</font></li>
+
+</ul>
+
+<h3> LAME 3.51&nbsp; November 7 1999</h3>
+
+<ul>
+
+  <li> Takehiro Tominaga: Bug in quantize.c absolute threshold of
+hearing calculation for non-44.1 kHz input files.</li>
+
+</ul>
+
+<h3> LAME 3.50&nbsp; November 1 1999</h3>
+
+<ul>
+
+  <li> LAME 3.37beta becomes official LAME 3.50 release</li>
+
+</ul>
+
+<h3> LAME 3.37beta&nbsp; November 1 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Lionel
+Bonnet:&nbsp; Found severe bug in MPEG2 Short block SNR.</font></li>
+
+  <li> Sergey Sapelin:&nbsp; VBR Toc improvement.</li>
+
+  <li> Sergey Dubov: fskip() routine</li>
+
+  <li> Conrad Sanderson: replacement for
+filterbank.c.&nbsp;&nbsp; Not much faster but amazingly simpler.</li>
+
+</ul>
+
+<h3> LAME 3.36beta&nbsp; October 25 1999</h3>
+
+<ul>
+
+  <li> Albert Faber:&nbsp; more MSVC and BladeDLL updates</li>
+
+  <li> Kimmo Mustonen:&nbsp; Much code cleanup and Amiga
+updates</li>
+
+  <li> Anton Oleynikov: Borland C updates</li>
+
+  <li> Mark Taylor: More stdin fixes:&nbsp; For some reason,
+forward fseek()'s would fail when used on pipes even though it is okay
+with redirection from "&lt;". So I changed all the forward
+fseek()'s to use fread().&nbsp; This should improve stdin support
+for wav/aiff files.&nbsp; If you know the input file is raw pcm,
+you can still use the '-r' option to avoid *all* seeking of any kind.</li>
+
+</ul>
+
+<h3> LAME 3.35beta&nbsp; October 21 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Leonid
+Kulakov:&nbsp; Serious bug in MPEG2 scalefactor band tables fixed.</font></li>
+
+  <li> Portability patches from:&nbsp; Anton Oleynikov,
+Sigbj&oslash;rn Skj&aelig;ret, Mathew Hendry, Richard Gorton</li>
+
+  <li> Alfred Weyers: compiler options, updated timestatus.</li>
+
+  <li> Albert Faber:&nbsp; BladeDll and other updates (new
+machine.h).</li>
+
+  <li> Monty:&nbsp; updated Makefile to fix gcc inline math
+bug.</li>
+
+</ul>
+
+<h3> LAME 3.34beta&nbsp; October 12 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Mark Taylor: Bug
+fixed:&nbsp; minimum bitrate in VBR mode could be ignored for a few
+frames.</font></li>
+
+  <li> <font color="#ff0000">Mark Taylor: New
+(minor) VBR tunings.</font></li>
+
+  <li> Tim Ruddick: New wav/aiff header parsing
+routines.&nbsp; Better parsing and fewer fseek()'s.</li>
+
+  <li> Anton Oleynikov:&nbsp; patches to work with Borland C</li>
+
+  <li> <font color="#ff0000">Gabriel
+Bouvigne:&nbsp; Experimental voice option enabled with --voice</font></li>
+
+</ul>
+
+<h3> LAME 3.33beta&nbsp; October 11 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Robert Hegemann: RH
+VBR mode now the default and only VBR mode.&nbsp; The new code will
+always quantize to 0 distortion and the quality is increased by
+reducing the masking from the psy-model.&nbsp; -X0 is still the
+default for now.</font></li>
+
+  <li> <font color="#ff0000">Robert Hegemann: new
+-X5 mode</font></li>
+
+  <li> Mathew Hendry: New timing code, removes the need for
+HAVETIMES</li>
+
+  <li> <font color="#3366ff">Mathew
+Hendry:&nbsp; assembler quantize_xrpow for Windows</font></li>
+
+  <li> Iwasa Kazmi:&nbsp; stdin/stdout patch for Windows</li>
+
+  <li> Mark Taylor: New option: "--athonly" will ignore the
+psy-model output and use only the absolute threshold of hearing for the
+masking.</li>
+
+</ul>
+
+<h3> LAME 3.32beta&nbsp; October 8 1999</h3>
+
+<ul>
+
+  <li> <font color="#3366ff">Takehiro
+Tominaga:&nbsp; faster long block spreading function convolution
+for non 44.1 kHz sampling frequencies, and faster short block spreading
+function convolution for all sampling frequencies.</font></li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; Completly rewritten huffman table selection and
+count_bits().&nbsp; More efficient table selection results in many
+more bits per frame.</font></li>
+
+  <li> <font color="#ff0000">Takehiro
+Tominaga:&nbsp; More efficient scalefac compress setting.</font></li>
+
+  <li> <font color="#3366ff">Mike Cheng: new
+calc_noise2()</font></li>
+
+  <li> Alfred Weyers: patch for timestatus() seconds rollover</li>
+
+</ul>
+
+<h3> LAME 3.31beta&nbsp; September 28 1999</h3>
+
+<ul>
+
+  <li> Albert Faber:&nbsp; updated his BladeDLL
+code.&nbsp; This allows LAME to be compiled into a BladeEnc
+compatiable .dll.</li>
+
+  <li> <font color="#3366ff">Mike Cheng: faster
+l3psycho_ener() routine.</font></li>
+
+  <li> Sigbj&oslash;rn Skj&aelig;ret: more code cleanup.</li>
+
+</ul>
+
+<h3> LAME&nbsp; 3.30beta&nbsp; September 27 1999</h3>
+
+<ul>
+
+  <li> Conrad Sanderson:&nbsp; ID3 tag code added (type
+'lame' for instructions)</li>
+
+  <li> new mdct.c from Mike Cheng (no faster, but much cleaner
+code)</li>
+
+  <li> Mathew Hendry: Microsoft nmake makefile and a couple other
+changes for MSVC</li>
+
+  <li> More modulization work:&nbsp; One input sound file
+interface handles mp3's, uncompressed audio, with or without
+LIBSNDFILE.&nbsp; Fixes (hopefully) a bunch of file I/O bugs
+introduced in 3.29 (Mark Taylor)</li>
+
+  <li> LAME will now print valid samplerate/bitrate combinations
+(Mark Taylor)</li>
+
+  <li> stdin/stdout fix for OS/2 (Paul Hartman)</li>
+
+  <li> For mp3 input files, totalframes estimated based on
+filesize and first frame bitrate. (Mark Taylor)</li>
+
+  <li> Updated all functions with new style prototypes.&nbsp;
+(Sigbj&oslash;rn Skj&aelig;ret)</li>
+
+</ul>
+
+<h3> LAME 3.29beta&nbsp; September 21 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Bug in bigv_bitcount
+fixed.&nbsp; Loop.c was overestimating the number of bits needed,
+resulting in wasted bits every frame.&nbsp; (Leonid A. Kulakov)</font></li>
+
+  <li> <font color="#ff0000">Bug in
+*_choose_table() fixed&nbsp;&nbsp; These routines would not
+sellect the optimal Huffman table in some cases.&nbsp;&nbsp;
+(Leonid A. Kulakov)</font></li>
+
+  <li> <font color="#ff0000">Tuning of ATH
+normalization (macik)</font></li>
+
+  <li> Removed unused variables and fixed function prototypes
+(Sigbj&oslash;rn Skj&aelig;ret)</li>
+
+  <li> Sami Farin sent a&nbsp; .wav&nbsp; file
+that&nbsp; LAME built in support choked on.&nbsp;&nbsp; I
+added a slightly more sophisticated wav header parsing to handle this,
+but if you have trouble, use libsndfile.</li>
+
+  <li> Resampling hooks and options added.&nbsp; Buffering
+and resampling routines need to be written.</li>
+
+  <li> LAME will now take an mp3 file as input.&nbsp; When
+resampling code is working, LAME will be able to (for example) convert
+a high bitrate stereo mp3 to a low bitrate mono mp3 for streaming.</li>
+
+</ul>
+
+<h3> LAME 3.28beta&nbsp; September 15 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Serious bug fixed in
+high frequency MDCT coefficients.&nbsp; Huffman coding was
+reversing the order of the count1 block quadruples.&nbsp;&nbsp;
+(Leonid A. Kulakov)</font></li>
+
+  <li> nint() problems under Tru64 unix fixed and preprocessor
+variable HAVE_NINT removed.&nbsp; (Bob Bell)</li>
+
+  <li> Compiler warning fixes and code
+cleanup&nbsp;&nbsp; (Sigbj&oslash;rn Skj&aelig;ret,
+Lionel Bonnet)</li>
+
+  <li> USAGE file now includes suggestions for
+downsampling.&nbsp; For low bitrate encodings, proper downsampling
+can give dramatically better results.&nbsp; (John Hayward-Warburton)</li>
+
+</ul>
+
+<h3> LAME 3.27beta&nbsp; September 12 1999</h3>
+
+<ul>
+
+  <li> Several bugs in encode.c and l3bitstream.c fixed by Lionel
+Bonnet.</li>
+
+  <li> Bugs in new VBR (#define RH) formula for mono input file
+and mid/side encoding fixed.</li>
+
+</ul>
+
+<h3> LAME 3.26beta&nbsp; September 10 1999</h3>
+
+<ul>
+
+  <li> The "-m m" option (mono .mp3 file) will automatically mix
+left and right channels if the input file is stereo.&nbsp; (Alfred
+Weyers)</li>
+
+  <li> <font color="#ff0000">New quant_compare
+algorithm (method for deciding which of two quantizations is better)
+enabled with -X4 (Greg Maxwell)</font></li>
+
+  <li> <font color="#ff0000">New mid/side VBR bit
+allocation formula.&nbsp; Mid channel bits are set by the quality
+requirements, and then the side channel uses a reduced number of bits
+(in a proportion coming from the fixed bitrate code).&nbsp; This
+might not be optimal, but it should be pretty good and no one knows
+what the optimal solution should be.&nbsp; (Greg Maxwell)</font></li>
+
+  <li> <font color="#ff0000">New VBR (#define RH)
+tunings based on detailed listening tests by Macik and Greg Maxwell.</font></li>
+
+  <li> Sigbj&oslash;rn Skj&aelig;ret fixed several
+compiler warnings (which turned out to be potential bugs)</li>
+
+  <li> Takehiro Tominaga fixed a low bitrate bug in reduce_side()</li>
+
+  <li> Alfred Weyers fixed some buffer overflows.</li>
+
+  <li> <font color="#ff0000">New ATH (absolute
+threshold of hearing) formula replaces buggy ISO code, and
+adds&nbsp; analog silence treatment&nbsp; (removal of
+coefficients below below ATH).&nbsp;&nbsp; These are turned on
+by default but have not been fully tested.&nbsp; (Robert Hegemann)</font></li>
+
+  <li> <font color="#ff0000">Bug in short block
+spreading function fixed.&nbsp; (Robert Hegemann)</font></li>
+
+</ul>
+
+<h3> LAME 3.25beta&nbsp; August 22 1999</h3>
+
+<ul>
+
+  <li> Sigbj&oslash;rn Skj&aelig;ret fixed a zero byte
+malloc call.&nbsp; This bug&nbsp; was introduced in 3.24 and
+causes problems on non Linux systems.</li>
+
+  <li> Bit allocation routines would sometimes allocate more than
+4095 bits to one channel of one granule.&nbsp; A couple of people
+reported problems that might be caused by this, especially at higher
+bitrates.</li>
+
+  <li> Nils Faerber updated the man page and fixed many of the
+compiler warnings.</li>
+
+</ul>
+
+<h3> LAME 3.24beta&nbsp;&nbsp; August 15 1999</h3>
+
+<ul>
+
+  <li> This release contains the following new code (for
+developers) which is disabled by default:</li>
+
+  <li> Robert Hegemann:&nbsp; Completely overhauled VBR
+code.&nbsp; Now computes exact number of bits required for the
+given qualty and then quantized with the appropriate bitrate.</li>
+
+  <li> Several new quantization quality measures.</li>
+
+</ul>
+
+<h3> LAME 3.23beta&nbsp; August 8 1999</h3>
+
+<ul>
+
+  <li> Very nice continuously updated VBR histogram display from
+Iwasa Kazmi.&nbsp; (disabled with --nohist).</li>
+
+  <li> More modulerization work.&nbsp; The encoding engine
+can now be compiled into libmp3lame, but the interface is awkward.</li>
+
+  <li> <font color="#ff0000">Bug fixed in FFT Hann
+window formula (Leonid A. Kulakov).</font></li>
+
+  <li> New LAME logo on the download page.&nbsp; Created by
+Chris Michalisles.</li>
+
+  <li> <font color="#ff0000">Several VBR algorithm
+improvements from Robert Hegemann.&nbsp; New quantization noise
+metrics and VBR quality measure takes into account mid/side
+encoding.&nbsp; Should produce smaller files with the same quality,
+especially when using jstereo.</font></li>
+
+</ul>
+
+<h3> LAME 3.22beta&nbsp; July 27 1999</h3>
+
+<ul>
+
+  <li> Downsampling (stereo to mono) bug with MPEG2
+fixed.&nbsp; (Mike Oliphant)</li>
+
+  <li> Downsampling now merges L &amp; R channels - before it
+only took the L channel.</li>
+
+  <li> More modularization and code cleanup from Albert Faber and
+myself.</li>
+
+  <li> Input filesize limit removed for raw pcm input
+files.&nbsp; For other file types, LAME will still only read the
+first 2^32 samples, (27 hours of playing time at 44.1 kHz).</li>
+
+</ul>
+
+<h3> LAME 3.21beta&nbsp; July 26 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Correct Mid/Side
+masking thresholds for JSTEREO mode!&nbsp; This is enabled with
+-h.&nbsp; It&nbsp; makes LAME about 20% slower since it
+computes psycho-acoustics for L,R Mid and Side channels.</font></li>
+
+  <li> <font color="#ff0000">"Analog silence"
+threshold added.&nbsp; Keeps VBR from upping the bitrate during
+very quite passages.&nbsp; (Robert.Hegemann)</font></li>
+
+  <li> <font color="#ff0000">New VBR quality
+setting from Robert Hegemann.&nbsp; It is based on the idea that
+distortion at lower bit rates sounds worse than at higher bitrates, and
+so the allowed distortion (VBR quality setting) is proportional to the
+bitrate.&nbsp; Because of this, default minimum bitrate is now
+32kbs.</font></li>
+
+  <li> <font color="#ff0000">Expermental subblock
+gain code enabled with -Z.</font></li>
+
+  <li> New "-r" option for raw pcm input files.&nbsp; With
+-r, LAME will not do any fseek()'s or look for wav and aiff headers on
+the input file.</li>
+
+  <li> Bug fixes in mp3x (frame analyzer) for viewing frames near
+end of the file.</li>
+
+  <li> Bug fixed to allow setting the sampling rate of raw pcm
+input files.</li>
+
+</ul>
+
+<h3> LAME 3.20beta&nbsp; July 19 1999</h3>
+
+<ul>
+
+  <li> Bug in get_audio.c fixed.&nbsp; Libsndfile wrappers
+would not compile (Miguel Revilla&nbsp; Rodriguez)</li>
+
+  <li> Nils Faerber found some unitialized variables and some
+wierd extranous computations in filter_subband, now fixed.&nbsp;
+This was causing seg faults on some machines.</li>
+
+</ul>
+
+<h3> LAME 3.19beta&nbsp; July 18 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Oops!&nbsp; Robert
+Hegemann immediatly found a bug in the new&nbsp; (old -Z option)
+quantization code.&nbsp; calc_noise1 was not returning tot_noise,
+so non ms-stereo frames were buggy.</font></li>
+
+</ul>
+
+<h3> LAME 3.18beta&nbsp; July 17 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Many psycho-acoustic
+bug fixes.&nbsp; Dan Nelson discovered a bug in MPEG2: For short
+blocks, the code assumes 42 partition bands.&nbsp; MPEG1 sometimes
+has less, MPEG2 can have more.&nbsp; In MPEG1, this bug would not
+have effected the output if your compiler initializes static variables
+to 0 on creation.&nbsp; In MPEG2 it leads to array out-of-bounds
+access errors. Finally, there was a related bug in MPEG1/MPEG2, short
+&amp; long blocks where the energy above 16 kHz was all added to
+partition band 0. (the lowest frequeny partition band!)</font></li>
+
+  <li> <font color="#ff0000">The -Z option (Gabriel
+Bouvigne's idea of using total quantization noise to choose between two
+quantizations with the same value of "over") is now the
+default.&nbsp; I believe this helps remove the trilling sound in
+Jan's testsignal4.wav.&nbsp; The quality of testsignal2.wav and
+testsignal4.wav are now better than Xing and getting closer to FhG.</font></li>
+
+  <li> Bug fixes in frame &amp; sample count for downsampling
+mode. (ben "jacobs")</li>
+
+  <li> Patches to improve modulization.&nbsp; (ben "jacobs")</li>
+
+</ul>
+
+<h3> LAME 3.17beta&nbsp; July 11 1999</h3>
+
+<ul>
+
+  <li> substantial code cleanup towards goal of making LAME more
+modular.</li>
+
+</ul>
+
+<h3> LAME 3.16beta&nbsp; July 11 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">New tunings of window
+switching, and better bit allocation based on pe.&nbsp; (Jan
+Rafaj.&nbsp; improves both testsignal2.wav and testsignal4.wav).</font></li>
+
+  <li> <font color="#ff0000">Bug in mid/side
+quantization when side channel was zero fixed.&nbsp; (Albert Faber)</font></li>
+
+  <li> Removed some extranous computations in l3psy.c (Robert
+Hegemann)</li>
+
+  <li> More detailed timing status info, including hours display.
+(Sakari Ailus) and percentage indicator (Conrad Sanderson).</li>
+
+  <li> <font color="#3366ff">Window_subband and
+calc_noise1,calc_noise2 speedups.&nbsp; Quantize_xrpow speedup
+should be significant on non GNU/intel systems. (Mike Cheng)</font></li>
+
+  <li> <font color="#3366ff">Better initial guess
+for VBR bitrate.&nbsp; Should speed up VBR encoding.&nbsp;
+(Gabriel Bouvigne)</font></li>
+
+  <li> More advanced .wav header parsing.&nbsp; fixes bugs
+involving click in first frame. (Robert.Hegemann)</li>
+
+  <li> Correct filesize and total frame computation when using
+LIBSNDFILE (ben "jacobs")</li>
+
+  <li> Click in last frame (buffering problem) when using
+libsndfile fixed.</li>
+
+  <li> Audio I/O code overhauled.&nbsp; There is now a
+uniform audio i/o interface to libsndfile or the LAME built in wav/aiff
+routines.&nbsp; All audio i/o code localized to get_audio.c.</li>
+
+</ul>
+
+<h3> LAME 3.15beta</h3>
+
+<ul>
+
+  <li> times()/clock() problem fixed for non-unix OS.&nbsp;
+(Ben "Jacobs")</li>
+
+  <li> Fixed uninitialized pe[] when using fast mode.&nbsp;
+(Ben "Jacobs")</li>
+
+</ul>
+
+<h3> LAME 3.13&nbsp; June 24 1999</h3>
+
+<ul>
+
+  <li> Patches for BeOS from Gertjan van Ratingen.</li>
+
+  <li> Makefile info for OS/2 Warp 4.0&nbsp; (from dink.org).</li>
+
+  <li> Status display now based on wall clock time, not cpu time.</li>
+
+  <li> mem_alloc no longer allocates twice as much memory as
+needed (Jan Peman).</li>
+
+</ul>
+
+<h3> 3.12pre9</h3>
+
+<ul>
+
+  <li> Updated BLADEDLL code to handle recent changes (Albert
+Faber).</li>
+
+  <li> Bug fixed in parsing options when not using GTK (Albert
+Faber).</li>
+
+  <li> <font color="#ff0000">MPEG2 Layer III psycho
+acoustics now working.</font></li>
+
+  <li> <font color="#3366ff">Improved huffman
+encoding Chris Matrakidis. (10% faster).&nbsp; I dont know how he
+finds these improvements!&nbsp; LAME with full quality now encodes
+faster than real time on my PII 266.</font></li>
+
+  <li> Fixed time display when encoding takes more than 60
+minutes.</li>
+
+</ul>
+
+<h3> 3.12pre8</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">New <a href="gpsycho/ms_stereo.html">mid/side stereo</a>
+criterion.&nbsp; LAME will use mid/side stereo only when the
+difference between L &amp; R masking thresholds (averaged over all
+scalefactors) is less then 5db.&nbsp; In several test samples it
+does a very good job mimicking the FhG encoder.</font></li>
+
+  <li> <font color="#ff0000">Bug in mid/side stereo
+fixed:&nbsp; independent variation of mid &amp; side channel
+scalefactors disabled.&nbsp; Because of the way outer_loop is
+currently coded, when encoding mid/side coefficietns using left/right
+thresholds, you have to vary the scalefactors simultaneously.</font></li>
+
+  <li> <font color="#ff0000">Bug in side/mid energy
+ratio calculation fixed. (Thanks to Robert Hegemann)</font></li>
+
+  <li> Default mode is stereo (not jstereo) if bitrate is chosen
+as 192kbs or higher.&nbsp; Tero Auvinen first pointed out that FhG
+seems to think at 160kbs, their encoder is so good it doesn't need
+jstereo tricks. Since LAME is not as good as FhG, I am going to claim
+that 192kbs LAME is so good it doens't need jstereo tricks, and thus it
+is disabled by default.</li>
+
+  <li> WAV header parsing for big-endian machines, and automatic
+detection of big-endian machines.&nbsp; (Thanks to&nbsp;
+Sigbj&oslash;rn Skj&aelig;ret).</li>
+
+  <li> added 56 sample delay to sync LAME with FhG.</li>
+
+  <li> MP3x (frame analyzer) can now handle MPEG2 streams.</li>
+
+</ul>
+
+<h3> 3.12pre7</h3>
+
+<ul>
+
+  <li> MPEG2 layer III now working!&nbsp; lower bit rates
+(down to 8kbs) and 3 more sampling frequencies:&nbsp; 16000, 22050,
+24000Hz. Quality is poor - the psy-model does not yet work with these
+sampling frequencies.</li>
+
+  <li> Fixed "ERROR: outer_loop(): huff_bits &lt; 0." bug
+when using VBR.</li>
+
+  <li> bash and sh scripts to run LAME on multiple files now
+included.&nbsp; (from Robert Hegemann and Gerhard Wesp respectively)</li>
+
+  <li> bug fix in encoding times for longer files from&nbsp;
+(Alvaro Martinez Echevarria)</li>
+
+  <li> yet another segfault in the frame analyzer fixed.</li>
+
+  <li> ISO psy-model/bit allocation routines removed.&nbsp;
+This allowed makeframe() to be made much simpler, and most of the
+complicated buffering is now gone. Eventually I would like the encoding
+engine to be a stand alone library.</li>
+
+</ul>
+
+<h3> 3.12pre6</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">Better VBR
+tuning.&nbsp; Find minimum bitrate with distortion less than the
+allows maximum.&nbsp; A minimum bit rate is imposed on frames with
+short blocks (where the measured distortion can not be
+trusted).&nbsp;&nbsp; A minimum frame bitrate can be specified
+with -b, default=64kbs.</font></li>
+
+  <li> <a href="http://www.zip.com.au/%7Eerikd/libsndfile">LIBSNDFILE</a>
+support.&nbsp; With libsndfile, LAME can encode almost all sound
+formats.&nbsp; Albert Faber did the work for this, including
+getting libsndfile running under win32.</li>
+
+  <li> CRC checksum now working!&nbsp;&nbsp; (Thanks to
+Johannes Overmann )</li>
+
+  <li> frame analyzer will now work with mono .mp3 files</li>
+
+  <li> <font color="#3366ff">more code tweeks from
+Jan Peman.</font></li>
+
+  <li> <font color="#3366ff">Compaq-Alpha(Linux)
+fixes and speedups from Nils Faerber.</font></li>
+
+  <li> <font color="#3366ff">Faster
+bin_search_StepSize from Juha Laukala.</font></li>
+
+  <li> <font color="#3366ff">Faster quantize() from
+Mike Cheng</font></li>
+
+  <li> <font color="#3366ff">Faster
+quantize_xrpow() from Chris Matrakidis.&nbsp; xrpow_flag removed
+since this option is now on by default.</font></li>
+
+  <li> Fixed .wav header parsing from Nils Faerber.</li>
+
+  <li> Xing VBR frame info header code from Albert
+Faber.&nbsp;&nbsp; "Xing" and "LAME 3.12" embedded in first
+frame.</li>
+
+  <li> <font color="#ff0000">Bug in VBR bit
+allocation based on "over" value fixed.</font></li>
+
+</ul>
+
+<h3> LAME 3.11&nbsp; June 3 1999</h3>
+
+<ul>
+
+  <li> Almost all warnings (-Wall) now fixed!&nbsp; (Thanks
+to Jan Peman)</li>
+
+  <li> More coding improvements from Gabriel Bouvigne and Warren
+Toomey.</li>
+
+  <li> <font color="#ff0000">VBR&nbsp;
+(variable bit rate).&nbsp;&nbsp; Increases bit rate for short
+blocks and for frames where the number of bands containing audible
+distortion is greater than a given value.&nbsp; Much tuning needs
+to be done.</font></li>
+
+  <li> Patch to remove all atan() calls from James Droppo.</li>
+
+</ul>
+
+<h3> LAME 3.10 May 30 1999</h3>
+
+<ul>
+
+  <li> <font color="#3366ff">Fast mode
+(-f)&nbsp; disables psycho-acoustic model for real time encoding on
+older machines.&nbsp; Thanks to Lauri Ahonen who first sent a patch
+for this.</font></li>
+
+  <li> <font color="#ff0000">New bit reservoir
+usage scheme to accommodate the new pre-echo detection formulas.</font></li>
+
+  <li> <font color="#ff0000">Tuning of AWS and
+ENER_AWS pre-echo formulas by Gabriel Bouvigne and myself.&nbsp;
+They work great!&nbsp; now on by default.</font></li>
+
+  <li> In jstereo, force blocktypes for left &amp; right
+channels to be identical.&nbsp; FhG seems to do this.&nbsp; It
+can be disabled with "-d".</li>
+
+  <li> Patches to compile MP3x under win32 (Thanks to Albert
+Faber).</li>
+
+  <li> <font color="#3366ff">bin_serach_stepsize
+limited to a quantizationStepSize of&nbsp; -210 through 45.</font></li>
+
+  <li> <font color="#ff0000">outer_loop()&nbsp;
+will now vary Mid &amp; Side scalefactors independently.&nbsp;
+Can lead to better quantizations, but it is slower (twice as many
+quantizations to look at).&nbsp; Running with "-m f" does not need
+this and will run at the old speed</font></li>
+
+  <li> <font color="#ff0000">Bug in inner_loop
+would allow quantizations larger than allowed.&nbsp; (introduced in
+lame3.04, now fixed.)</font></li>
+
+  <li> Updated HTML documentation from Gabriel Bouvigne.</li>
+
+  <li> Unix&nbsp; man page from William Schelter.</li>
+
+  <li> <font color="#ff0000">numlines[] bug
+fixed.&nbsp; (Thanks to Rafael Luebbert, MPecker author).</font></li>
+
+  <li> <font color="#3366ff">Quantization speed
+improvements from Chirs Matrakidis.</font></li>
+
+  <li> <font color="#ff0000">When comparing
+quantizations with the same number of bands with audible distortion,
+use the one with the largest scalefactors, not the first one outer_loop
+happened to find.</font></li>
+
+  <li> Improved defination of best quantization when using -f
+(fast mode).</li>
+
+  <li> subblock code now working.&nbsp; But no algorithm to
+choose subblock gains yet.</li>
+
+  <li> Linux now segfaults on floating point
+exceptions.&nbsp; Should prevent me from releasing binaries that
+crash on other operating systems.</li>
+
+</ul>
+
+<h3> LAME 3.04 May 22 1999</h3>
+
+<ul>
+
+  <li>Preliminary documentation from Gabriel Bouvigne.</li>
+
+  <li> <font color="#3366ff">I wouldn't have
+thought it was possible, but now there are even more speed improvements
+from Chris Matrakidis!&nbsp; Removed one FFT when using joint
+stereo, and many improvements in loop.c.</font></li>
+
+  <li> "Fake" ms_stereo mode renamed "Force" ms_stereo since it
+forces mid/side stereo on all frames.&nbsp; For some music this is
+said to be a problem, but for most music mode is probably better than
+the default jstereo because it uses specialized mid/side channel
+masking thresholds.</li>
+
+  <li> Small bugs in Force ms_stereo mode fixed.</li>
+
+  <li> Compaq Alpha fixes from Nathan Slingerland.</li>
+
+  <li> <font color="#ff0000">Some new experimental
+pre-echo detection formulas in l3psy.c (#ifdef AWS and #ifdef ENER_AWS,
+both off by default.&nbsp; Thanks to Gabriel Bouvigne and Andre
+Osterhues)</font></li>
+
+  <li> Several bugs in the syncing of data displayed by mp3x (the
+frame analyzer) were fixed.</li>
+
+  <li> highq (-h) option added.&nbsp; This turns on things
+(just one so far) that should sound better but slow down LAME.</li>
+
+</ul>
+
+<h3>LAME 3.03 May 18 1999 </h3>
+
+<ul>
+
+  <li> <font color="#3366ff">Faster (20%) &amp;
+cleaner FFT (Thanks to Chris Matrakidis&nbsp;
+http://www.geocities.com/ResearchTriangle/8869/fft_summary.html)</font></li>
+
+  <li> mods so it works with VC++ (Thanks to Gabriel Bouvigne,
+www.mp3tech.org)</li>
+
+  <li> MP3s marked "original" by default&nbsp; (Thanks to
+Gabriel Bouvigne, www.mp3tech.org)</li>
+
+  <li> Can now be compiled into a BladeEnc compatible
+.DLL&nbsp;&nbsp; (Thanks to&nbsp; Albert Faber, CDex author)</li>
+
+  <li> Patches for "silent mode" and stdin/stdout&nbsp;
+(Thanks to Lars Magne Ingebrigtsen)</li>
+
+  <li> <font color="#ff0000">Fixed rare bug: if a
+long_block is sandwiched between two short_blocks, it must be changed
+to a short_block, but the short_block ratios have not been computed in
+l3psy.c.&nbsp; Now always compute short_block ratios just in case.</font></li>
+
+  <li> <font color="#ff0000">Fixed bug with initial
+quantize step size when many coefficients are zero.&nbsp; (Thanks
+to Martin Weghofer).</font></li>
+
+  <li> Bug fixed in MP3x display of audible distortion.</li>
+
+  <li> improved status display (Thanks to Lauri Ahonen).</li>
+
+</ul>
+
+<h3> LAME 3.02 May 12 1999</h3>
+
+<ul>
+
+  <li> <font color="#ff0000">encoder could use
+ms_stereo even if channel 0 and 1 block types were different.&nbsp;
+(Thanks to Jan Rafaj)</font></li>
+
+  <li> <font color="#ff0000">added -k option to
+disable the 16 kHz cutoff at 128kbs.&nbsp; This cutoff is never
+used at higher bitrates. (Thanks to Jan Rafaj)</font></li>
+
+  <li> <font color="#ff0000">modified pe bit
+allocation formula to make sense at bit rates other than 128kbs.</font></li>
+
+  <li> fixed l3_xmin initialization problem which showed up under
+FreeBSD.&nbsp; (Thanks to Warren Toomey)</li>
+
+</ul>
+
+<h3><b>LAME 3.01 May 11 1999</b> </h3>
+
+<ul>
+
+  <li> max_name_size increased to 300&nbsp; (Thanks to Mike
+Oliphant)</li>
+
+  <li> patch to allow seeks on input file (Thanks to Scott Manley)</li>
+
+  <li> fixes for mono modes (Thanks to everyone who pointed this
+out)</li>
+
+  <li> overflow in calc_noise2 fixed</li>
+
+  <li> bit reservoir overflow when encoding lots of frames with
+all zeros&nbsp; (Thanks to Jani Frilander)</li>
+
+</ul>
+
+<hr>
+
+<h3>LAME 3.0 May 10 1999</h3>
+
+<ul>
+
+  <li><font color="#ff0000">added GPSYCHO (developed
+by Mark Taylor)</font></li>
+
+  <li> <font color="#000000">added MP3x (developed
+by Mark Taylor)</font></li>
+
+  <li> LAME now maintained by Mark Taylor</li>
+
+</ul>
+
+<h3>November 8 1998</h3>
+<ul>
+
+  <li> Version 2.1f released</li>
+
+  <li> 50% faster filter_subband() routine in encode.c
+contributed by James Droppo</li>
+
+</ul>
+
+<h3>November 2 1998</h3>
+<ul>
+
+  <li> Version 2.1e released.</li>
+
+  <li> New command line switch <b>-a</b>
+auto-resamples a stereo input file to mono.</li>
+
+  <li> New command line switch <b>-r</b> resamples
+from 44.1 kHz to 32 kHz [this switch doesn't work really well. Very
+tinny sounding output files. Has to do with the way I do the resampling
+probably]</li>
+
+  <li> Both of these were put into the ISO code in the encode.c
+file, and are simply different ways of filling the input buffers from a
+file.</li>
+
+</ul>
+
+<h3>October 31 1998</h3>
+<ul>
+
+  <li> Version 2.1d released</li>
+
+  <li> Fixed memory alloc in musicin.c (for l3_sb_sample)</li>
+
+  <li> Added new command line switch (-x) to force swapping of
+byte order</li>
+
+  <li> Cleaned up memory routines in l3psy.c. All the mem_alloc()
+and free() routines where changed so that it was only done <i>once</i>
+and not every single time the routine was called.</li>
+
+  <li> Added a compile time switch -DTIMER that includes all
+timing info. It's a switch for the time being until some other people
+have tested on their system. Timing code has a tendency to do different
+things on different platforms.</li>
+
+</ul>
+
+<h3>October 18 1998</h3>
+<ul>
+
+  <li> Version 2.1b released.</li>
+
+  <li> Fixed up bug: all PCM files were being read as WAV.</li>
+
+  <li> Played with the mem_alloc routine to fix crash under
+amigaos (just allocating twice as much memory as needed). Might see if
+we can totally do without this routine. Individual malloc()s where they
+are needed instead</li>
+
+  <li> Put Jan Peman's quality switch back in. This reduces
+quality via the '-q&nbsp;&lt;int&gt;' switch. Fun speedup which is
+mostly harmless if you're not concerned with quality.</li>
+
+  <li> Compiling with amiga-gcc works fine</li>
+
+</ul>
+
+<h3>October 16 1998</h3>
+<ul>
+
+  <li> Version 2.1a released. User input/output has been cleaned
+up a bit. WAV file reading is there in a very rudimentary sense ie the
+program will recognize the header and skip it, but not read it. The WAV
+file is assumed to be 16bit stereo 44.1 kHz.</li>
+
+</ul>
+
+<h3>October 6 1998</h3>
+<ul>
+
+  <li> Version 2.1 released with all tables now incorporated into
+the exe. Thanks to <b>Lars Magne Ingebrigtseni</b></li>
+
+</ul>
+
+<h3>October 4 1998</h3>
+
+<ul>
+  <li>
+    In response to some concerns about the quality of the encoder, I
+    have rebuilt the encoder from scratch and carefully compared output
+    at all stages with the output of the unmodified ISO encoder.
+  </li>
+  <li>
+    <a href="http://www.uq.net.au/%7Ezzmcheng/lame/download.html">
+    Version 2.0</a> of LAME is built from the ISO source code (dist10),
+    and incorporates modifications from myself and the 8hz effort. The
+    output file from LAME v2.0 is <em>identical</em> to the output of
+    the ISO encoder for my test file. Since I do not have heaps of time,
+    I left the ISO AIFF file reader in the code, and did not incorporate
+    a WAV file reader.
+  </li>
+  <li>
+    Added section
+    on <a href="http://www.uq.net.au/%7Ezzmcheng/lame/quality.html">
+    quality</a>.
+  </li>
+</ul>
+
+<h3> October 1 1998</h3>
+<ul>
+  <li>Updated web page and released LAME v1.0</li>
+</ul>
+
+<hr>
+
+<h3>Up to September 1998</h3>
+<p>Working on the 8hz source code...</p>
+<ul>
+  <li>
+    Patched the <a href="http://www.8hz.com/">8hz</a> source
+    code
+  </li>
+  <li>
+    45% faster than original source (on my freebsd p166).
+    <ul>
+      <li>
+	m1 - sped up the mdct.c and quantize() functions [MDCTD,
+	MDCTD2, LOOPD]
+      </li>
+      <li>m2 - sped up the filter_subband routine using <b>Stephane
+	  Tavenard</b>'s work from musicin [FILTST]
+      </li>
+      <li>m2 - minor cleanup of window_subband [WINDST2]</li>
+      <li>m2 - Cleaned up a few bits in l3psy.c. Replaced a sparse
+	matrix multiply with a hand configured unrolling [PSYD]</li>
+      <li>m3 - (amiga only) Added in the asm FFT for m68k (based on
+	sources from <b>Henryk Richter</b> and <b>Stephane Tavenard</b>)</li>
+      <li>m4 - raw pcm support back in</li>
+      <li>m5 - put in a byte-ordering switch for raw PCM reading (just
+	in case)</li>
+      <li>m6 - reworked the whole fft.c file. fft now 10-15%
+	faster.</li>
+      <li>m7 - totally new fft routine. exploits fact that this is a
+	real-&gt;complex fft. About twice as fast as previous fastest fft (in
+	m6). (C fft routine is faster than the asm one on an m68k!)</li>
+      <li>m8
+	<ul>
+	  <li>
+	    Now encodes from stdin. Use '-' as the input filename.  Thanks
+	    to <b>Brad Threatt</b>
+	  </li>
+	  <li>
+	    Worked out that the 1024point FFT only ever uses the first 6
+	    phi values, and the first 465 energy values. Saves a bunch of
+	    calculations.
+	  </li>
+	  <li>
+	    Added a speed-up/quality switch. Speed is increased but
+	    quality is decreased <i>slightly</i>. My ears are bad enough
+	    not to be able to notice the difference in quality at low
+	    settings :). Setting '-q 1' improves speed by about 10%. '-q
+	    100' improves speed by about 26%. Enoding of my test track
+	    goes from 111s (at default '-q 0') to 82s (at -q 100). Thanks
+	    to <b>Jan Peman</b> for this tip.
+	  </li>
+	</ul>
+      </li>
+      <li>
+	m9 - fixed an error in l3psy.c. numlines[] is overwritten with
+	incorrect data. Added a new variable numlines_s[] to fix
+	this. Thanks again to <b>Jan Peman</b>.
+      </li>
+      <li>
+	m10 - Down to 106 seconds by selecting a few more compiler
+	options. Also added a pow20() function in l3loop.c to speed up
+	(ever so slightly) calls to pow(2.0, x)
+      </li>
+      
+      <li>m11
+	<ul>
+          <li>
+	    No speedups. Just cleaned up some bits of the code.
+	  </li>
+          <li>
+	    Changed K&amp;R prototyping to 'normal' format.  Thanks
+	    to <b>Steffan Haeuser</b> for his help here.
+	  </li>
+          <li>
+	    Changed some C++ style comments to normal C comments in
+	    huffman.c
+	  </li>
+          <li>
+	    Removed the #warning from psy_data.h (it was getting
+	    annoying!)
+	  </li>
+          <li>
+	    Removed reference in bitstream.c to malloc.h. Is there a
+	    system left where malloc.h hasn't been superceded by
+	    stdlib.h?
+	  </li>
+	</ul>
+      </li>
+  </ul>
+
+  <li>In Progess:
+    <ul>
+      <li>
+	my PSYD hack for the spreading functions is only valid for
+	44.1 kHz - Should really put in a "if freq = 44.1 kHz"
+	switch for it. Someone might want to extend the speedup for
+	48 and 32 kHz.
+      </li>
+      <li>
+	Putting in Jan Peman's quantanf_init speedup.
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<hr>
+<center>
+<p>
+  <a href="http://validator.w3.org/check?uri=referer">
+    <img src="http://www.w3.org/Icons/valid-html401"
+	 alt="Valid HTML 4.01 Transitional" height="31" width="88">
+  </a>
+</p>
+</center>
+
+</body>
+</html>
diff --git a/doc/html/id3.html b/doc/html/id3.html
new file mode 100644
index 0000000..d2659b1
--- /dev/null
+++ b/doc/html/id3.html
@@ -0,0 +1,269 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>ID3 tags</TITLE>
+<META NAME="description" CONTENT="Command line switch reference">
+<META NAME="keywords" CONTENT="lame">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT=#000000
+        BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C
+        ALINK=#995500>
+<H1>ID3 tags</H1>
+<p>&nbsp;</p>
+<p>LAME is able to embed ID3 v1, v1.1 or v2 tags inside the encoded MP3 file. 
+  This allows to have some usefull information about the music track included 
+  inside the file. Those data can be read by most MP3 players.<br>
+  <br>
+  LAME will smartly choose wich tags to use. It will add ID3 v2 tags only if the 
+  input comments won't fint in v1 or v1.1 tags, ie if they are more than 30 characters. 
+  In this case, both v1 and v2 tags will be added, to ensure reading of tags by 
+  MP3 players wich are unable to read ID3 v2 tags.</p>
+<P> 
+<TABLE CELLPADDING=3 BORDER="1">
+  <TR VALIGN="TOP"> 
+    <TD ALIGN="LEFT" nowrap><b>ID3 comments switches</b></TD>
+    <TD ALIGN="LEFT" nowrap><b>parameters</b></TD>
+  </TR>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--tt "title"</kbd></td>
+    <td align="LEFT" nowrap>title of song</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--ta "artist"</kbd></td>
+    <td align="LEFT" nowrap>artist who did the song</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--tl "album"</kbd></td>
+    <td align="LEFT" nowrap>album where it came from</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--ty "year"</kbd></td>
+    <td align="LEFT" nowrap>year in which the song/album was made</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--tc "comment"</kbd></td>
+    <td align="LEFT" nowrap>additional info</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--tn "track[/total]"</kbd></td>
+    <td align="LEFT" nowrap>audio/song track number and (optionally) the total
+     number of tracks on the original recording.</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--tg "genre"</kbd></td>
+    <td align="LEFT" nowrap> genre of song (name or number)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--ti "file"</kbd></td>
+    <td align="LEFT" nowrap> audio/song albumArt (jpeg/png/gif file, 128KB max, v2.3 tag)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--tv "id=value"</kbd></td>
+    <td align="LEFT" nowrap> user-defined frame specified by id and value (v2.3 tag)</td>
+  </tr>
+</table>
+<br>
+<br>
+<TABLE CELLPADDING=3 BORDER="1">
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><b>ID3 behaviour switches</b></td>
+    <td align="LEFT" nowrap>&nbsp; </td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--add-id3v2</kbd></td>
+    <td align="LEFT" nowrap> force addition of version 2 tag</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--id3v1-only</kbd></td>
+    <td align="LEFT" nowrap> add only a version 1 tag</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--id3v2-only</kbd></td>
+    <td align="LEFT" nowrap> add only a version 2 tag</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--space-id3v1</kbd></td>
+    <td align="LEFT" nowrap> pad version 1 tags with spaces instead of nulls</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--pad-id3v2</kbd></td>
+    <td align="LEFT" nowrap> same as '--pad-id3v2-size 128'</td>
+  </tr>
+  <tr valign="TOP">
+    <td align="LEFT" nowrap=""><kbd>--pad-id3v2-size "num"</kbd></td>
+    <td align="LEFT" nowrap=""> adds version 2 tag, pad with extra "num" bytes</td>
+  </tr>
+  <tr valign="TOP">
+    <td align="LEFT" nowrap><kbd>--ignore-tag-errors</kbd></td>
+    <td align="LEFT" nowrap> ignore errors in values passed for tags, use defaults in case an error occours</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd>--genre-list</kbd></td>
+    <td align="LEFT" nowrap> print alphabetically sorted ID3 genre list and exit</td>
+  </tr>
+</TABLE>
+<p><br>
+  The following genres are supported:<br>
+  <br>
+</p>
+<table width="80%" border="0">
+  <tr valign="top" align="left"> 
+    <td>00 - Blues<br>
+      01 - Classic Rock<br>
+      02 - Country<br>
+      03 - Dance<br>
+      04 - Disco<br>
+      05 - Funk<br>
+      06 - Grunge<br>
+      07 - Hip-Hop<br>
+      08 - Jazz<br>
+      09 - Metal<br>
+      10 - New Age<br>
+      11 - Oldies<br>
+      12 - Other<br>
+      13 - Pop<br>
+      14 - R&B<br>
+      15 - Rap<br>
+      16 - Reggae<br>
+      17 - Rock<br>
+      18 - Techno<br>
+      19 - Industrial<br>
+      20 - Alternative<br>
+      21 - Ska<br>
+      22 - Death Metal<br>
+      23 - Pranks<br>
+      24 - Soundtrack<br>
+      25 - Euro-Techno<br>
+      26 - Ambient<br>
+      27 - Trip-Hop<br>
+      28 - Vocal<br>
+      29 - Jazz+Funk<br>
+      30 - Fusion<br>
+      31 - Trance<br>
+      32 - Classical<br>
+      33 - Instrumental<br>
+      34 - Acid<br>
+      35 - House<br>
+      36 - Game<br>
+      37 - Sound Clip<br>
+      38 - Gospel<br>
+      39 - Noise<br>
+      40 - Alternative Rock<br>
+      41 - Bass<br>
+      43 - Punk<br>
+      44 - Space<br>
+      45 - Meditative<br>
+      46 - Instrumental Pop<br>
+      47 - Instrumental Rock<br>
+      48 - Ethnic<br>
+      49 - Gothic<br>
+      50 - Darkwave<br>
+      51 - Techno-Industrial<br>
+      52 - Electronic<br>
+      53 - Pop-Folk<br>
+      54 - Eurodance<br>
+      55 - Dream<br>
+      56 - Southern Rock<br>
+      57 - Comedy<br>
+      58 - Cult<br>
+      59 - Gangsta<br>
+      60 - Top 40<br>
+      61 - Christian Rap<br>
+      62 - Pop/Funk<br>
+      63 - Jungle<br>
+      64 - Native US<br>
+      65 - Cabaret<br>
+      66 - New Wave<br>
+      67 - Psychedelic<br>
+      68 - Rave<br>
+      69 - Showtunes<br>
+      70 - Trailer<br>
+      71 - Lo-Fi<br>
+      72 - Tribal<br>
+      73 - Acid Punk<br>
+      74 - Acid Jazz<br>
+      75 - Polka<br>
+      76 - Retro<br>
+      77 - Musical<br>
+      78 - Rock & Roll<br>
+      79 - Hard Rock<br>
+      80 - Folk<br>
+      81 - Folk-Rock<br>
+      82 - National Folk<br>
+      83 - Swing<br>
+      84 - Fast Fusion<br>
+      85 - Bebob<br>
+      86 - Latin<br>
+      87 - Revival<br>
+      88 - Celtic<br>
+      89 - Bluegrass<br>
+      90 - Avantgarde<br>
+      91 - Gothic Rock<br>
+      92 - Progressive Rock<br>
+      93 - Psychedelic Rock<br>
+      94 - Symphonic Rock<br>
+      95 - Slow Rock<br>
+      96 - Big Band<br>
+      97 - Chorus<br>
+      98 - Easy Listening<br>
+      99 - Acoustic </td>
+    <td>100 - Humour<br>
+      101 - Speech<br>
+      102 - Chanson<br>
+      103 - Opera<br>
+      104 - Chamber Music<br>
+      105 - Sonata<br>
+      106 - Symphony<br>
+      107 - Booty Bass<br>
+      108 - Primus<br>
+      109 - Porn Groove<br>
+      110 - Satire<br>
+      111 - Slow Jam<br>
+      112 - Club<br>
+      113 - Tango<br>
+      114 - Samba<br>
+      115 - Folklore<br>
+      116 - Ballad<br>
+      117 - Power Ballad<br>
+      118 - Rhythmic Soul<br>
+      119 - Freestyle<br>
+      120 - Duet<br>
+      121 - Punk Rock<br>
+      122 - Drum Solo<br>
+      123 - A Cappella<br>
+      124 - Euro-House<br>
+      125 - Dance Hall<br>
+      126 - Goa<br>
+      127 - Drum & Bass<br>
+      128 - Club-House<br>
+      129 - Hardcore<br>
+      130 - Terror<br>
+      131 - Indie<br>
+      132 - BritPop<br>
+      133 - Negerpunk<br>
+      134 - Polsk Punk<br>
+      135 - Beat<br>
+      136 - Christian Gangsta<br>
+      137 - Heavy Metal<br>
+      138 - Black Metal<br>
+      139 - Crossover<br>
+      140 - Contemporary Christian<br>
+      141 - Christian Rock<br>
+      142 - Merengue<br>
+      143 - Salsa<br>
+      144 - Thrash Metal<br>
+      145 - Anime<br>
+      146 - JPop<br>
+      147 - SynthPop</td>
+  </tr>
+</table>
+<p><br>
+  <br>
+  <br>
+</p>
+</BODY>
+</HTML>
diff --git a/doc/html/index.html b/doc/html/index.html
new file mode 100644
index 0000000..a23c241
--- /dev/null
+++ b/doc/html/index.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>LAME V3 Next Generation High-End MPEG Layer III Encoding</TITLE>
+<META NAME="description" CONTENT="LAME V3 Next Generation High-End MPEG Layer III Encoding">
+<META NAME="keywords" CONTENT="lame">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT=#000000
+        BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C
+        ALINK=#995500>
+<FONT FACE = Helvetica > 
+<P> 
+<H1 ALIGN="CENTER"><FONT SIZE="+4"><i><font face="Arial, Helvetica, sans-serif">LAME</font></i><font face="Arial, Helvetica, sans-serif"> 
+  V3.98<BR>
+  </font></FONT> 
+  <P><font size="+4" face="Arial, Helvetica, sans-serif"> <BR>
+    </font> <font face="Arial, Helvetica, sans-serif"><BIG>L<font color="#3366FF">ame</font> 
+    A<font color="#3366FF">in't an</font> M<font color="#3366FF">P3</font> E<font color="#3366FF">ncoder</font></BIG></font> 
+  <P><BIG> <BR>
+    </BIG> 
+</H1>
+<P ALIGN="CENTER"><STRONG>Open Source Project <BR>
+  <A HREF="http://www.mp3dev.org">http://www.mp3dev.org</A> </STRONG></P>
+<P ALIGN="LEFT"></P>
+<P> 
+<DIV ALIGN="LEFT"> 
+  <P> 
+</DIV>
+<BR>
+<HR>
+<br>
+<LI><A HREF="node6.html#SECTION00310000000000000000"> Introduction</A> 
+  <UL>
+    <LI><A HREF="node6.html#SECTION00311000000000000000"> The purpose of audio 
+      compression</A> 
+    <LI><A HREF="node6.html#SECTION00312000000000000000"> The two parts of audio 
+      compression</A> 
+    <LI><A HREF="node6.html#SECTION00313000000000000000"> Compression ratios, 
+      bitrate and quality</A> 
+  </UL>
+<LI><A HREF="examples.html"> Some command line examples</A> 
+<LI><A HREF="modes.html"> CBR, ABR and VBR: the 3 encoding modes</A> 
+<LI><a href="basic.html">Basic command line switch reference</a> 
+<LI><a href="switchs.html">Full command line switch reference</a> 
+<LI><a href="id3.html">ID3 tags</a> 
+<LI><a href="history.html">History</a> 
+<LI><a href="contributors.html">Contributors</a><BR>
+</font> 
+</BODY>
+</HTML>
diff --git a/doc/html/lame.css b/doc/html/lame.css
new file mode 100644
index 0000000..a9c3ebd
--- /dev/null
+++ b/doc/html/lame.css
@@ -0,0 +1,24 @@
+BODY {
+        font-family: Arial, Helvetica, sans-serif;
+        position: absolute;
+        padding-left: 1cm;
+        margin-left: 1cm;
+     }
+
+h1, h2, h3 {
+        margin-left: -1cm; text-align: left
+        }
+
+TABLE { text-align: left; font-family: Arial, Helvetica, sans-serif;}
+TH {background-color: #C0C0C0}
+TD {font-family: Arial, Helvetica, sans-serif;}
+
+SMALL.TINY		{ font-size : xx-small }
+SMALL.SCRIPTSIZE	{ font-size : xx-small }
+SMALL.FOOTNOTESIZE	{ font-size : x-small  }
+SMALL.SMALL		{ font-size : small    }
+BIG.LARGE		{ font-size : large    }
+BIG.XLARGE		{ font-size : x-large  }
+BIG.XXLARGE		{ font-size : xx-large }
+BIG.HUGE		{ font-size : xx-large }
+BIG.XHUGE		{ font-size : xx-large }
diff --git a/doc/html/modes.html b/doc/html/modes.html
new file mode 100644
index 0000000..9c7707a
--- /dev/null
+++ b/doc/html/modes.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>Encoding modes</TITLE>
+<META NAME="description" CONTENT="Command line switch reference">
+<META NAME="keywords" CONTENT="lame">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT=#000000
+        BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C
+        ALINK=#995500>
+<H1>CBR/ABR/VBR: the 3 encoding modes</H1>
+<p>&nbsp;</p>
+<p>LAME is able to encode your music using one of its 3 encoding modes: constant 
+  bitrate (CBR), average bitrate (ABR) and variable bitrate (VBR).<br>
+  <br>
+  <br>
+</p>
+<h2>Constant Bitrate (CBR)</h2>
+<p>This is the default encoding mode, and also the most basic. In this mode, the 
+  bitrate will be the same for the whole file. It means that each part of your 
+  mp3 file will be using the same number of bits. The musical passage beeing a 
+  difficult one to encode or an easy one, the encoder will use the same bitrate, 
+  so the quality of your mp3 is variable. Complex parts will be of a lower quality 
+  than the easiest ones. The main advantage is that the final files size won't 
+  change and can be accurately predicted.<br>
+  <br>
+</p>
+<h2>Average Bitrate (ABR)</h2>
+<p>In this mode, you choose a target bitrate and the encoder will try to constantly 
+  maintain an average bitrate while using higher bitrates for the parts of your 
+  music that need more bits. The result will be of higher quality than CBR encoding 
+  while the average file size will remain predictible, so this mode is highly 
+  recommended over CBR.<br>
+  <br>
+</p>
+<h2>Variable bitrate (VBR)</h2>
+<p>In this mode, you choose the desired quality on a scale going from 9 (lowest 
+  quality/highest distortion) to 0 (highest quality/lowest distortion). Then encoder 
+  tries to maintain the given quality in the whole file by choosing the optimal 
+  number of bits to spend for each part of your music. The main advantage is that 
+  you are able to specify the quality level that you want to reach, but the inconvenient 
+  is that the final file size is totally unpredictible.</p>
+</BODY>
+</HTML>
diff --git a/doc/html/node6.html b/doc/html/node6.html
new file mode 100644
index 0000000..9159790
--- /dev/null
+++ b/doc/html/node6.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>Introduction</TITLE>
+<META NAME="description" CONTENT="Introduction">
+<META NAME="keywords" CONTENT="lame">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT=#000000
+        BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C
+        ALINK=#995500>
+<FONT FACE = Helvetica ><strong>Subsections</strong>
+<UL>
+  <LI><A 
+ HREF="node6.html#SECTION00311000000000000000"> The purpose of audio compression</A> 
+  <LI><A 
+ HREF="node6.html#SECTION00312000000000000000"> The two parts of audio compression</A> 
+  <LI><A 
+ HREF="node6.html#SECTION00313000000000000000"> Compression ratios, bitrate and 
+    quality</A> 
+</UL>
+
+<HR>
+<H1><A NAME="SECTION00310000000000000000"> Introduction</A> </H1>
+There is a lot of confusion surrounding the terms <I>audio compression</I>, <I>audio 
+encoding</I>, and <I>audio decoding</I>. This section will give you an overview 
+what audio coding (another one of these terms...) is all about. 
+<P> 
+<H2><A NAME="SECTION00311000000000000000"> The purpose of audio compression</A> 
+</H2>
+<P> Up to the advent of audio compression, high-quality digital audio data took 
+  a lot of hard disk space to store. Let us go through a short example. 
+<P> You want to, say, sample your favorite 1-minute song and store it on your 
+  harddisk. Because you want CD quality, you sample at 44.1 kHz, stereo, 
+  with 16 bits per sample. 
+<P> 44100 Hz means that you have 44100 values per second coming in from your sound 
+  card (or input file). Multiply that by two because you have two channels. Multiply 
+  by another factor of two because you have two bytes per value (that's what 16 
+  bit means). The song will take up <NOBR>44100 samples/s &middot; 2 channels 
+  &middot; 2 bytes/sample &middot; 60 s/min ~ 10 MBytes</NOBR> of storage space 
+  on your harddisk. 
+<P> If you wanted to download that over the internet, given an average 56k&nbsp;modem 
+  connected at 44k (which is a typical case), it would take you (at least) <NOBR>10000000 
+  bytes &middot; 8 bits/byte / (44000 bits/s) &middot; / (60 s/min) ~ 30 minutes</NOBR> 
+<DIV ALIGN="CENTER"> <B>Just to download one minute of music!</B> </DIV>
+<P> Digital audio coding, which - in this context - is synonymously called digital 
+  audio compression as well, is the art of minimizing storage space (or channel 
+  bandwidth) requirements for audio data. Modern perceptual audio coding techniques 
+  (like MPEG Layer III) exploit the properties of the human ear (the perception 
+  of sound) to achieve a size reduction by a factor of 11 with little or no perceptible 
+  loss of quality. 
+<P> Therefore, such schemes are the key technology for high quality low bit-rate 
+  applications, like soundtracks for CD-ROM games, solid-state sound memories, 
+  Internet audio, digital audio broadcasting systems, and the like. 
+<P> 
+<H2><A NAME="SECTION00312000000000000000"> The two parts of audio compression</A> 
+</H2>
+<P> Audio compression really consists of two parts. The first part, called <I>encoding</I>, 
+  transforms the digital audio data that resides, say, in a WAVE file, into a 
+  highly compressed form called <I>bitstream</I>. To play the bitstream on your 
+  soundcard, you need the second part, called <I>decoding</I>. Decoding takes 
+  the bitstream and re-expands it to a WAVE file. 
+<P> The program that effects the first part is called an audio <I>encoder</I>. 
+  <i>LAME</i> is such an encoder . The program that does the second part is called 
+  an audio <I>decoder</I>. One well-known MPEG&nbsp;Layer III decoder is <tt>Xmms</tt>, 
+  another <TT>mpg123</TT>. Both can be found on <A NAME="tex2html1"
+ HREF="http://www.mp3-tech.org">ww.mp3-tech.org</A> . 
+<H2><A NAME="SECTION00313000000000000000"> Compression ratios, bitrate and quality</A> 
+</H2>
+<P> It has not been explicitly mentioned up to now: What you end up with after 
+  encoding and decoding is not the same sound file anymore: All superflous information 
+  has been squeezed out, so to say. It is not the same <I>file</I>, but it will 
+  <I>sound</I> the same - more or less, depending on how much compression had 
+  been performed on it. 
+<P> Generally speaking, the lower the compression ratio achieved, the better the 
+  sound quality will be in the end - and <I>vice versa</I>. Table <A HREF="node6.html#table-soundq">1.1</A> 
+  gives you an overview about quality achievable. 
+<P> Because compression ratio is a somewhat unwieldy measure, experts use the 
+  term <I>bitrate</I> when speaking of the strength of compression. Bitrate denotes 
+  the average number of bits that one second of audio data will take up in your 
+  compressed bitstream. Usually the units used will be kbps, which is <SUP>kbits</SUP>/<SUB>s</SUB>, 
+  or 1000&nbsp;<SUP>bits</SUP>/<SUB>s</SUB>. To calculate the number of bytes 
+  per second of audio data, simply divide the number of bits per second by eight. 
+<P> <BR>
+<DIV ALIGN="CENTER"><A NAME="table-soundq">&#160;</A> <A NAME="95">&#160;</A> 
+  <TABLE CELLPADDING=3 BORDER="1" width="512" height="225">
+    <CAPTION><STRONG>Table 1.1:</STRONG> Bitrate versus sound quality</CAPTION>
+    <TR VALIGN="TOP"> 
+      <TD ALIGN="RIGHT" nowrap width="115">Bitrate</TD>
+      <TD ALIGN="RIGHT" nowrap width="67">Bandwidth</TD>
+      <TD ALIGN="LEFT" nowrap width="246">Quality comparable to or better than</TD>
+    </TR>
+    <TR VALIGN="TOP"> 
+      <TD ALIGN="RIGHT" nowrap width="115">16 kbps</TD>
+      <TD ALIGN="RIGHT" nowrap width="67">4.5 kHz</TD>
+      <TD ALIGN="LEFT" nowrap width="246">shortwave radio</TD>
+    </TR>
+    <TR VALIGN="TOP"> 
+      <TD ALIGN="RIGHT" nowrap width="115">32 kbps</TD>
+      <TD ALIGN="RIGHT" nowrap width="67">7.5 kHz</TD>
+      <TD ALIGN="LEFT" nowrap width="246">AM radio</TD>
+    </TR>
+    <TR VALIGN="TOP"> 
+      <TD ALIGN="RIGHT" nowrap width="115">96 kbps</TD>
+      <TD ALIGN="RIGHT" nowrap width="67">11 kHz</TD>
+      <TD ALIGN="LEFT" nowrap width="246">FM radio</TD>
+    </TR>
+    <tr valign="TOP"> 
+      <td align="RIGHT" nowrap width="115">128 kbps</td>
+      <td align="RIGHT" nowrap width="67">16 kHz</td>
+      <td align="LEFT" nowrap width="246">near CD</td>
+    </tr>
+    <tr valign="TOP"> 
+      <td align="RIGHT" nowrap width="115">160-180 kbps <br>
+        (variable bitrate)</td>
+      <td align="RIGHT" nowrap width="67">20 kHz</td>
+      <td align="LEFT" nowrap width="246">perceptual transparency</td>
+    </tr>
+    <TR VALIGN="TOP"> 
+      <TD ALIGN="RIGHT" nowrap width="115">256 kbps</TD>
+      <TD ALIGN="RIGHT" nowrap width="67">22 kHz</TD>
+      <TD ALIGN="LEFT" nowrap width="246">studio</TD>
+    </TR>
+  </TABLE>
+</DIV>
+<BR>
+</font> 
+</BODY>
+</HTML>
diff --git a/doc/html/switchs.html b/doc/html/switchs.html
new file mode 100644
index 0000000..d22521c
--- /dev/null
+++ b/doc/html/switchs.html
@@ -0,0 +1,1133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>Full command line switch reference</TITLE>
+<META NAME="description" CONTENT="Command line switch reference">
+<META NAME="keywords" CONTENT="lame">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
+<LINK REL="STYLESHEET" HREF="lame.css">
+</HEAD>
+<BODY TEXT=#000000
+        BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C
+        ALINK=#995500>
+<H1>Full command line switch reference</H1>
+<P> <font size="-1">note: Options which could exist without being documented 
+  here are considered as experimental ones. Such experimental options should usually 
+  not be used.</font> 
+<P> 
+<TABLE CELLPADDING=3 BORDER="1">
+  <TR VALIGN="TOP"> 
+    <TD ALIGN="LEFT" nowrap><b>switch</b></TD>
+    <TD ALIGN="LEFT" nowrap><b>parameter</b></TD>
+  </TR>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#a">-a</a></kbd></td>
+    <td align="LEFT" nowrap>downmix stereo file to mono</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-abr">--abr</a></kbd></td>
+    <td align="LEFT" nowrap>average bitrate encoding</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#b">-b</a></kbd></td>
+    <td align="LEFT" nowrap>bitrate (8...320)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#Bmax">-B</a></kbd></td>
+    <td align="LEFT" nowrap>max VBR/ABR bitrate (8...320)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-bitwidth">--bitwidth</a></kbd></td>
+    <td align="LEFT" nowrap>input bit width</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#c">-c</a></kbd></td>
+    <td align="LEFT" nowrap>copyright</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-cbr">--cbr</a></kbd></td>
+    <td align="LEFT" nowrap>enforce use of constant bitrate</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-clipdetect">--clipdetect</a></kbd></td>
+    <td align="LEFT" nowrap>clipping detection</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-comp">--comp</a></kbd></td>
+    <td align="LEFT" nowrap>choose compression ratio</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-decode">--decode</a></kbd></td>
+    <td align="LEFT" nowrap>decoding only</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-disptime">--disptime</a></kbd></td>
+    <td align="LEFT" nowrap>time between display updates</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#e">-e</a></kbd></td>
+    <td align="LEFT" nowrap>de-emphasis (<b>n</b>, 5, c)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#f">-f</a></kbd></td>
+    <td align="LEFT" nowrap> fast mode</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#FF">-F</a></kbd></td>
+    <td align="LEFT" nowrap> strictly enforce the -b option</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-freeformat">--freeformat</a></kbd></td>
+    <td align="LEFT" nowrap> free format bitstream</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#h">-h</a></kbd></td>
+    <td align="LEFT" nowrap>high quality</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-help">--help</a></kbd></td>
+    <td align="LEFT" nowrap> help</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-highpass">--highpass</a></kbd></td>
+    <td align="LEFT" nowrap> highpass filtering frequency in kHz</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-highpass">--highpass-width</a></kbd></td>
+    <td align="LEFT" nowrap> width of highpass filtering in kHz</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-lowpass">--lowpass</a></kbd></td>
+    <td align="LEFT" nowrap> lowpass filtering frequency in kHz</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-lowpass-width">--lowpass-width</a></kbd></td>
+    <td align="LEFT" nowrap> width of lowpass filtering in kHz</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#m">-m</a></kbd></td>
+    <td align="LEFT" nowrap>stereo mode (s, <b>j</b>, f, m)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-mp1input">--mp1input</a></kbd></td>
+    <td align="LEFT" nowrap>MPEG Layer I input file</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-mp2input">--mp2input</a></kbd></td>
+    <td align="LEFT" nowrap>MPEG Layer II input file</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-mp3input">--mp3input</a></kbd></td>
+    <td align="LEFT" nowrap>MPEG Layer III input file</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-noasm">--noasm</a></kbd></td>
+    <td align="LEFT" nowrap>disable assembly optimizations (mmx/3dnow/sse)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-nohist">--nohist</a></kbd></td>
+    <td align="LEFT" nowrap>disable histogram display</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-noreplaygain">--noreplaygain</a></kbd></td>
+    <td align="LEFT" nowrap>disable ReplayGain analysis</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-nores">--nores</a></kbd></td>
+    <td align="LEFT" nowrap>disable bit reservoir</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-notemp">--notemp</a></kbd></td>
+    <td align="LEFT" nowrap>disable temporal masking</td>
+  </tr>
+  <TR VALIGN="TOP"> 
+    <TD ALIGN="LEFT" nowrap><kbd><a href="#o">-o</a></kbd></TD>
+    <TD ALIGN="LEFT" nowrap>non-original</TD>
+  </TR>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#p">-p</a></kbd></td>
+    <td align="LEFT" nowrap>error protection</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-preset">--preset</a></kbd></td>
+    <td align="LEFT" nowrap>use built-in preset</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-priority">--priority</a></kbd></td>
+    <td align="LEFT" nowrap>OS/2 process priority control</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#q">-q</a></kbd></td>
+    <td align="LEFT" nowrap>algorithm quality selection</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-silent">--quiet</a></kbd></td>
+    <td align="LEFT" nowrap>silent operation</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#r">-r</a></kbd></td>
+    <td align="LEFT" nowrap>input file is raw PCM</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-replaygain-accurate">--replaygain-accurate</a></kbd></td>
+    <td align="LEFT" nowrap>compute ReplayGain more accurately and find the peak sample</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-replaygain-fast">--replaygain-fast</a></kbd></td>
+    <td align="LEFT" nowrap>compute ReplayGain fast but slightly inaccurately (default)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-resample">--resample</a></kbd></td>
+    <td align="LEFT" nowrap>output sampling frequency in kHz (encoding only)</td>
+  </tr>
+  <TR VALIGN="TOP"> 
+    <TD ALIGN="LEFT" nowrap><kbd><a href="#s">-s</a></kbd></TD>
+    <TD ALIGN="LEFT" nowrap>sampling frequency in kHz</TD>
+  </TR>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-silent">-S</a></kbd></td>
+    <td align="LEFT" nowrap>silent operation</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-scale">--scale</a></kbd></td>
+    <td align="LEFT" nowrap>scale input</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-scale-l">--scale-l</a></kbd></td>
+    <td align="LEFT" nowrap>scale input channel 0 (left)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-scale-r">--scale-r</a></kbd></td>
+    <td align="LEFT" nowrap>scale input channel 1 (right)</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-silent">--silent</a></kbd></td>
+    <td align="LEFT" nowrap>silent operation</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-strictly-enforce-ISO">--strictly-enforce-ISO</a></kbd></td>
+    <td align="LEFT" nowrap>strict ISO compliance</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#t">-t</a></kbd></td>
+    <td align="LEFT" nowrap>disable INFO/WAV header</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#V">-V</a></kbd></td>
+    <td align="LEFT" nowrap>VBR quality setting, integer or floating point number [0,...,10[</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-vbr-new">--vbr-new</a></kbd></td>
+    <td align="LEFT" nowrap>new VBR mode</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-vbr-old">--vbr-old</a></kbd></td>
+    <td align="LEFT" nowrap>older VBR mode</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#-verbose">--verbose</a></kbd></td>
+    <td align="LEFT" nowrap>verbosity</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#x">-x</a></kbd></td>
+    <td align="LEFT" nowrap>swapbytes</td>
+  </tr>
+  <tr valign="TOP"> 
+    <td align="LEFT" nowrap><kbd><a href="#Xquant">-X</a></kbd></td>
+    <td align="LEFT" nowrap>change quality measure</td>
+  </tr>
+</TABLE>
+<BR>
+<dl> 
+  <dt><strong>* <kbd>-a</kbd><a name="a">&nbsp;&nbsp;&nbsp;&nbsp;downmix&#160;</a></strong> 
+  <dd>Mix the stereo input file to mono and encode as mono.<br>
+    The downmix is calculated as the sum of the left and right channel, attenuated 
+    by 6 dB. <br>
+    <br>
+    This option is only needed in the case of raw PCM stereo input (because LAME 
+    cannot determine the number of channels in the input file).<br>
+    To encode a stereo PCM input file as mono, use "lame -m s -a".<br>
+    <br>
+    For WAV and AIFF input files, using "-m m" will always produce a mono .mp3 
+    file from both mono and stereo input. 
+  <dt><br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+</dl>
+<dl> 
+  <dt><strong>* <kbd>--abr n</kbd><a name="-abr">&nbsp;&nbsp;&nbsp;&nbsp;average 
+    bitrate encoding</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Turns on encoding with a targeted average bitrate of n kbits, allowing to 
+    use frames of different sizes. The allowed range of n is 8-310, you can use 
+    any integer value within that range.<br>
+    <br>
+    It can be combined with the -b and -B switches like:<br>
+    lame --abr 123 -b 64 -B 192 a.wav a.mp3<br>
+    which would limit the allowed frame sizes between 64 and 192 kbits. <br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+</dl>
+<dl> 
+  <dt><strong>* <kbd>-b n</kbd><a name="b">&nbsp;&nbsp;&nbsp;&nbsp;bitrate</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd>For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)<br>
+    n = 32,40,48,56,64,80,96,112,128,160,192,224,256,320<br>
+    <br>
+    For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)<br>
+    n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160<br>
+    <br>
+    For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)<br>
+    n = 8,16,24,32,40,48,56,64<br>
+    <br>
+    When used with variable bitrate encoding (VBR), -b specifies the minimum bitrate 
+    to be used. However, in order to avoid wasted space, the smallest frame size 
+    available will be used during silences. 
+  <dt><br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+</dl>
+<dl> 
+  <dt><strong>* <kbd>-B n</kbd><a name="Bmax">&nbsp;&nbsp;&nbsp;&nbsp;maximum 
+    VBR/ABR bitrate&nbsp;</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)<br>
+    n = 32,40,48,56,64,80,96,112,128,160,192,224,256,320<br>
+    <br>
+    For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)<br>
+    n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160<br>
+    <br>
+    For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)<br>
+    n = 8,16,24,32,40,48,56,64<br>
+    <br>
+    Specifies the maximum allowed bitrate when using VBR/ABR <br>
+    <br>
+    The use of -B is NOT RECOMMENDED. A 128kbps CBR bitstream, because of the bit reservoir, 
+    can actually have frames which use as many bits as a 320kbps frame. VBR modes 
+    minimize the use of the bit reservoir, and thus need to allow 320kbps frames 
+    to get the same flexibility as CBR streams.<br>
+    <br>
+    <i>note: If you own an mp3 hardware player build upon a MAS 3503 chip, you 
+    must set maximum bitrate to no more than 224 kpbs.</i> <br>
+</dl>
+<dl> 
+  <dt><strong>* <kbd>--bitwidth 8/16/24/32</kbd><a name="-bitwidth">&nbsp;&nbsp;&nbsp;&nbsp;input 
+    bit width&nbsp;</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Required only for raw PCM input files. Otherwise it will be determined 
+    from the header of the input file. <br>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--clipdetect</kbd><a name="-clipdetect">&nbsp;&nbsp;&nbsp;&nbsp;clipping detection</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd>
+    Enable --replaygain-accurate and print a message whether clipping 
+    occurs and how far in dB the waveform is from full scale.<br>
+    <br>
+    This option is not usable if the MP3 decoder was <b>explicitly</b>
+    disabled in the build of LAME.<br>
+    <br>
+    See also: <a href="#-replaygain-accurate">--replaygain-accurate</a>
+  <dt><br>
+    <br>
+    <hr width="50%" noshade align="center">
+    <br>
+  <dt><strong>* <kbd>--cbr</kbd><a name="-cbr">
+    &nbsp;&nbsp;&nbsp;&nbsp;enforce use of constant bitrate</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd>This switch enforces the use of constant bitrate encoding. 
+  <dt><br>
+    <br>
+    <hr width="50%" noshade align="center">
+    <br>
+  <dt><strong>* <kbd>--comp</kbd><a name="-comp">&nbsp;&nbsp;&nbsp;&nbsp;choose 
+    compression ratio</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Instead of choosing bitrate, using this option, user can choose compression 
+    ratio to achieve. 
+  <dt><br>
+    <br>
+    <hr width="50%" noshade align="center">
+    <br>
+  <dt><strong>* <kbd>--decode</kbd><a name="-decode">&nbsp;&nbsp;&nbsp;&nbsp;decoding 
+    only</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Uses LAME for decoding to a WAV file. The input file can be any input type 
+    supported by encoding, including layer I,II,III (MP3) and OGG files. In case 
+    of MPEG files, LAME uses a bugfixed version of mpglib for decoding.<br>
+    <br>
+    If -t is used (disable WAV header), Lame will output raw PCM in native endian 
+    format. You can use -x to swap bytes order. <br>
+    <br>
+    This option is not usable if the MP3 decoder was <b>explicitly</b>
+    disabled in the build of LAME.
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--disptime n</kbd><a name="-disptime">&nbsp;&nbsp;&nbsp;&nbsp;time 
+    between display updates</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Set the delay in seconds between two display updates. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-e n/5/c</kbd><a name="e">&nbsp;&nbsp;&nbsp;&nbsp;de-emphasis</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> <br>
+    n = (none, default)<br>
+    5 = 0/15 microseconds<br>
+    c = citt j.17<br>
+    <br>
+    All this does is set a flag in the bitstream. If you have a PCM input file 
+    where one of the above types of (obsolete) emphasis has been applied, you 
+    can set this flag in LAME. Then the mp3 decoder should de-emphasize the output 
+    during playback, although most decoders ignore this flag.<br>
+    <br>
+    A better solution would be to apply the de-emphasis with a standalone utility 
+    before encoding, and then encode without -e. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-f</kbd><a name="f">&nbsp;&nbsp;&nbsp;&nbsp;fast mode</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> This switch forces the encoder to use a faster encoding mode, but with 
+    a lower quality. The behaviour is the same as the -q7 switch.<br>
+    <br>
+    Noise shaping will be disabled, but psycho acoustics will still be computed 
+    for bit allocation and pre-echo detection. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-F</kbd><a name="FF">&nbsp;&nbsp;&nbsp;strictly enforce the 
+    -b option</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> This is mainly for use with hardware players that do not support low bitrate 
+    mp3.<br>
+    <br>
+    Without this option, the minimum bitrate will be ignored for passages of analog 
+    silence, ie when the music level is below the absolute threshold of human 
+    hearing (ATH). 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--freeformat</kbd><a name="-freeformat">&nbsp;&nbsp;&nbsp;&nbsp;free 
+    format bitstream</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Produces a free format bitstream. With this option, you can use -b with 
+    any bitrate higher than 8 kbps.<br>
+    <br>
+    However, even if an mp3 decoder is required to support free bitrates at least 
+    up to 320 kbps, many players are unable to deal with it.<br>
+    <br>
+    Tests have shown that the following decoders support free format:<br>
+    <br>
+    FreeAmp up to 440 kbps<br>
+    in_mpg123 up to 560 kbps<br>
+    l3dec up to 310 kbps<br>
+    LAME up to 560 kbps<br>
+    MAD up to 640 kbps<br>
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-h</kbd><a name="h">&nbsp;&nbsp;&nbsp;&nbsp;high quality</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> Use some quality improvements. Encoding will be slower, but the result 
+    will be of higher quality. The behaviour is the same as the -q2 switch.<br>
+    This switch is always enabled when using VBR. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--help</kbd><a name="-help">&nbsp;&nbsp;&nbsp;&nbsp;help</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> Display a list of all available options. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--highpass</kbd><a name="-highpass">&nbsp;&nbsp;&nbsp;&nbsp;highpass 
+    filtering frequency in kHz</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Set an highpass filtering frequency. Frequencies below the specified one 
+    will be cutoff. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--highpass-width</kbd><a name="-highpass-width">&nbsp;&nbsp;&nbsp;&nbsp;width 
+    of highpass filtering in kHz</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Set the width of the highpass filter. The default value is 15% of the highpass 
+    frequency. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--lowpass</kbd><a name="-lowpass">&nbsp;&nbsp;&nbsp;&nbsp;lowpass 
+    filtering frequency in kHz</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Set a lowpass filtering frequency. Frequencies above the specified one 
+    will be cutoff. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--lowpass-width</kbd><a name="-lowpass-width">&nbsp;&nbsp;&nbsp;&nbsp;width 
+    of lowpass filtering in kHz</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Set the width of the lowpass filter. The default value is 15% of the lowpass 
+    frequency. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-m s/<b>j/</b>f/d/m</kbd><a name="m">&nbsp;&nbsp;&nbsp;&nbsp;stereo 
+    mode</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Joint-stereo is the default mode for input files featuring two channels.. 
+    <b><i><br>
+    <br>
+    stereo</i></b> <br>
+    In this mode, the encoder makes no use of potentially existing correlations 
+    between the two input channels. It can, however, negotiate the bit demand 
+    between both channel, i.e. give one channel more bits if the other contains 
+    silence or needs less bits because of a lower complexity.<br>
+    <br>
+    <i><b>joint stereo</b></i><br>
+    In this mode, the encoder will make use of correlation between both channels. 
+    The signal will be matrixed into a sum ("mid"), computed by L+R, and difference 
+    ("side") signal, computed by L-R, and more bits are allocated to the mid channel.<br>
+    This will effectively increase the bandwidth if the signal does not have too 
+    much stereo separation, thus giving a significant gain in encoding quality. 
+    In joint stereo, the encoder can select between Left/Right and Mid/Side representation 
+    on a frame basis.<br>
+    <br>
+    Using mid/side stereo inappropriately can result in audible compression artifacts. 
+    To much switching between mid/side and regular stereo can also sound bad. 
+    To determine when to switch to mid/side stereo, LAME uses a much more sophisticated 
+    algorithm than that described in the ISO documentation, and thus is safe to 
+    use in joint stereo mode.<br>
+    <br>
+    <b><i>forced joint stereo </i></b><br>
+    This mode will force MS joint stereo on all frames. It's slightly faster than 
+    joint stereo, but it should be used only if you are sure that every frame 
+    of the input file has very little stereo separation.<br>
+    <br>
+    <b><i>dual channels </i></b><br>
+    In this mode, the 2 channels will be totally independently encoded. Each 
+    channel will have exactly half of the bitrate. This mode is designed for applications 
+    like dual languages encoding (ex: English in one channel and French in the 
+    other). Using this encoding mode for regular stereo files will result in a 
+    lower quality encoding.<br>
+    <br>
+    <b><i>mono</i></b><br>
+    The input will be encoded as a mono signal. If it was a stereo signal, it 
+    will be downsampled to mono. The downmix is calculated as the sum of the left 
+    and right channel, attenuated by 6 dB. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--mp1input</kbd><a name="-mp1input">&nbsp;&nbsp;&nbsp;&nbsp;MPEG 
+    Layer I input file</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Assume the input file is a MPEG Layer I file.<br>
+    If the filename ends in ".mp1" or &quot;.mpg&quot; LAME will assume it is 
+    a MPEG Layer I file. For stdin or Layer I files which do not end in .mp1 or .mpg 
+    you need to use this switch. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--mp2input</kbd><a name="-mp2input">&nbsp;&nbsp;&nbsp;&nbsp;MPEG 
+    Layer II input file</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Assume the input file is a MPEG Layer II (ie MP2) file.<br>
+    If the filename ends in ".mp2" LAME will assume it is a MPEG Layer II file. For 
+    stdin or Layer II files which do not end in .mp2 you need to use this switch. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--mp3input</kbd><a name="-mp3input">&nbsp;&nbsp;&nbsp;&nbsp;MPEG 
+    Layer III input file</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Assume the input file is a MP3 file. Useful for downsampling from one 
+    mp3 to another. As an example, it can be useful for streaming through an 
+    IceCast server.<br>
+    If the filename ends in ".mp3" LAME will assume it is an MP3 file. For stdin or 
+    MP3 files which do not end in .mp3 you need to use this switch. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--noasm mmx/3dnow/sse</kbd><a name="-noasm">
+   &nbsp;&nbsp;&nbsp;&nbsp;disable assembly optimizations</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Disable specific assembly optimizations. Quality will not increase, only
+      speed will be reduced. If you have problems running Lame on a Cyrix/Via
+      processor, disabling mmx optimizations might solve your problem.
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--nohist</kbd><a name="-nohist">&nbsp;&nbsp;&nbsp;&nbsp;disable 
+    histogram display</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> By default, LAME will display a bitrate histogram while producing VBR mp3 
+    files. This will disable that feature.<br>
+    Histogram display might not be available on your release. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--noreplaygain</kbd><a name="-noreplaygain">&nbsp;&nbsp;&nbsp;&nbsp;disable 
+    ReplayGain analysis</a></strong></dt>
+</dl>
+<dl> 
+  <dd> By default ReplayGain analysis is enabled. This switch disables it.<br>
+  <br>
+    See also: <a href="#-replaygain-accurate">--replaygain-accurate</a>,
+    <a href="#-replaygain-fast">--replaygain-fast</a>
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--nores</kbd><a name="-nores">&nbsp;&nbsp;&nbsp;&nbsp;disable 
+    bit reservoir</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Disable the bit reservoir. Each frame will then become independent from 
+    previous ones, but the quality will be lower. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--notemp</kbd><a name="-notemp">&nbsp;&nbsp;&nbsp;&nbsp;disable 
+    temporal masking</a></strong></dt>
+</dl>
+<dl> 
+  <dd>Don't make use of the temporal masking effect. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-o</kbd><a name="o">&nbsp;&nbsp;&nbsp;&nbsp;non-original</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> Mark the encoded file as being a copy. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-p</kbd><a name="p">&nbsp;&nbsp;&nbsp;&nbsp;error protection</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Turn on CRC error protection.<br>
+    It will add a cyclic redundancy check (CRC) code in each frame, allowing to 
+    detect transmission errors that could occur on the MP3 stream. However, it 
+    takes 16 bits per frame that would otherwise be used for encoding, and then 
+    will slightly reduce the sound quality. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--preset presetName</kbd> <a name="-preset">&nbsp;&nbsp;&nbsp;&nbsp;use 
+    built-in preset</a></strong></dt>
+</dl>
+<dd> Use one of the built-in presets (standard, fast standard, extreme, fast extreme, insane, or the abr/cbr modes).
+<br>
+<dd>   "--preset help" gives more information about the usage possibilities for these presets. 
+<dt><br>
+  <br>
+<hr width="50%" noshade align="center">
+<br>
+<dl> </dl>
+<dt><strong>* <kbd>--priority 0...4</kbd><a name="-priority">&nbsp;&nbsp;&nbsp;&nbsp;OS/2 
+  process priority control</a></strong> </dt>
+<dl> 
+  <dd> With this option, LAME will run with a different process priority under 
+    IBM OS/2.<br>
+    This will greatly improve system responsiveness, since OS/2 will have more 
+    free time to properly update the screen and poll the keyboard/mouse. It should 
+    make quite a difference overall, especially on slower machines. LAME's performance 
+    impact should be minimal.<br>
+    <br>
+  <dd><b>0 (Low priority)</b><br>
+    Priority 0 assumes "IDLE" class, with delta 0.<br>
+    LAME will have the lowest priority possible, and the encoding may be suspended 
+    very frequently by user interaction.<br>
+    <br>
+  <dd><b>1 (Medium priority)</b><br>
+    Priority 1 assumes "IDLE" class, with delta +31.<br>
+    LAME won't interfere at all with what you're doing.<br>
+    Recommended if you have a slower machine. <br>
+    <br>
+  <dd><b>2 (Regular priority)</b><br>
+    Priority 2 assumes "REGULAR" class, with delta -31.<br>
+    LAME won't interfere with your activity. It'll run just like a regular process, 
+    but will spare just a bit of idle time for the system. Recommended for most 
+    users. <br>
+    <br>
+  <dd><b>3 (High priority)</b><br>
+    Priority 3 assumes "REGULAR" class, with delta 0.<br>
+    LAME will run with a priority a bit higher than a normal process. <br>
+    Good if you're just running LAME by itself or with moderate user interaction.<br>
+    <br>
+  <dd><b>4 (Maximum priority)</b><br>
+    Priority 4 assumes "REGULAR" class, with delta +31.<br>
+    LAME will run with a very high priority, and may interfere with the machine 
+    response.<br>
+    Recommended if you only intend to run LAME by itself, or if you have a fast 
+    processor. <br>
+    <br>
+    <br>
+    Priority 1 or 2 is recommended for most users. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-q 0..9</kbd><a name="q">&nbsp;&nbsp;&nbsp;&nbsp;algorithm 
+    quality selection</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Bitrate is of course the main influence on quality. The higher the bitrate, 
+    the higher the quality. But for a given bitrate, we have a choice of algorithms 
+    to determine the best scalefactors and Huffman encoding (noise shaping).<br>
+    <br>
+    -q 0: use slowest &amp; best possible version of all algorithms. -q 0 and -q 1 
+    are slow and may not produce significantly higher quality.<br>
+    <br>
+    -q 2: recommended. Same as -h.<br>
+    <br>
+    -q 5: default value. Good speed, reasonable quality.<br>
+    <br>
+    -q 7: same as -f. Very fast, ok quality. (psycho acoustics are used for pre-echo 
+    &amp; M/S, but no noise shaping is done.<br>
+    <br>
+    -q 9: disables almost all algorithms including psy-model. poor quality. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-r</kbd><a name="r">&nbsp;&nbsp;&nbsp;&nbsp;input file is 
+    raw PCM</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Assume the input file is raw PCM. Sampling rate and mono/stereo/jstereo 
+    must be specified on the command line. Without -r, LAME will perform several 
+    fseek()'s on the input file looking for WAV and AIFF headers.<br>
+    Might not be available on your release. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--replaygain-accurate</kbd><a name="-replaygain-accurate">&nbsp;&nbsp;&nbsp;&nbsp;compute
+   ReplayGain more accurately and find the peak sample</a></strong></dt>
+</dl>
+<dl> 
+  <dd>
+    Enable decoding on the fly. Compute "Radio" ReplayGain on the decoded 
+    data stream. Find the peak sample of the decoded data stream and store 
+    it in the file.<br>
+    <br>    
+    ReplayGain analysis does <i>not</i> affect the content of a 
+    compressed data stream itself, it is a value stored in the header 
+    of a sound file. Information on the purpose of ReplayGain and the
+    algorithms used is available from 
+    <a href="http://www.replaygain.org/">http://www.replaygain.org/</a><br>
+    <br>
+    By default, LAME performs ReplayGain analysis on the input data 
+    (after the user-specified volume scaling). This
+    behavior might give slightly inaccurate results because the data on 
+    the output of a lossy compression/decompression sequence differs from 
+    the initial input data. When --replaygain-accurate is specified the
+    mp3 stream gets decoded on the fly and the analysis is performed on the
+    decoded data stream. Although theoretically this method gives more 
+    accurate results, it has several disadvantages:
+    <ul>
+      <li> tests have shown that the difference between the ReplayGain values 
+        computed on the input data and decoded data is usually no greater 
+        than 0.5dB, although the minimum volume difference the human ear 
+        can perceive is about 1.0dB
+      </li>
+      <li> decoding on the fly significantly slows down the encoding process
+      </li>
+    </ul>
+    The apparent advantage is that:
+    <ul>
+      <li> with --replaygain-accurate the peak sample is determined and 
+        stored in the file. The knowledge of the peak sample can be useful
+        to decoders (players) to prevent a negative effect called 'clipping'
+        that introduces distortion into sound.
+      </li>
+    </ul>    
+    <br>
+    Only the "RadioGain" ReplayGain value is computed. It is stored in the 
+    LAME tag. The analysis is  performed with the reference volume equal
+    to 89dB. Note: the reference volume has been changed from 83dB on 
+    transition from version 3.95 to 3.95.1.<br>
+    <br>
+    This option is not usable if the MP3 decoder was <b>explicitly</b>
+    disabled in the build of LAME. (Note: if LAME is compiled without the 
+    MP3 decoder, ReplayGain analysis is performed on the input data after
+    user-specified volume scaling).<br>
+    <br>
+    See also: <a href="#-replaygain-fast">--replaygain-fast</a>, 
+    <a href="#-noreplaygain">--noreplaygain</a>, <a href="#-clipdetect">--clipdetect</a>
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--replaygain-fast</kbd><a name="-replaygain-fast">&nbsp;&nbsp;&nbsp;&nbsp;compute
+   ReplayGain fast but slightly inaccurately (default)</a></strong></dt>
+</dl>
+<dl> 
+  <dd>
+    Compute "Radio" ReplayGain on the input data stream after user-specified 
+    volume scaling and/or resampling.<br>
+    <br>    
+    ReplayGain analysis does <i>not</i> affect the content of a 
+    compressed data stream itself, it is a value stored in the header 
+    of a sound file. Information on the purpose of ReplayGain and the
+    algorithms used is available from 
+    <a href="http://www.replaygain.org/">http://www.replaygain.org/</a><br>
+    <br>
+    Only the "RadioGain" ReplayGain value is computed. It is stored in the 
+    LAME tag. The analysis is  performed with the reference volume equal
+    to 89dB. Note: the reference volume has been changed from 83dB on 
+    transition from version 3.95 to 3.95.1.<br>
+    <br>
+    This switch is enabled by default.<br>
+    <br>
+    See also: <a href="#-replaygain-accurate">--replaygain-accurate</a>, 
+    <a href="#-noreplaygain">--noreplaygain</a>
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--resample 8/11.025/12/16/22.05/24/32/44.1/48</kbd><a name="-resample">&nbsp;&nbsp;&nbsp;&nbsp;output 
+    sampling frequency in kHz</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Select output sampling frequency (for encoding only). <br>
+    If not specified, LAME will automatically resample the input when using high 
+    compression ratios. 
+  <dt><br>
+  </dt>
+</dl>
+<dl> 
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-s 8/11.025/12/16/22.05/24/32/44.1/48</kbd><a name="s">&nbsp;&nbsp;&nbsp;&nbsp;sampling 
+    frequency</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Required only for raw PCM input files. Otherwise it will be determined 
+    from the header of the input file.<br>
+    <br>
+    LAME will automatically resample the input file to one of the supported MP3 
+    samplerates if necessary. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-S / --silent / --quiet</kbd><a name="-silent">&nbsp;&nbsp;&nbsp;&nbsp;silent 
+    operation</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> Don't print progress report. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--scale n</kbd><a name="-scale">&nbsp;&nbsp;&nbsp;&nbsp;scales 
+    input by n</a></strong> </dt>
+  <dt><strong>* <kbd>--scale-l n</kbd><a name="-scale-l">&nbsp;&nbsp;&nbsp;&nbsp;scales 
+    input channel 0 (left) by n</a></strong> </dt>
+  <dt><strong>* <kbd>--scale-r n</kbd><a name="-scale-r">&nbsp;&nbsp;&nbsp;&nbsp;scales 
+    input channel 1 (right) by n</a></strong> </dt>
+</dl>
+<dl> 
+  <dd>Scales input by n. This just multiplies the PCM data (after it has been 
+    converted to floating point) by n. <br>
+    <br>
+    n > 1: increase volume<br>
+    n = 1: no effect<br>
+    n < 1: reduce volume<br>
+    <br>
+    Use with care, since most MP3 decoders will truncate data which decodes to 
+    values greater than 32768. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--strictly-enforce-ISO</kbd><a name="-strictly-enforce-ISO">&nbsp;&nbsp;&nbsp;&nbsp;strict 
+    ISO compliance</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> With this option, LAME will enforce the 7680 bit limitation on total frame 
+    size.<br>
+    This results in many wasted bits for high bitrate encodings but will ensure 
+    strict ISO compatibility. This compatibility might be important for hardware 
+    players. 
+</dl>
+<dl> 
+  <dd>&nbsp; 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-t</kbd><a name="t">&nbsp;&nbsp;&nbsp;&nbsp;disable INFO/WAV 
+    header </a></strong></dt>
+</dl>
+<dl> 
+  <dd> Disable writing of the INFO Tag on encoding.<br>
+    This tag in embedded in frame 0 of the MP3 file. It includes some information 
+    about the encoding options of the file, and in VBR it lets VBR aware players 
+    correctly seek and compute playing times of VBR files.<br>
+    <br>
+    When '--decode' is specified (decode to WAV), this flag will disable writing 
+    of the WAV header. The output will be raw PCM, native endian format. Use -x 
+    to swap bytes. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-V [0,...,10[</kbd><a name="V">&nbsp;&nbsp;&nbsp;&nbsp;VBR quality 
+    setting, integer or floating point number</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Enable VBR (Variable BitRate) and specifies the value of VBR quality.<br>
+    default=4<br>
+    0=highest quality. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--vbr-new</kbd><a name="-vbr-new">&nbsp;&nbsp;&nbsp;&nbsp;new 
+    VBR mode</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Invokes the newest VBR algorithm. During the development of version 3.90, 
+    considerable tuning was done on this algorithm, and it is now considered to 
+    be on par with the original --vbr-old. <br>
+    It has the added advantage of being very fast (over twice as fast as --vbr-old). 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--vbr-old</kbd><a name="-vbr-old">&nbsp;&nbsp;&nbsp;&nbsp;older 
+    VBR mode</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Invokes the oldest, most tested VBR algorithm. It produces very good quality 
+    files, though is not very fast. This has, up through v3.89, been considered 
+    the "workhorse" VBR algorithm. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>--verbose</kbd><a name="-verbose">&nbsp;&nbsp;&nbsp;&nbsp;verbosity</a></strong></dt>
+</dl>
+<dl> 
+  <dd> Print a lot of information on screen. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-x</kbd><a name="x">&nbsp;&nbsp;&nbsp;&nbsp;swapbytes</a></strong> 
+  </dt>
+</dl>
+<dl> 
+  <dd> Swap bytes in the input file or output file when using --decode.<br>
+    For sorting out little endian/big endian type problems. If your encodings 
+    sounds like static, try this first. 
+  <dt><br>
+    <br>
+  </dt>
+  <hr width="50%" noshade align="center">
+  <br>
+  <dl> </dl>
+  <dt><strong>* <kbd>-X 0...7</kbd><a name="Xquant">&nbsp;&nbsp;&nbsp;&nbsp;change 
+    quality measure</a></strong> </dt>
+</dl>
+<dl> 
+  <dd> When LAME searches for a "good" quantization, it has to compare the actual 
+    one with the best one found so far. The comparison says which one is better, 
+    the best so far or the actual. The -X parameter selects between different 
+    approaches to make this decision, -X0 being the default mode:<br>
+    <br>
+    <b>-X0 </b><br>
+    The criterions are (in order of importance):<br>
+    * less distorted scalefactor bands<br>
+    * the sum of noise over the thresholds is lower<br>
+    * the total noise is lower<br>
+    <br>
+    <b>-X1</b><br>
+    The actual is better if the maximum noise over all scalefactor bands is less 
+    than the best so far .<br>
+    <br>
+    <b>-X2</b><br>
+    The actual is better if the total sum of noise is lower than the best so far.<br>
+    <br>
+    <b>-X3</b><br>
+    The actual is better if the total sum of noise is lower than the best so far 
+    and the maximum noise over all scalefactor bands is less than the best so 
+    far plus 2db.<br>
+    <br>
+    <b>-X4</b> <br>
+    Not yet documented.<br>
+    <br>
+    <b>-X5</b><br>
+    The criterions are (in order of importance):<br>
+    * the sum of noise over the thresholds is lower <br>
+    * the total sum of noise is lower<br>
+    <br>
+    <b>-X6</b> <br>
+    The criterions are (in order of importance):<br>
+    * the sum of noise over the thresholds is lower<br>
+    * the maximum noise over all scalefactor bands is lower<br>
+    * the total sum of noise is lower<br>
+    <br>
+    <b>-X7</b> <br>
+    The criterions are:<br>
+    * less distorted scalefactor bands<br>
+    or<br>
+    * the sum of noise over the thresholds is lower 
+</dl>
+</BODY>
+</HTML>
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
new file mode 100644
index 0000000..ecab077
--- /dev/null
+++ b/doc/man/Makefile.am
@@ -0,0 +1,7 @@
+## $Id: Makefile.am,v 1.1 2000/10/22 11:39:44 aleidinger Exp $
+
+AUTOMAKE_OPTIONS = foreign ansi2knr
+
+man_MANS = lame.1
+EXTRA_DIST = ${man_MANS}
+
diff --git a/doc/man/Makefile.in b/doc/man/Makefile.in
new file mode 100644
index 0000000..182c3f6
--- /dev/null
+++ b/doc/man/Makefile.in
@@ -0,0 +1,407 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc/man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)"
+NROFF = nroff
+MANS = $(man_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign ansi2knr
+man_MANS = lame.1
+EXTRA_DIST = ${man_MANS}
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/man/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  doc/man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(man1dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man1 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/man/lame.1 b/doc/man/lame.1
new file mode 100644
index 0000000..27f864c
--- /dev/null
+++ b/doc/man/lame.1
@@ -0,0 +1,1145 @@
+.TH lame 1 "July 08, 2008" "LAME 3.98" "LAME audio compressor"
+.SH NAME
+lame \- create mp3 audio files
+.SH SYNOPSIS
+lame [options] <infile> <outfile>
+.SH DESCRIPTION
+.PP
+LAME is a program which can be used to create compressed audio files.
+(Lame ain't an MP3 encoder).
+These audio files can be played back by popular MP3 players such as
+mpg123 or madplay.
+To read from stdin, use "\-" for <infile>.
+To write to stdout, use a "\-" for <outfile>.
+.SH OPTIONS
+Input options:
+.TP
+.B \-r
+Assume the input file is raw pcm.
+Sampling rate and mono/stereo/jstereo must be specified on the command line.
+For each stereo sample, LAME expects the input data to be ordered left channel
+first, then right channel. By default, LAME expects them to be signed integers
+with a bitwidth of 16.
+Without
+.B \-r,
+LAME will perform several
+.I fseek()'s
+on the input file looking for WAV and AIFF headers.
+.br
+Might not be available on your release. 
+.TP
+.B \-x
+Swap bytes in the input file or output file when using
+.B \-\-decode.
+.br
+For sorting out little endian/big endian type problems.
+If your encodings sounds like static,
+try this first.
+.br
+Without using
+.B \-x,
+LAME will treat input file as native endian.
+.TP
+.BI \-s " sfreq"
+.I sfreq
+= 8/11.025/12/16/22.05/24/32/44.1/48
+
+Required only for raw PCM input files.
+Otherwise it will be determined from the header of the input file.
+
+LAME will automatically resample the input file to one of the supported
+MP3 samplerates if necessary.
+.TP
+.BI \-\-bitwidth " n"
+Input bit width per sample.
+.br
+.I n
+= 8, 16, 24, 32 (default 16)
+
+Required only for raw PCM input files.
+Otherwise it will be determined from the header of the input file.
+.TP
+.BI \-\-signed
+Instructs LAME that the samples from the input are signed (the default
+for 16, 24 and 32 bits raw pcm data).
+
+Required only for raw PCM input files.
+.TP
+.BI \-\-unsigned
+Instructs LAME that the samples from the input are unsigned (the default
+for 8 bits raw pcm data, where 0x80 is zero).
+
+Required only for raw PCM input files
+and only available at bitwidth 8.
+.TP
+.BI \-\-little-endian
+Instructs LAME that the samples from the input are in little-endian form.
+
+Required only for raw PCM input files.
+.TP
+.BI \-\-big-endian
+Instructs LAME that the samples from the input are in big-endian form.
+
+Required only for raw PCM input files.
+.TP
+.B \-\-mp2input
+Assume the input file is a MPEG Layer II (ie MP2) file.
+.br
+If the filename ends in ".mp2" LAME will assume it is a MPEG Layer II file.
+For stdin or Layer II files which do not end in .mp2 you need to use
+this switch. 
+.TP
+.B \-\-mp3input
+Assume the input file is a MP3 file.
+.br
+Useful for downsampling from one mp3 to another.
+As an example,
+it can be useful for streaming through an IceCast server.
+.br
+If the filename ends in ".mp3" LAME will assume it is an MP3.
+For stdin or MP3 files which do not end in .mp3 you need to use this switch. 
+.TP
+.BI \-\-nogap " file1 file2 ..."
+gapless encoding for a set of contiguous files
+.TP
+.BI \-\-nogapout " dir"
+output dir for gapless encoding (must precede \-\-nogap)
+
+.PP
+Operational options:
+.TP
+.BI \-m  " mode"
+.I mode
+= s, j, f, d, m
+
+Joint-stereo is the default mode for stereo files with VBR when
+.B \-V
+is more than 4 or fixed bitrates of 160kbs or less.
+At higher fixed bitrates or higher VBR settings,
+the default is stereo. 
+
+.B (s)imple stereo 
+.br
+In this mode,
+the encoder makes no use of potentially existing correlations between
+the two input channels.
+It can,
+however,
+negotiate the bit demand between both channel,
+i.e. give one channel more bits if the other contains silence or needs
+less bits because of a lower complexity.
+
+.B (j)oint stereo
+.br
+In this mode,
+the encoder will make use of a correlation between both channels.
+The signal will be matrixed into a sum ("mid"),
+computed by L+R,
+and difference ("side") signal,
+computed by L\-R,
+and more bits are allocated to the mid channel.
+This will effectively increase the bandwidth if the signal does not
+have too much stereo separation,
+thus giving a significant gain in encoding quality.
+
+Using mid/side stereo inappropriately can result in audible
+compression artifacts.
+To much switching between mid/side and regular stereo can also
+sound bad.
+To determine when to switch to mid/side stereo,
+LAME uses a much more sophisticated algorithm than that described
+in the ISO documentation, and thus is safe to use in joint
+stereo mode.
+
+.B (f)orced MS stereo 
+.br
+This mode will force MS stereo on all frames.
+It is slightly faster than joint stereo,
+but it should be used only if you are sure that every frame of the
+input file has very little stereo separation.
+
+.B (d)ual mono
+.br
+In this mode,
+the 2 channels will be totally independently encoded.
+Each channel will have exactly half of the bitrate.
+This mode is designed for applications like dual languages
+encoding (for example: English in one channel and French in the other).
+Using this encoding mode for regular stereo files will result in a
+lower quality encoding.
+
+.B (m)ono
+.br
+The input will be encoded as a mono signal.
+If it was a stereo signal,
+it will be downsampled to mono.
+The downmix is calculated as the sum of the left and right channel,
+attenuated by 6 dB.
+.TP
+.B \-a
+Mix the stereo input file to mono and encode as mono.
+.br
+The downmix is calculated as the sum of the left and right channel,
+attenuated by 6 dB. 
+
+This option is only needed in the case of raw PCM stereo input
+(because LAME cannot determine the number of channels in the input file).
+To encode a stereo PCM input file as mono,
+use
+.B lame \-m
+.I s
+.B \-a.
+
+For WAV and AIFF input files,
+using
+.B \-m
+will always produce a mono .mp3 file from both mono and stereo input. 
+.TP
+.B \-d
+Allows the left and right channels to use different block size types. 
+.TP
+.B \-\-freeformat
+Produces a free format bitstream.
+With this option,
+you can use
+.B \-b
+with any bitrate higher than 8 kbps.
+
+However,
+even if an mp3 decoder is required to support free bitrates at
+least up to 320 kbps,
+many players are unable to deal with it.
+
+Tests have shown that the following decoders support free format:
+.br
+.B FreeAmp
+up to 440 kbps
+.br
+.B in_mpg123
+up to 560 kbps
+.br
+.B l3dec
+up to 310 kbps
+.br
+.B LAME
+up to 560 kbps
+.br
+.B MAD
+up to 640 kbps
+.TP
+.B \-\-decode
+Uses LAME for decoding to a wav file.
+The input file can be any input type supported by encoding,
+including layer II files.
+LAME uses a bugfixed version of mpglib for decoding.
+
+If
+.B \-t
+is used (disable wav header),
+LAME will output raw pcm in native endian format.
+You can use
+.B \-x
+to swap bytes order.
+
+This option is not usable if the MP3 decoder was
+.B explicitly
+disabled in the build of LAME.
+.TP
+.BI \-t
+Disable writing of the INFO Tag on encoding.
+.br
+This tag in embedded in frame 0 of the MP3 file.
+It includes some information about the encoding options of the file,
+and in VBR it lets VBR aware players correctly seek and compute
+playing times of VBR files.
+
+When
+.B \-\-decode
+is specified (decode to WAV),
+this flag will disable writing of the WAV header.
+The output will be raw pcm,
+native endian format.
+Use
+.B \-x
+to swap bytes.
+.TP
+.BI \-\-comp " arg"
+Instead of choosing bitrate,
+using this option,
+user can choose compression ratio to achieve.
+.TP
+.BI \-\-scale " n"
+.PD 0
+.TP
+.BI \-\-scale\-l " n"
+.TP
+.BI \-\-scale\-r " n"
+Scales input (every channel, only left channel or only right channel) by
+.I n.
+This just multiplies the PCM data (after it has been converted to floating
+point) by
+.I n. 
+
+.I n
+> 1: increase volume
+.br
+.I n
+= 1: no effect
+.br
+.I n
+< 1: reduce volume
+
+Use with care,
+since most MP3 decoders will truncate data which decodes to values
+greater than 32768.
+.PD
+.TP
+.B \-\-replaygain\-fast
+Compute ReplayGain fast but slightly inaccurately.
+
+This computes "Radio" ReplayGain on the input data stream after
+user\(hyspecified volume\(hyscaling and/or resampling.
+
+The ReplayGain analysis does
+.I not
+affect the content of a compressed data stream itself,
+it is a value stored in the header of a sound file.
+Information on the purpose of ReplayGain and the algorithms used is
+available from
+.B http://www.replaygain.org/.
+
+Only the "RadioGain" Replaygain value is computed,
+it is stored in the LAME tag.
+The analysis is performed with the reference
+volume equal to 89dB.
+Note: the reference volume has been changed from 83dB on transition from
+version 3.95 to 3.95.1.
+
+This switch is enabled by default.
+
+See also:
+.B \-\-replaygain\-accurate, \-\-noreplaygain
+.TP
+.B \-\-replaygain\-accurate
+Compute ReplayGain more accurately and find the peak sample.
+
+This enables decoding on the fly, computes "Radio" ReplayGain on the
+decoded data stream,
+finds the peak sample of the decoded data stream and stores it in the file.
+ 
+The ReplayGain analysis does
+.I not
+affect the content of a compressed data stream itself,
+it is a value stored in the header of a sound file.
+Information on the purpose of ReplayGain and the algorithms used is
+available from
+.B http://www.replaygain.org/.
+
+ 
+By default, LAME performs ReplayGain analysis on the input data
+(after the user\(hyspecified volume scaling).
+This behavior might give slightly inaccurate results
+because the data on the output of a lossy compression/decompression sequence
+differs from the initial input data.
+When
+.B \-\-replaygain-accurate
+is specified the mp3 stream gets decoded on the fly and the analysis is
+performed on the decoded data stream.
+Although theoretically this method gives more accurate results,
+it has several disadvantages:
+.RS 8
+.IP "*" 4
+tests have shown that the difference between the ReplayGain values computed
+on the input data and decoded data is usually not greater than 0.5dB,
+although the minimum volume difference the human ear can perceive is
+about 1.0dB
+.IP "*" 4
+decoding on the fly significantly slows down the encoding process
+.RE
+.RS 7
+
+The apparent advantage is that:
+.RE
+.RS 8
+.IP "*" 4
+with
+.B \-\-replaygain-accurate
+the real peak sample is determined and stored in the file.
+The knowledge of the peak sample can be useful to decoders (players)
+to prevent a negative effect called 'clipping' that introduces distortion
+into the sound.
+.RE
+.RS 7
+ 
+Only the "RadioGain" ReplayGain value is computed,
+it is stored in the LAME tag.
+The analysis is performed with the reference
+volume equal to 89dB.
+Note: the reference volume has been changed from 83dB on transition from
+version 3.95 to 3.95.1.
+ 
+This option is not usable if the MP3 decoder was
+.B explicitly
+disabled in the build of LAME.
+(Note: if LAME is compiled without the MP3 decoder,
+ReplayGain analysis is performed on the input data after user-specified
+volume scaling).
+ 
+See also:
+.B \-\-replaygain-fast, \-\-noreplaygain \-\-clipdetect
+.RE
+.TP
+.B \-\-noreplaygain
+Disable ReplayGain analysis.
+
+By default ReplayGain analysis is enabled. This switch disables it.
+
+See also:
+.B \-\-replaygain-fast, \-\-replaygain-accurate
+.TP
+.B \-\-clipdetect
+Clipping detection.
+
+Enable
+.B \-\-replaygain-accurate
+and print a message whether clipping occurs and how far in dB the waveform
+is from full scale.
+  
+This option is not usable if the MP3 decoder was
+.B explicitly
+disabled in the build of LAME.
+
+See also:
+.B \-\-replaygain-accurate
+.TP
+.B \-\-preset " [fast] type | [cbr] kbps"
+Use one of the built-in presets.
+
+Have a look at the PRESETS section below.
+
+.B \-\-preset help
+gives more infos about the the used options in these presets.
+.TP
+.B \-\-preset " [fast] type | [cbr] kbps"
+Use one of the built-in  presets.
+.TP
+.B \-\-noasm " type"
+Disable specific assembly optimizations (
+.B mmx
+/
+.B 3dnow
+/
+.B sse
+).
+Quality will not increase, only speed will be reduced.
+If you have problems running Lame on a Cyrix/Via processor,
+disabling mmx optimizations might solve your problem.
+
+.PP
+Verbosity:
+.TP
+.BI \-\-disptime " n"
+Set the delay in seconds between two display updates. 
+.TP
+.B \-\-nohist
+By default,
+LAME will display a bitrate histogram while producing VBR mp3 files.
+This will disable that feature.
+.br
+Histogram display might not be available on your release. 
+.TP
+.B -S
+.PD 0
+.TP
+.B \-\-silent
+.TP
+.B \-\-quiet
+Do not print anything on the screen.
+.PD
+.TP
+.B \-\-verbose
+Print a lot of information on the screen.
+.TP
+.B \-\-help
+Display a list of available options.
+
+.PP
+Noise shaping & psycho acoustic algorithms:
+.TP
+.BI -q " qual"
+0 <=
+.I qual
+<= 9
+
+Bitrate is of course the main influence on quality.
+The higher the bitrate,
+the higher the quality.
+But for a given bitrate,
+we have a choice of algorithms to determine the best scalefactors
+and Huffman encoding (noise shaping).
+
+.B -q 0:
+.br
+use slowest & best possible version of all algorithms.
+.B -q 0
+and
+.B -q 1
+are slow and may not produce significantly higher quality.
+
+.B -q 2:
+.br
+recommended.
+Same as
+.B -h.
+
+.B -q 5:
+.br
+default value.
+Good speed,
+reasonable quality.
+
+.B -q 7:
+.br
+same as
+.B -f.
+Very fast,
+ok quality.
+Psycho acoustics are used for pre-echo & M/S,
+but no noise shaping is done.
+
+.B -q 9:
+.br
+disables almost all algorithms including psy-model.
+Poor quality.
+.TP
+.B -h
+Use some quality improvements.
+Encoding will be slower,
+but the result will be of higher quality.
+The behavior is the same as the
+.B -q 2
+switch.
+.br
+This switch is always enabled when using VBR. 
+.TP
+.B -f
+This switch forces the encoder to use a faster encoding mode,
+but with a lower quality.
+The behavior is the same as the
+.B -q 7
+switch.
+
+Noise shaping will be disabled,
+but psycho acoustics will still be computed for bit allocation
+and pre-echo detection. 
+
+.PP
+CBR (constant bitrate, the default) options:
+.TP
+.BI -b  " n"
+For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)
+.br
+.I n
+= 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
+
+For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)
+.br
+.I n
+= 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
+
+For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)
+.br
+.I n
+= 8, 16, 24, 32, 40, 48, 56, 64
+
+Default is 128 for MPEG1 and 64 for MPEG2. 
+.TP
+.BI \-\-cbr
+enforce use of constant bitrate
+
+.PP
+ABR (average bitrate) options:
+.TP
+.BI \-\-abr " n"
+Turns on encoding with a targeted average bitrate of n kbits,
+allowing to use frames of different sizes.
+The allowed range of
+.I n
+is 8 - 310,
+you can use any integer value within that range.
+
+It can be combined with the
+.B -b
+and
+.B -B
+switches like:
+.B lame \-\-abr
+.I 123
+.B -b
+.I 64
+.B -B
+.I 192 a.wav a.mp3
+which would limit the allowed frame sizes between 64 and 192 kbits.
+
+The use of
+.B -B
+is NOT RECOMMENDED.
+A 128 kbps CBR bitstream,
+because of the bit reservoir,
+can actually have frames which use as many bits as a 320 kbps frame.
+VBR modes minimize the use of the bit reservoir,
+and thus need to allow 320 kbps frames to get the same flexibility
+as CBR streams. 
+
+.PP
+VBR (variable bitrate) options:
+.TP
+.B -v
+use variable bitrate
+.B (\-\-vbr-new)
+.TP
+.B \-\-vbr-old
+Invokes the oldest,
+most tested VBR algorithm.
+It produces very good quality files,
+though is not very fast.
+This has,
+up through v3.89,
+been considered the "workhorse" VBR algorithm.
+.TP
+.B \-\-vbr-new
+Invokes the newest VBR algorithm.
+During the development of version 3.90,
+considerable tuning was done on this algorithm,
+and it is now considered to be on par with the original
+.B \-\-vbr-old. 
+It has the added advantage of being very fast (over twice as fast as
+.B \-\-vbr-old).
+.TP
+.BI -V " n"
+0 <=
+.I n
+<= 9
+.br
+Enable VBR (Variable BitRate) and specifies the value of VBR quality
+(default = 4).
+0 = highest quality.
+
+.PP
+ABR and VBR options:
+.TP
+.BI -b " bitrate"
+For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)
+.br
+.I n
+= 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
+
+For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)
+.br
+.I n
+= 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
+
+For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)
+.br
+.I n
+= 8, 16, 24, 32, 40, 48, 56, 64
+
+Specifies the minimum bitrate to be used.
+However,
+in order to avoid wasted space,
+the smallest frame size available will be used during silences. 
+.TP
+.BI -B " bitrate"
+For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)
+.br
+.I n
+= 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
+
+For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)
+.br
+.I n
+= 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
+
+For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)
+.br
+.I n
+= 8, 16, 24, 32, 40, 48, 56, 64
+
+Specifies the maximum allowed bitrate.
+
+Note: If you own an mp3 hardware player build upon a MAS 3503 chip,
+you must set maximum bitrate to no more than 224 kpbs. 
+.TP
+.B -F
+Strictly enforce the
+.B -b
+option.
+.br
+This is mainly for use with hardware players that do not support low
+bitrate mp3.
+
+Without this option,
+the minimum bitrate will be ignored for passages of analog silence,
+i.e. when the music level is below the absolute threshold of
+human hearing (ATH). 
+
+.PP
+PSY related:
+.TP
+.B \-\-nssafejoint
+M/S switching criterion
+.TP
+.BI \-\-nsmsfix " arg"
+M/S switching tuning [effective 0-3.5]
+.TP
+.BI \-\-ns-bass " x"
+Adjust masking for sfbs  0 -  6 (long)  0 -  5 (short)
+.TP
+.BI \-\-ns-alto " x"
+Adjust masking for sfbs  7 - 13 (long)  6 - 10 (short)
+.TP
+.BI \-\-ns-treble " x"
+Adjust masking for sfbs 14 - 21 (long) 11 - 12 (short)
+.TP
+.BI \-\-ns-sfb21 " x"
+Change ns-treble by x dB for sfb21
+
+.PP
+Experimental options:
+.TP
+.BI -X " n"
+0 <=
+.I n
+<= 7
+
+When LAME searches for a "good" quantization,
+it has to compare the actual one with the best one found so far. 
+The comparison says which one is better,
+the best so far or the actual.
+The
+.B -X
+parameter selects between different approaches to make this decision,
+.B -X0
+being the default mode:
+
+.B -X0 
+.br
+The criterions are (in order of importance):
+.br
+* less distorted scalefactor bands
+.br
+* the sum of noise over the thresholds is lower
+.br
+* the total noise is lower
+
+.B -X1
+.br
+The actual is better if the maximum noise over all scalefactor bands is
+less than the best so far.
+
+.B -X2
+.br
+The actual is better if the total sum of noise is lower than the best so
+far.
+
+.B -X3
+.br
+The actual is better if the total sum of noise is lower than the best so
+far and the maximum noise over all scalefactor bands is less than the
+best so far plus 2dB.
+
+.B -X4
+.br
+Not yet documented.
+
+.B -X5
+.br
+The criterions are (in order of importance):
+.br
+* the sum of noise over the thresholds is lower 
+.br
+* the total sum of noise is lower
+
+.B -X6 
+.br
+The criterions are (in order of importance):
+.br
+* the sum of noise over the thresholds is lower
+.br
+* the maximum noise over all scalefactor bands is lower
+.br
+* the total sum of noise is lower
+
+.B -X7 
+.br
+The criterions are:
+.br
+* less distorted scalefactor bands
+.br
+or
+.br
+* the sum of noise over the thresholds is lower 
+.TP
+.B -Y
+lets LAME ignore noise in sfb21, like in CBR
+
+.PP
+MP3 header/stream options:
+.TP
+.BI -e " emp"
+.I emp
+= n, 5, c
+
+n = (none, default)
+.br
+5 = 0/15 microseconds
+.br
+c = citt j.17
+
+All this does is set a flag in the bitstream.
+If you have a PCM input file where one of the above types of
+(obsolete) emphasis has been applied,
+you can set this flag in LAME.
+Then the mp3 decoder should de-emphasize the output during playback,
+although most decoders ignore this flag.
+
+A better solution would be to apply the de-emphasis with a standalone
+utility before encoding,
+and then encode without
+.B -e. 
+.TP
+.B -c
+Mark the encoded file as being copyrighted.
+.TP
+.B -o
+Mark the encoded file as being a copy. 
+.TP
+.B -p
+Turn on CRC error protection.
+.br
+It will add a cyclic redundancy check (CRC) code in each frame,
+allowing to detect transmission errors that could occur on the
+MP3 stream.
+However,
+it takes 16 bits per frame that would otherwise be used for encoding,
+and then will slightly reduce the sound quality. 
+.TP
+.B \-\-nores
+Disable the bit reservoir.
+Each frame will then become independent from previous ones,
+but the quality will be lower. 
+.TP
+.B \-\-strictly-enforce-ISO
+With this option,
+LAME will enforce the 7680 bit limitation on total frame size.
+.br
+This results in many wasted bits for high bitrate encodings but will
+ensure strict ISO compatibility.
+This compatibility might be important for hardware players.
+
+.PP
+Filter options:
+.TP
+.BI \-\-lowpass " freq"
+Set a lowpass filtering frequency in kHz.
+Frequencies above the specified one will be cutoff. 
+.TP
+.BI \-\-lowpass-width " freq"
+Set the width of the lowpass filter.
+The default value is 15% of the lowpass frequency. 
+.TP
+.BI \-\-highpass " freq"
+Set an highpass filtering frequency in kHz.
+Frequencies below the specified one will be cutoff. 
+.TP
+.BI \-\-highpass-width " freq"
+Set the width of the highpass filter in kHz.
+The default value is 15% of the highpass frequency.
+.TP
+.BI \-\-resample " sfreq"
+.I sfreq
+= 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48
+.br
+Select output sampling frequency (only supported for encoding).
+.br
+If not specified,
+LAME will automatically resample the input when using high compression ratios.
+
+.PP
+ID3 tag options:
+.TP
+.BI \-\-tt " title"
+audio/song title (max 30 chars for version 1 tag)
+.TP
+.BI \-\-ta " artist"
+audio/song artist (max 30 chars for version 1 tag)
+.TP
+.BI \-\-tl " album"
+audio/song album (max 30 chars for version 1 tag)
+.TP
+.BI \-\-ty " year"
+audio/song year of issue (1 to 9999)
+.TP
+.BI \-\-tc " comment"
+user-defined text (max 30 chars for v1 tag, 28 for v1.1)
+.TP
+.BI \-\-tn " track[/total]"
+audio/song track number and (optionally) the total number of tracks on
+the original recording. (track and total each 1 to 255. Providing
+just the track number creates v1.1 tag, providing a total forces v2.0).
+.TP
+.BI \-\-tg " genre"
+audio/song genre (name or number in list)
+.TP
+.B \-\-add-id3v2
+force addition of version 2 tag
+.TP
+.B \-\-id3v1-only
+add only a version 1 tag
+.TP
+.B \-\-id3v2-only
+add only a version 2 tag
+.TP
+.B \-\-space-id3v1
+pad version 1 tag with spaces instead of nulls
+.TP
+.B \-\-pad-id3v2
+same as \-\-pad-id3v2-size 128
+.TP
+.B \-\-pad-id3v2-size "num"
+adds version 2 tag, pad with extra "num" bytes
+.TP
+.B \-\-genre-list
+print alphabetically sorted ID3 genre list and exit
+.TP
+.B \-\-ignore-tag-errors
+ignore errors in values passed for tags, use defaults in case an error occurs
+
+.PP
+Analysis options:
+.TP
+.B \-g
+run graphical analysis on <infile>.
+<infile> can also be a .mp3 file.
+(This feature is a compile time option.
+Your binary may for speed reasons be compiled without this.)
+
+.SH ID3 TAGS
+LAME is able to embed ID3 v1,
+v1.1 or v2 tags inside the encoded MP3 file.
+This allows to have some useful information about the music track
+included inside the file.
+Those data can be read by most MP3 players.
+
+Lame will smartly choose which tags to use.
+It will add ID3 v2 tags only if the input comments won't fit in v1
+or v1.1 tags,
+i.e. if they are more than 30 characters.
+In this case,
+both v1 and v2 tags will be added,
+to ensure reading of tags by MP3 players which are unable to read ID3 v2 tags.
+
+.SH ENCODING MODES
+LAME is able to encode your music using one of its 3 encoding modes:
+constant bitrate (CBR), average bitrate (ABR) and variable bitrate (VBR).
+.TP
+.B Constant Bitrate (CBR)
+This is the default encoding mode,
+and also the most basic.
+In this mode,
+the bitrate will be the same for the whole file.
+It means that each part of your mp3 file will be using the same
+number of bits.
+The musical passage being a difficult one to encode or an easy one,
+the encoder will use the same bitrate,
+so the quality of your mp3 is variable.
+Complex parts will be of a lower quality than the easiest ones.
+The main advantage is that the final files size won't change and
+can be accurately predicted.
+.TP
+.B Average Bitrate (ABR)
+In this mode,
+you choose the encoder will maintain an average bitrate while using
+higher bitrates for the parts of your music that need more bits.
+The result will be of higher quality than CBR encoding but the
+average file size will remain predictable,
+so this mode is highly recommended over CBR.
+This encoding mode is similar to what is referred as vbr in AAC or
+Liquid Audio (2 other compression technologies).
+.TP
+.B Variable bitrate (VBR)
+In this mode,
+you choose the desired quality on a scale from 9 (lowest
+quality/biggest distortion) to 0 (highest quality/lowest distortion).
+Then encoder tries to maintain the given quality in the whole file by
+choosing the optimal number of bits to spend for each part of your music.
+The main advantage is that you are able to specify the quality level that
+you want to reach,
+but the inconvenient is that the final file size is totally unpredictable.
+
+.SH PRESETS
+The
+.B \-\-preset
+switches are aliases over LAME settings.
+
+To activate these presets:
+.PP
+For VBR modes (generally highest quality):
+.TP
+.B \-\-preset medium
+This preset should provide near transparency to most people on most music.
+.TP
+.B \-\-preset standard
+This preset should generally be transparent to most people on most music and
+is already quite high in quality.
+.TP
+.B \-\-preset extreme
+If you have extremely good hearing and similar equipment,
+this preset will generally provide slightly higher quality than the
+.B standard
+mode.
+.PP
+For CBR 320kbps (highest quality possible from the
+.B \-\-preset
+switches):
+.TP
+.B \-\-preset insane
+This preset will usually be overkill for most people and most situations,
+but if you must have the absolute highest quality with no regard to filesize,
+this is the way to go.
+.PP
+For ABR modes (high quality per given bitrate but not as high as VBR):
+.TP
+.B \-\-preset " kbps"
+Using this preset will usually give you good quality at a specified bitrate.
+Depending on the bitrate entered,
+this preset will determine the optimal settings for that particular situation.
+While this approach works,
+it is not nearly as flexible as VBR,
+and usually will not attain the same level of quality as VBR at higher bitrates.
+.PP
+The following options are also available for the corresponding profiles:
+.PP
+.B fast standard|extreme
+.br
+.B cbr " kbps"
+.PP
+.TP
+.B fast
+Enables the new fast VBR for a particular profile.
+.TP
+.B cbr
+If you use the ABR mode (read above) with a significant bitrate such as 80,
+96,
+112,
+128,
+160,
+192,
+224,
+256,
+320,
+you can use the
+.B cbr
+option to force CBR mode encoding instead of the standard ABR mode.
+ABR does provide higher quality but CBR may be useful in situations such as when
+streaming an MP3 over the Internet may be important.
+
+
+.SH EXAMPLES
+.LP
+Fixed bit rate jstereo 128kbs encoding:
+.IP
+.B lame
+.I sample.wav sample.mp3
+
+.LP
+Fixed bit rate jstereo 128 kbps encoding, highest quality (recommended):
+.IP
+.B lame \-h
+.I sample.wav sample.mp3
+
+.LP
+Fixed bit rate jstereo 112 kbps encoding:
+.IP
+.B lame \-b
+.I 112 sample.wav sample.mp3
+
+.LP
+To disable joint stereo encoding (slightly faster,
+but less quality at bitrates <= 128 kbps):
+.IP
+.B lame \-m
+.I s sample.wav sample.mp3
+
+.LP
+Fast encode,
+low quality (no psycho-acoustics):
+.IP
+.B lame \-f
+.I sample.wav sample.mp3
+
+.LP
+Variable bitrate (use \-V n to adjust quality/filesize):
+.IP
+.B lame \-h \-V
+.I 6 sample.wav sample.mp3
+
+.LP
+Streaming mono 22.05 kHz raw pcm, 24 kbps output:
+.IP
+.B cat
+.I inputfile
+.B | lame \-r \-m
+.I m
+.B \-b
+.I 24
+.B \-s
+.I 22.05 \- \-
+.B >
+.I output
+
+.LP
+Streaming mono 44.1 kHz raw pcm,
+with downsampling to 22.05 kHz:
+.IP
+.B cat
+.I inputfile
+.B | lame \-r \-m
+.I m
+.B \-b
+.I 24
+.B \-\-resample
+.I 22.05 \- \-
+.B >
+.I output
+
+.LP
+Encode with the
+.B fast standard
+preset:
+.IP
+.B lame \-\-preset fast standard
+.I sample.wav sample.mp3
+
+.SH BUGS
+.PP
+Probably there are some.
+.SH SEE ALSO
+.BR mpg123 (1) ,
+.BR madplay (1) ,
+.BR sox (1)
+.SH AUTHORS
+.nf
+LAME originally developed by Mike Cheng and now maintained by
+Mark Taylor, and the LAME team.
+
+GPSYCHO psycho-acoustic model by Mark Taylor.
+(See http://www.mp3dev.org/).
+
+mpglib by Michael Hipp
+
+Manual page by William Schelter, Nils Faerber, Alexander Leidinger,
+and Rog\['e]rio Brito.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/dshow/Encoder.cpp b/dshow/Encoder.cpp
new file mode 100644
index 0000000..291639d
--- /dev/null
+++ b/dshow/Encoder.cpp
@@ -0,0 +1,577 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  LAME encoder wrapper
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <streams.h>
+#include "Encoder.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CEncoder::CEncoder() :
+    m_bInpuTypeSet(FALSE),
+    m_bOutpuTypeSet(FALSE),
+    m_bFinished(FALSE),
+    m_outOffset(0),
+    m_outReadOffset(0),
+    m_frameCount(0),
+    pgf(NULL)
+{
+    m_outFrameBuf = new unsigned char[OUT_BUFFER_SIZE];
+}
+
+CEncoder::~CEncoder()
+{
+    Close(NULL);
+
+    if (m_outFrameBuf)
+        delete [] m_outFrameBuf;
+}
+
+//////////////////////////////////////////////////////////////////////
+// SetInputType - check if given input type is supported
+//////////////////////////////////////////////////////////////////////
+HRESULT CEncoder::SetInputType(LPWAVEFORMATEX lpwfex, bool bJustCheck)
+{
+    CAutoLock l(&m_lock);
+
+    if (lpwfex->wFormatTag == WAVE_FORMAT_PCM)
+    {
+        if (lpwfex->nChannels == 1 || lpwfex->nChannels == 2)
+        {
+            if (lpwfex->nSamplesPerSec  == 48000 ||
+                lpwfex->nSamplesPerSec  == 44100 ||
+                lpwfex->nSamplesPerSec  == 32000 ||
+                lpwfex->nSamplesPerSec  == 24000 ||
+                lpwfex->nSamplesPerSec  == 22050 ||
+                lpwfex->nSamplesPerSec  == 16000 ||
+                lpwfex->nSamplesPerSec  == 12000 ||
+                lpwfex->nSamplesPerSec  == 11025 ||
+                lpwfex->nSamplesPerSec  ==  8000)
+            {
+                if (lpwfex->wBitsPerSample == 16)
+                {
+                    if (!bJustCheck)
+                    {
+                        memcpy(&m_wfex, lpwfex, sizeof(WAVEFORMATEX));
+                        m_bInpuTypeSet = true;
+                    }
+
+                    return S_OK;
+                }
+            }
+        }
+    }
+
+    if (!bJustCheck)
+        m_bInpuTypeSet = false;
+
+    return E_INVALIDARG;
+}
+
+//////////////////////////////////////////////////////////////////////
+// SetOutputType - try to initialize encoder with given output type
+//////////////////////////////////////////////////////////////////////
+HRESULT CEncoder::SetOutputType(MPEG_ENCODER_CONFIG &mabsi)
+{
+    CAutoLock l(&m_lock);
+
+    m_mabsi = mabsi;
+    m_bOutpuTypeSet = true;
+
+    return S_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+// SetDefaultOutputType - sets default MPEG audio properties according
+// to input type
+//////////////////////////////////////////////////////////////////////
+HRESULT CEncoder::SetDefaultOutputType(LPWAVEFORMATEX lpwfex)
+{
+    CAutoLock l(&m_lock);
+
+    if(lpwfex->nChannels == 1 || m_mabsi.bForceMono)
+        m_mabsi.ChMode = MONO;
+
+    if((lpwfex->nSamplesPerSec < m_mabsi.dwSampleRate) || (lpwfex->nSamplesPerSec % m_mabsi.dwSampleRate != 0))
+        m_mabsi.dwSampleRate = lpwfex->nSamplesPerSec;
+
+    return S_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Init - initialized or reiniyialized encoder SDK with given input 
+// and output settings
+//////////////////////////////////////////////////////////////////////
+HRESULT CEncoder::Init()
+{
+    CAutoLock l(&m_lock);
+
+    m_outOffset     = 0;
+    m_outReadOffset = 0;
+
+    m_bFinished     = FALSE;
+
+    m_frameCount    = 0;
+
+    if (!pgf)
+    {
+        if (!m_bInpuTypeSet || !m_bOutpuTypeSet)
+            return E_UNEXPECTED;
+
+        // Init Lame library
+        // note: newer, safer interface which doesn't 
+        // allow or require direct access to 'gf' struct is being written
+        // see the file 'API' included with LAME.
+        if (pgf = lame_init())
+        {
+            lame_set_num_channels(pgf, m_wfex.nChannels);
+            lame_set_in_samplerate(pgf, m_wfex.nSamplesPerSec);
+            lame_set_out_samplerate(pgf, m_mabsi.dwSampleRate);
+            if ((lame_get_out_samplerate(pgf) >= 32000) && (m_mabsi.dwBitrate < 32))
+                lame_set_brate(pgf, 32);
+            else
+                lame_set_brate(pgf, m_mabsi.dwBitrate);
+            lame_set_VBR(pgf, m_mabsi.vmVariable);
+            lame_set_VBR_min_bitrate_kbps(pgf, m_mabsi.dwVariableMin);
+            lame_set_VBR_max_bitrate_kbps(pgf, m_mabsi.dwVariableMax);
+
+            lame_set_copyright(pgf, m_mabsi.bCopyright);
+            lame_set_original(pgf, m_mabsi.bOriginal);
+            lame_set_error_protection(pgf, m_mabsi.bCRCProtect);
+
+            lame_set_bWriteVbrTag(pgf, m_mabsi.dwXingTag);
+            lame_set_strict_ISO(pgf, m_mabsi.dwStrictISO);
+            lame_set_VBR_hard_min(pgf, m_mabsi.dwEnforceVBRmin);
+
+            if (lame_get_num_channels(pgf) == 2 && !m_mabsi.bForceMono)
+            {
+                //int act_br = pgf->VBR ? pgf->VBR_min_bitrate_kbps + pgf->VBR_max_bitrate_kbps / 2 : pgf->brate;
+
+                // Disabled. It's for user's consideration now
+                //int rel = pgf->out_samplerate / (act_br + 1);
+                //pgf->mode = rel < 200 ? m_mabsi.ChMode : JOINT_STEREO;
+
+                lame_set_mode(pgf, m_mabsi.ChMode);
+            }
+            else
+                lame_set_mode(pgf, MONO);
+
+            if (lame_get_mode(pgf) == JOINT_STEREO)
+                lame_set_force_ms(pgf, m_mabsi.dwForceMS);
+            else
+                lame_set_force_ms(pgf, 0);
+
+//            pgf->mode_fixed = m_mabsi.dwModeFixed;
+
+            if (m_mabsi.dwVoiceMode != 0)
+            {
+                lame_set_lowpassfreq(pgf,12000);
+                ///pgf->VBR_max_bitrate_kbps = 160;
+            }
+
+            if (m_mabsi.dwKeepAllFreq != 0)
+            {
+                ///pgf->lowpassfreq = -1;
+                ///pgf->highpassfreq = -1;
+                /// not available anymore
+            }
+
+            lame_set_quality(pgf, m_mabsi.dwQuality);
+            lame_set_VBR_q(pgf, m_mabsi.dwVBRq);
+
+            lame_init_params(pgf);
+
+            // encoder delay compensation
+            {
+                int const nch = lame_get_num_channels(pgf);
+                short * start_padd = (short *)calloc(48, nch * sizeof(short));
+
+				int out_bytes = 0;
+
+                if (nch == 2)
+                    out_bytes = lame_encode_buffer_interleaved(pgf, start_padd, 48, m_outFrameBuf, OUT_BUFFER_SIZE);
+                else
+                    out_bytes = lame_encode_buffer(pgf, start_padd, start_padd, 48, m_outFrameBuf, OUT_BUFFER_SIZE);
+
+				if (out_bytes > 0)
+					m_outOffset += out_bytes;
+
+                free(start_padd);
+            }
+
+            return S_OK;
+        }
+
+        return E_FAIL;
+    }
+
+    return S_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Close - closes encoder
+//////////////////////////////////////////////////////////////////////
+HRESULT CEncoder::Close(IStream* pStream)
+{
+	CAutoLock l(&m_lock);
+    if (pgf)
+    {
+		if(lame_get_bWriteVbrTag(pgf) && pStream)
+		{
+			updateLameTagFrame(pStream);
+		}
+
+        lame_close(pgf);
+        pgf = NULL;
+    }
+
+    return S_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Encode - encodes data placed on pdata and returns
+// the number of processed bytes
+//////////////////////////////////////////////////////////////////////
+int CEncoder::Encode(const short * pdata, int data_size)
+{
+    CAutoLock l(&m_lock);
+
+    if (!pgf || !m_outFrameBuf || !pdata || data_size < 0 || (data_size & (sizeof(short) - 1)))
+        return -1;
+
+    // some data left in the buffer, shift to start
+    if (m_outReadOffset > 0)
+    {
+        if (m_outOffset > m_outReadOffset)
+            memmove(m_outFrameBuf, m_outFrameBuf + m_outReadOffset, m_outOffset - m_outReadOffset);
+
+        m_outOffset -= m_outReadOffset;
+    }
+
+    m_outReadOffset = 0;
+
+
+
+    m_bFinished = FALSE;
+
+    int bytes_processed = 0;
+    int const nch = lame_get_num_channels(pgf);
+
+    while (1)
+    {
+        int nsamples = (data_size - bytes_processed) / (sizeof(short) * nch);
+
+        if (nsamples <= 0)
+            break;
+
+        if (nsamples > 1152)
+            nsamples = 1152;
+
+        if (m_outOffset >= OUT_BUFFER_MAX)
+            break;
+
+        int out_bytes = 0;
+
+        if (nch == 2)
+            out_bytes = lame_encode_buffer_interleaved(
+                                            pgf,
+                                            (short *)(pdata + (bytes_processed / sizeof(short))),
+                                            nsamples,
+                                            m_outFrameBuf + m_outOffset,
+                                            OUT_BUFFER_SIZE - m_outOffset);
+        else
+            out_bytes = lame_encode_buffer(
+                                            pgf,
+                                            pdata + (bytes_processed / sizeof(short)),
+                                            pdata + (bytes_processed / sizeof(short)),
+                                            nsamples,
+                                            m_outFrameBuf + m_outOffset,
+                                            OUT_BUFFER_SIZE - m_outOffset);
+
+        if (out_bytes < 0)
+            return -1;
+
+        m_outOffset     += out_bytes;
+        bytes_processed += nsamples * nch * sizeof(short);
+    }
+
+    return bytes_processed;
+}
+
+//
+// Finsh - flush the buffered samples
+//
+HRESULT CEncoder::Finish()
+{
+    CAutoLock l(&m_lock);
+
+    if (!pgf || !m_outFrameBuf || (m_outOffset >= OUT_BUFFER_MAX))
+        return E_FAIL;
+
+    m_outOffset += lame_encode_flush(pgf, m_outFrameBuf + m_outOffset, OUT_BUFFER_SIZE - m_outOffset);
+
+    m_bFinished = TRUE;
+
+    return S_OK;
+}
+
+
+int getFrameLength(const unsigned char * pdata)
+{
+    if (!pdata || pdata[0] != 0xff || (pdata[1] & 0xe0) != 0xe0)
+        return -1;
+
+    const int sample_rate_tab[4][4] =
+    {
+        {11025,12000,8000,1},
+        {1,1,1,1},
+        {22050,24000,16000,1},
+        {44100,48000,32000,1}
+    };
+
+#define MPEG_VERSION_RESERVED   1
+#define MPEG_VERSION_1          3
+
+#define LAYER_III               1
+
+#define BITRATE_FREE            0
+#define BITRATE_RESERVED        15
+
+#define SRATE_RESERVED          3
+
+#define EMPHASIS_RESERVED       2
+
+    int version_id      = (pdata[1] & 0x18) >> 3;
+    int layer           = (pdata[1] & 0x06) >> 1;
+    int bitrate_id      = (pdata[2] & 0xF0) >> 4;
+    int sample_rate_id  = (pdata[2] & 0x0C) >> 2;
+    int padding         = (pdata[2] & 0x02) >> 1;
+    int emphasis        =  pdata[3] & 0x03;
+
+    if (version_id      != MPEG_VERSION_RESERVED &&
+        layer           == LAYER_III &&
+        bitrate_id      != BITRATE_FREE &&
+        bitrate_id      != BITRATE_RESERVED &&
+        sample_rate_id  != SRATE_RESERVED &&
+        emphasis        != EMPHASIS_RESERVED)
+    {
+        int spf         = (version_id == MPEG_VERSION_1) ? 1152 : 576;
+        int sample_rate = sample_rate_tab[version_id][sample_rate_id];
+        int bitrate     = dwBitRateValue[version_id != MPEG_VERSION_1][bitrate_id - 1] * 1000;
+
+        return (bitrate * spf) / (8 * sample_rate) + padding;
+    }
+
+    return -1;
+}
+
+
+int CEncoder::GetFrame(const unsigned char ** pframe)
+{
+    if (!pgf || !m_outFrameBuf || !pframe)
+        return -1;
+
+	while ((m_outOffset - m_outReadOffset) > 4)
+    {
+        int frame_length = getFrameLength(m_outFrameBuf + m_outReadOffset);
+
+        if (frame_length < 0)
+        {
+            m_outReadOffset++;
+        }
+        else if (frame_length <= (m_outOffset - m_outReadOffset))
+        {
+            *pframe = m_outFrameBuf + m_outReadOffset;
+            m_outReadOffset += frame_length;
+
+            m_frameCount++;
+
+            // don't deliver the first and the last frames
+            if (m_frameCount != 1 && !(m_bFinished && (m_outOffset - m_outReadOffset) < 5))
+                return frame_length;
+        }
+        else
+            break;
+    }
+
+    return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Returns block of a mp3 file, witch size integer multiples of cbAlign
+// or not aligned if finished
+////////////////////////////////////////////////////////////////////////////////
+int CEncoder::GetBlockAligned(const unsigned char ** pblock, int* piBufferSize, const long& cbAlign)
+{
+	ASSERT(piBufferSize);
+    if (!pgf || !m_outFrameBuf || !pblock)
+        return -1;
+
+	int iBlockLen = m_outOffset - m_outReadOffset;
+	ASSERT(iBlockLen >= 0);
+	
+	if(!m_bFinished)
+	{
+		if(cbAlign > 0)
+			iBlockLen-=iBlockLen%cbAlign;
+		*piBufferSize = iBlockLen;
+	}
+	else
+	{
+		if(cbAlign && iBlockLen%cbAlign)
+		{
+			*piBufferSize = iBlockLen + cbAlign - iBlockLen%cbAlign;
+		}
+		else
+		{
+			*piBufferSize = iBlockLen;
+		}
+	}
+
+	if(iBlockLen) {
+		*pblock = m_outFrameBuf + m_outReadOffset;
+		m_outReadOffset+=iBlockLen;
+	}
+
+	return iBlockLen;
+}
+
+HRESULT CEncoder::maybeSyncWord(IStream *pStream)
+{
+	HRESULT hr = S_OK;
+    unsigned char mp3_frame_header[4];
+	ULONG nbytes;
+	if(FAILED(hr = pStream->Read(mp3_frame_header, sizeof(mp3_frame_header), &nbytes)))
+		return hr;
+	
+    if ( nbytes != sizeof(mp3_frame_header) ) {
+        return E_FAIL;
+    }
+    if ( mp3_frame_header[0] != 0xffu ) {
+        return S_FALSE; /* doesn't look like a sync word */
+    }
+    if ( (mp3_frame_header[1] & 0xE0u) != 0xE0u ) {
+		return S_FALSE; /* doesn't look like a sync word */
+    }
+    return S_OK;
+}
+
+HRESULT CEncoder::skipId3v2(IStream *pStream, size_t lametag_frame_size)
+{
+	HRESULT hr = S_OK;
+    ULONG  nbytes;
+    size_t  id3v2TagSize = 0;
+    unsigned char id3v2Header[10];
+	LARGE_INTEGER seekTo;
+
+    /* seek to the beginning of the stream */
+	seekTo.QuadPart = 0;
+	if (FAILED(hr = pStream->Seek(seekTo,  STREAM_SEEK_SET, NULL))) {
+        return hr;  /* not seekable, abort */
+    }
+    /* read 10 bytes in case there's an ID3 version 2 header here */
+	hr = pStream->Read(id3v2Header, sizeof(id3v2Header), &nbytes);
+    if (FAILED(hr))
+		return hr;
+	if(nbytes != sizeof(id3v2Header)) {
+        return E_FAIL;  /* not readable, maybe opened Write-Only */
+    }
+    /* does the stream begin with the ID3 version 2 file identifier? */
+    if (!strncmp((char *) id3v2Header, "ID3", 3)) {
+        /* the tag size (minus the 10-byte header) is encoded into four
+        * bytes where the most significant bit is clear in each byte
+        */
+        id3v2TagSize = (((id3v2Header[6] & 0x7f) << 21)
+            | ((id3v2Header[7] & 0x7f) << 14)
+            | ((id3v2Header[8] & 0x7f) << 7)
+            | (id3v2Header[9] & 0x7f))
+            + sizeof id3v2Header;
+    }
+    /* Seek to the beginning of the audio stream */
+	seekTo.QuadPart = id3v2TagSize;
+	if (FAILED(hr = pStream->Seek(seekTo, STREAM_SEEK_SET, NULL))) {
+        return hr;
+    }
+    if (S_OK != (hr = maybeSyncWord(pStream))) {
+		return SUCCEEDED(hr)?E_FAIL:hr;
+    }
+	seekTo.QuadPart = id3v2TagSize+lametag_frame_size;
+	if (FAILED(hr = pStream->Seek(seekTo, STREAM_SEEK_SET, NULL))) {
+        return hr;
+    }
+    if (S_OK != (hr = maybeSyncWord(pStream))) {
+        return SUCCEEDED(hr)?E_FAIL:hr;
+    }
+    /* OK, it seems we found our LAME-Tag/Xing frame again */
+    /* Seek to the beginning of the audio stream */
+	seekTo.QuadPart = id3v2TagSize;
+	if (FAILED(hr = pStream->Seek(seekTo, STREAM_SEEK_SET, NULL))) {
+        return hr;
+    }
+    return S_OK;
+}
+
+// Updates VBR tag
+HRESULT CEncoder::updateLameTagFrame(IStream* pStream)
+{
+	HRESULT hr = S_OK;
+	size_t n = lame_get_lametag_frame( pgf, 0, 0 ); /* ask for bufer size */
+
+    if ( n > 0 )
+    {
+        unsigned char* buffer = 0;
+        ULONG m = n;
+
+        if ( FAILED(hr = skipId3v2(pStream, n) )) 
+        {
+            /*DispErr( "Error updating LAME-tag frame:\n\n"
+                     "can't locate old frame\n" );*/
+            return hr;
+        }
+
+        buffer = (unsigned char*)malloc( n );
+
+        if ( buffer == 0 ) 
+        {
+            /*DispErr( "Error updating LAME-tag frame:\n\n"
+                     "can't allocate frame buffer\n" );*/
+            return E_OUTOFMEMORY;
+        }
+
+        /* Put it all to disk again */
+        n = lame_get_lametag_frame( pgf, buffer, n );
+        if ( n > 0 ) 
+        {
+			hr = pStream->Write(buffer, n, &m);        
+        }
+        free( buffer );
+
+        if ( m != n ) 
+        {
+            /*DispErr( "Error updating LAME-tag frame:\n\n"
+                     "couldn't write frame into file\n" );*/
+			return E_FAIL;
+        }
+    }
+    return hr;
+}
diff --git a/dshow/Encoder.h b/dshow/Encoder.h
new file mode 100644
index 0000000..f6794dc
--- /dev/null
+++ b/dshow/Encoder.h
@@ -0,0 +1,172 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  LAME encoder wrapper
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(AFX_VITECENCODER_H__40DC8A44_B937_11D2_A381_A2FD7C37FA15__INCLUDED_)
+#define AFX_VITECENCODER_H__40DC8A44_B937_11D2_A381_A2FD7C37FA15__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include <lame.h>
+
+
+const unsigned int dwBitRateValue[2][14] =
+{
+    {32,40,48,56,64,80,96,112,128,160,192,224,256,320},     // MPEG-1
+    {8,16,24,32,40,48,56,64,80,96,112,128,144,160}          // MPEG-2/2.5
+};
+/*
+#define STEREO           0
+#define JOINT_STEREO     1
+#define DUAL_CHANNEL     2
+#define MONO             3
+*/
+
+#define OUT_BUFFER_SIZE             16384
+#define OUT_BUFFER_GUARD            8192
+
+#define OUT_BUFFER_MAX              (OUT_BUFFER_SIZE - OUT_BUFFER_GUARD)
+
+typedef struct {
+    DWORD   dwSampleRate;                   //SF in Hz
+    DWORD   dwBitrate;                      //BR in bit per second
+    vbr_mode    vmVariable;
+    DWORD   dwVariableMin;                  //specify a minimum allowed bitrate
+    DWORD   dwVariableMax;                  //specify a maximum allowed bitrate
+    DWORD   dwQuality;                      //Encoding quality
+    DWORD   dwVBRq;                         // VBR quality setting (0=highest quality, 9=lowest)                         
+    long    lLayer;                         //Layer: 1 or 2
+
+    MPEG_mode ChMode;                       //Channel coding mode: see doc
+    DWORD   dwForceMS;
+
+    DWORD   bCRCProtect;                    //Is CRC protection activated?
+    DWORD   bForceMono;
+    DWORD   bSetDuration;
+    DWORD   bCopyright;                     //Is the stream protected by copyright?
+    DWORD   bOriginal;                      //Is the stream an original?
+
+    DWORD   dwPES;                          // PES header. Obsolete
+
+    DWORD   dwEnforceVBRmin;
+    DWORD   dwVoiceMode;
+    DWORD   dwKeepAllFreq;
+    DWORD   dwStrictISO;
+    DWORD   dwNoShortBlock;
+    DWORD   dwXingTag;
+    DWORD   dwModeFixed;
+    DWORD   bSampleOverlap;
+} MPEG_ENCODER_CONFIG;
+
+
+class CEncoder
+{
+public:
+
+    CEncoder();
+    virtual ~CEncoder();
+
+    // Initialize encoder with PCM stream properties
+    HRESULT SetInputType(LPWAVEFORMATEX lpwfex, bool bJustCheck = FALSE);   // returns E_INVALIDARG if not supported
+    // GetInputType - returns current input type
+    HRESULT GetInputType(WAVEFORMATEX *pwfex)
+    {
+        if(m_bInpuTypeSet)
+        {
+            memcpy(pwfex, &m_wfex, sizeof(WAVEFORMATEX));
+            return S_OK;
+        }
+        else
+            return E_UNEXPECTED;
+    }
+
+    // Set MPEG audio parameters
+    HRESULT SetOutputType(MPEG_ENCODER_CONFIG &mabsi);      // returns E_INVALIDARG if not supported or
+                                                            // not compatible with input type
+    // Return current MPEG audio settings
+    HRESULT GetOutputType(MPEG_ENCODER_CONFIG* pmabsi)
+    {
+        if (m_bOutpuTypeSet)
+        {
+            memcpy(pmabsi, &m_mabsi, sizeof(MPEG_ENCODER_CONFIG));
+            return S_OK;
+        }
+        else
+            return E_UNEXPECTED;
+    }
+
+    // Set if output stream is a PES. Obsolete
+    void SetPES(bool bPES)
+    {
+        m_mabsi.dwPES = false;//bPES;
+    }
+    // Is output stream a PES. Obsolete
+    BOOL IsPES() const
+    {
+        return (BOOL)m_mabsi.dwPES;
+    }
+
+    // Initialize encoder SDK
+    HRESULT Init();
+    // Close encoder SDK
+    HRESULT Close(IStream* pStream);
+
+    // Encode media sample data
+    int Encode(const short * pdata, int data_size);
+    int GetFrame(const unsigned char ** pframe);
+	
+	// Returns block of a mp3 file, witch size integer multiples of cbAlign
+	int GetBlockAligned(const unsigned char ** pblock, int* piBufferSize, const long& cbAlign);
+
+    HRESULT Finish();
+
+protected:
+	HRESULT updateLameTagFrame(IStream* pStream);
+	HRESULT skipId3v2(IStream *pStream, size_t lametag_frame_size);
+	HRESULT maybeSyncWord(IStream *pStream);
+    HRESULT SetDefaultOutputType(LPWAVEFORMATEX lpwfex);
+
+    // Input media type
+    WAVEFORMATEX        m_wfex;
+
+    // Output media type
+    MPEG_ENCODER_CONFIG m_mabsi;
+
+    // Compressor private data
+    lame_global_flags * pgf;
+
+    // Compressor miscelaneous state
+    BOOL                m_bInpuTypeSet;
+    BOOL                m_bOutpuTypeSet;
+
+    BOOL                m_bFinished;
+    int                 m_frameCount;
+
+    unsigned char *     m_outFrameBuf;
+    int                 m_outOffset;
+    int                 m_outReadOffset;
+
+    CCritSec            m_lock;
+};
+
+#endif // !defined(AFX_VITECENCODER_H__40DC8A44_B937_11D2_A381_A2FD7C37FA15__INCLUDED_)
diff --git a/dshow/Makefile.am b/dshow/Makefile.am
new file mode 100644
index 0000000..7ae0a9e
--- /dev/null
+++ b/dshow/Makefile.am
@@ -0,0 +1,27 @@
+## $Id: Makefile.am,v 1.5 2001/02/18 12:11:10 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	Encoder.cpp \
+	Encoder.h \
+	Mpegac.cpp \
+	Mpegac.def \
+	Mpegac.h \
+	PropPage.cpp \
+	PropPage.h \
+	PropPage_adv.cpp \
+	PropPage_adv.h \
+	Property.rc \
+	README \
+	REG.CPP \
+	REG.H \
+	UIDS.H \
+	aboutprp.cpp \
+	aboutprp.h \
+	dshow.dsp \
+	dshow.dsw \
+	elogo.ico \
+	iaudioprops.h \
+	resource.h
+
diff --git a/dshow/Makefile.in b/dshow/Makefile.in
new file mode 100644
index 0000000..7b7604d
--- /dev/null
+++ b/dshow/Makefile.in
@@ -0,0 +1,378 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = dshow
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	Encoder.cpp \
+	Encoder.h \
+	Mpegac.cpp \
+	Mpegac.def \
+	Mpegac.h \
+	PropPage.cpp \
+	PropPage.h \
+	PropPage_adv.cpp \
+	PropPage_adv.h \
+	Property.rc \
+	README \
+	REG.CPP \
+	REG.H \
+	UIDS.H \
+	aboutprp.cpp \
+	aboutprp.h \
+	dshow.dsp \
+	dshow.dsw \
+	elogo.ico \
+	iaudioprops.h \
+	resource.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  dshow/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  dshow/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/dshow/Mpegac.cpp b/dshow/Mpegac.cpp
new file mode 100644
index 0000000..6c86255
--- /dev/null
+++ b/dshow/Mpegac.cpp
@@ -0,0 +1,2025 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  DirectShow filter implementation
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <streams.h>
+#include <olectl.h>
+#include <initguid.h>
+//#include <olectlid.h>
+#include "uids.h"
+#include "iaudioprops.h"
+#include "mpegac.h"
+#include "resource.h"
+
+#include "PropPage.h"
+#include "PropPage_adv.h"
+#include "aboutprp.h"
+
+#include "Encoder.h"
+#include "Reg.h"
+
+#ifndef _INC_MMREG
+#include <mmreg.h>
+#endif
+
+// default parameters
+#define         DEFAULT_LAYER               3
+#define         DEFAULT_STEREO_MODE         JOINT_STEREO
+#define         DEFAULT_FORCE_MS            0
+#define         DEFAULT_MODE_FIXED          0
+#define         DEFAULT_ENFORCE_MIN         0
+#define         DEFAULT_VOICE               0
+#define         DEFAULT_KEEP_ALL_FREQ       0
+#define         DEFAULT_STRICT_ISO          0
+#define         DEFAULT_DISABLE_SHORT_BLOCK 0
+#define         DEFAULT_XING_TAG            0
+#define         DEFAULT_SAMPLE_RATE         44100
+#define         DEFAULT_BITRATE             128
+#define         DEFAULT_VARIABLE            0
+#define         DEFAULT_CRC                 0
+#define         DEFAULT_FORCE_MONO          0
+#define         DEFAULT_SET_DURATION        1
+#define         DEFAULT_SAMPLE_OVERLAP      1
+#define         DEFAULT_COPYRIGHT           0
+#define         DEFAULT_ORIGINAL            0
+#define         DEFAULT_VARIABLEMIN         80
+#define         DEFAULT_VARIABLEMAX         160
+#define         DEFAULT_ENCODING_QUALITY    5
+#define         DEFAULT_VBR_QUALITY         4
+#define         DEFAULT_PES                 0
+
+#define         DEFAULT_FILTER_MERIT        MERIT_DO_NOT_USE                // Standard compressor merit value
+
+#define GET_DATARATE(kbps) (kbps * 1000 / 8)
+#define GET_FRAMELENGTH(bitrate, sample_rate) ((WORD)(((sample_rate < 32000 ? 72000 : 144000) * (bitrate))/(sample_rate)))
+#define DECLARE_PTR(type, ptr, expr) type* ptr = (type*)(expr);
+
+// Create a list of all (or mostly all) of the encoder CBR output capabilities which
+// will be parsed into a list of capabilities used by the IAMStreamConfig Interface
+output_caps_t OutputCapabilities[] = 
+{ // {SampleRate, BitRate}
+    { 48000, 320 },{ 48000, 256 },{ 48000, 224 },{ 48000, 192 },            // MPEG 1.0 Spec @ 48KHz
+    { 48000, 160 },{ 48000, 128 },{ 48000, 112 },{ 48000, 96 },
+    { 48000, 80 },{ 48000, 64 },{ 48000, 56 },{ 48000, 48 },
+    { 48000, 40 },{ 48000, 32 },
+
+    { 24000, 160 },{ 24000, 144 },{ 24000, 128 },{ 24000, 112 },            // MPEG 2.0 Spec @ 24KHz
+    { 24000, 96 },{ 24000, 80 },{ 24000, 64 },{ 24000, 56 },
+    { 24000, 48 },{ 24000, 40 },{ 24000, 32 },{ 24000, 24 },
+    { 24000, 16 },{ 24000, 8 },
+
+    { 12000, 64 },{ 12000, 56 },{ 12000, 48 },{ 12000, 40 },                // MPEG 2.5 Spec @ 12KHz
+    { 12000, 32 },{ 12000, 24 },{ 12000, 16 },{ 12000, 8 },
+    // ---------------------------                                          --------------------------
+    { 44100, 320 },{ 44100, 256 },{ 44100, 224 },{ 44100, 192 },            // MPEG 1.0 Spec @ 44.1KHz
+    { 44100, 160 },{ 44100, 128 },{ 44100, 112 },{ 44100, 96 },
+    { 44100, 80 },{ 44100, 64 },{ 44100, 56 },{ 44100, 48 },
+    { 44100, 40 },{ 44100, 32 },
+
+    { 22050, 160 },{ 22050, 144 },{ 22050, 128 },{ 22050, 112 },            // MPEG 2.0 Spec @ 22.05KHz
+    { 22050, 96 },{ 22050, 80 },{ 22050, 64 },{ 22050, 56 },
+    { 22050, 48 },{ 22050, 40 },{ 22050, 32 },{ 22050, 24 },
+    { 22050, 16 },{ 22050, 8 },
+
+    { 11025, 64 },{ 11025, 56 },{ 11025, 48 },{ 11025, 40 },                // MPEG 2.5 Spec @ 11.025KHz
+    { 11025, 32 },{ 11025, 24 },{ 11025, 16 },{ 11025, 8 },
+    // ---------------------------                                          --------------------------
+    { 32000, 320 },{ 32000, 256 },{ 32000, 224 },{ 32000, 192 },            // MPEG 1.0 Spec @ 32KHz
+    { 32000, 160 },{ 32000, 128 },{ 32000, 112 },{ 32000, 96 },
+    { 32000, 80 },{ 32000, 64 },{ 32000, 56 },{ 32000, 48 },
+    { 32000, 40 },{ 32000, 32 },
+
+    { 16000, 160 },{ 16000, 144 },{ 16000, 128 },{ 16000, 112 },            // MPEG 2.0 Spec @ 16KHz
+    { 16000, 96 },{ 16000, 80 },{ 16000, 64 },{ 16000, 56 },
+    { 16000, 48 },{ 16000, 40 },{ 16000, 32 },{ 16000, 24 },
+    { 16000, 16 },{ 16000, 8 },
+
+    { 8000, 64 },{ 8000, 56 },{ 8000, 48 },{ 8000, 40 },                    // MPEG 2.5 Spec @ 8KHz
+    { 8000, 32 },{ 8000, 24 },{ 8000, 16 },{ 8000, 8 }
+};
+
+
+/*  Registration setup stuff */
+//  Setup data
+
+
+AMOVIESETUP_MEDIATYPE sudMpgInputType[] =
+{
+    { &MEDIATYPE_Audio, &MEDIASUBTYPE_PCM }
+};
+AMOVIESETUP_MEDIATYPE sudMpgOutputType[] =
+{
+    { &MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload },
+    { &MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG2_AUDIO },
+    { &MEDIATYPE_Audio, &MEDIASUBTYPE_MP3 },
+    { &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio }
+};
+
+AMOVIESETUP_PIN sudMpgPins[] =
+{
+    { L"PCM Input",
+      FALSE,                               // bRendered
+      FALSE,                               // bOutput
+      FALSE,                               // bZero
+      FALSE,                               // bMany
+      &CLSID_NULL,                         // clsConnectsToFilter
+      NULL,                                // ConnectsToPin
+      NUMELMS(sudMpgInputType),            // Number of media types
+      sudMpgInputType
+    },
+    { L"MPEG Output",
+      FALSE,                               // bRendered
+      TRUE,                                // bOutput
+      FALSE,                               // bZero
+      FALSE,                               // bMany
+      &CLSID_NULL,                         // clsConnectsToFilter
+      NULL,                                // ConnectsToPin
+      NUMELMS(sudMpgOutputType),           // Number of media types
+      sudMpgOutputType
+    }
+};
+
+AMOVIESETUP_FILTER sudMpgAEnc =
+{
+	&CLSID_LAMEDShowFilter,
+    L"LAME Audio Encoder",
+    DEFAULT_FILTER_MERIT,                  // Standard compressor merit value
+    NUMELMS(sudMpgPins),                   // 2 pins
+    sudMpgPins
+};
+
+/*****************************************************************************/
+// COM Global table of objects in this dll
+static WCHAR g_wszName[] = L"LAME Audio Encoder";
+CFactoryTemplate g_Templates[] = 
+{
+  { g_wszName, &CLSID_LAMEDShowFilter, CMpegAudEnc::CreateInstance, NULL, &sudMpgAEnc },
+  { L"LAME Audio Encoder Property Page", &CLSID_LAMEDShow_PropertyPage, CMpegAudEncPropertyPage::CreateInstance},
+  { L"LAME Audio Encoder Property Page", &CLSID_LAMEDShow_PropertyPageAdv, CMpegAudEncPropertyPageAdv::CreateInstance},
+  { L"LAME Audio Encoder About", &CLSID_LAMEDShow_About, CMAEAbout::CreateInstance}
+};
+// Count of objects listed in g_cTemplates
+int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
+
+
+
+////////////////////////////////////////////
+// Declare the DirectShow filter information.
+
+// Used by IFilterMapper2() in the call to DllRegisterServer()
+// to register the filter in the CLSID_AudioCompressorCategory.
+REGFILTER2 rf2FilterReg = {
+    1,                     // Version number.
+    DEFAULT_FILTER_MERIT,  // Merit. This should match the merit specified in the AMOVIESETUP_FILTER definition
+    NUMELMS(sudMpgPins),   // Number of pins.
+    sudMpgPins             // Pointer to pin information.
+};
+
+STDAPI DllRegisterServer(void)
+{
+    HRESULT hr = AMovieDllRegisterServer2(TRUE);
+    if (FAILED(hr)) {
+        return hr;
+    }
+
+    IFilterMapper2 *pFM2 = NULL;
+    hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&pFM2);
+    if (SUCCEEDED(hr)) {
+        hr = pFM2->RegisterFilter(
+            CLSID_LAMEDShowFilter,           // Filter CLSID. 
+            g_wszName,                       // Filter name.
+            NULL,                            // Device moniker. 
+            &CLSID_AudioCompressorCategory,  // Audio compressor category.
+            g_wszName,                       // Instance data.
+            &rf2FilterReg                    // Filter information.
+            );
+        pFM2->Release();
+    }
+    return hr;
+}
+
+STDAPI DllUnregisterServer()
+{
+    HRESULT hr = AMovieDllRegisterServer2(FALSE);
+    if (FAILED(hr)) {
+        return hr;
+    }
+
+    IFilterMapper2 *pFM2 = NULL;
+    hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&pFM2);
+    if (SUCCEEDED(hr)) {
+        hr = pFM2->UnregisterFilter(&CLSID_AudioCompressorCategory, g_wszName, CLSID_LAMEDShowFilter);
+        pFM2->Release();
+    }
+    return hr;
+}
+
+
+
+CUnknown *CMpegAudEnc::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr) 
+{
+    CMpegAudEnc *punk = new CMpegAudEnc(lpunk, phr);
+    if (punk == NULL) 
+        *phr = E_OUTOFMEMORY;
+    return punk;
+}
+
+CMpegAudEnc::CMpegAudEnc(LPUNKNOWN lpunk, HRESULT *phr)
+ :  CTransformFilter(NAME("LAME Audio Encoder"), lpunk, CLSID_LAMEDShowFilter),
+    CPersistStream(lpunk, phr)
+{
+    // ENCODER OUTPUT PIN
+    // Override the output pin with our own which will implement the IAMStreamConfig Interface
+    CTransformOutputPin *pOut = new CMpegAudEncOutPin( this, phr );
+    if (pOut == NULL) {
+        *phr = E_OUTOFMEMORY;
+        return;
+    }
+    else if (FAILED(*phr)) {             // A failed return code should delete the object
+        delete pOut;
+        return;
+    }
+    m_pOutput = pOut;
+
+    // ENCODER INPUT PIN
+    // Since we've created our own output pin we must also create
+    // the input pin ourselves because the CTransformFilter base class 
+    // will create an extra output pin if the input pin wasn't created.        
+    CTransformInputPin *pIn = new CTransformInputPin(NAME("LameEncoderInputPin"),
+                                                     this,              // Owner filter
+                                                     phr,               // Result code
+                                                     L"Input");         // Pin name
+
+    if (pIn == NULL) {
+        *phr = E_OUTOFMEMORY;
+        return;
+    }
+    else if (FAILED(*phr)) {             // A failed return code should delete the object
+        delete pIn;
+        return;
+    }
+    m_pInput = pIn;
+
+
+    MPEG_ENCODER_CONFIG mec;
+    ReadPresetSettings(&mec);
+    m_Encoder.SetOutputType(mec);
+
+    m_CapsNum = 0;
+    m_hasFinished = TRUE;
+    m_bStreamOutput = FALSE;
+    m_currentMediaTypeIndex = 0;
+}
+
+CMpegAudEnc::~CMpegAudEnc(void)
+{
+}
+
+LPAMOVIESETUP_FILTER CMpegAudEnc::GetSetupData()
+{
+    return &sudMpgAEnc;
+}
+
+
+HRESULT CMpegAudEnc::Receive(IMediaSample * pSample)
+{
+    CAutoLock lock(&m_cs);
+
+    if (!pSample)
+        return S_OK;
+
+    BYTE * pSourceBuffer = NULL;
+
+    if (pSample->GetPointer(&pSourceBuffer) != S_OK || !pSourceBuffer)
+        return S_OK;
+
+    long sample_size = pSample->GetActualDataLength();
+
+    REFERENCE_TIME rtStart, rtStop;
+    BOOL gotValidTime = (pSample->GetTime(&rtStart, &rtStop) != VFW_E_SAMPLE_TIME_NOT_SET);
+
+    if (sample_size <= 0 || pSourceBuffer == NULL || m_hasFinished || (gotValidTime && rtStart < 0))
+        return S_OK;
+
+    if (gotValidTime)
+    {
+        if (m_rtStreamTime < 0)
+        {
+            m_rtStreamTime = rtStart;
+            m_rtEstimated = rtStart;
+        }
+        else
+        {
+            resync_point_t * sync = m_sync + m_sync_in_idx;
+
+            if (sync->applied)
+            {
+                REFERENCE_TIME rtGap = rtStart - m_rtEstimated;
+
+                // if old sync data is applied and gap is greater than 1 ms
+                // then make a new synchronization point
+                if (rtGap > 10000 || (m_allowOverlap && rtGap < -10000))
+                {
+                    sync->sample    = m_samplesIn;
+                    sync->delta     = rtGap;
+                    sync->applied   = FALSE;
+
+                    m_rtEstimated  += sync->delta;
+
+                    if (m_sync_in_idx < (RESYNC_COUNT - 1))
+                        m_sync_in_idx++;
+                    else
+                        m_sync_in_idx = 0;
+                }
+            }
+        }
+    }
+
+    m_rtEstimated   += (LONGLONG)(m_bytesToDuration * sample_size);
+    m_samplesIn     += sample_size / m_bytesPerSample;
+
+    while (sample_size > 0)
+    {
+        int bytes_processed = m_Encoder.Encode((short *)pSourceBuffer, sample_size);
+
+        if (bytes_processed <= 0)
+            return S_OK;
+
+        FlushEncodedSamples();
+
+        sample_size     -= bytes_processed;
+        pSourceBuffer   += bytes_processed;
+    }
+
+    return S_OK;
+}
+
+
+
+
+HRESULT CMpegAudEnc::FlushEncodedSamples()
+{
+    IMediaSample * pOutSample = NULL;
+    BYTE * pDst = NULL;
+
+	if(m_bStreamOutput)
+	{
+		HRESULT hr = S_OK;
+		const unsigned char *   pblock      = NULL;
+		int iBufferSize;
+		int iBlockLength = m_Encoder.GetBlockAligned(&pblock, &iBufferSize, m_cbStreamAlignment);
+		
+		if(!iBlockLength)
+			return S_OK;
+
+		hr = m_pOutput->GetDeliveryBuffer(&pOutSample, NULL, NULL, 0);
+		if (hr == S_OK && pOutSample)
+		{
+			hr = pOutSample->GetPointer(&pDst);
+			if (hr == S_OK && pDst)
+			{
+				CopyMemory(pDst, pblock, iBlockLength);
+				REFERENCE_TIME rtEndPos = m_rtBytePos + iBufferSize;
+				EXECUTE_ASSERT(S_OK == pOutSample->SetTime(&m_rtBytePos, &rtEndPos));
+				pOutSample->SetActualDataLength(iBufferSize);
+				m_rtBytePos += iBlockLength;
+				m_pOutput->Deliver(pOutSample);
+			}
+
+			pOutSample->Release();
+		}
+		return S_OK;
+	}
+
+    if (m_rtStreamTime < 0)
+        m_rtStreamTime = 0;
+
+    while (1)
+    {
+        const unsigned char *   pframe      = NULL;
+        int                     frame_size  = m_Encoder.GetFrame(&pframe);
+
+        if (frame_size <= 0 || !pframe)
+            break;
+
+        if (!m_sync[m_sync_out_idx].applied && m_sync[m_sync_out_idx].sample <= m_samplesOut)
+        {
+            m_rtStreamTime += m_sync[m_sync_out_idx].delta;
+            m_sync[m_sync_out_idx].applied = TRUE;
+
+            if (m_sync_out_idx < (RESYNC_COUNT - 1))
+                m_sync_out_idx++;
+            else
+                m_sync_out_idx = 0;
+        }
+
+        REFERENCE_TIME rtStart = m_rtStreamTime;
+        REFERENCE_TIME rtStop = rtStart + m_rtFrameTime;
+
+		HRESULT hr = S_OK;
+		
+		hr = m_pOutput->GetDeliveryBuffer(&pOutSample, NULL, NULL, 0);
+		if (hr == S_OK && pOutSample)
+		{
+			hr = pOutSample->GetPointer(&pDst);
+			if (hr == S_OK && pDst)
+			{
+				CopyMemory(pDst, pframe, frame_size);
+				pOutSample->SetActualDataLength(frame_size);
+			
+				pOutSample->SetSyncPoint(TRUE);
+				pOutSample->SetTime(&rtStart, m_setDuration ? &rtStop : NULL);
+			
+
+				m_pOutput->Deliver(pOutSample);
+			}
+
+			pOutSample->Release();
+		}
+	
+
+        m_samplesOut += m_samplesPerFrame;
+        m_rtStreamTime = rtStop;
+    }
+
+    return S_OK;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+//  StartStreaming - prepare to receive new data
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::StartStreaming()
+{
+    WAVEFORMATEX * pwfxIn  = (WAVEFORMATEX *) m_pInput->CurrentMediaType().Format();
+
+    m_bytesPerSample    = pwfxIn->nChannels * sizeof(short);
+	DWORD dwOutSampleRate;
+	if(MEDIATYPE_Stream == m_pOutput->CurrentMediaType().majortype)
+	{
+		MPEG_ENCODER_CONFIG mcfg;
+		if(FAILED(m_Encoder.GetOutputType(&mcfg)))
+			return E_FAIL;
+		
+		dwOutSampleRate = mcfg.dwSampleRate;
+	}
+	else
+	{
+		dwOutSampleRate = ((WAVEFORMATEX *) m_pOutput->CurrentMediaType().Format())->nSamplesPerSec;
+	}
+	m_samplesPerFrame   = (dwOutSampleRate >= 32000) ? 1152 : 576;
+
+    m_rtFrameTime = MulDiv(10000000, m_samplesPerFrame, dwOutSampleRate);
+
+    m_samplesIn = m_samplesOut = 0;
+    m_rtStreamTime = -1;
+	m_rtBytePos = 0;
+
+    // initialize encoder
+    m_Encoder.Init();
+
+    m_hasFinished   = FALSE;
+
+    for (int i = 0; i < RESYNC_COUNT; i++)
+    {
+        m_sync[i].sample   = 0;
+        m_sync[i].delta    = 0;
+        m_sync[i].applied  = TRUE;
+    }
+
+    m_sync_in_idx = 0;
+    m_sync_out_idx = 0;
+
+    get_SetDuration(&m_setDuration);
+    get_SampleOverlap(&m_allowOverlap);
+
+	return S_OK;
+}
+
+
+HRESULT CMpegAudEnc::StopStreaming()
+{
+	IStream *pStream = NULL;
+	if(m_bStreamOutput && m_pOutput->IsConnected() != FALSE)
+	{
+		IPin * pDwnstrmInputPin = m_pOutput->GetConnected();
+		if(pDwnstrmInputPin && FAILED(pDwnstrmInputPin->QueryInterface(IID_IStream, (LPVOID*)(&pStream))))
+		{
+			pStream = NULL;
+		}
+	}
+	
+
+	m_Encoder.Close(pStream);
+
+	if(pStream)
+		pStream->Release();
+
+    return S_OK;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+//  EndOfStream - stop data processing 
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::EndOfStream()
+{
+    CAutoLock lock(&m_cs);
+
+    // Flush data
+    m_Encoder.Finish();
+    FlushEncodedSamples();
+
+	IStream *pStream = NULL;
+    if(m_bStreamOutput && m_pOutput->IsConnected() != FALSE)
+	{
+		IPin * pDwnstrmInputPin = m_pOutput->GetConnected();
+		if(pDwnstrmInputPin)
+		{
+			if(FAILED(pDwnstrmInputPin->QueryInterface(IID_IStream, (LPVOID*)(&pStream))))
+			{
+				pStream = NULL;	
+			}
+		}
+	}
+
+	if(pStream)
+	{
+		ULARGE_INTEGER size;
+		size.QuadPart = m_rtBytePos;
+		pStream->SetSize(size);	
+	}
+
+	m_Encoder.Close(pStream);
+
+	if(pStream)
+		pStream->Release();
+
+    m_hasFinished = TRUE;
+
+    return CTransformFilter::EndOfStream();
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+//  BeginFlush  - stop data processing 
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::BeginFlush()
+{
+    HRESULT hr = CTransformFilter::BeginFlush();
+
+    if (SUCCEEDED(hr))
+    {
+        CAutoLock lock(&m_cs);
+
+        DWORD dwDstSize = 0;
+
+        // Flush data
+        m_Encoder.Finish();
+        FlushEncodedSamples();
+
+		IStream *pStream = NULL;
+		if(m_bStreamOutput && m_pOutput->IsConnected() != FALSE)
+		{
+			IPin * pDwnstrmInputPin = m_pOutput->GetConnected();
+			if(pDwnstrmInputPin && SUCCEEDED(pDwnstrmInputPin->QueryInterface(IID_IStream, (LPVOID*)(&pStream))))
+			{
+				ULARGE_INTEGER size;
+				size.QuadPart = m_rtBytePos;
+				pStream->SetSize(size);	
+				pStream->Release();
+			}
+		}
+	    m_rtStreamTime = -1;
+		m_rtBytePos = 0;
+    }
+
+    return hr;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////
+//	SetMediaType - called when filters are connecting
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::SetMediaType(PIN_DIRECTION direction, const CMediaType * pmt)
+{
+    HRESULT hr = S_OK;
+
+    if (direction == PINDIR_INPUT)
+    {
+		if (*pmt->FormatType() != FORMAT_WaveFormatEx)
+        return VFW_E_INVALIDMEDIATYPE;
+
+		if (pmt->FormatLength() < sizeof(WAVEFORMATEX))
+			return VFW_E_INVALIDMEDIATYPE;
+
+        DbgLog((LOG_TRACE,1,TEXT("CMpegAudEnc::SetMediaType(), direction = PINDIR_INPUT")));
+
+        // Pass input media type to encoder
+        m_Encoder.SetInputType((LPWAVEFORMATEX)pmt->Format());
+
+        WAVEFORMATEX * pwfx = (WAVEFORMATEX *)pmt->Format();
+
+        if (pwfx)
+            m_bytesToDuration = (float)1.e7 / (float)(pwfx->nChannels * sizeof(short) * pwfx->nSamplesPerSec);
+        else
+            m_bytesToDuration = 0.0;
+
+        // Parse the encoder output capabilities into the subset of capabilities that are supported 
+        // for the current input format. This listing will be utilized by the IAMStreamConfig Interface.
+        LoadOutputCapabilities(pwfx->nSamplesPerSec);
+
+        Reconnect();
+    }
+    else if (direction == PINDIR_OUTPUT)
+    {
+        // Before we set the output type, we might need to reconnect 
+        // the input pin with a new type.
+        if (m_pInput && m_pInput->IsConnected()) 
+        {
+            // Check if the current input type is compatible.
+            hr = CheckTransform(&m_pInput->CurrentMediaType(), &m_pOutput->CurrentMediaType());
+            if (FAILED(hr)) {
+                // We need to reconnect the input pin. 
+                // Note: The CheckMediaType method has already called QueryAccept on the upstream filter. 
+                hr = m_pGraph->Reconnect(m_pInput);
+                return hr;
+            }
+        }
+
+//        WAVEFORMATEX wfIn;
+//        m_Encoder.GetInputType(&wfIn);
+
+//        if (wfIn.nSamplesPerSec %
+//            ((LPWAVEFORMATEX)pmt->Format())->nSamplesPerSec != 0)
+//            return VFW_E_TYPE_NOT_ACCEPTED;
+    }
+
+    return hr;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// CheckInputType - check if you can support mtIn
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::CheckInputType(const CMediaType* mtIn)
+{
+    if (*mtIn->Type() == MEDIATYPE_Audio && *mtIn->FormatType() == FORMAT_WaveFormatEx)
+        if (mtIn->FormatLength() >= sizeof(WAVEFORMATEX))
+            if (mtIn->IsTemporalCompressed() == FALSE)
+                return m_Encoder.SetInputType((LPWAVEFORMATEX)mtIn->Format(), true);
+
+    return E_INVALIDARG;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// CheckTransform - checks if we can support the transform from this input to this output
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+	if(MEDIATYPE_Stream != mtOut->majortype)
+	{
+		if (*mtOut->FormatType() != FORMAT_WaveFormatEx)
+			return VFW_E_INVALIDMEDIATYPE;
+
+		if (mtOut->FormatLength() < sizeof(WAVEFORMATEX))
+			return VFW_E_INVALIDMEDIATYPE;
+
+		MPEG_ENCODER_CONFIG	mec;
+		if(FAILED(m_Encoder.GetOutputType(&mec)))
+			return S_OK;
+
+		if (((LPWAVEFORMATEX)mtIn->Format())->nSamplesPerSec % mec.dwSampleRate != 0)
+			return S_OK;
+
+		if (mec.dwSampleRate != ((LPWAVEFORMATEX)mtOut->Format())->nSamplesPerSec)
+			return VFW_E_TYPE_NOT_ACCEPTED;
+
+		return S_OK;
+	}
+	else if(mtOut->subtype == MEDIASUBTYPE_MPEG1Audio)
+		return S_OK;
+
+	return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// DecideBufferSize - sets output buffers number and size
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::DecideBufferSize(
+                        IMemAllocator*		  pAllocator,
+                        ALLOCATOR_PROPERTIES* pProperties)
+{
+    HRESULT hr = S_OK;
+
+	if(m_bStreamOutput)
+		m_cbStreamAlignment = pProperties->cbAlign;
+
+    ///
+    if (pProperties->cBuffers == 0) pProperties->cBuffers = 1;  // If downstream filter didn't suggest a buffer count then default to 1
+    pProperties->cbBuffer = OUT_BUFFER_SIZE;
+	//
+	
+	ASSERT(pProperties->cbBuffer);
+	
+    ALLOCATOR_PROPERTIES Actual;
+    hr = pAllocator->SetProperties(pProperties,&Actual);
+    if(FAILED(hr))
+        return hr;
+
+    if (Actual.cbBuffer < pProperties->cbBuffer ||
+        Actual.cBuffers < pProperties->cBuffers) 
+    {// can't use this allocator
+        return E_INVALIDARG;
+    }
+    return S_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// GetMediaType - overrideable for suggesting output pin media types
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::GetMediaType(int iPosition, CMediaType *pMediaType)
+{
+    DbgLog((LOG_TRACE,1,TEXT("CMpegAudEnc::GetMediaType()")));
+
+    return m_pOutput->GetMediaType(iPosition, pMediaType);
+}
+
+////////////////////////////////////////////////////////////////////////////
+//  Reconnect - called after a manual change has been made to the 
+//  encoder parameters to reset the filter output media type structure
+//  to match the current encoder out MPEG audio properties 
+////////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::Reconnect()
+{
+    HRESULT hr = S_FALSE;
+
+    if (m_pOutput && m_pOutput->IsConnected() && m_State == State_Stopped)
+    {
+        MPEG_ENCODER_CONFIG mec;
+        hr = m_Encoder.GetOutputType(&mec);
+
+        if ((hr = m_Encoder.SetOutputType(mec)) == S_OK)
+        {
+            // Create an updated output MediaType using the current encoder settings
+            CMediaType cmt;
+			cmt.InitMediaType();
+            m_pOutput->GetMediaType(m_currentMediaTypeIndex, &cmt);
+
+            // If the updated MediaType matches the current output MediaType no reconnect is needed
+            if (m_pOutput->CurrentMediaType() == cmt) return S_OK;
+
+            // Attempt to reconnect the output pin using the updated MediaType
+            if (S_OK == (hr = m_pOutput->GetConnected()->QueryAccept(&cmt))) {
+                hr = m_pOutput->SetMediaType(&cmt);
+                if ( FAILED(hr) ) { return(hr); }
+
+                hr = m_pGraph->Reconnect(m_pOutput);
+            }
+            else
+                hr = m_pOutput->SetMediaType(&cmt);
+        }
+    }
+
+    return hr;
+}
+
+////////////////////////////////////////////////////////////////////////////
+//  LoadOutputCapabilities - create a list of the currently supported output 
+//  format capabilities which will be used by the IAMStreamConfig Interface
+////////////////////////////////////////////////////////////////////////////
+void CMpegAudEnc::LoadOutputCapabilities(DWORD sample_rate)
+{
+    m_CapsNum = 0;
+
+    // Clear out any existing output capabilities
+    ZeroMemory(OutputCaps, sizeof(OutputCaps));
+
+    // Create the set of Constant Bit Rate output capabilities that are
+    // supported for the current input pin sampling rate.
+    for (int i = 0;  i < NUMELMS(OutputCapabilities); i++) {
+        if (0 == sample_rate % OutputCapabilities[i].nSampleRate) {
+
+            // Add this output capability to the OutputCaps list
+            OutputCaps[m_CapsNum] = OutputCapabilities[i];
+            m_CapsNum++;
+
+            // Don't overrun the hard-coded capabilities array limit
+            if (m_CapsNum > (int)MAX_IAMSTREAMCONFIG_CAPS) break;
+        }
+    }
+}
+
+
+//
+// Read persistent configuration from Registry
+//
+void CMpegAudEnc::ReadPresetSettings(MPEG_ENCODER_CONFIG * pmec)
+{
+    DbgLog((LOG_TRACE,1,TEXT("CMpegAudEnc::ReadPresetSettings()")));
+
+    Lame::CRegKey rk(HKEY_CURRENT_USER, KEY_LAME_ENCODER);
+
+    pmec->dwBitrate         = rk.getDWORD(VALUE_BITRATE,DEFAULT_BITRATE);
+    pmec->dwVariableMin     = rk.getDWORD(VALUE_VARIABLEMIN,DEFAULT_VARIABLEMIN);
+    pmec->dwVariableMax     = rk.getDWORD(VALUE_VARIABLEMAX,DEFAULT_VARIABLEMAX);
+    pmec->vmVariable        = rk.getDWORD(VALUE_VARIABLE, DEFAULT_VARIABLE) ? vbr_rh : vbr_off;
+    pmec->dwQuality         = rk.getDWORD(VALUE_QUALITY,DEFAULT_ENCODING_QUALITY);
+    pmec->dwVBRq            = rk.getDWORD(VALUE_VBR_QUALITY,DEFAULT_VBR_QUALITY);
+    pmec->lLayer            = rk.getDWORD(VALUE_LAYER, DEFAULT_LAYER);
+    pmec->bCRCProtect       = rk.getDWORD(VALUE_CRC, DEFAULT_CRC);
+    pmec->bForceMono        = rk.getDWORD(VALUE_FORCE_MONO, DEFAULT_FORCE_MONO);
+    pmec->bSetDuration      = rk.getDWORD(VALUE_SET_DURATION, DEFAULT_SET_DURATION);
+    pmec->bSampleOverlap    = rk.getDWORD(VALUE_SAMPLE_OVERLAP, DEFAULT_SAMPLE_OVERLAP);
+    pmec->bCopyright        = rk.getDWORD(VALUE_COPYRIGHT, DEFAULT_COPYRIGHT);
+    pmec->bOriginal         = rk.getDWORD(VALUE_ORIGINAL, DEFAULT_ORIGINAL);
+    pmec->dwSampleRate      = rk.getDWORD(VALUE_SAMPLE_RATE, DEFAULT_SAMPLE_RATE);
+    pmec->dwPES             = rk.getDWORD(VALUE_PES, DEFAULT_PES);
+
+    pmec->ChMode            = (MPEG_mode)rk.getDWORD(VALUE_STEREO_MODE, DEFAULT_STEREO_MODE);
+    pmec->dwForceMS         = rk.getDWORD(VALUE_FORCE_MS, DEFAULT_FORCE_MS);
+
+    pmec->dwEnforceVBRmin   = rk.getDWORD(VALUE_ENFORCE_MIN, DEFAULT_ENFORCE_MIN);
+    pmec->dwVoiceMode       = rk.getDWORD(VALUE_VOICE, DEFAULT_VOICE);
+    pmec->dwKeepAllFreq     = rk.getDWORD(VALUE_KEEP_ALL_FREQ, DEFAULT_KEEP_ALL_FREQ);
+    pmec->dwStrictISO       = rk.getDWORD(VALUE_STRICT_ISO, DEFAULT_STRICT_ISO);
+    pmec->dwNoShortBlock    = rk.getDWORD(VALUE_DISABLE_SHORT_BLOCK, DEFAULT_DISABLE_SHORT_BLOCK);
+    pmec->dwXingTag         = rk.getDWORD(VALUE_XING_TAG, DEFAULT_XING_TAG);
+    pmec->dwModeFixed       = rk.getDWORD(VALUE_MODE_FIXED, DEFAULT_MODE_FIXED);
+
+    rk.Close();
+}
+
+////////////////////////////////////////////////////////////////
+//  Property page handling 
+////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEnc::GetPages(CAUUID *pcauuid) 
+{
+    GUID *pguid;
+
+    pcauuid->cElems = 3;
+    pcauuid->pElems = pguid = (GUID *) CoTaskMemAlloc(sizeof(GUID) * pcauuid->cElems);
+
+    if (pcauuid->pElems == NULL)
+        return E_OUTOFMEMORY;
+
+    pguid[0] = CLSID_LAMEDShow_PropertyPage;
+    pguid[1] = CLSID_LAMEDShow_PropertyPageAdv;
+    pguid[2] = CLSID_LAMEDShow_About;
+
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::NonDelegatingQueryInterface(REFIID riid, void ** ppv) 
+{
+
+    if (riid == IID_ISpecifyPropertyPages)
+        return GetInterface((ISpecifyPropertyPages *) this, ppv);
+	else if(riid == IID_IPersistStream)
+        return GetInterface((IPersistStream *)this, ppv);
+//    else if (riid == IID_IVAudioEncSettings)
+//        return GetInterface((IVAudioEncSettings*) this, ppv);
+    else if (riid == IID_IAudioEncoderProperties)
+        return GetInterface((IAudioEncoderProperties*) this, ppv);
+
+    return CTransformFilter::NonDelegatingQueryInterface(riid, ppv);
+}
+
+////////////////////////////////////////////////////////////////
+//IVAudioEncSettings interface methods
+////////////////////////////////////////////////////////////////
+
+//
+// IAudioEncoderProperties
+//
+STDMETHODIMP CMpegAudEnc::get_PESOutputEnabled(DWORD *dwEnabled)
+{
+    *dwEnabled = (DWORD)m_Encoder.IsPES();
+    DbgLog((LOG_TRACE, 1, TEXT("get_PESOutputEnabled -> %d"), *dwEnabled));
+
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_PESOutputEnabled(DWORD dwEnabled)
+{
+    m_Encoder.SetPES((BOOL)!!dwEnabled);
+    DbgLog((LOG_TRACE, 1, TEXT("set_PESOutputEnabled(%d)"), !!dwEnabled));
+
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_MPEGLayer(DWORD *dwLayer)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwLayer = (DWORD)mec.lLayer;
+
+    DbgLog((LOG_TRACE, 1, TEXT("get_MPEGLayer -> %d"), *dwLayer));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_MPEGLayer(DWORD dwLayer)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    if (dwLayer == 2)
+        mec.lLayer = 2;
+    else if (dwLayer == 1)
+        mec.lLayer = 1;
+    m_Encoder.SetOutputType(mec);
+
+    DbgLog((LOG_TRACE, 1, TEXT("set_MPEGLayer(%d)"), dwLayer));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_Bitrate(DWORD *dwBitrate)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwBitrate = (DWORD)mec.dwBitrate;
+    DbgLog((LOG_TRACE, 1, TEXT("get_Bitrate -> %d"), *dwBitrate));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_Bitrate(DWORD dwBitrate)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwBitrate = dwBitrate;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_Bitrate(%d)"), dwBitrate));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_Variable(DWORD *dwVariable)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwVariable = (DWORD)(mec.vmVariable == vbr_off ? 0 : 1);
+    DbgLog((LOG_TRACE, 1, TEXT("get_Variable -> %d"), *dwVariable));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_Variable(DWORD dwVariable)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+
+    mec.vmVariable = dwVariable ? vbr_rh : vbr_off;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_Variable(%d)"), dwVariable));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_VariableMin(DWORD *dwMin)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwMin = (DWORD)mec.dwVariableMin;
+    DbgLog((LOG_TRACE, 1, TEXT("get_Variablemin -> %d"), *dwMin));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_VariableMin(DWORD dwMin)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwVariableMin = dwMin;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_Variablemin(%d)"), dwMin));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_VariableMax(DWORD *dwMax)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwMax = (DWORD)mec.dwVariableMax;
+    DbgLog((LOG_TRACE, 1, TEXT("get_Variablemax -> %d"), *dwMax));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_VariableMax(DWORD dwMax)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwVariableMax = dwMax;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_Variablemax(%d)"), dwMax));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_Quality(DWORD *dwQuality)             
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwQuality=(DWORD)mec.dwQuality;
+    DbgLog((LOG_TRACE, 1, TEXT("get_Quality -> %d"), *dwQuality));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_Quality(DWORD dwQuality)             
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwQuality = dwQuality;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_Quality(%d)"), dwQuality));
+    return S_OK;
+}
+STDMETHODIMP CMpegAudEnc::get_VariableQ(DWORD *dwVBRq)             
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwVBRq=(DWORD)mec.dwVBRq;
+    DbgLog((LOG_TRACE, 1, TEXT("get_VariableQ -> %d"), *dwVBRq));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_VariableQ(DWORD dwVBRq)             
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwVBRq = dwVBRq;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_VariableQ(%d)"), dwVBRq));
+    return S_OK;
+}
+
+
+STDMETHODIMP CMpegAudEnc::get_SourceSampleRate(DWORD *dwSampleRate)
+{
+    *dwSampleRate = 0;
+
+    WAVEFORMATEX wf;
+    if(FAILED(m_Encoder.GetInputType(&wf)))
+        return E_FAIL;
+
+    *dwSampleRate = wf.nSamplesPerSec;
+    DbgLog((LOG_TRACE, 1, TEXT("get_SourceSampleRate -> %d"), *dwSampleRate));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_SourceChannels(DWORD *dwChannels)
+{
+    WAVEFORMATEX wf;
+    if(FAILED(m_Encoder.GetInputType(&wf)))
+        return E_FAIL;
+
+    *dwChannels = wf.nChannels;
+    DbgLog((LOG_TRACE, 1, TEXT("get_SourceChannels -> %d"), *dwChannels));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_SampleRate(DWORD *dwSampleRate)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwSampleRate = mec.dwSampleRate;
+    DbgLog((LOG_TRACE, 1, TEXT("get_SampleRate -> %d"), *dwSampleRate));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_SampleRate(DWORD dwSampleRate)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    DWORD dwOldSampleRate = mec.dwSampleRate;
+    mec.dwSampleRate = dwSampleRate;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_SampleRate(%d)"), dwSampleRate));
+
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_ChannelMode(DWORD *dwChannelMode)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwChannelMode = mec.ChMode;
+    DbgLog((LOG_TRACE, 1, TEXT("get_ChannelMode -> %d"), *dwChannelMode));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_ChannelMode(DWORD dwChannelMode)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.ChMode = (MPEG_mode)dwChannelMode;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_ChannelMode(%d)"), dwChannelMode));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_ForceMS(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.dwForceMS;
+    DbgLog((LOG_TRACE, 1, TEXT("get_ForceMS -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_ForceMS(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwForceMS = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_ForceMS(%d)"), dwFlag));
+    return S_OK;
+}
+
+
+STDMETHODIMP CMpegAudEnc::get_CRCFlag(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.bCRCProtect;
+    DbgLog((LOG_TRACE, 1, TEXT("get_CRCFlag -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_ForceMono(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.bForceMono;
+    DbgLog((LOG_TRACE, 1, TEXT("get_ForceMono -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_SetDuration(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.bSetDuration;
+    DbgLog((LOG_TRACE, 1, TEXT("get_SetDuration -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_SampleOverlap(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.bSampleOverlap;
+    DbgLog((LOG_TRACE, 1, TEXT("get_SampleOverlap -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_CRCFlag(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.bCRCProtect = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_CRCFlag(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_ForceMono(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.bForceMono = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_ForceMono(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_SetDuration(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.bSetDuration = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_SetDuration(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_SampleOverlap(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.bSampleOverlap = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_SampleOverlap(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_EnforceVBRmin(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.dwEnforceVBRmin;
+    DbgLog((LOG_TRACE, 1, TEXT("get_EnforceVBRmin -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_EnforceVBRmin(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwEnforceVBRmin = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_EnforceVBRmin(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_VoiceMode(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.dwVoiceMode;
+    DbgLog((LOG_TRACE, 1, TEXT("get_VoiceMode -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_VoiceMode(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwVoiceMode = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_VoiceMode(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_KeepAllFreq(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.dwKeepAllFreq;
+    DbgLog((LOG_TRACE, 1, TEXT("get_KeepAllFreq -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_KeepAllFreq(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwKeepAllFreq = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_KeepAllFreq(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_StrictISO(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.dwStrictISO;
+    DbgLog((LOG_TRACE, 1, TEXT("get_StrictISO -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_StrictISO(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwStrictISO = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_StrictISO(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_NoShortBlock(DWORD *dwNoShortBlock)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwNoShortBlock = mec.dwNoShortBlock;
+    DbgLog((LOG_TRACE, 1, TEXT("get_NoShortBlock -> %d"), *dwNoShortBlock));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_NoShortBlock(DWORD dwNoShortBlock)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwNoShortBlock = dwNoShortBlock;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_NoShortBlock(%d)"), dwNoShortBlock));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_XingTag(DWORD *dwXingTag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwXingTag = mec.dwXingTag;
+    DbgLog((LOG_TRACE, 1, TEXT("get_XingTag -> %d"), *dwXingTag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_XingTag(DWORD dwXingTag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwXingTag = dwXingTag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_XingTag(%d)"), dwXingTag));
+    return S_OK;
+}
+
+
+
+STDMETHODIMP CMpegAudEnc::get_OriginalFlag(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.bOriginal;
+    DbgLog((LOG_TRACE, 1, TEXT("get_OriginalFlag -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_OriginalFlag(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.bOriginal = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_OriginalFlag(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_CopyrightFlag(DWORD *dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwFlag = mec.bCopyright;
+    DbgLog((LOG_TRACE, 1, TEXT("get_CopyrightFlag -> %d"), *dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_CopyrightFlag(DWORD dwFlag)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.bCopyright = dwFlag;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_CopyrightFlag(%d)"), dwFlag));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_ModeFixed(DWORD *dwModeFixed)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    *dwModeFixed = mec.dwModeFixed;
+    DbgLog((LOG_TRACE, 1, TEXT("get_ModeFixed -> %d"), *dwModeFixed));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::set_ModeFixed(DWORD dwModeFixed)
+{
+    MPEG_ENCODER_CONFIG mec;
+    m_Encoder.GetOutputType(&mec);
+    mec.dwModeFixed = dwModeFixed;
+    m_Encoder.SetOutputType(mec);
+    DbgLog((LOG_TRACE, 1, TEXT("set_ModeFixed(%d)"), dwModeFixed));
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::get_ParameterBlockSize(BYTE *pcBlock, DWORD *pdwSize)
+{
+    DbgLog((LOG_TRACE, 1, TEXT("get_ParameterBlockSize -> %d%d"), *pcBlock, *pdwSize));
+
+    if (pcBlock != NULL) {
+        if (*pdwSize >= sizeof(MPEG_ENCODER_CONFIG)) {
+            m_Encoder.GetOutputType((MPEG_ENCODER_CONFIG*)pcBlock);
+            return S_OK;
+        }
+        else {
+            *pdwSize = sizeof(MPEG_ENCODER_CONFIG);
+            return E_FAIL;
+        }
+    }
+    else if (pdwSize != NULL) {
+        *pdwSize = sizeof(MPEG_ENCODER_CONFIG);
+        return S_OK;
+    }
+
+    return E_FAIL;
+}
+
+STDMETHODIMP CMpegAudEnc::set_ParameterBlockSize(BYTE *pcBlock, DWORD dwSize)
+{
+    DbgLog((LOG_TRACE, 1, TEXT("get_ParameterBlockSize(%d, %d)"), *pcBlock, dwSize));
+    if (sizeof(MPEG_ENCODER_CONFIG) == dwSize){
+        m_Encoder.SetOutputType(*(MPEG_ENCODER_CONFIG*)pcBlock);
+        return S_OK;
+    }
+    else return E_FAIL; 
+}
+
+
+STDMETHODIMP CMpegAudEnc::DefaultAudioEncoderProperties()
+{
+    DbgLog((LOG_TRACE, 1, TEXT("DefaultAudioEncoderProperties()")));
+
+    HRESULT hr = InputTypeDefined();
+    if (FAILED(hr))
+        return hr;
+
+    DWORD dwSourceSampleRate;
+    get_SourceSampleRate(&dwSourceSampleRate);
+
+    set_PESOutputEnabled(DEFAULT_PES);
+    set_MPEGLayer(DEFAULT_LAYER);
+
+    set_Bitrate(DEFAULT_BITRATE);
+    set_Variable(FALSE);
+    set_VariableMin(DEFAULT_VARIABLEMIN);
+    set_VariableMax(DEFAULT_VARIABLEMAX);
+    set_Quality(DEFAULT_ENCODING_QUALITY);
+    set_VariableQ(DEFAULT_VBR_QUALITY);
+
+    set_SampleRate(dwSourceSampleRate);
+    set_CRCFlag(DEFAULT_CRC);
+    set_ForceMono(DEFAULT_FORCE_MONO);
+    set_SetDuration(DEFAULT_SET_DURATION);
+    set_SampleOverlap(DEFAULT_SAMPLE_OVERLAP);
+    set_OriginalFlag(DEFAULT_ORIGINAL);
+    set_CopyrightFlag(DEFAULT_COPYRIGHT);
+
+    set_EnforceVBRmin(DEFAULT_ENFORCE_MIN);
+    set_VoiceMode(DEFAULT_VOICE);
+    set_KeepAllFreq(DEFAULT_KEEP_ALL_FREQ);
+    set_StrictISO(DEFAULT_STRICT_ISO);
+    set_NoShortBlock(DEFAULT_DISABLE_SHORT_BLOCK);
+    set_XingTag(DEFAULT_XING_TAG);
+    set_ForceMS(DEFAULT_FORCE_MS);
+    set_ChannelMode(DEFAULT_STEREO_MODE);
+    set_ModeFixed(DEFAULT_MODE_FIXED);
+
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::LoadAudioEncoderPropertiesFromRegistry()
+{
+    DbgLog((LOG_TRACE, 1, TEXT("LoadAudioEncoderPropertiesFromRegistry()")));
+
+    MPEG_ENCODER_CONFIG mec;
+    ReadPresetSettings(&mec);
+    if(m_Encoder.SetOutputType(mec) == S_FALSE)
+        return S_FALSE;
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::SaveAudioEncoderPropertiesToRegistry()
+{
+    DbgLog((LOG_TRACE, 1, TEXT("SaveAudioEncoderPropertiesToRegistry()")));
+    Lame::CRegKey rk;
+
+    MPEG_ENCODER_CONFIG mec;
+    if(m_Encoder.GetOutputType(&mec) == S_FALSE)
+        return E_FAIL;
+
+    if(rk.Create(HKEY_CURRENT_USER, KEY_LAME_ENCODER))
+    {
+        rk.setDWORD(VALUE_BITRATE, mec.dwBitrate);
+        rk.setDWORD(VALUE_VARIABLE, mec.vmVariable);
+        rk.setDWORD(VALUE_VARIABLEMIN, mec.dwVariableMin);
+        rk.setDWORD(VALUE_VARIABLEMAX, mec.dwVariableMax);
+        rk.setDWORD(VALUE_QUALITY, mec.dwQuality);
+        rk.setDWORD(VALUE_VBR_QUALITY, mec.dwVBRq);
+
+        rk.setDWORD(VALUE_CRC, mec.bCRCProtect);
+        rk.setDWORD(VALUE_FORCE_MONO, mec.bForceMono);
+        rk.setDWORD(VALUE_SET_DURATION, mec.bSetDuration);
+        rk.setDWORD(VALUE_SAMPLE_OVERLAP, mec.bSampleOverlap);
+        rk.setDWORD(VALUE_PES, mec.dwPES);
+        rk.setDWORD(VALUE_COPYRIGHT, mec.bCopyright);
+        rk.setDWORD(VALUE_ORIGINAL, mec.bOriginal);
+        rk.setDWORD(VALUE_SAMPLE_RATE, mec.dwSampleRate);
+
+        rk.setDWORD(VALUE_STEREO_MODE, mec.ChMode);
+        rk.setDWORD(VALUE_FORCE_MS, mec.dwForceMS);
+        rk.setDWORD(VALUE_XING_TAG, mec.dwXingTag);
+        rk.setDWORD(VALUE_DISABLE_SHORT_BLOCK, mec.dwNoShortBlock);
+        rk.setDWORD(VALUE_STRICT_ISO, mec.dwStrictISO);
+        rk.setDWORD(VALUE_KEEP_ALL_FREQ, mec.dwKeepAllFreq);
+        rk.setDWORD(VALUE_VOICE, mec.dwVoiceMode);
+        rk.setDWORD(VALUE_ENFORCE_MIN, mec.dwEnforceVBRmin);
+        rk.setDWORD(VALUE_MODE_FIXED, mec.dwModeFixed);
+
+        rk.Close();
+    }
+
+    // Reconnect filter graph
+    Reconnect();
+
+    return S_OK;
+}
+
+STDMETHODIMP CMpegAudEnc::InputTypeDefined()
+{
+    WAVEFORMATEX wf;
+    if(FAILED(m_Encoder.GetInputType(&wf)))
+    {
+        DbgLog((LOG_TRACE, 1, TEXT("!InputTypeDefined()")));
+        return E_FAIL;
+    }
+
+    DbgLog((LOG_TRACE, 1, TEXT("InputTypeDefined()")));
+    return S_OK;
+}
+
+
+STDMETHODIMP CMpegAudEnc::ApplyChanges()
+{
+    return Reconnect();
+}
+
+//
+// CPersistStream stuff
+//
+
+// what is our class ID?
+STDMETHODIMP CMpegAudEnc::GetClassID(CLSID *pClsid)
+{
+    CheckPointer(pClsid, E_POINTER);
+    *pClsid = CLSID_LAMEDShowFilter;
+    return S_OK;
+}
+
+HRESULT CMpegAudEnc::WriteToStream(IStream *pStream)
+{
+    DbgLog((LOG_TRACE,1,TEXT("WriteToStream()")));
+
+	MPEG_ENCODER_CONFIG mec;
+
+	if(m_Encoder.GetOutputType(&mec) == S_FALSE)
+		return E_FAIL;
+
+    return pStream->Write(&mec, sizeof(mec), 0);
+}
+
+
+// what device should we use?  Used to re-create a .GRF file that we
+// are in
+HRESULT CMpegAudEnc::ReadFromStream(IStream *pStream)
+{
+	MPEG_ENCODER_CONFIG mec;
+
+    HRESULT hr = pStream->Read(&mec, sizeof(mec), 0);
+    if(FAILED(hr))
+        return hr;
+
+	if(m_Encoder.SetOutputType(mec) == S_FALSE)
+		return S_FALSE;
+
+    DbgLog((LOG_TRACE,1,TEXT("ReadFromStream() succeeded")));
+
+    hr = S_OK;
+    return hr;
+}
+
+
+// How long is our data?
+int CMpegAudEnc::SizeMax()
+{
+    return sizeof(MPEG_ENCODER_CONFIG);
+}
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// CMpegAudEncOutPin is the one and only output pin of CMpegAudEnc  
+// 
+//////////////////////////////////////////////////////////////////////////
+CMpegAudEncOutPin::CMpegAudEncOutPin( CMpegAudEnc * pFilter, HRESULT * pHr ) :
+        CTransformOutputPin( NAME("LameEncoderOutputPin"), pFilter, pHr, L"Output\0" ),
+        m_pFilter(pFilter)
+{
+    m_SetFormat = FALSE;
+}
+
+CMpegAudEncOutPin::~CMpegAudEncOutPin()
+{
+} 
+
+STDMETHODIMP CMpegAudEncOutPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
+{
+    if(riid == IID_IAMStreamConfig) {
+        CheckPointer(ppv, E_POINTER);
+        return GetInterface((IAMStreamConfig*)(this), ppv);
+    }
+    return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// This is called after the output format has been negotiated and
+// will update the LAME encoder settings so that it matches the
+// settings specified in the MediaType structure.
+//////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEncOutPin::SetMediaType(const CMediaType *pmt)
+{
+    // Retrieve the current LAME encoder configuration
+    MPEG_ENCODER_CONFIG mec;
+    m_pFilter->m_Encoder.GetOutputType(&mec);
+
+    // Annotate if we are using the MEDIATYPE_Stream output type
+    m_pFilter->m_bStreamOutput = (pmt->majortype == MEDIATYPE_Stream);
+
+    if (pmt->majortype == MEDIATYPE_Stream) {
+        // Update the encoder configuration using the settings that were
+        // cached in the CMpegAudEncOutPin::GetMediaType() call
+        mec.dwSampleRate = m_CurrentOutputFormat.nSampleRate;
+        mec.dwBitrate = m_CurrentOutputFormat.nBitRate;
+        mec.ChMode = m_CurrentOutputFormat.ChMode;
+    }
+    else {
+        // Update the encoder configuration directly using the values
+        // passed via the CMediaType structure.  
+        MPEGLAYER3WAVEFORMAT *pfmt = (MPEGLAYER3WAVEFORMAT*) pmt->Format();
+        mec.dwSampleRate = pfmt->wfx.nSamplesPerSec;
+        mec.dwBitrate = pfmt->wfx.nAvgBytesPerSec * 8 / 1000;
+
+        if (pfmt->wfx.nChannels == 1) { mec.ChMode = MONO; }
+        else if (pfmt->wfx.nChannels == 2 && mec.ChMode == MONO && !mec.bForceMono) { mec.ChMode = STEREO; }
+    }
+    m_pFilter->m_Encoder.SetOutputType(mec);
+
+    // Now configure this MediaType on the output pin
+    HRESULT hr = CTransformOutputPin::SetMediaType(pmt);
+    return hr;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Retrieve the various MediaTypes that match the advertised formats
+// supported on the output pin and configure an AM_MEDIA_TYPE output 
+// structure that is based on the selected format.
+//////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEncOutPin::GetMediaType(int iPosition, CMediaType *pmt)
+{
+    if (iPosition < 0) return E_INVALIDARG;
+
+    // If iPosition equals zero then we always return the currently configured MediaType 
+    if (iPosition == 0) {
+        *pmt = m_mt;
+        return S_OK;
+    }
+
+    switch (iPosition)
+    {
+        case 1:
+        {
+            pmt->SetType(&MEDIATYPE_Audio);
+            pmt->SetSubtype(&MEDIASUBTYPE_MP3);
+            break;
+        }
+        case 2:
+        {
+            pmt->SetType(&MEDIATYPE_Stream);
+            pmt->SetSubtype(&MEDIASUBTYPE_MPEG1Audio);
+            pmt->SetFormatType(&GUID_NULL);
+            break;
+        }
+        case 3:
+        {   // The last case that we evaluate is the MPEG2_PES format, but if the 
+            // encoder isn't configured for it then just return VFW_S_NO_MORE_ITEMS
+            if ( !m_pFilter->m_Encoder.IsPES() ) { return VFW_S_NO_MORE_ITEMS; }
+
+            pmt->SetType(&MEDIATYPE_MPEG2_PES);
+            pmt->SetSubtype(&MEDIASUBTYPE_MPEG2_AUDIO);
+            break;
+        }
+        default:
+            return VFW_S_NO_MORE_ITEMS;
+    }
+
+
+    // Output capabilities are dependent on the input so insure it is connected
+    if ( !m_pFilter->m_pInput->IsConnected() ) {
+        pmt->SetFormatType(&FORMAT_None);
+        return NOERROR;
+    }
+
+
+    // Annotate the current MediaType index for recall in CMpegAudEnc::Reconnect()
+    m_pFilter->m_currentMediaTypeIndex = iPosition;
+
+    // Configure the remaining AM_MEDIA_TYPE parameters using the cached encoder settings.
+    // Since MEDIATYPE_Stream doesn't have a format block the current settings 
+    // for CHANNEL MODE, BITRATE and SAMPLERATE are cached in m_CurrentOutputFormat for use
+    // when we setup the LAME encoder in the call to CMpegAudEncOutPin::SetMediaType()
+    MPEG_ENCODER_CONFIG mec;
+    m_pFilter->m_Encoder.GetOutputType(&mec);           // Retrieve the current encoder config
+
+    WAVEFORMATEX wf;                                    // Retrieve the input configuration
+    m_pFilter->m_Encoder.GetInputType(&wf);
+
+    // Use the current encoder sample rate unless it isn't a modulus of the input rate
+    if ((wf.nSamplesPerSec % mec.dwSampleRate) == 0) { 
+        m_CurrentOutputFormat.nSampleRate = mec.dwSampleRate;
+    }
+    else {
+        m_CurrentOutputFormat.nSampleRate = wf.nSamplesPerSec;
+    }
+
+    // Select the output channel config based on the encoder config and input channel count
+    m_CurrentOutputFormat.ChMode = mec.ChMode;
+    switch (wf.nChannels)                    // Determine if we need to alter ChMode based upon the channel count and ForceMono flag 
+    {
+        case 1:
+        {
+            m_CurrentOutputFormat.ChMode = MONO;
+            break;
+        }
+        case 2:
+        {
+            if (mec.ChMode == MONO && !mec.bForceMono) { m_CurrentOutputFormat.ChMode = STEREO; }
+            else if ( mec.bForceMono ) { m_CurrentOutputFormat.ChMode = MONO; }
+            break;
+        }
+    }
+
+    // Select the encoder bit rate. In VBR mode we set the data rate parameter
+    // of the WAVE_FORMAT_MPEGLAYER3 structure to the minimum VBR value
+    m_CurrentOutputFormat.nBitRate = (mec.vmVariable == vbr_off) ? mec.dwBitrate : mec.dwVariableMin;
+
+    if (pmt->majortype == MEDIATYPE_Stream) return NOERROR;     // No further config required for MEDIATYPE_Stream
+
+
+    // Now configure the remainder of the WAVE_FORMAT_MPEGLAYER3 format block
+    // and its parent AM_MEDIA_TYPE structure
+    DECLARE_PTR(MPEGLAYER3WAVEFORMAT, p_mp3wvfmt, pmt->AllocFormatBuffer(sizeof(MPEGLAYER3WAVEFORMAT)));
+    ZeroMemory(p_mp3wvfmt, sizeof(MPEGLAYER3WAVEFORMAT));
+
+    p_mp3wvfmt->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
+    p_mp3wvfmt->wfx.nChannels = (m_CurrentOutputFormat.ChMode == MONO) ? 1 : 2;
+    p_mp3wvfmt->wfx.nSamplesPerSec = m_CurrentOutputFormat.nSampleRate;
+    p_mp3wvfmt->wfx.nAvgBytesPerSec = GET_DATARATE(m_CurrentOutputFormat.nBitRate);
+    p_mp3wvfmt->wfx.nBlockAlign = 1;
+    p_mp3wvfmt->wfx.wBitsPerSample = 0;
+    p_mp3wvfmt->wfx.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+
+    p_mp3wvfmt->wID = MPEGLAYER3_ID_MPEG;
+    p_mp3wvfmt->fdwFlags = MPEGLAYER3_FLAG_PADDING_ISO;
+    p_mp3wvfmt->nBlockSize = GET_FRAMELENGTH(m_CurrentOutputFormat.nBitRate, p_mp3wvfmt->wfx.nSamplesPerSec);
+    p_mp3wvfmt->nFramesPerBlock = 1;
+    p_mp3wvfmt->nCodecDelay = 0;
+
+    pmt->SetTemporalCompression(FALSE);
+    pmt->SetSampleSize(OUT_BUFFER_SIZE);
+    pmt->SetFormat((LPBYTE)p_mp3wvfmt, sizeof(MPEGLAYER3WAVEFORMAT));
+    pmt->SetFormatType(&FORMAT_WaveFormatEx);
+
+    return NOERROR;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// This method is called to see if a given output format is supported
+//////////////////////////////////////////////////////////////////////////
+HRESULT CMpegAudEncOutPin::CheckMediaType(const CMediaType *pmtOut)
+{
+    // Fail if the input pin is not connected.
+    if (!m_pFilter->m_pInput->IsConnected()) {
+        return VFW_E_NOT_CONNECTED;
+    }
+
+    // Reject any media types that we know in advance our 
+    // filter cannot use.
+    if (pmtOut->majortype != MEDIATYPE_Audio && pmtOut->majortype != MEDIATYPE_Stream) { return S_FALSE; }
+
+    // If SetFormat was previously called, check whether pmtOut exactly 
+    // matches the format that was specified in SetFormat.
+    // Return S_OK if they match, or VFW_E_INVALIDMEDIATYPE otherwise.)
+    if ( m_SetFormat ) {
+        if (*pmtOut != m_mt) { return VFW_E_INVALIDMEDIATYPE; }
+        else { return S_OK; }
+    }
+
+    // Now do the normal check for this media type.
+    HRESULT hr;
+    hr = m_pFilter->CheckTransform (&m_pFilter->m_pInput->CurrentMediaType(),  // The input type.
+                                    pmtOut);                                   // The proposed output type.
+
+    if (hr == S_OK) {
+        return S_OK;           // This format is compatible with the current input type.
+    }
+ 
+    // This format is not compatible with the current input type. 
+    // Maybe we can reconnect the input pin with a new input type.
+    
+    // Enumerate the upstream filter's preferred output types, and 
+    // see if one of them will work.
+    CMediaType *pmtEnum;
+    BOOL fFound = FALSE;
+    IEnumMediaTypes *pEnum;
+    hr = m_pFilter->m_pInput->GetConnected()->EnumMediaTypes(&pEnum);
+    if (hr != S_OK) {
+        return E_FAIL;
+    }
+
+    while (hr = pEnum->Next(1, (AM_MEDIA_TYPE **)&pmtEnum, NULL), hr == S_OK)
+    {
+        // Check this input type against the proposed output type.
+        hr = m_pFilter->CheckTransform(pmtEnum, pmtOut);
+        if (hr != S_OK) {
+            DeleteMediaType(pmtEnum);
+            continue; // Try the next one.
+        }
+
+        // This input type is a possible candidate. But, we have to make
+        // sure that the upstream filter can switch to this type. 
+        hr = m_pFilter->m_pInput->GetConnected()->QueryAccept(pmtEnum);
+        if (hr != S_OK) {
+            // The upstream filter will not switch to this type.
+            DeleteMediaType(pmtEnum);
+            continue; // Try the next one.
+        }
+        fFound = TRUE;
+        DeleteMediaType(pmtEnum);
+        break;
+    }
+    pEnum->Release();
+
+    if (fFound) {
+        // This output type is OK, but if we are asked to use it, we will
+        // need to reconnect our input pin. (See SetFormat, below.)
+        return S_OK;
+    }
+    else {
+        return VFW_E_INVALIDMEDIATYPE;
+    }
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//  IAMStreamConfig
+//////////////////////////////////////////////////////////////////////////
+
+HRESULT STDMETHODCALLTYPE CMpegAudEncOutPin::SetFormat(AM_MEDIA_TYPE *pmt)
+{
+    CheckPointer(pmt, E_POINTER);
+    HRESULT hr;
+
+    // Hold the filter state lock, to make sure that streaming isn't 
+    // in the middle of starting or stopping:
+    CAutoLock cObjectLock(&m_pFilter->m_csFilter);
+
+    // Cannot set the format unless the filter is stopped.
+    if (m_pFilter->m_State != State_Stopped) {
+        return VFW_E_NOT_STOPPED;
+    }
+
+    // The set of possible output formats depends on the input format,
+    // so if the input pin is not connected, return a failure code.
+    if (!m_pFilter->m_pInput->IsConnected()) {
+        return VFW_E_NOT_CONNECTED;
+    }
+
+    // If the pin is already using this format, there's nothing to do.
+    if (IsConnected() && CurrentMediaType() == *pmt) {
+        if ( m_SetFormat ) return S_OK;
+    }
+
+    // See if this media type is acceptable.
+    if ((hr = CheckMediaType((CMediaType *)pmt)) != S_OK) {
+        return hr;
+    }
+
+    // If we're connected to a downstream filter, we have to make
+    // sure that the downstream filter accepts this media type.
+    if (IsConnected()) {
+        hr = GetConnected()->QueryAccept(pmt);
+        if (hr != S_OK) {
+            return VFW_E_INVALIDMEDIATYPE;
+        }
+    }
+
+    // Now make a note that from now on, this is the only format allowed,
+    // and refuse anything but this in the CheckMediaType() code above.
+    m_SetFormat = TRUE;
+    m_mt = *pmt;
+
+    // Changing the format means reconnecting if necessary.
+    if (IsConnected()) {
+        m_pFilter->m_pGraph->Reconnect(this);
+    }
+
+    return NOERROR;
+}
+
+HRESULT STDMETHODCALLTYPE CMpegAudEncOutPin::GetFormat(AM_MEDIA_TYPE **ppmt)
+{
+    *ppmt = CreateMediaType(&m_mt);
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CMpegAudEncOutPin::GetNumberOfCapabilities(int *piCount, int *piSize)
+{
+    // The set of possible output formats depends on the input format,
+    // so if the input pin is not connected, return a failure code.
+    if (!m_pFilter->m_pInput->IsConnected()) {
+        return VFW_E_NOT_CONNECTED;
+    }
+
+    // Retrieve the current encoder configuration
+    MPEG_ENCODER_CONFIG mec;
+    m_pFilter->m_Encoder.GetOutputType(&mec);
+
+    // If the encoder is in VBR mode GetStreamCaps() isn't implemented
+    if (mec.vmVariable != vbr_off) { *piCount = 0; }
+    else { *piCount = m_pFilter->m_CapsNum; }
+
+    *piSize = sizeof(AUDIO_STREAM_CONFIG_CAPS);
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CMpegAudEncOutPin::GetStreamCaps(int iIndex, AM_MEDIA_TYPE **pmt, BYTE *pSCC)
+{
+    // The set of possible output formats depends on the input format,
+    // so if the input pin is not connected, return a failure code.
+    if (!m_pFilter->m_pInput->IsConnected()) {
+        return VFW_E_NOT_CONNECTED;
+    }
+
+    // If we don't have a capabilities array GetStreamCaps() isn't implemented
+    if (m_pFilter->m_CapsNum == 0) return E_NOTIMPL;
+
+    // If the encoder is in VBR mode GetStreamCaps() isn't implemented
+    MPEG_ENCODER_CONFIG mec;
+    m_pFilter->m_Encoder.GetOutputType(&mec);
+    if (mec.vmVariable != vbr_off) return E_NOTIMPL;
+
+    if (iIndex < 0) return E_INVALIDARG;
+    if (iIndex > m_pFilter->m_CapsNum) return S_FALSE;
+
+    // Load the MPEG Layer3 WaveFormatEx structure with the appropriate entries 
+    // for this IAMStreamConfig index element.
+    *pmt = CreateMediaType(&m_mt);
+    if (*pmt == NULL) return E_OUTOFMEMORY;
+
+    DECLARE_PTR(MPEGLAYER3WAVEFORMAT, p_mp3wvfmt, (*pmt)->pbFormat);
+
+    (*pmt)->majortype = MEDIATYPE_Audio;
+    (*pmt)->subtype = MEDIASUBTYPE_MP3;
+    (*pmt)->bFixedSizeSamples = TRUE;
+    (*pmt)->bTemporalCompression = FALSE;
+    (*pmt)->lSampleSize = OUT_BUFFER_SIZE;
+    (*pmt)->formattype = FORMAT_WaveFormatEx;
+    (*pmt)->cbFormat = sizeof(MPEGLAYER3WAVEFORMAT);
+
+    p_mp3wvfmt->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
+    p_mp3wvfmt->wfx.nChannels = 2;
+    p_mp3wvfmt->wfx.nSamplesPerSec = m_pFilter->OutputCaps[iIndex].nSampleRate;
+    p_mp3wvfmt->wfx.nAvgBytesPerSec = GET_DATARATE(m_pFilter->OutputCaps[iIndex].nBitRate);
+    p_mp3wvfmt->wfx.nBlockAlign = 1;
+    p_mp3wvfmt->wfx.wBitsPerSample = 0;
+    p_mp3wvfmt->wfx.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+
+    p_mp3wvfmt->wID = MPEGLAYER3_ID_MPEG;
+    p_mp3wvfmt->fdwFlags = MPEGLAYER3_FLAG_PADDING_ISO;
+    p_mp3wvfmt->nBlockSize = GET_FRAMELENGTH(m_pFilter->OutputCaps[iIndex].nBitRate, m_pFilter->OutputCaps[iIndex].nSampleRate);
+    p_mp3wvfmt->nFramesPerBlock = 1;
+    p_mp3wvfmt->nCodecDelay = 0;
+
+    // Set up the companion AUDIO_STREAM_CONFIG_CAPS structure
+    // We are only using the CHANNELS element of the structure
+    DECLARE_PTR(AUDIO_STREAM_CONFIG_CAPS, pascc, pSCC);
+
+    ZeroMemory(pascc, sizeof(AUDIO_STREAM_CONFIG_CAPS));
+    pascc->guid = MEDIATYPE_Audio;
+
+    pascc->MinimumChannels = 1;
+    pascc->MaximumChannels = 2;
+    pascc->ChannelsGranularity = 1;
+
+    pascc->MinimumSampleFrequency = p_mp3wvfmt->wfx.nSamplesPerSec;
+    pascc->MaximumSampleFrequency = p_mp3wvfmt->wfx.nSamplesPerSec;
+    pascc->SampleFrequencyGranularity = 0;
+
+    pascc->MinimumBitsPerSample = p_mp3wvfmt->wfx.wBitsPerSample;
+    pascc->MaximumBitsPerSample = p_mp3wvfmt->wfx.wBitsPerSample;
+    pascc->BitsPerSampleGranularity = 0;
+
+    return S_OK;
+}
+
diff --git a/dshow/Mpegac.def b/dshow/Mpegac.def
new file mode 100644
index 0000000..d3a2be9
--- /dev/null
+++ b/dshow/Mpegac.def
@@ -0,0 +1,27 @@
+;
+; LAME MP3 encoder for DirectShow
+;
+; Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+;
+; This library is free software; you can redistribute it and/or
+; modify it under the terms of the GNU Library General Public
+; License as published by the Free Software Foundation; either
+; version 2 of the License, or (at your option) any later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; Library General Public License for more details.
+;
+; You should have received a copy of the GNU Library General Public
+; License along with this library; if not, write to the
+; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+; Boston, MA 02111-1307, USA.
+;
+
+LIBRARY     lame.ax
+EXPORTS
+    DllGetClassObject     PRIVATE
+    DllCanUnloadNow       PRIVATE
+    DllRegisterServer     PRIVATE
+    DllUnregisterServer   PRIVATE
diff --git a/dshow/Mpegac.h b/dshow/Mpegac.h
new file mode 100644
index 0000000..9341f0a
--- /dev/null
+++ b/dshow/Mpegac.h
@@ -0,0 +1,287 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  DirectShow filter implementation
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <mmreg.h>
+#include "Encoder.h"
+
+#define KEY_LAME_ENCODER            "SOFTWARE\\GNU\\LAME MPEG Layer III Audio Encoder Filter"
+
+#define VALUE_BITRATE               "Bitrate"
+#define VALUE_VARIABLE              "Variable"
+#define VALUE_VARIABLEMIN           "VariableMin"
+#define VALUE_VARIABLEMAX           "VariableMax"
+#define VALUE_QUALITY               "Quality"
+#define VALUE_VBR_QUALITY           "VBR Quality"
+#define VALUE_SAMPLE_RATE           "Sample Rate"
+
+#define VALUE_STEREO_MODE           "Stereo Mode"
+#define VALUE_FORCE_MS              "Force MS"
+
+#define VALUE_LAYER                 "Layer"
+#define VALUE_ORIGINAL              "Original"
+#define VALUE_COPYRIGHT             "Copyright"
+#define VALUE_CRC                   "CRC"
+#define VALUE_FORCE_MONO            "Force Mono"
+#define VALUE_SET_DURATION          "Set Duration"
+#define VALUE_SAMPLE_OVERLAP        "Allow sample overlap"
+#define VALUE_PES                   "PES"
+
+#define VALUE_ENFORCE_MIN           "EnforceVBRmin"
+#define VALUE_VOICE                 "Voice Mode"
+#define VALUE_KEEP_ALL_FREQ         "Keep All Frequencies"
+#define VALUE_STRICT_ISO            "Strict ISO"
+#define VALUE_DISABLE_SHORT_BLOCK   "No Short Block"
+#define VALUE_XING_TAG              "Xing Tag"
+#define VALUE_MODE_FIXED            "Mode Fixed"
+
+
+typedef struct 
+{
+    DWORD      nSampleRate;
+    DWORD      nBitRate;
+    MPEG_mode  ChMode;                       //Channel coding mode
+} current_output_format_t;
+
+typedef struct 
+{
+    DWORD   nSampleRate;
+    DWORD   nBitRate;
+} output_caps_t;
+
+typedef struct
+{
+    LONGLONG        sample;
+    REFERENCE_TIME  delta;
+
+    BOOL            applied;
+} resync_point_t;
+
+#define RESYNC_COUNT    4
+
+// The maximum number of capabilities that we can expose in our IAMStreamConfig
+// implementation is currently set to 100. This number is larger than we
+// should ever realistically need. However, a cleaner implementation might
+// be to use a dynamically sized array like std::vector or CAtlArray to 
+// hold this data.
+#define MAX_IAMSTREAMCONFIG_CAPS 100
+
+///////////////////////////////////////////////////////////////////
+// CMpegAudEnc class - implementation for ITransformFilter interface
+///////////////////////////////////////////////////////////////////
+class CMpegAudEncOutPin;
+class CMpegAudEncPropertyPage;
+class CMpegAudEnc : public CTransformFilter,
+                    public ISpecifyPropertyPages,
+                    public IAudioEncoderProperties,
+                    public CPersistStream
+{
+public:
+    DECLARE_IUNKNOWN
+
+    static CUnknown *CreateInstance(LPUNKNOWN lpunk, HRESULT *phr);
+
+    LPAMOVIESETUP_FILTER GetSetupData();
+
+    HRESULT Reconnect();
+
+    HRESULT Receive(IMediaSample *pSample);
+
+    HRESULT CheckInputType(const CMediaType* mtIn);
+    HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+    HRESULT DecideBufferSize(IMemAllocator * pAllocator, ALLOCATOR_PROPERTIES *pprop);
+
+    HRESULT GetMediaType  (int iPosition, CMediaType *pMediaType);
+    HRESULT SetMediaType  (PIN_DIRECTION direction,const CMediaType *pmt);
+
+
+    //
+    HRESULT StartStreaming();
+    HRESULT StopStreaming();
+    HRESULT EndOfStream();
+    HRESULT BeginFlush();
+
+    ~CMpegAudEnc(void);
+
+    // ISpecifyPropertyPages
+    STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
+    STDMETHODIMP GetPages(CAUUID *pPages);
+
+    // IAudioEncoderProperties
+    STDMETHODIMP get_PESOutputEnabled(DWORD *dwEnabled);    // PES header. Obsolete
+    STDMETHODIMP set_PESOutputEnabled(DWORD dwEnabled);     // PES header. Obsolete
+
+    STDMETHODIMP get_MPEGLayer(DWORD *dwLayer);
+    STDMETHODIMP set_MPEGLayer(DWORD dwLayer);
+
+    STDMETHODIMP get_Bitrate(DWORD *dwBitrate);
+    STDMETHODIMP set_Bitrate(DWORD dwBitrate);   
+    STDMETHODIMP get_Variable(DWORD *dwVariable);
+    STDMETHODIMP set_Variable(DWORD dwVariable);
+    STDMETHODIMP get_VariableMin(DWORD *dwMin);
+    STDMETHODIMP set_VariableMin(DWORD dwMin);
+    STDMETHODIMP get_VariableMax(DWORD *dwMax);
+    STDMETHODIMP set_VariableMax(DWORD dwMax);
+    STDMETHODIMP get_Quality(DWORD *dwQuality);
+    STDMETHODIMP set_Quality(DWORD dwQuality);
+    STDMETHODIMP get_VariableQ(DWORD *dwVBRq);
+    STDMETHODIMP set_VariableQ(DWORD dwVBRq);
+    STDMETHODIMP get_SourceSampleRate(DWORD *dwSampleRate);
+    STDMETHODIMP get_SourceChannels(DWORD *dwChannels);
+    STDMETHODIMP get_SampleRate(DWORD *dwSampleRate);
+    STDMETHODIMP set_SampleRate(DWORD dwSampleRate);
+
+    STDMETHODIMP get_ChannelMode(DWORD *dwChannelMode);
+    STDMETHODIMP set_ChannelMode(DWORD dwChannelMode);
+    STDMETHODIMP get_ForceMS(DWORD *dwFlag);
+    STDMETHODIMP set_ForceMS(DWORD dwFlag);
+    STDMETHODIMP get_EnforceVBRmin(DWORD *dwFlag);
+    STDMETHODIMP set_EnforceVBRmin(DWORD dwFlag);
+    STDMETHODIMP get_VoiceMode(DWORD *dwFlag);
+    STDMETHODIMP set_VoiceMode(DWORD dwFlag);
+    STDMETHODIMP get_KeepAllFreq(DWORD *dwFlag);
+    STDMETHODIMP set_KeepAllFreq(DWORD dwFlag);
+    STDMETHODIMP get_StrictISO(DWORD *dwFlag);
+    STDMETHODIMP set_StrictISO(DWORD dwFlag);
+    STDMETHODIMP get_NoShortBlock(DWORD *dwNoShortBlock);
+    STDMETHODIMP set_NoShortBlock(DWORD dwNoShortBlock);
+    STDMETHODIMP get_XingTag(DWORD *dwXingTag);
+    STDMETHODIMP set_XingTag(DWORD dwXingTag);
+    STDMETHODIMP get_ModeFixed(DWORD *dwModeFixed);
+    STDMETHODIMP set_ModeFixed(DWORD dwModeFixed);
+
+
+    STDMETHODIMP get_CRCFlag(DWORD *dwFlag);
+    STDMETHODIMP set_CRCFlag(DWORD dwFlag);
+    STDMETHODIMP get_ForceMono(DWORD *dwFlag);
+    STDMETHODIMP set_ForceMono(DWORD dwFlag);
+    STDMETHODIMP get_SetDuration(DWORD *dwFlag);
+    STDMETHODIMP set_SetDuration(DWORD dwFlag);
+    STDMETHODIMP get_OriginalFlag(DWORD *dwFlag);
+    STDMETHODIMP set_OriginalFlag(DWORD dwFlag);
+    STDMETHODIMP get_CopyrightFlag(DWORD *dwFlag);
+    STDMETHODIMP set_CopyrightFlag(DWORD dwFlag);
+    STDMETHODIMP get_SampleOverlap(DWORD *dwFlag);
+    STDMETHODIMP set_SampleOverlap(DWORD dwFlag);
+
+    STDMETHODIMP get_ParameterBlockSize(BYTE *pcBlock, DWORD *pdwSize);
+    STDMETHODIMP set_ParameterBlockSize(BYTE *pcBlock, DWORD dwSize);
+
+    STDMETHODIMP DefaultAudioEncoderProperties();
+    STDMETHODIMP LoadAudioEncoderPropertiesFromRegistry();
+    STDMETHODIMP SaveAudioEncoderPropertiesToRegistry();
+    STDMETHODIMP InputTypeDefined();
+
+    STDMETHODIMP ApplyChanges();
+
+    // CPersistStream
+    HRESULT WriteToStream(IStream *pStream);
+    HRESULT ReadFromStream(IStream *pStream);
+
+    int SizeMax();
+    STDMETHODIMP GetClassID(CLSID *pClsid);
+
+private:
+    CMpegAudEnc(LPUNKNOWN lpunk, HRESULT *phr);
+
+    HRESULT FlushEncodedSamples();
+
+    void ReadPresetSettings(MPEG_ENCODER_CONFIG *pmabsi);
+
+    void LoadOutputCapabilities(DWORD sample_rate);
+
+    // Encoder object
+    CEncoder                    m_Encoder;
+
+    REFERENCE_TIME              m_rtStreamTime;
+    REFERENCE_TIME              m_rtFrameTime;
+    REFERENCE_TIME              m_rtEstimated;
+
+    // Synchronization data
+    LONGLONG                    m_samplesIn;
+    LONGLONG                    m_samplesOut;
+    int                         m_samplesPerFrame;
+    int                         m_bytesPerSample;
+    float                       m_bytesToDuration;
+
+    resync_point_t              m_sync[RESYNC_COUNT];
+    int                         m_sync_in_idx;
+    int                         m_sync_out_idx;
+
+    BOOL                        m_hasFinished;
+
+    CCritSec                    m_cs;
+
+    DWORD                       m_setDuration;
+    DWORD                       m_allowOverlap;
+
+	REFERENCE_TIME m_rtBytePos;
+
+	BOOL						m_bStreamOutput;      // Binary stream output
+	long						m_cbStreamAlignment;  // Stream block size
+    int                         m_CapsNum;
+	int                         m_currentMediaTypeIndex;
+    output_caps_t               OutputCaps[MAX_IAMSTREAMCONFIG_CAPS];
+
+protected:
+    friend class CMpegAudEncOutPin;
+    friend class CMpegAudEncPropertyPage;
+};
+
+
+class CMpegAudEncOutPin : public CTransformOutputPin, public IAMStreamConfig
+{
+public:
+
+    //////////////////////////////////////////////////////////////////////////
+    //  IUnknown
+    //////////////////////////////////////////////////////////////////////////
+    DECLARE_IUNKNOWN
+    STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
+
+    //////////////////////////////////////////////////////////////////////////
+    //  IAMStreamConfig
+    //////////////////////////////////////////////////////////////////////////
+    HRESULT STDMETHODCALLTYPE SetFormat(AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE GetFormat(AM_MEDIA_TYPE **ppmt);
+    HRESULT STDMETHODCALLTYPE GetNumberOfCapabilities(int *piCount, int *piSize);
+    HRESULT STDMETHODCALLTYPE GetStreamCaps(int iIndex, AM_MEDIA_TYPE **pmt, BYTE *pSCC);
+
+    //////////////////////////////////////////////////////////////////////////
+    //  CTransformOutputPin
+    //////////////////////////////////////////////////////////////////////////
+    CMpegAudEncOutPin( CMpegAudEnc * pFilter, HRESULT * pHr );
+    ~CMpegAudEncOutPin();
+
+    HRESULT CheckMediaType(const CMediaType *pmtOut);
+    HRESULT GetMediaType(int iPosition, CMediaType *pmt);
+    HRESULT SetMediaType(const CMediaType *pmt);
+    
+private:
+    BOOL        m_SetFormat;
+    CMpegAudEnc *m_pFilter;
+
+    current_output_format_t  m_CurrentOutputFormat;
+
+protected:
+    friend class CMpegAudEnc;
+
+};
diff --git a/dshow/PropPage.cpp b/dshow/PropPage.cpp
new file mode 100644
index 0000000..7e0b3b7
--- /dev/null
+++ b/dshow/PropPage.cpp
@@ -0,0 +1,646 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Basic property page
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <streams.h>
+#include <olectl.h>
+#include <commctrl.h>
+#include "iaudioprops.h"
+#include "mpegac.h"
+#include "resource.h"
+#include "PropPage.h"
+#include "Reg.h"
+
+// strings to appear in comboboxes
+const char * szBitRateString[2][14] = {
+    {
+        "32 kbps","40 kbps","48 kbps","56 kbps",
+        "64 kbps","80 kbps","96 kbps","112 kbps",
+        "128 kbps","160 kbps","192 kbps","224 kbps",
+        "256 kbps","320 kbps"
+    },
+    {
+        "8 kbps","16 kbps","24 kbps","32 kbps",
+        "40 kbps","48 kbps","56 kbps","64 kbps",
+        "80 kbps","96 kbps","112 kbps","128 kbps",
+        "144 kbps","160 kbps"
+    }
+};
+
+LPCSTR szQualityDesc[10] = {
+    "High", "High", "High", "High", "High",
+    "Medium", "Medium",
+    "Low", "Low",
+    "Fast mode"
+};
+
+LPCSTR szVBRqDesc[10] = {
+    "0 - ~1:4",
+    "1 - ~1:5",
+    "2 - ~1:6",
+    "3 - ~1:7",
+    "4 - ~1:9",
+    "5 - ~1:9",
+    "6 - ~1:10",
+    "7 - ~1:11",
+    "8 - ~1:12",
+    "9 - ~1:14"
+};
+
+struct SSampleRate {
+    DWORD dwSampleRate;
+    LPCSTR lpSampleRate;
+};
+
+SSampleRate srRates[9] = {
+    // MPEG-1
+    {48000, "48 kHz"},
+    {44100, "44.1 kHz"},
+    {32000, "32 kHz"},
+
+    // MPEG-2
+    {24000, "24 kHz"},
+    {22050, "22.05 kHz"},
+    {16000, "16 kHz"},
+
+    // MPEG-2.5
+    {12000, "12 kHz"},
+    {11025, "11.025 kHz"},
+    { 8000, "8 kHz"}
+};
+
+////////////////////////////////////////////////////////////////
+// CreateInstance
+////////////////////////////////////////////////////////////////
+CUnknown *CMpegAudEncPropertyPage::CreateInstance( LPUNKNOWN punk, HRESULT *phr )
+{
+    CMpegAudEncPropertyPage *pNewObject
+        = new CMpegAudEncPropertyPage( punk, phr );
+
+    if( pNewObject == NULL )
+        *phr = E_OUTOFMEMORY;
+
+    return pNewObject;
+}
+
+////////////////////////////////////////////////////////////////
+// Constructor
+////////////////////////////////////////////////////////////////
+CMpegAudEncPropertyPage::CMpegAudEncPropertyPage(LPUNKNOWN punk, HRESULT *phr)
+ : CBasePropertyPage(NAME("Encoder Property Page"), 
+                      punk, IDD_AUDIOENCPROPS, IDS_AUDIO_PROPS_TITLE)                      
+    , m_pAEProps(NULL)
+{
+    ASSERT(phr);
+
+    m_srIdx = 0;
+
+    InitCommonControls();
+}
+
+//
+// OnConnect
+//
+// Give us the filter to communicate with
+HRESULT CMpegAudEncPropertyPage::OnConnect(IUnknown *pUnknown)
+{
+    ASSERT(m_pAEProps == NULL);
+
+    // Ask the filter for it's control interface
+
+    HRESULT hr = pUnknown->QueryInterface(IID_IAudioEncoderProperties,(void **)&m_pAEProps);
+    if (FAILED(hr))
+        return E_NOINTERFACE;
+
+    ASSERT(m_pAEProps);
+
+    // Get current filter state
+    m_pAEProps->get_Bitrate(&m_dwBitrate);
+    m_pAEProps->get_Variable(&m_dwVariable);
+    m_pAEProps->get_VariableMin(&m_dwMin);
+    m_pAEProps->get_VariableMax(&m_dwMax);
+    m_pAEProps->get_Quality(&m_dwQuality);
+    m_pAEProps->get_VariableQ(&m_dwVBRq);
+    m_pAEProps->get_SampleRate(&m_dwSampleRate);
+    m_pAEProps->get_CRCFlag(&m_dwCRC);
+    m_pAEProps->get_ForceMono(&m_dwForceMono);
+    m_pAEProps->get_CopyrightFlag(&m_dwCopyright);
+    m_pAEProps->get_OriginalFlag(&m_dwOriginal);
+
+    return NOERROR;
+}
+
+//
+// OnDisconnect
+//
+// Release the interface
+
+HRESULT CMpegAudEncPropertyPage::OnDisconnect()
+{
+    // Release the interface
+    if (m_pAEProps == NULL)
+        return E_UNEXPECTED;
+
+    m_pAEProps->set_Bitrate(m_dwBitrate);
+    m_pAEProps->set_Variable(m_dwVariable);
+    m_pAEProps->set_VariableMin(m_dwMin);
+    m_pAEProps->set_VariableMax(m_dwMax);
+    m_pAEProps->set_Quality(m_dwQuality);
+    m_pAEProps->set_VariableQ(m_dwVBRq);
+    m_pAEProps->set_SampleRate(m_dwSampleRate);
+    m_pAEProps->set_CRCFlag(m_dwCRC);
+    m_pAEProps->set_ForceMono(m_dwForceMono);
+    m_pAEProps->set_CopyrightFlag(m_dwCopyright);
+    m_pAEProps->set_OriginalFlag(m_dwOriginal);
+    m_pAEProps->SaveAudioEncoderPropertiesToRegistry();
+
+    m_pAEProps->Release();
+    m_pAEProps = NULL;
+
+    return NOERROR;
+}
+
+//
+// OnActivate
+//
+// Called on dialog creation
+
+HRESULT CMpegAudEncPropertyPage::OnActivate(void)
+{
+    InitPropertiesDialog(m_hwnd);
+
+    return NOERROR;
+}
+
+//
+// OnDeactivate
+//
+// Called on dialog destruction
+
+HRESULT CMpegAudEncPropertyPage::OnDeactivate(void)
+{
+    return NOERROR;
+}
+
+////////////////////////////////////////////////////////////////
+// OnReceiveMessage - message handler function
+////////////////////////////////////////////////////////////////
+BOOL CMpegAudEncPropertyPage::OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
+{
+    switch (uMsg)
+    {
+    case WM_HSCROLL:
+        if ((HWND)lParam == m_hwndQuality)
+        {
+            int pos = SendMessage(m_hwndQuality, TBM_GETPOS, 0, 0);
+            if (pos >= 0 && pos < 10)
+            {
+                SetDlgItemText(hwnd,IDC_TEXT_QUALITY,szQualityDesc[pos]);
+                m_pAEProps->set_Quality(pos);
+                SetDirty();
+            }
+        }
+        break;
+
+    case WM_COMMAND:
+        switch (LOWORD(wParam))
+        {
+        case IDC_COMBO_CBR:
+            if (HIWORD(wParam) == CBN_SELCHANGE)
+            {
+                int nBitrate = SendDlgItemMessage(hwnd, IDC_COMBO_CBR, CB_GETCURSEL, 0, 0L);
+                DWORD dwSampleRate;
+                m_pAEProps->get_SampleRate(&dwSampleRate);
+                DWORD dwBitrate;
+
+                if (dwSampleRate >= 32000)
+                {
+                    // Consider MPEG-1
+                    dwBitrate = dwBitRateValue[0][nBitrate];
+                }
+                else
+                {
+                    // Consider MPEG-2/2.5
+                    dwBitrate = dwBitRateValue[1][nBitrate];
+                }
+
+                m_pAEProps->set_Bitrate(dwBitrate);
+
+                SetDirty();
+            }
+            break;
+
+        case IDC_COMBO_VBRMIN:
+            if (HIWORD(wParam) == CBN_SELCHANGE)
+            {
+                int nVariableMin = SendDlgItemMessage(hwnd, IDC_COMBO_VBRMIN, CB_GETCURSEL, 0, 0L);
+                DWORD dwSampleRate;
+                m_pAEProps->get_SampleRate(&dwSampleRate);
+                DWORD dwMin;
+
+                if (dwSampleRate >= 32000)
+                {
+                    // Consider MPEG-1
+                    dwMin = dwBitRateValue[0][nVariableMin];
+                }
+                else
+                {
+                    // Consider MPEG-2/2.5
+                    dwMin = dwBitRateValue[1][nVariableMin];
+                }
+
+                m_pAEProps->set_VariableMin(dwMin);
+
+                SetDirty();
+            }
+            break;
+
+        case IDC_COMBO_VBRMAX:
+            if (HIWORD(wParam) == CBN_SELCHANGE)
+            {
+                int nVariableMax = SendDlgItemMessage(hwnd, IDC_COMBO_VBRMAX, CB_GETCURSEL, 0, 0L);
+                DWORD dwSampleRate;
+                m_pAEProps->get_SampleRate(&dwSampleRate);
+                DWORD dwMax;
+
+                if (dwSampleRate >= 32000)
+                {
+                    // Consider MPEG-1
+                    dwMax = dwBitRateValue[0][nVariableMax];
+                }
+                else
+                {
+                    // Consider MPEG-2/2.5
+                    dwMax = dwBitRateValue[1][nVariableMax];
+                }
+
+                m_pAEProps->set_VariableMax(dwMax);
+
+                SetDirty();
+            }
+            break;
+
+        case IDC_COMBO_SAMPLE_RATE:
+            if (HIWORD(wParam) == CBN_SELCHANGE)
+            {
+                int nSampleRate = SendDlgItemMessage(hwnd, IDC_COMBO_SAMPLE_RATE, CB_GETCURSEL, 0, 0L);
+
+                if (nSampleRate < 0)
+                    nSampleRate = 0;
+                else if (nSampleRate > 2)
+                    nSampleRate = 2;
+
+                DWORD dwSampleRate = srRates[nSampleRate * 3 + m_srIdx].dwSampleRate;
+
+                m_pAEProps->set_SampleRate(dwSampleRate);
+                InitPropertiesDialog(hwnd);
+                SetDirty();
+            }
+            break;
+
+        case IDC_COMBO_VBRq:
+            if (HIWORD(wParam) == CBN_SELCHANGE)
+            {
+                int nVBRq = SendDlgItemMessage(hwnd, IDC_COMBO_VBRq, CB_GETCURSEL, 0, 0L);
+                if (nVBRq >=0 && nVBRq <=9) 
+                    m_pAEProps->set_VariableQ(nVBRq);
+                SetDirty();
+            }
+            break;
+
+        case IDC_RADIO_CBR:
+        case IDC_RADIO_VBR:
+            m_pAEProps->set_Variable(LOWORD(wParam)-IDC_RADIO_CBR);
+            SetDirty();
+            break;
+
+        case IDC_CHECK_PES:
+            m_pAEProps->set_PESOutputEnabled(IsDlgButtonChecked(hwnd, IDC_CHECK_PES));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_COPYRIGHT:
+            m_pAEProps->set_CopyrightFlag(IsDlgButtonChecked(hwnd, IDC_CHECK_COPYRIGHT));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_ORIGINAL:
+            m_pAEProps->set_OriginalFlag(IsDlgButtonChecked(hwnd, IDC_CHECK_ORIGINAL));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_CRC:
+            m_pAEProps->set_CRCFlag(IsDlgButtonChecked(hwnd, IDC_CHECK_CRC));
+            SetDirty();
+            break;
+
+        case IDC_FORCE_MONO:
+            m_pAEProps->set_ForceMono(IsDlgButtonChecked(hwnd, IDC_FORCE_MONO));
+            SetDirty();
+            break;
+        }
+        return TRUE;
+
+    case WM_DESTROY:
+        return TRUE;
+
+    default:
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+//
+// OnApplyChanges
+//
+HRESULT CMpegAudEncPropertyPage::OnApplyChanges()
+{
+    m_pAEProps->get_Bitrate(&m_dwBitrate);
+    m_pAEProps->get_Variable(&m_dwVariable);
+    m_pAEProps->get_VariableMin(&m_dwMin);
+    m_pAEProps->get_VariableMax(&m_dwMax);
+    m_pAEProps->get_Quality(&m_dwQuality);
+    m_pAEProps->get_VariableQ(&m_dwVBRq);
+    m_pAEProps->get_SampleRate(&m_dwSampleRate);
+    m_pAEProps->get_CRCFlag(&m_dwCRC);
+    m_pAEProps->get_ForceMono(&m_dwForceMono);
+    m_pAEProps->get_CopyrightFlag(&m_dwCopyright);
+    m_pAEProps->get_OriginalFlag(&m_dwOriginal);
+    m_pAEProps->SaveAudioEncoderPropertiesToRegistry();
+
+    m_pAEProps->ApplyChanges();
+
+    return S_OK;
+}
+
+//
+// Initialize dialogbox controls with proper values
+//
+void CMpegAudEncPropertyPage::InitPropertiesDialog(HWND hwndParent)
+{
+    EnableControls(hwndParent, TRUE);
+
+    m_hwndQuality = GetDlgItem(hwndParent,IDC_SLIDER_QUALITY);
+    DWORD dwQuality;
+    m_pAEProps->get_Quality(&dwQuality);
+    SendDlgItemMessage(hwndParent, IDC_SLIDER_QUALITY, TBM_SETRANGE, 1, MAKELONG (2,9));
+    SendDlgItemMessage(hwndParent, IDC_SLIDER_QUALITY, TBM_SETPOS, 1, dwQuality);
+    if (dwQuality>=0 && dwQuality<10)
+        SetDlgItemText(hwndParent,IDC_TEXT_QUALITY,szQualityDesc[dwQuality]);
+
+    //
+    // initialize sample rate selection
+    //
+    DWORD dwSourceSampleRate;
+    m_pAEProps->get_SourceSampleRate(&dwSourceSampleRate);
+
+    SendDlgItemMessage(hwndParent, IDC_COMBO_SAMPLE_RATE, CB_RESETCONTENT, 0, 0L);
+
+    switch (dwSourceSampleRate)
+    {
+    case 48000:
+    case 24000:
+    case 12000:
+        m_srIdx = 0;
+        break;
+
+    case 32000:
+    case 16000:
+    case  8000:
+        m_srIdx = 2;
+        break;
+
+    case 44100:
+    case 22050:
+    case 11025:
+    default:
+        m_srIdx = 1;
+    }
+
+    for (int i = 0; i < 3; i++)
+        SendDlgItemMessage(hwndParent, IDC_COMBO_SAMPLE_RATE, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)srRates[i * 3 + m_srIdx].lpSampleRate);
+
+    DWORD dwSampleRate;
+    m_pAEProps->get_SampleRate(&dwSampleRate);
+    m_pAEProps->set_SampleRate(dwSampleRate);
+
+    int nSR = 0;
+    while (dwSampleRate != srRates[nSR * 3 + m_srIdx].dwSampleRate && nSR < 3)
+    {
+        nSR++;
+    }
+
+    if (nSR >= 3)
+        nSR = 0;
+
+    SendDlgItemMessage(hwndParent, IDC_COMBO_SAMPLE_RATE, CB_SETCURSEL, nSR, 0);
+
+    DWORD dwChannels;
+    m_pAEProps->get_SourceChannels(&dwChannels);
+
+    //
+    //initialize VBRq combo box
+    //
+    int k;
+    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRq, CB_RESETCONTENT, 0, 0);
+    for (k = 0; k < 10; k++)
+        SendDlgItemMessage(hwndParent, IDC_COMBO_VBRq, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szVBRqDesc[k]);
+    DWORD dwVBRq;
+    m_pAEProps->get_VariableQ(&dwVBRq);
+    if (dwVBRq<0)
+        dwVBRq = 0;
+    if (dwVBRq>9)
+        dwVBRq = 9;
+    m_pAEProps->set_VariableQ(dwVBRq);
+    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRq, CB_SETCURSEL, dwVBRq, 0);
+
+//////////////////////////////////////
+// initialize CBR selection
+//////////////////////////////////////
+    int nSt;
+
+    SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_RESETCONTENT, 0, 0);
+    if (dwSampleRate >= 32000)
+    {
+        // If target sampling rate is less than 32000, consider
+        // MPEG 1 audio
+        nSt = 0;
+        for (int i = 0; i < 14; i++)
+            SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[0][i]);
+    }
+    else
+    {
+        // Consider MPEG 2 / 2.5 audio
+        nSt = 1;
+        for (int i = 0; i < 14 ; i++)
+            SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[1][i]);
+    }
+
+    DWORD dwBitrate;
+    m_pAEProps->get_Bitrate(&dwBitrate);
+
+    int nBitrateSel = 0;
+    // BitRateValue[][i] is in ascending order
+    // We use this fact. We also know there are 14 bitrate values available.
+    // We are going to use the closest possible, so we can limit loop with 13
+    while (nBitrateSel < 13 && dwBitRateValue[nSt][nBitrateSel] < dwBitrate)
+        nBitrateSel++;
+    SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_SETCURSEL, nBitrateSel, 0);
+
+    // check if the specified bitrate is found exactly and correct if not
+    if (dwBitRateValue[nSt][nBitrateSel] != dwBitrate)
+    {
+        dwBitrate = dwBitRateValue[nSt][nBitrateSel];
+        // we can change it, because it is independent of any other parameters
+        // (but depends on some of them!)
+        m_pAEProps->set_Bitrate(dwBitrate);
+    }
+
+    //
+    // Check VBR/CBR radio button
+    //
+    DWORD dwVariable;
+    m_pAEProps->get_Variable(&dwVariable);
+    CheckRadioButton(hwndParent, IDC_RADIO_CBR, IDC_RADIO_VBR, IDC_RADIO_CBR + dwVariable);
+
+//////////////////////////////////////////////////
+// initialize VBR selection
+//////////////////////////////////////////////////
+    //VBRMIN, VBRMAX
+    int j, nST;
+
+    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_RESETCONTENT, 0, 0);
+
+    if (dwSampleRate >= 32000)
+    {
+            nST = 0;
+            for (j=0; j<14 ;j++) {
+                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[0][j]);
+                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[0][j]);
+            }
+    }
+    else
+    {
+            nST = 1;
+            for (j = 0; j < 14; j++)
+            {
+                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[1][j]);
+                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[1][j]);
+            }
+    }
+
+    DWORD dwMin,dwMax;
+    m_pAEProps->get_VariableMin(&dwMin);
+    m_pAEProps->get_VariableMax(&dwMax);
+
+    int nVariableMinSel = 0;
+    int nVariableMaxSel = 0;
+    
+    // BitRateValue[][i] is in ascending order
+    // We use this fact. We also know there are 14 bitrate values available.
+    // We are going to use the closest possible, so we can limit loop with 13
+    while (nVariableMinSel<13 && dwBitRateValue[nST][nVariableMinSel] < dwMin)
+        nVariableMinSel++;
+    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_SETCURSEL, nVariableMinSel, 0);
+
+    while (nVariableMaxSel<13 && dwBitRateValue[nST][nVariableMaxSel] < dwMax)
+        nVariableMaxSel++;
+    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_SETCURSEL, nVariableMaxSel, 0);
+
+    
+    // check if the specified bitrate is found exactly and correct if not
+    if (dwBitRateValue[nST][nVariableMinSel] != dwMin)
+    {
+        dwMin = dwBitRateValue[nST][nVariableMinSel];
+        // we can change it, because it is independent of any other parameters
+        // (but depends on some of them!)
+        m_pAEProps->set_VariableMin(dwMin);
+    }
+
+    // check if the specified bitrate is found exactly and correct if not
+    if (dwBitRateValue[nST][nVariableMaxSel] != dwMax)
+    {
+        dwMax = dwBitRateValue[nST][nVariableMaxSel];
+        // we can change it, because it is independent of any other parameters
+        // (but depends on some of them!)
+        m_pAEProps->set_VariableMax(dwMax);
+    }
+
+    //
+    // initialize checkboxes
+    //
+    DWORD dwPES;
+    m_pAEProps->get_PESOutputEnabled(&dwPES);
+
+    dwPES = 0;
+    CheckDlgButton(hwndParent, IDC_CHECK_PES, dwPES ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwCRC;
+    m_pAEProps->get_CRCFlag(&dwCRC);
+    CheckDlgButton(hwndParent, IDC_CHECK_CRC, dwCRC ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwForceMono;
+    m_pAEProps->get_ForceMono(&dwForceMono);
+    CheckDlgButton(hwndParent, IDC_FORCE_MONO, dwForceMono ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwCopyright;
+    m_pAEProps->get_CopyrightFlag(&dwCopyright);
+    CheckDlgButton(hwndParent, IDC_CHECK_COPYRIGHT, dwCopyright ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwOriginal;
+    m_pAEProps->get_OriginalFlag(&dwOriginal);
+    CheckDlgButton(hwndParent, IDC_CHECK_ORIGINAL, dwOriginal ? BST_CHECKED : BST_UNCHECKED);
+}
+
+
+////////////////////////////////////////////////////////////////
+// EnableControls
+////////////////////////////////////////////////////////////////
+void CMpegAudEncPropertyPage::EnableControls(HWND hwndParent, bool bEnable)
+{
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_PES), false);//bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_CBR), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_CBR), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_VBR), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_VBRMIN), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_VBRMAX), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_COPYRIGHT), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_ORIGINAL), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_CRC), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_FORCE_MONO), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_SLIDER_QUALITY), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_SAMPLE_RATE), bEnable);
+}
+
+//
+// SetDirty
+//
+// notifies the property page site of changes
+
+void CMpegAudEncPropertyPage::SetDirty()
+{
+    m_bDirty = TRUE;
+    if (m_pPageSite)
+        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
+}
+
diff --git a/dshow/PropPage.h b/dshow/PropPage.h
new file mode 100644
index 0000000..fa7fbe9
--- /dev/null
+++ b/dshow/PropPage.h
@@ -0,0 +1,60 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Basic property page
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+class CMpegAudEncPropertyPage : public CBasePropertyPage 
+{
+
+public:
+    static CUnknown *CreateInstance( LPUNKNOWN punk, HRESULT *phr );
+    CMpegAudEncPropertyPage( LPUNKNOWN punk, HRESULT *phr );
+
+    HRESULT OnConnect(IUnknown *pUnknown);
+    HRESULT OnDisconnect();
+    HRESULT OnActivate();
+    HRESULT OnDeactivate();
+    HRESULT OnApplyChanges();
+    BOOL OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
+
+private:
+    void    InitPropertiesDialog(HWND hwndParent);
+    void    EnableControls(HWND hwndParent, bool bEnable);
+    void    SetDirty(void);
+
+    DWORD   m_dwBitrate;                //constant bit rate
+    DWORD   m_dwVariable;               //flag - whether the variable bit rate set 
+    DWORD   m_dwMin;                    //specify a minimum allowed bitrate
+    DWORD   m_dwMax;                    //specify a maximum allowed bitrate
+    DWORD   m_dwQuality;                //encoding quality
+    DWORD   m_dwVBRq;                   //VBR quality setting (0=highest quality, 9=lowest) 
+    DWORD   m_dwSampleRate;
+    DWORD   m_dwChannelMode;
+    DWORD   m_dwCRC;
+    DWORD   m_dwForceMono;
+    DWORD   m_dwCopyright;
+    DWORD   m_dwOriginal;
+
+    HWND    m_hwndQuality;               //Slider window handle
+
+    int     m_srIdx;
+
+    IAudioEncoderProperties *m_pAEProps;
+};
diff --git a/dshow/PropPage_adv.cpp b/dshow/PropPage_adv.cpp
new file mode 100644
index 0000000..54e4cbe
--- /dev/null
+++ b/dshow/PropPage_adv.cpp
@@ -0,0 +1,367 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Advanced property page
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <streams.h>
+#include <olectl.h>
+#include <commctrl.h>
+#include "iaudioprops.h"
+#include "mpegac.h"
+#include "resource.h"
+#include "PropPage_adv.h"
+#include "Reg.h"
+
+#define         MPG_MD_STEREO           0
+#define         MPG_MD_JOINT_STEREO     1
+#define         MPG_MD_DUAL_CHANNEL     2
+#define         MPG_MD_MONO             3
+
+// Strings which apear in comboboxes
+const char *chChMode[4] = {
+    "Mono",
+    "Standard stereo",
+    "Joint stereo",
+    "Dual channel"};
+
+////////////////////////////////////////////////////////////////
+// CreateInstance
+////////////////////////////////////////////////////////////////
+CUnknown *CMpegAudEncPropertyPageAdv::CreateInstance( LPUNKNOWN punk, HRESULT *phr )
+{
+    CMpegAudEncPropertyPageAdv *pNewObject
+        = new CMpegAudEncPropertyPageAdv( punk, phr );
+
+    if( pNewObject == NULL )
+        *phr = E_OUTOFMEMORY;
+
+    return pNewObject;
+}
+
+////////////////////////////////////////////////////////////////
+// Constructor
+////////////////////////////////////////////////////////////////
+CMpegAudEncPropertyPageAdv::CMpegAudEncPropertyPageAdv(LPUNKNOWN punk, HRESULT *phr) :
+    CBasePropertyPage(NAME("Encoder Advanced Property Page"), punk, IDD_ADVPROPS, IDS_AUDIO_ADVANCED_TITLE),
+    m_pAEProps(NULL)
+{
+    ASSERT(phr);
+
+    InitCommonControls();
+}
+
+//
+// OnConnect
+//
+// Give us the filter to communicate with
+HRESULT CMpegAudEncPropertyPageAdv::OnConnect(IUnknown *pUnknown)
+{
+    ASSERT(m_pAEProps == NULL);
+
+    // Ask the filter for it's control interface
+
+    HRESULT hr = pUnknown->QueryInterface(IID_IAudioEncoderProperties,(void **)&m_pAEProps);
+    if (FAILED(hr) || !m_pAEProps)
+        return E_NOINTERFACE;
+
+    ASSERT(m_pAEProps);
+
+    // Get current filter state
+//    m_pAEProps->LoadAudioEncoderPropertiesFromRegistry();
+
+    m_pAEProps->get_EnforceVBRmin(&m_dwEnforceVBRmin);
+    m_pAEProps->get_VoiceMode(&m_dwVoiceMode);
+    m_pAEProps->get_KeepAllFreq(&m_dwKeepAllFreq);
+    m_pAEProps->get_StrictISO(&m_dwStrictISO);
+    m_pAEProps->get_NoShortBlock(&m_dwNoShortBlock);
+    m_pAEProps->get_XingTag(&m_dwXingTag);
+    m_pAEProps->get_ChannelMode(&m_dwChannelMode);
+    m_pAEProps->get_ForceMS(&m_dwForceMS);
+    m_pAEProps->get_ModeFixed(&m_dwModeFixed);
+    m_pAEProps->get_SampleOverlap(&m_dwOverlap);
+    m_pAEProps->get_SetDuration(&m_dwSetStop);
+
+    return NOERROR;
+}
+
+//
+// OnDisconnect
+//
+// Release the interface
+
+HRESULT CMpegAudEncPropertyPageAdv::OnDisconnect()
+{
+    // Release the interface
+    if (m_pAEProps == NULL)
+        return E_UNEXPECTED;
+
+    m_pAEProps->set_EnforceVBRmin(m_dwEnforceVBRmin);
+    m_pAEProps->set_VoiceMode(m_dwVoiceMode);
+    m_pAEProps->set_KeepAllFreq(m_dwKeepAllFreq);
+    m_pAEProps->set_StrictISO(m_dwStrictISO);
+    m_pAEProps->set_NoShortBlock(m_dwNoShortBlock);
+    m_pAEProps->set_XingTag(m_dwXingTag);
+    m_pAEProps->set_ChannelMode(m_dwChannelMode);
+    m_pAEProps->set_ForceMS(m_dwForceMS);
+    m_pAEProps->set_ModeFixed(m_dwModeFixed);
+    m_pAEProps->set_SampleOverlap(m_dwOverlap);
+    m_pAEProps->set_SetDuration(m_dwSetStop);
+    m_pAEProps->SaveAudioEncoderPropertiesToRegistry();
+
+    m_pAEProps->Release();
+    m_pAEProps = NULL;
+
+    return NOERROR;
+}
+
+//
+// OnActivate
+//
+// Called on dialog creation
+
+HRESULT CMpegAudEncPropertyPageAdv::OnActivate(void)
+{
+    InitPropertiesDialog(m_hwnd);
+
+    return NOERROR;
+}
+
+//
+// OnDeactivate
+//
+// Called on dialog destruction
+
+HRESULT CMpegAudEncPropertyPageAdv::OnDeactivate(void)
+{
+    return NOERROR;
+}
+
+////////////////////////////////////////////////////////////////
+// OnReceiveMessage - message handler function
+////////////////////////////////////////////////////////////////
+BOOL CMpegAudEncPropertyPageAdv::OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
+{
+    switch (uMsg)
+    {
+    case WM_COMMAND:
+        switch (LOWORD(wParam))
+        {
+        case IDC_RADIO_STEREO:
+        case IDC_RADIO_JSTEREO:
+        case IDC_RADIO_DUAL:
+        case IDC_RADIO_MONO:
+            {
+
+                DWORD dwChannelMode = LOWORD(wParam) - IDC_RADIO_STEREO;
+                CheckRadioButton(hwnd, IDC_RADIO_STEREO, IDC_RADIO_MONO, LOWORD(wParam));
+
+                if (dwChannelMode == MPG_MD_JOINT_STEREO)
+                    EnableWindow(GetDlgItem(hwnd,IDC_CHECK_FORCE_MS),TRUE);
+                else
+                    EnableWindow(GetDlgItem(hwnd,IDC_CHECK_FORCE_MS),FALSE);
+
+                m_pAEProps->set_ChannelMode(dwChannelMode);
+                SetDirty();
+            }
+            break;
+
+        case IDC_CHECK_ENFORCE_MIN:
+            m_pAEProps->set_EnforceVBRmin(IsDlgButtonChecked(hwnd, IDC_CHECK_ENFORCE_MIN));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_VOICE:
+            m_pAEProps->set_VoiceMode(IsDlgButtonChecked(hwnd, IDC_CHECK_VOICE));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_KEEP_ALL_FREQ:
+            m_pAEProps->set_KeepAllFreq(IsDlgButtonChecked(hwnd, IDC_CHECK_KEEP_ALL_FREQ));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_STRICT_ISO:
+            m_pAEProps->set_StrictISO(IsDlgButtonChecked(hwnd, IDC_CHECK_STRICT_ISO));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_DISABLE_SHORT_BLOCK:
+            m_pAEProps->set_NoShortBlock(IsDlgButtonChecked(hwnd, IDC_CHECK_DISABLE_SHORT_BLOCK));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_XING_TAG:
+            m_pAEProps->set_XingTag(IsDlgButtonChecked(hwnd, IDC_CHECK_XING_TAG));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_FORCE_MS:
+            m_pAEProps->set_ForceMS(IsDlgButtonChecked(hwnd, IDC_CHECK_FORCE_MS));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_MODE_FIXED:
+            m_pAEProps->set_ModeFixed(IsDlgButtonChecked(hwnd, IDC_CHECK_MODE_FIXED));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_OVERLAP:
+            m_pAEProps->set_SampleOverlap(IsDlgButtonChecked(hwnd, IDC_CHECK_OVERLAP));
+            SetDirty();
+            break;
+
+        case IDC_CHECK_STOP:
+            m_pAEProps->set_SetDuration(IsDlgButtonChecked(hwnd, IDC_CHECK_STOP));
+            SetDirty();
+            break;
+        }
+
+        return TRUE;
+
+    case WM_DESTROY:
+        return TRUE;
+
+    default:
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+//
+// OnApplyChanges
+//
+HRESULT CMpegAudEncPropertyPageAdv::OnApplyChanges()
+{
+    m_pAEProps->get_EnforceVBRmin(&m_dwEnforceVBRmin);
+    m_pAEProps->get_VoiceMode(&m_dwVoiceMode);
+    m_pAEProps->get_KeepAllFreq(&m_dwKeepAllFreq);
+    m_pAEProps->get_StrictISO(&m_dwStrictISO);
+    m_pAEProps->get_ChannelMode(&m_dwChannelMode);
+    m_pAEProps->get_ForceMS(&m_dwForceMS);
+    m_pAEProps->get_NoShortBlock(&m_dwNoShortBlock);
+    m_pAEProps->get_XingTag(&m_dwXingTag);
+    m_pAEProps->get_ModeFixed(&m_dwModeFixed);
+    m_pAEProps->get_SampleOverlap(&m_dwOverlap);
+    m_pAEProps->get_SetDuration(&m_dwSetStop);
+    m_pAEProps->SaveAudioEncoderPropertiesToRegistry();
+
+    m_pAEProps->ApplyChanges();
+
+    return S_OK;
+}
+
+//
+// Initialize dialogbox controls with proper values
+//
+void CMpegAudEncPropertyPageAdv::InitPropertiesDialog(HWND hwndParent)
+{
+    EnableControls(hwndParent, TRUE);
+
+    //
+    // initialize radio bottons
+    //
+    DWORD dwChannelMode;
+    m_pAEProps->get_ChannelMode(&dwChannelMode);
+    CheckRadioButton(hwndParent, IDC_RADIO_STEREO, IDC_RADIO_MONO, IDC_RADIO_STEREO + dwChannelMode);
+
+    if (dwChannelMode == MPG_MD_JOINT_STEREO)
+        EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_FORCE_MS), TRUE);
+    else
+        EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_FORCE_MS), FALSE);
+
+    //
+    // initialize checkboxes
+    //
+    DWORD dwEnforceVBRmin;
+    m_pAEProps->get_EnforceVBRmin(&dwEnforceVBRmin);
+    CheckDlgButton(hwndParent, IDC_CHECK_ENFORCE_MIN, dwEnforceVBRmin ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwVoiceMode;
+    m_pAEProps->get_VoiceMode(&dwVoiceMode);
+    CheckDlgButton(hwndParent, IDC_CHECK_VOICE, dwVoiceMode ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwKeepAllFreq;
+    m_pAEProps->get_KeepAllFreq(&dwKeepAllFreq);
+    CheckDlgButton(hwndParent, IDC_CHECK_KEEP_ALL_FREQ, dwKeepAllFreq ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwStrictISO;
+    m_pAEProps->get_StrictISO(&dwStrictISO);
+    CheckDlgButton(hwndParent, IDC_CHECK_STRICT_ISO, dwStrictISO ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwNoShortBlock;
+    m_pAEProps->get_NoShortBlock(&dwNoShortBlock);
+    CheckDlgButton(hwndParent, IDC_CHECK_DISABLE_SHORT_BLOCK, dwNoShortBlock ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwXingEnabled;
+    m_pAEProps->get_XingTag(&dwXingEnabled);
+    CheckDlgButton(hwndParent, IDC_CHECK_XING_TAG, dwXingEnabled ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwForceMS;
+    m_pAEProps->get_ForceMS(&dwForceMS);
+    CheckDlgButton(hwndParent, IDC_CHECK_FORCE_MS, dwForceMS ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwModeFixed;
+    m_pAEProps->get_ModeFixed(&dwModeFixed);
+    CheckDlgButton(hwndParent, IDC_CHECK_MODE_FIXED, dwModeFixed ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwOverlap;
+    m_pAEProps->get_SampleOverlap(&dwOverlap);
+    CheckDlgButton(hwndParent, IDC_CHECK_OVERLAP, dwOverlap ? BST_CHECKED : BST_UNCHECKED);
+
+    DWORD dwStopTime;
+    m_pAEProps->get_SetDuration(&dwStopTime);
+    CheckDlgButton(hwndParent, IDC_CHECK_STOP, dwStopTime ? BST_CHECKED : BST_UNCHECKED);
+}
+
+
+////////////////////////////////////////////////////////////////
+// EnableControls
+////////////////////////////////////////////////////////////////
+void CMpegAudEncPropertyPageAdv::EnableControls(HWND hwndParent, bool bEnable)
+{
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_ENFORCE_MIN), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_STEREO), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_JSTEREO), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_DUAL), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_MONO), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_FORCE_MS), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_VOICE), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_KEEP_ALL_FREQ), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_STRICT_ISO), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_DISABLE_SHORT_BLOCK), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_XING_TAG), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_MODE_FIXED), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_OVERLAP), bEnable);
+    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_STOP), bEnable);
+}
+
+//
+// SetDirty
+//
+// notifies the property page site of changes
+
+void CMpegAudEncPropertyPageAdv::SetDirty()
+{
+    m_bDirty = TRUE;
+    if (m_pPageSite)
+        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
+}
+
diff --git a/dshow/PropPage_adv.h b/dshow/PropPage_adv.h
new file mode 100644
index 0000000..67fabed
--- /dev/null
+++ b/dshow/PropPage_adv.h
@@ -0,0 +1,55 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Advanced property page
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+class CMpegAudEncPropertyPageAdv : public CBasePropertyPage 
+{
+
+public:
+    static CUnknown *CreateInstance( LPUNKNOWN punk, HRESULT *phr );
+    CMpegAudEncPropertyPageAdv( LPUNKNOWN punk, HRESULT *phr );
+
+    HRESULT OnConnect(IUnknown *pUnknown);
+    HRESULT OnDisconnect();
+    HRESULT OnActivate();
+    HRESULT OnDeactivate();
+    HRESULT OnApplyChanges();
+    BOOL OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
+
+private:
+    void    InitPropertiesDialog(HWND hwndParent);
+    void    EnableControls(HWND hwndParent, bool bEnable);
+    void    SetDirty(void);
+
+    DWORD   m_dwEnforceVBRmin;
+    DWORD   m_dwVoiceMode;
+    DWORD   m_dwKeepAllFreq;
+    DWORD   m_dwStrictISO;
+    DWORD   m_dwNoShortBlock;
+    DWORD   m_dwXingTag;
+    DWORD   m_dwChannelMode;
+    DWORD   m_dwForceMS;
+    DWORD   m_dwModeFixed;
+    DWORD   m_dwOverlap;
+    DWORD   m_dwSetStop;
+
+    IAudioEncoderProperties *m_pAEProps;
+};
diff --git a/dshow/Property.rc b/dshow/Property.rc
new file mode 100644
index 0000000..3ada6f1
--- /dev/null
+++ b/dshow/Property.rc
@@ -0,0 +1,272 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russisch resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+    "#include ""windows.h""\r\n"
+    "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+    "#include ""resource.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Russisch resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Englisch (USA) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_AUDIOENCPROPS DIALOGEX 0, 0, 228, 121
+STYLE WS_CHILD | WS_VISIBLE
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    CONTROL         "Constant Bit Rate",IDC_RADIO_CBR,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,4,2,71,10
+    CONTROL         "Variable Bit Rate",IDC_RADIO_VBR,"Button",
+                    BS_AUTORADIOBUTTON,4,31,69,10
+    COMBOBOX        IDC_COMBO_CBR,52,14,76,92,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_GROUP | WS_TABSTOP
+    COMBOBOX        IDC_COMBO_VBRMIN,52,44,76,85,CBS_DROPDOWNLIST | 
+                    WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_COMBO_VBRMAX,52,62,76,86,CBS_DROPDOWNLIST | 
+                    CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP,
+                    WS_EX_TRANSPARENT
+    CONTROL         "Copyright",IDC_CHECK_COPYRIGHT,"Button",BS_AUTOCHECKBOX | 
+                    WS_GROUP | WS_TABSTOP,151,39,45,10
+    CONTROL         "Original/Copy",IDC_CHECK_ORIGINAL,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,151,51,59,10
+    CONTROL         "CRC Protected",IDC_CHECK_CRC,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,151,63,63,10
+    CONTROL         "Slider1",IDC_SLIDER_QUALITY,"msctls_trackbar32",
+                    TBS_BOTH | TBS_NOTICKS | WS_GROUP | WS_TABSTOP,66,101,96,
+                    15
+    LTEXT           "kbps",IDC_STATIC,4,16,22,8
+    CONTROL         "Min",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,4,
+                    46,13,11
+    LTEXT           "Max",IDC_STATIC,4,64,16,11
+    LTEXT           "Encoding Quality",IDC_STATIC,4,105,54,8,NOT WS_GROUP
+    LTEXT           "0",IDC_TEXT_QUALITY,170,104,47,10
+    COMBOBOX        IDC_COMBO_SAMPLE_RATE,151,14,59,104,CBS_DROPDOWNLIST | 
+                    WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Target Sample Rate",IDC_STATIC,"Static",
+                    SS_LEFTNOWORDWRAP | NOT WS_VISIBLE | WS_GROUP,152,2,66,8
+    COMBOBOX        IDC_COMBO_VBRq,52,80,76,90,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_TABSTOP
+    LTEXT           "VBR Quality",IDC_STATIC,4,82,40,8
+    CONTROL         "Force Mono",IDC_FORCE_MONO,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,151,75,54,10
+END
+
+IDD_ADVPROPS DIALOG DISCARDABLE  0, 0, 228, 129
+STYLE WS_CHILD | WS_VISIBLE
+FONT 8, "MS Sans Serif"
+BEGIN
+    CONTROL         "Mono",IDC_RADIO_MONO,"Button",BS_AUTORADIOBUTTON | 
+                    WS_GROUP | WS_TABSTOP,109,93,34,10
+    CONTROL         "Standard stereo",IDC_RADIO_STEREO,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,109,36,67,11
+    CONTROL         "Joint stereo",IDC_RADIO_JSTEREO,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,109,51,60,10
+    GROUPBOX        "Mode Selection",IDC_STATIC,103,26,118,82,BS_CENTER | 
+                    WS_GROUP
+    CONTROL         "Strictly enforce VBR min bitrate",IDC_CHECK_ENFORCE_MIN,
+                    "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,8,113,
+                    10
+    CONTROL         "Voice encoding mode",IDC_CHECK_VOICE,"Button",
+                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,21,85,10
+    CONTROL         "Keep all frequencies",IDC_CHECK_KEEP_ALL_FREQ,"Button",
+                    BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | WS_TABSTOP,7,
+                    34,80,10
+    CONTROL         "Strict ISO compliance",IDC_CHECK_STRICT_ISO,"Button",
+                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,47,84,10
+    CONTROL         "Disable short blocks",IDC_CHECK_DISABLE_SHORT_BLOCK,
+                    "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | 
+                    WS_TABSTOP,7,60,79,10
+    CONTROL         "Enable Xing VBR tag",IDC_CHECK_XING_TAG,"Button",
+                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,73,83,10
+    CONTROL         "Dual channel",IDC_RADIO_DUAL,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,109,79,58,10
+    CONTROL         "Forced mid / side stereo",IDC_CHECK_FORCE_MS,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,122,65,92,10
+    CONTROL         "Mode Fixed",IDC_CHECK_MODE_FIXED,"Button",
+                    BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | WS_TABSTOP,7,
+                    86,53,10
+    CONTROL         "Allow sample overlap",IDC_CHECK_OVERLAP,"Button",
+                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,99,82,10
+    CONTROL         "Set sample stop time",IDC_CHECK_STOP,"Button",
+                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,112,81,10
+END
+
+IDD_ABOUT DIALOG DISCARDABLE  0, 0, 228, 121
+STYLE WS_CHILD
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT           "LAME Ain't MP3 Encoder (X.XX engine)",IDC_LAME_VER,7,8,
+                    208,8
+    LTEXT           "LAME Project Homepage: http://www.mp3dev.org",
+                    IDC_LAME_URL,7,19,192,8
+    EDITTEXT        IDC_LAME_LA,7,31,214,83,ES_MULTILINE | ES_AUTOVSCROLL | 
+                    ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE 
+BEGIN
+    IDD_AUDIOENCPROPS, DIALOG
+    BEGIN
+        RIGHTMARGIN, 223
+        BOTTOMMARGIN, 118
+    END
+
+    IDD_ADVPROPS, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 221
+        TOPMARGIN, 5
+        BOTTOMMARGIN, 121
+    END
+
+    IDD_ABOUT, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 221
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 114
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,61,24875
+ PRODUCTVERSION 1,0,61,24875
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "LAME DirectShow Filter\0"
+            VALUE "CompanyName", "\0"
+            VALUE "FileDescription", "LAME Audio Encoder\0"
+            VALUE "FileVersion", "1, 0, 61, 90411\0"
+            VALUE "InternalName", "LAME Audio Encoder\0"
+            VALUE "LegalCopyright", "Copyright © 2005 Elecard Ltd.\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "lame.ax\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "LAME Audio Encoder\0"
+            VALUE "ProductVersion", "1, 0, 61, 90411\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_AUDIO_PROPS_TITLE   "MPEG Layer III Audio Encoder"
+    IDS_AUDIO_ADVANCED_TITLE "Advanced"
+    IDS_ABOUT               "About"
+END
+
+#endif    // Englisch (USA) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/dshow/README b/dshow/README
new file mode 100644
index 0000000..933d1fe
--- /dev/null
+++ b/dshow/README
@@ -0,0 +1,70 @@
+LAME DirectShow Filter
+Version 1.0
+
+Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+This library is a Microsoft(R) DirectShow(R) wrapper filter for 
+LAME library. It adds DirectShow interface to the library and two
+property pages so you can tune some encoding parameters.
+
+We are interested to hear from you, when you use this package
+as part of another project.
+
+Filter Homepage http://www.elecard.com/products/layer3encoder.shtml
+
+Vitaly Ivanov   vitaly.ivanov@elecard.net.ru
+
+
+
+NOTE:
+1st: build dx9sdk/Samples/DShow/BaseClasses Project
+2nd: copy resulting strmbase.lib (or strmbasd.lib for debug support) 
+     into LAME's DShow folder
+3rd: add the BaseClasses directory path to the Visual Studio
+     Include and Library directory search path lists 
+     i.e. for Visual Studio 6 choose:
+
+     Tools -> Options -> Directories
+
+4th: build LAME .DLL builds (if you didn't yet)
+5th: build LAME DShow Filter
+
+
+TROUBLESHOOTING FAQ:
+Q. When trying to open a workspace file (.dsw), I get an "empty" workspace
+(i.e. there are no source files listed) and/or when trying to open a project
+file (.dsp), I get a "This makefile was not generated by Developer Studio" 
+error.
+
+A. Often, this can be caused by having UNIX line breaks (LF) in the 
+.dsw and .dsp files, as opposed to Windows line breaks (CR\LF). It 
+is interesting to note that .dsw and .dsp files are just text files; 
+you can open them up in any text editor. If you open the .dsw and 
+.dsp files in a text editor that can't handle UNIX line breaks 
+(namely Notepad) you will probably see big, black squares at 
+the end of lines. You can "fix" this error by following this procedure.
+
+1) Do NOT let Microsoft Visual C++ attempt to fix the problem! Press "No" when prompted.
+
+2) Open the .dsw and .dsp files in a text editor that understands UNIX line breaks. 
+WordPad is one and it is available with most copies of Windows.
+
+3) Once open, simply re-save the file (In WordPad, make sure you set the Save 
+As type to "Text Document"). All UNIX line breaks should then be automatically
+converted to Windows line breaks.
+
diff --git a/dshow/REG.CPP b/dshow/REG.CPP
new file mode 100644
index 0000000..642f3c5
--- /dev/null
+++ b/dshow/REG.CPP
@@ -0,0 +1,289 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Registry calls handling class
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <Windows.h>
+
+#include "reg.h"
+
+namespace Lame
+{
+
+CRegKey::CRegKey(void)
+{
+    m_hRootKey = NULL;
+    m_name[0] = 0;
+    m_hKey = NULL;
+}
+
+
+CRegKey::CRegKey(HKEY rt, PTSTR pName)
+{
+    m_hRootKey = rt;
+    m_hKey = NULL;
+    if(pName)
+    {
+        lstrcpy(m_name, pName);
+        Open(m_hRootKey, m_name);
+    }
+    else
+        m_name[0] = 0;
+}
+
+
+CRegKey::~CRegKey(void)
+{
+    Close();
+}
+
+
+
+BOOL    CRegKey::Open(HKEY rootKey, PTSTR pName)
+{
+    if(m_hKey)
+        Close();
+
+    m_hRootKey = rootKey;
+    if(pName) 
+    {
+        lstrcpy(m_name, pName);
+        if(RegOpenKeyEx(m_hRootKey, m_name, 0, KEY_ALL_ACCESS, &m_hKey) != ERROR_SUCCESS) 
+        {
+            m_hKey = NULL;
+            return FALSE;
+        }
+    }
+    else 
+    {
+        m_name[0] = 0;
+        m_hKey = m_hRootKey;
+    }
+
+    return TRUE;
+}
+
+
+BOOL    CRegKey::Create(HKEY rootKey, PTSTR pName)
+{
+    if(m_hKey)
+        Close();
+
+    m_hRootKey = rootKey;
+    if(pName) 
+    {
+        lstrcpy(m_name, pName);
+        if(RegCreateKeyEx(m_hRootKey, pName, NULL,
+                TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
+                &m_hKey, NULL) != ERROR_SUCCESS) 
+        {
+
+            m_hKey = NULL;
+            return FALSE;
+        }
+    }
+    else 
+    {
+        m_name[0] = 0;
+    }
+    m_hRootKey = m_hKey;
+
+    return TRUE;
+}
+
+
+BOOL    CRegKey::Open(PTSTR an)
+{
+    TCHAR achName[MAX_PATH];
+
+    if(m_hKey)
+        Close();
+
+    lstrcpy(achName, m_name);
+    if(an)
+        lstrcat(achName, an);
+
+    if(RegOpenKeyEx(m_hRootKey, achName, 0, KEY_ALL_ACCESS, &m_hKey) != ERROR_SUCCESS) 
+    {
+        m_hKey = NULL;
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+
+BOOL    CRegKey::Create(PTSTR an)
+{
+    TCHAR achName[MAX_PATH];
+
+    if(m_hKey)
+        Close();
+
+    lstrcpy(achName, m_name);
+    if(an)
+        lstrcat(achName, an);
+
+    if(RegCreateKeyEx(m_hRootKey, achName, NULL,
+            TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
+            &m_hKey, NULL) != ERROR_SUCCESS) 
+    {
+
+        m_hKey = NULL;
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+
+BOOL    CRegKey::Close(void)
+{
+    if(m_hKey && m_hKey != m_hRootKey)
+        RegCloseKey(m_hKey);
+
+    m_hKey = 0;
+    return TRUE;
+}
+
+BOOL    CRegKey::getFlag(PTSTR valuename, BOOL bDefault)
+{
+    if(!m_hKey)
+        return bDefault;
+
+    DWORD cbData;
+    DWORD   dwData;
+    DWORD   dwType;
+
+    cbData = sizeof(dwData);
+    if(RegQueryValueEx(m_hKey, valuename, NULL, &dwType, (PBYTE)&dwData, &cbData) == ERROR_SUCCESS) 
+    {
+        if(dwType == REG_DWORD)
+            return (dwData) ? TRUE : FALSE;
+    }
+    return bDefault;
+}
+
+
+void    CRegKey::setFlag(PTSTR valuename, BOOL bValue, BOOL bDefault)
+{
+    if(getFlag(valuename, bDefault) == bValue )
+        return;
+
+    RegSetValueEx(m_hKey, valuename, 0, REG_DWORD, (PBYTE)&bValue, sizeof(bValue));
+}
+
+
+void    CRegKey::setFlag(PTSTR valuename, BOOL bValue)
+{
+    RegSetValueEx(m_hKey, valuename, 0, REG_DWORD, (PBYTE)&bValue, sizeof(bValue));
+}
+
+
+DWORD   CRegKey::getDWORD(PTSTR valuename, DWORD bDefault)
+{
+    DWORD dwData;
+    DWORD cbData;
+    DWORD   dwType;
+
+    if(!m_hKey)
+        return bDefault;
+
+    cbData = sizeof(dwData);
+    if(RegQueryValueEx(m_hKey, valuename, NULL, &dwType, (PBYTE)&dwData, &cbData) == ERROR_SUCCESS) {
+        if(dwType == REG_DWORD) 
+        {
+            return (UINT)dwData;
+        }
+    }
+
+    return bDefault;
+}
+
+
+void    CRegKey::setDWORD(PTSTR valuename, DWORD dwValue, DWORD dwDefault)
+{
+    DWORD dwData = dwValue;
+
+    if(getDWORD(valuename, dwDefault) == dwValue)
+        return;
+
+    RegSetValueEx(m_hKey, valuename, 0, REG_DWORD, (PBYTE)&dwData, sizeof(dwData));
+}
+
+
+void    CRegKey::setDWORD(PTSTR valuename, DWORD dwValue)
+{
+    DWORD dwData = dwValue;
+    RegSetValueEx(m_hKey, valuename, 0, REG_DWORD, (PBYTE)&dwData, sizeof(dwData));
+}
+
+
+DWORD CRegKey::getString(PTSTR valuename, PTSTR pDefault, PTSTR pResult, int cbSize)
+{
+    DWORD dwType;
+
+    cbSize *= sizeof(TCHAR);    // for unicode strings
+
+    if(m_hKey) 
+    {
+        if(RegQueryValueEx(m_hKey, valuename, NULL, &dwType, (LPBYTE)pResult, (LPDWORD)&cbSize) == ERROR_SUCCESS) 
+        {
+            if(dwType == REG_SZ) 
+            {
+                return(cbSize - 1);
+            }
+        }
+    }
+    lstrcpy(pResult, pDefault);
+    return lstrlen(pDefault);
+}
+
+
+void    CRegKey::setString(PTSTR valuename, PTSTR pData)
+{
+    RegSetValueEx(m_hKey, valuename, 0, REG_SZ, (LPBYTE)pData, (lstrlen(pData) + 1)*sizeof(TCHAR));
+}
+
+
+DWORD CRegKey::getBinary(PTSTR valuename, PVOID pDefault, PVOID pResult, int cbSize)
+{
+    DWORD dwType;
+
+    if(RegQueryValueEx(m_hKey, valuename, NULL, &dwType, (LPBYTE)pResult, (LPDWORD)&cbSize) == ERROR_SUCCESS) 
+    {
+        if(dwType == REG_BINARY) 
+        {
+            return cbSize;
+        }
+    }
+
+    memmove(pResult, pDefault, cbSize);
+    return cbSize;
+}
+
+
+DWORD CRegKey::setBinary(PTSTR valuename, PVOID pData, int cbSize)
+{
+    RegSetValueEx(m_hKey, valuename, 0, REG_BINARY, (LPBYTE)pData, cbSize);
+    return cbSize;
+}
+
+} // namespace Lame
diff --git a/dshow/REG.H b/dshow/REG.H
new file mode 100644
index 0000000..e611eed
--- /dev/null
+++ b/dshow/REG.H
@@ -0,0 +1,92 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Registry calls handling class
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef	__REG__
+#define	__REG__
+
+namespace Lame
+{
+class	CRegKey 
+{
+protected:
+	TCHAR	m_name[MAX_PATH];
+	HKEY	m_hKey;
+	HKEY	m_hRootKey;
+public:
+	CRegKey(void);
+	CRegKey(HKEY rootKey, PTSTR pName);
+	~CRegKey(void);
+
+	BOOL	Open(HKEY rootKey, PTSTR pName);
+	BOOL	Create(HKEY rootKey, PTSTR pName);
+	BOOL	Open(PTSTR an = NULL);
+	BOOL	Create(PTSTR an = NULL);
+	BOOL	Close(void);
+
+	operator HKEY () const { return m_hKey; };
+
+	BOOL	getFlag(PTSTR valuename, BOOL bDefault);
+	void	setFlag(PTSTR valuename, BOOL bValue, BOOL bDefault);
+	void	setFlag(PTSTR valuename, BOOL bValue);
+	DWORD	getDWORD(PTSTR valuename, DWORD bDefault);
+	void	setDWORD(PTSTR valuename, DWORD dwValue);
+	void	setDWORD(PTSTR valuename, DWORD dwValue, DWORD dwDefault);
+	DWORD	getString(PTSTR valuename, PTSTR pDefault, PTSTR pResult, int cbSize);
+	void	setString(PTSTR valuename, PTSTR pData);
+	DWORD	getBinary(PTSTR valuename, PVOID pDefault, PVOID pResult, int cbSize);
+	DWORD	setBinary(PTSTR valuename, PVOID pData, int cbSize);
+};
+
+class CRegEnumKey 
+{
+public:
+	CRegEnumKey(HKEY hKey)
+	{
+		m_hKey = hKey;
+		m_dwIndex = 0;
+	}
+
+	~CRegEnumKey()
+	{
+	}
+
+	LONG Next(LPTSTR pszStr, DWORD cbName)
+	{
+		FILETIME	ftLastWriteTime;
+		LONG lRet =  RegEnumKeyEx(m_hKey, m_dwIndex, pszStr, 
+						&cbName, NULL, NULL, NULL, &ftLastWriteTime); 
+ 
+		m_dwIndex++;
+		return lRet;
+	}
+
+
+	void Reset(void)
+	{
+		m_dwIndex = 0;
+	}
+protected: 
+	HKEY	m_hKey;
+	DWORD	m_dwIndex;
+};
+}
+#endif // __REG__
diff --git a/dshow/UIDS.H b/dshow/UIDS.H
new file mode 100644
index 0000000..8e92631
--- /dev/null
+++ b/dshow/UIDS.H
@@ -0,0 +1,41 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  CLSIDs of the filter and property pages
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// {b8d27088-df5f-4b7c-98dc-0e91a1696286}
+DEFINE_GUID(CLSID_LAMEDShowFilter,
+0xb8d27088, 0xff5f, 0x4b7c, 0x98, 0xdc, 0x0e, 0x91, 0xa1, 0x69, 0x62, 0x86);
+
+
+// {b8d27089-df5f-4b7c-98dc-0e91a1696286}
+DEFINE_GUID(CLSID_LAMEDShow_PropertyPage,
+0xb8d27089, 0xff5f, 0x4b7c, 0x98, 0xdc, 0x0e, 0x91, 0xa1, 0x69, 0x62, 0x86);
+
+// {b8d2708a-df5f-4b7c-98dc-0e91a1696286}
+DEFINE_GUID(CLSID_LAMEDShow_PropertyPageAdv,
+0xb8d2708a, 0xff5f, 0x4b7c, 0x98, 0xdc, 0x0e, 0x91, 0xa1, 0x69, 0x62, 0x86);
+
+// {FE69EDD1-04CB-11d5-994A-000021D1FE2F}
+DEFINE_GUID(CLSID_LAMEDShow_About,
+0xfe69edd1, 0xf4cb, 0x11d5, 0x99, 0x4a, 0x0, 0x0, 0x21, 0xd1, 0xfe, 0x2f);
+
+DEFINE_GUID(MEDIASUBTYPE_MP3,
+0x00000055, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71);
\ No newline at end of file
diff --git a/dshow/aboutprp.cpp b/dshow/aboutprp.cpp
new file mode 100644
index 0000000..282ca26
--- /dev/null
+++ b/dshow/aboutprp.cpp
@@ -0,0 +1,195 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  About property page
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <windows.h>
+#include <streams.h>
+#include <olectl.h>
+#include <commctrl.h>
+#include "iaudioprops.h"
+#include "aboutprp.h"
+#include "mpegac.h"
+#include "resource.h"
+#include "Reg.h"
+#include <stdio.h>
+
+// -------------------------------------------------------------------------
+// CMAEAbout
+// -------------------------------------------------------------------------
+
+
+CHAR lpszText[] =   "This library is free software; you can redistribute it \r\n"
+                    "and/or modify it under the terms of the GNU \r\n"
+                    "Library General Public License\r\n"
+                    "as published by the Free Software Foundation;\r\n"
+                    "either version 2 of the License,\r\n"
+                    "or (at your option) any later version.\r\n"
+                    "\r\n"
+                    "This library is distributed in the hope that it will be useful,\r\n" 
+                    "but WITHOUT ANY WARRANTY;\r\n"
+                    "without even the implied warranty of MERCHANTABILITY or \r\n"
+                    "FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r\n"
+                    "Library General Public License for more details.\r\n"
+                    "\r\n"
+                    "You should have received a copy of the GNU\r\n"
+                    "Library General Public License\r\n"
+                    "along with this library; if not, write to the\r\n"
+                    "Free Software Foundation,\r\n"
+                    "Inc., 59 Temple Place - Suite 330,\r\n"
+                    "Boston, MA 02111-1307, USA.\r\n";
+
+//
+// CreateInstance
+//
+CUnknown * WINAPI CMAEAbout::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)
+{
+    CUnknown *punk = new CMAEAbout(lpunk, phr);
+    if (punk == NULL) {
+        *phr = E_OUTOFMEMORY;
+    }
+
+    return punk;
+}
+
+
+//
+// Constructor
+//
+// Creaete a Property page object for the MPEG options
+CMAEAbout::CMAEAbout(LPUNKNOWN lpunk, HRESULT *phr)
+    : CBasePropertyPage(NAME("About LAME Ain't MP3 Encoder"), lpunk,
+        IDD_ABOUT,IDS_ABOUT)
+    , m_fWindowInactive(TRUE)
+{
+    ASSERT(phr);
+
+//    InitCommonControls();
+}
+
+//
+// OnConnect
+//
+// Give us the filter to communicate with
+
+HRESULT CMAEAbout::OnConnect(IUnknown *pUnknown)
+{
+    return NOERROR;
+}
+
+
+//
+// OnDisconnect
+//
+// Release the interface
+
+HRESULT CMAEAbout::OnDisconnect()
+{
+    // Release the interface
+
+    return NOERROR;
+}
+
+
+//
+// OnActivate
+//
+// Called on dialog creation
+
+HRESULT CMAEAbout::OnActivate(void)
+{
+    // Add text to the window.
+    m_fWindowInactive = FALSE;
+    SendDlgItemMessage(m_hwnd, IDC_LAME_LA, WM_SETTEXT, 0, (LPARAM)lpszText);
+
+
+    CHAR strbuf[250];
+#pragma warning(push)
+#pragma warning(disable: 4995)
+    sprintf(strbuf, "LAME Encoder Version %s", get_lame_version());
+    SendDlgItemMessage(m_hwnd, IDC_LAME_VER, WM_SETTEXT, 0, (LPARAM)strbuf);
+
+    sprintf(strbuf, "LAME Project Homepage: %s", get_lame_url());
+    SendDlgItemMessage(m_hwnd, IDC_LAME_URL, WM_SETTEXT, 0, (LPARAM)strbuf);
+#pragma warning(pop)
+    return NOERROR;
+}
+
+//
+// OnDeactivate
+//
+// Called on dialog destruction
+
+HRESULT CMAEAbout::OnDeactivate(void)
+{
+    m_fWindowInactive = TRUE;
+    return NOERROR;
+}
+
+
+//
+// OnApplyChanges
+//
+// User pressed the Apply button, remember the current settings
+
+HRESULT CMAEAbout::OnApplyChanges(void)
+{
+    return NOERROR;
+}
+
+
+//
+// OnReceiveMessages
+//
+// Handles the messages for our property window
+
+BOOL CMAEAbout::OnReceiveMessage( HWND hwnd
+                                , UINT uMsg
+                                , WPARAM wParam
+                                , LPARAM lParam)
+{
+    if (m_fWindowInactive)
+        return FALSE;
+
+    switch (uMsg)
+    {
+    case WM_DESTROY:
+        return TRUE;
+
+    default:
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+//
+// SetDirty
+//
+// notifies the property page site of changes
+
+void CMAEAbout::SetDirty()
+{
+    m_bDirty = TRUE;
+
+    if (m_pPageSite)
+        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
+}
+
diff --git a/dshow/aboutprp.h b/dshow/aboutprp.h
new file mode 100644
index 0000000..664b50e
--- /dev/null
+++ b/dshow/aboutprp.h
@@ -0,0 +1,41 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  About property page
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+class CMAEAbout: public CBasePropertyPage
+{
+public:
+
+    CMAEAbout(LPUNKNOWN lpUnk, HRESULT *phr);
+    static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr);
+
+    HRESULT OnActivate();
+    HRESULT OnConnect(IUnknown *pUnknown);
+    HRESULT OnDisconnect();
+    HRESULT OnDeactivate();
+    HRESULT OnApplyChanges();
+    BOOL OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
+
+private:
+    void    SetDirty(void);
+
+    BOOL    m_fWindowInactive;
+};
diff --git a/dshow/dshow.dsp b/dshow/dshow.dsp
new file mode 100644
index 0000000..36dd1ee
--- /dev/null
+++ b/dshow/dshow.dsp
@@ -0,0 +1,209 @@
+# Microsoft Developer Studio Project File - Name="LAME DShow" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

+

+CFG=LAME DShow - Win32 Release

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "dshow.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "dshow.mak" CFG="LAME DShow - Win32 Release"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "LAME DShow - Win32 Release" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE "LAME DShow - Win32 Debug" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+MTL=midl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "LAME DShow - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir ".\Release"

+# PROP BASE Intermediate_Dir ".\Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\obj\Release"

+# PROP Intermediate_Dir "..\obj\Release\dshow"

+# PROP Ignore_Export_Lib 1

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c

+# ADD CPP /nologo /Gz /MD /W3 /GX /O2 /I "../include" /D "NDEBUG" /D "INC_OLE2" /D "STRICT" /D WINVER=0x0400 /D _X86_=1 /D "_WINDOWS" /D "WIN32" /D "STDC_HEADERS" /FD /c

+# SUBTRACT CPP /Fr /YX

+# ADD BASE MTL /nologo /D "NDEBUG" /win32

+# ADD MTL /D "NDEBUG" /mktyplib203 /win32

+# SUBTRACT MTL /nologo

+# ADD BASE RSC /l 0x419 /d "NDEBUG"

+# ADD RSC /l 0x409 /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# SUBTRACT BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386

+# ADD LINK32 libmp3lame.lib .\strmbase.lib msvcrt.lib libcmt.lib vfw32.lib winmm.lib kernel32.lib advapi32.lib version.lib largeint.lib Comdlg32.lib user32.lib gdi32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib quartz.lib measure.lib /nologo /base:"0x1c400000" /version:0.3 /entry:"DllEntryPoint@12" /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib /out:"..\output\Release\lame.ax" /libpath:"..\output\Release" /opt:NOWIN98

+

+!ELSEIF  "$(CFG)" == "LAME DShow - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir ".\Debug"

+# PROP BASE Intermediate_Dir ".\Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\obj\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\dshow"

+# PROP Ignore_Export_Lib 1

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c

+# ADD CPP /nologo /Gz /MDd /W3 /GX /ZI /Od /I "..\include" /D "DEBUG" /D "INC_OLE2" /D WINVER=0x0400 /D _X86_=1 /D "STRICT" /D "_WINDOWS" /D "WIN32" /D "STDC_HEADERS" /YX /FD /c

+# SUBTRACT CPP /Fr

+# ADD BASE MTL /nologo /D "_DEBUG" /win32

+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32

+# ADD BASE RSC /l 0x419 /d "_DEBUG"

+# ADD RSC /l 0x409 /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386

+# ADD LINK32 libmp3lame.lib .\strmbasD.lib msvcrtd.lib libcmt.lib vfw32.lib winmm.lib kernel32.lib advapi32.lib version.lib largeint.lib Comdlg32.lib user32.lib gdi32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib quartz.lib measure.lib /nologo /base:"0x1c400000" /entry:"DllEntryPoint@12" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib /out:"..\output\Debug\lame.ax" /libpath:"..\output\Debug" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none /incremental:no

+

+!ENDIF 

+

+# Begin Target

+

+# Name "LAME DShow - Win32 Release"

+# Name "LAME DShow - Win32 Debug"

+# Begin Group "Source Files"

+

+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"

+# Begin Source File

+

+SOURCE=.\aboutprp.cpp

+

+!IF  "$(CFG)" == "LAME DShow - Win32 Release"

+

+# PROP Intermediate_Dir "..\obj\Release"

+# ADD CPP /FR

+

+!ELSEIF  "$(CFG)" == "LAME DShow - Win32 Debug"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\Encoder.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\Mpegac.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\Mpegac.def

+# End Source File

+# Begin Source File

+

+SOURCE=.\Property.rc

+# End Source File

+# Begin Source File

+

+SOURCE=.\PropPage.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\PropPage_adv.cpp

+# End Source File

+# Begin Source File

+

+SOURCE=.\REG.CPP

+# End Source File

+# End Group

+# Begin Group "Header Files"

+

+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"

+# Begin Source File

+

+SOURCE=.\aboutprp.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\Encoder.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\iaudioprops.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\Mpegac.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\PropPage.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\PropPage_adv.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\reg.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\resource.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\uids.h

+# End Source File

+# End Group

+# Begin Group "Resource Files"

+

+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"

+# Begin Source File

+

+SOURCE=.\elogo.ico

+# End Source File

+# End Group

+# Begin Source File

+

+SOURCE=..\include\lame.h

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE=.\README

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE=.\STRMBASE.lib

+# PROP Exclude_From_Build 1

+# End Source File

+# Begin Source File

+

+SOURCE="..\output\libmp3lame-dynamic.lib"

+# PROP Exclude_From_Build 1

+# End Source File

+# End Target

+# End Project

diff --git a/dshow/dshow.dsw b/dshow/dshow.dsw
new file mode 100644
index 0000000..24207f9
--- /dev/null
+++ b/dshow/dshow.dsw
@@ -0,0 +1,59 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00

+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!

+

+###############################################################################

+

+Project: "LAME DShow"=.\dshow.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name mpglib

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "libmp3lame"=..\libmp3lame\libmp3lame_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Project: "mpglib"=..\mpglib\mpglib_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Global:

+

+Package=<5>

+{{{

+}}}

+

+Package=<3>

+{{{

+}}}

+

+###############################################################################

+

diff --git a/dshow/elogo.ico b/dshow/elogo.ico
new file mode 100644
index 0000000..1eae73d
--- /dev/null
+++ b/dshow/elogo.ico
Binary files differ
diff --git a/dshow/iaudioprops.h b/dshow/iaudioprops.h
new file mode 100644
index 0000000..481f5e0
--- /dev/null
+++ b/dshow/iaudioprops.h
@@ -0,0 +1,273 @@
+/*
+ *  LAME MP3 encoder for DirectShow
+ *  Interface definition
+ *
+ *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// A custom interface to allow the user to modify audio
+// encoder properties
+#ifndef __IAUDIOPROPERTIES__
+#define __IAUDIOPROPERTIES__
+#ifdef __cplusplus
+extern "C" {
+#endif
+    // {ca7e9ef0-1cbe-11d3-8d29-00a0c94bbfee}
+    DEFINE_GUID(IID_IAudioEncoderProperties, 
+    0xca7e9ef0, 0x1cbe, 0x11d3, 0x8d, 0x29, 0x00, 0xa0, 0xc9, 0x4b, 0xbf, 0xee);
+    //
+    // Configuring MPEG audio encoder parameters with unspecified
+    // input stream type may lead to misbehaviour and confusing
+    // results. In most cases the specified parameters will be
+    // overridden by defaults for the input media type.
+    // To archive proper results use this interface on the
+    // audio encoder filter with input pin connected to the valid
+    // source.
+    //
+    DECLARE_INTERFACE_(IAudioEncoderProperties, IUnknown)
+    {
+        // Is PES output enabled? Return TRUE or FALSE
+        STDMETHOD(get_PESOutputEnabled) (THIS_
+            DWORD *dwEnabled
+        ) PURE;
+        // Enable/disable PES output
+        STDMETHOD(set_PESOutputEnabled) (THIS_
+            DWORD dwEnabled
+        ) PURE;
+        // Get target compression bitrate in Kbits/s
+        STDMETHOD(get_Bitrate) (THIS_
+            DWORD *dwBitrate
+        ) PURE;
+        // Set target compression bitrate in Kbits/s
+        // Not all numbers available! See spec for details!
+        STDMETHOD(set_Bitrate) (THIS_
+            DWORD dwBitrate
+        ) PURE;
+        // Get variable bitrate flag
+        STDMETHOD(get_Variable) (THIS_
+            DWORD *dwVariable
+        ) PURE;
+        // Set variable bitrate flag
+        STDMETHOD(set_Variable) (THIS_
+            DWORD dwVariable
+        ) PURE;
+        // Get variable bitrate in Kbits/s
+        STDMETHOD(get_VariableMin) (THIS_
+            DWORD *dwmin
+        ) PURE;
+        // Set variable bitrate in Kbits/s
+        // Not all numbers available! See spec for details!
+        STDMETHOD(set_VariableMin) (THIS_
+            DWORD dwmin
+        ) PURE;
+        // Get variable bitrate in Kbits/s
+        STDMETHOD(get_VariableMax) (THIS_
+            DWORD *dwmax
+        ) PURE;
+        // Set variable bitrate in Kbits/s
+        // Not all numbers available! See spec for details!
+        STDMETHOD(set_VariableMax) (THIS_
+            DWORD dwmax
+        ) PURE;
+        // Get compression quality
+        STDMETHOD(get_Quality) (THIS_
+            DWORD *dwQuality
+        ) PURE;
+        // Set compression quality
+        // Not all numbers available! See spec for details!
+        STDMETHOD(set_Quality) (THIS_
+            DWORD dwQuality
+        ) PURE;
+        // Get VBR quality
+        STDMETHOD(get_VariableQ) (THIS_
+            DWORD *dwVBRq
+        ) PURE;
+        // Set VBR quality
+        // Not all numbers available! See spec for details!
+        STDMETHOD(set_VariableQ) (THIS_
+            DWORD dwVBRq
+        ) PURE;
+        // Get source sample rate. Return E_FAIL if input pin
+        // in not connected.
+        STDMETHOD(get_SourceSampleRate) (THIS_
+            DWORD *dwSampleRate
+        ) PURE;
+        // Get source number of channels. Return E_FAIL if
+        // input pin is not connected.
+        STDMETHOD(get_SourceChannels) (THIS_
+            DWORD *dwChannels
+        ) PURE;
+        // Get sample rate for compressed audio bitstream
+        STDMETHOD(get_SampleRate) (THIS_
+            DWORD *dwSampleRate
+        ) PURE;
+        // Set sample rate. See genaudio spec for details
+        STDMETHOD(set_SampleRate) (THIS_
+            DWORD dwSampleRate
+        ) PURE;
+        // Get channel mode. See genaudio.h for details
+        STDMETHOD(get_ChannelMode) (THIS_
+            DWORD *dwChannelMode
+        ) PURE;
+        // Set channel mode
+        STDMETHOD(set_ChannelMode) (THIS_
+            DWORD dwChannelMode
+        ) PURE;
+        // Is CRC enabled?
+        STDMETHOD(get_CRCFlag) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        // Enable/disable CRC
+        STDMETHOD(set_CRCFlag) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Force mono
+        STDMETHOD(get_ForceMono) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        // Force mono
+        STDMETHOD(set_ForceMono) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Set duration
+        STDMETHOD(get_SetDuration) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        // Set duration
+        STDMETHOD(set_SetDuration) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'original' flag
+        STDMETHOD(get_OriginalFlag) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_OriginalFlag) (THIS_
+            DWORD dwFlag
+            ) PURE;
+        // Control 'copyright' flag
+        STDMETHOD(get_CopyrightFlag) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_CopyrightFlag) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'Enforce VBR Minimum bitrate' flag
+        STDMETHOD(get_EnforceVBRmin) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_EnforceVBRmin) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'Voice' flag
+        STDMETHOD(get_VoiceMode) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_VoiceMode) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'Keep All Frequencies' flag
+        STDMETHOD(get_KeepAllFreq) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_KeepAllFreq) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'Strict ISO complience' flag
+        STDMETHOD(get_StrictISO) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_StrictISO) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'Disable short block' flag
+        STDMETHOD(get_NoShortBlock) (THIS_
+            DWORD *dwDisable
+        ) PURE;
+        STDMETHOD(set_NoShortBlock) (THIS_
+            DWORD dwDisable
+        ) PURE;
+        // Control 'Xing VBR Tag' flag
+        STDMETHOD(get_XingTag) (THIS_
+            DWORD *dwXingTag
+        ) PURE;
+        STDMETHOD(set_XingTag) (THIS_
+            DWORD dwXingTag
+        ) PURE;
+        // Control 'Forced mid/ side stereo' flag
+        STDMETHOD(get_ForceMS) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_ForceMS) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        // Control 'ModeFixed' flag
+        STDMETHOD(get_ModeFixed) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+        STDMETHOD(set_ModeFixed) (THIS_
+            DWORD dwFlag
+        ) PURE;
+
+        //Receive the block of encoder 
+        //configuration parametres
+        STDMETHOD(get_ParameterBlockSize) (THIS_
+            BYTE *pcBlock, DWORD *pdwSize
+        ) PURE;
+        // Set encoder configuration parametres
+        STDMETHOD(set_ParameterBlockSize) (THIS_
+            BYTE *pcBlock, DWORD dwSize
+        ) PURE;
+        // Set default audio encoder parameters depending
+        // on current input stream type
+        STDMETHOD(DefaultAudioEncoderProperties) (THIS_
+        ) PURE;
+        // By default the modified properties are not saved to
+        // the registry immediately, so the filter needs to be
+        // forced to do this. Omitting this step may lead to
+        // misbehavior and confusing results.
+        STDMETHOD(LoadAudioEncoderPropertiesFromRegistry) (THIS_
+        ) PURE;
+        STDMETHOD(SaveAudioEncoderPropertiesToRegistry) (THIS_
+        ) PURE;
+        // Determine whether the filter can be configured. If this
+        // function returns E_FAIL then input format hasn't been
+        // specified and filter behavior is unpredictable. If S_OK,
+        // the filter could be configured with correct values.
+        STDMETHOD(InputTypeDefined) (THIS_
+        ) PURE;
+        // Reconnects output pin (crucial for Fraunhofer MPEG Layer-3 Decoder)
+        STDMETHOD(ApplyChanges) (THIS_
+        ) PURE;
+
+        // Allow output sample overlap in terms of DirectShow
+        // timestamps (i.e. when sample's start time is less
+        // than previous sample's end time). Avi Mux doesn't like this
+        STDMETHOD(set_SampleOverlap) (THIS_
+            DWORD dwFlag
+        ) PURE;
+        STDMETHOD(get_SampleOverlap) (THIS_
+            DWORD *dwFlag
+        ) PURE;
+    };
+#ifdef __cplusplus
+}
+#endif
+#endif // __IAUDIOPROPERTIES__
+
+
+
diff --git a/dshow/resource.h b/dshow/resource.h
new file mode 100644
index 0000000..2ec4034
--- /dev/null
+++ b/dshow/resource.h
@@ -0,0 +1,59 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by Property.rc
+//
+#define IDS_AUDIO_PROPS_TITLE           3
+#define IDS_AUDIO_ADVANCED_TITLE        4
+#define IDS_ABOUT                       5
+#define IDD_AUDIOENCPROPS               100
+#define IDD_ADVPROPS                    102
+#define IDD_ABOUT                       105
+#define IDI_ICON2                       106
+#define IDC_COMBO_CBR                   1004
+#define IDC_CHECK_COPYRIGHT             1007
+#define IDC_CHECK_ORIGINAL              1008
+#define IDC_CHECK_CRC                   1009
+#define IDC_CHECK_PES                   1010
+#define IDC_COMBO_VBRMIN                1013
+#define IDC_TITLE_TEXT                  1016
+#define IDC_RADIO_CBR                   1019
+#define IDC_RADIO_VBR                   1020
+#define IDC_SLIDER_QUALITY              1021
+#define IDC_TEXT_QUALITY                1023
+#define IDC_COMBO_VBRMAX                1024
+#define IDC_COMBO_SAMPLE_RATE           1025
+#define IDC_COMBO_VBRq                  1026
+#define IDC_RADIO_STEREO                1027
+#define IDC_RADIO_JSTEREO               1028
+#define IDC_RADIO_DUAL                  1029
+#define IDC_RADIO_MONO                  1030
+#define IDC_CHECK_ENFORCE_MIN           1031
+#define IDC_CHECK_VOICE                 1032
+#define IDC_CHECK_KEEP_ALL_FREQ         1033
+#define IDC_CHECK_STRICT_ISO            1034
+#define IDC_CHECK_DISABLE_SHORT_BLOCK   1035
+#define IDC_CHECK_XING_TAG              1036
+#define IDC_CHECK_FORCE_MS              1037
+#define IDC_CHECK_MODE_FIXED            1038
+#define IDC_RICHEDIT_LAME               1039
+#define IDC_CHECK_OVERLAP               1039
+#define IDC_CHECK_STOP                  1040
+#define IDC_EDIT_TEXT                   1044
+#define IDC_LAME_LA                     1044
+#define IDC_FORCE_MONO                  1045
+#define IDC_LAME_VER                    1046
+#define IDC_LAME_URL                    1047
+#define IDC_SET_DURATION                1048
+#define IDC_STATIC                      -1
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC                     1
+#define _APS_NEXT_RESOURCE_VALUE        107
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1049
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/frontend/.indent.pro b/frontend/.indent.pro
new file mode 100644
index 0000000..2ad4b6c
--- /dev/null
+++ b/frontend/.indent.pro
@@ -0,0 +1,32 @@
+// INDENT setup file:
+//	basically the GNU-style of coding
+// 
+--no-blank-lines-after-declarations
+--blank-lines-after-procedures
+--no-blank-lines-after-commas
+--break-before-boolean-operator
+--braces-on-if-line                               // after
+--brace-indent2                                   // 2 <-
+--braces-on-struct-decl-line                      //
+--comment-indentation25                           // 32
+--declaration-comment-column30                    // 1?
+--no-comment-delimiters-on-blank-lines
+--dont-cuddle-else
+--else-endif-column1
+--space-after-cast
+--declaration-indentation8                        // 2
+-ndj                                              // what does this mean?
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4                                   // 2
+--parameter-indentation6                          // 5
+--continue-at-parentheses
+--space-after-procedure-calls
+--procnames-start-lines
+--dont-star-comments
+--leave-optional-blank-lines 
+--no-space-after-function-call-names
+
+--tab-size0
+--line-length100
diff --git a/frontend/Makefile.am b/frontend/Makefile.am
new file mode 100644
index 0000000..0ea2ac7
--- /dev/null
+++ b/frontend/Makefile.am
@@ -0,0 +1,81 @@
+## $Id: Makefile.am,v 1.28 2006/09/30 09:17:05 bouvigne Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+bin_PROGRAMS = @WITH_FRONTEND@ @WITH_MP3RTP@ @WITH_MP3X@
+EXTRA_PROGRAMS = lame$(EXEEXT) mp3rtp$(EXEEXT) mp3x$(EXEEXT)
+
+brhist_sources = brhist.c brhist.h
+
+EXTRA_DIST = \
+	$(brhist_sources) \
+	lame_vc6.dsp \
+	lame_vc8.vcproj \
+	mp3x_vc6.dsp \
+	amiga_mpega.c
+
+DEFS = @DEFS@ @CONFIG_DEFS@
+
+common_sources = \
+	console.c \
+	get_audio.c \
+	lametime.c \
+	parse.c \
+	portableio.c \
+	timestatus.c
+
+noinst_HEADERS = \
+	console.h \
+	get_audio.h \
+	gtkanal.h \
+	gpkplotting.h \
+	lametime.h \
+	main.h \
+	parse.h \
+	portableio.h \
+	timestatus.h
+
+## EXTRA_lame__EXEEXT__SOURCES = $(brhist_sources)
+## EXTRA_mp3rtp__EXEEXT__SOURCES = $(brhist_sources)
+## EXTRA_mp3x__EXEEXT__SOURCES = $(brhist_sources)
+
+if WITH_BRHIST
+lame_SOURCES = main.c $(common_sources) $(brhist_sources)
+mp3rtp_SOURCES = mp3rtp.c rtp.c rtp.h $(common_sources) \
+	$(brhist_sources)
+mp3x_SOURCES = mp3x.c gtkanal.c gpkplotting.c \
+	$(common_sources) $(brhist_sources)
+else
+lame_SOURCES = main.c $(common_sources)
+mp3rtp_SOURCES = mp3rtp.c rtp.c rtp.h $(common_sources)
+mp3x_SOURCES = mp3x.c gtkanal.c gpkplotting.c $(common_sources)
+endif
+
+CFLAGS = @CFLAGS@ @GTK_CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @FRONTEND_LDFLAGS@ @SNDFILE_LIBS@ -static
+
+INCLUDES = -I$(top_srcdir)/libmp3lame -I$(top_srcdir)/include -I$(top_builddir)
+
+LDADD = @LDADD@ \
+	$(top_builddir)/libmp3lame/libmp3lame.la \
+	@FRONTEND_LDADD@
+
+mp3x_LDADD = $(LDADD) @GTK_LIBS@
+
+CLEANFILES = lclint.txt $(EXTRA_PROGRAMS)
+
+LCLINTFLAGS= \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+lclint.txt: ${lame_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${lame_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
diff --git a/frontend/Makefile.in b/frontend/Makefile.in
new file mode 100644
index 0000000..c6bfedc
--- /dev/null
+++ b/frontend/Makefile.in
@@ -0,0 +1,641 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ANSI2KNR = $(top_srcdir)/ansi2knr
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/Makefile.am.global depcomp
+subdir = frontend
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__lame_SOURCES_DIST = main.c console.c get_audio.c lametime.c \
+	parse.c portableio.c timestatus.c brhist.c brhist.h
+am__objects_1 = console$U.$(OBJEXT) get_audio$U.$(OBJEXT) \
+	lametime$U.$(OBJEXT) parse$U.$(OBJEXT) portableio$U.$(OBJEXT) \
+	timestatus$U.$(OBJEXT)
+am__objects_2 = brhist$U.$(OBJEXT)
+@WITH_BRHIST_FALSE@am_lame_OBJECTS = main$U.$(OBJEXT) $(am__objects_1)
+@WITH_BRHIST_TRUE@am_lame_OBJECTS = main$U.$(OBJEXT) $(am__objects_1) \
+@WITH_BRHIST_TRUE@	$(am__objects_2)
+lame_OBJECTS = $(am_lame_OBJECTS)
+lame_LDADD = $(LDADD)
+lame_DEPENDENCIES = $(top_builddir)/libmp3lame/libmp3lame.la
+am__mp3rtp_SOURCES_DIST = mp3rtp.c rtp.c rtp.h console.c get_audio.c \
+	lametime.c parse.c portableio.c timestatus.c brhist.c brhist.h
+@WITH_BRHIST_FALSE@am_mp3rtp_OBJECTS = mp3rtp$U.$(OBJEXT) \
+@WITH_BRHIST_FALSE@	rtp$U.$(OBJEXT) $(am__objects_1)
+@WITH_BRHIST_TRUE@am_mp3rtp_OBJECTS = mp3rtp$U.$(OBJEXT) \
+@WITH_BRHIST_TRUE@	rtp$U.$(OBJEXT) $(am__objects_1) \
+@WITH_BRHIST_TRUE@	$(am__objects_2)
+mp3rtp_OBJECTS = $(am_mp3rtp_OBJECTS)
+mp3rtp_LDADD = $(LDADD)
+mp3rtp_DEPENDENCIES = $(top_builddir)/libmp3lame/libmp3lame.la
+am__mp3x_SOURCES_DIST = mp3x.c gtkanal.c gpkplotting.c console.c \
+	get_audio.c lametime.c parse.c portableio.c timestatus.c \
+	brhist.c brhist.h
+@WITH_BRHIST_FALSE@am_mp3x_OBJECTS = mp3x$U.$(OBJEXT) \
+@WITH_BRHIST_FALSE@	gtkanal$U.$(OBJEXT) gpkplotting$U.$(OBJEXT) \
+@WITH_BRHIST_FALSE@	$(am__objects_1)
+@WITH_BRHIST_TRUE@am_mp3x_OBJECTS = mp3x$U.$(OBJEXT) \
+@WITH_BRHIST_TRUE@	gtkanal$U.$(OBJEXT) gpkplotting$U.$(OBJEXT) \
+@WITH_BRHIST_TRUE@	$(am__objects_1) $(am__objects_2)
+mp3x_OBJECTS = $(am_mp3x_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/libmp3lame/libmp3lame.la
+mp3x_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(lame_SOURCES) $(mp3rtp_SOURCES) $(mp3x_SOURCES)
+DIST_SOURCES = $(am__lame_SOURCES_DIST) $(am__mp3rtp_SOURCES_DIST) \
+	$(am__mp3x_SOURCES_DIST)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@ @GTK_CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@ @CONFIG_DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = -I$(top_srcdir)/libmp3lame -I$(top_srcdir)/include -I$(top_builddir)
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@ \
+	$(top_builddir)/libmp3lame/libmp3lame.la \
+	@FRONTEND_LDADD@
+
+LDFLAGS = @LDFLAGS@ @FRONTEND_LDFLAGS@ @SNDFILE_LIBS@ -static
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+bin_PROGRAMS = @WITH_FRONTEND@ @WITH_MP3RTP@ @WITH_MP3X@
+EXTRA_PROGRAMS = lame$(EXEEXT) mp3rtp$(EXEEXT) mp3x$(EXEEXT)
+brhist_sources = brhist.c brhist.h
+EXTRA_DIST = \
+	$(brhist_sources) \
+	lame_vc6.dsp \
+	lame_vc8.vcproj \
+	mp3x_vc6.dsp \
+	amiga_mpega.c
+
+common_sources = \
+	console.c \
+	get_audio.c \
+	lametime.c \
+	parse.c \
+	portableio.c \
+	timestatus.c
+
+noinst_HEADERS = \
+	console.h \
+	get_audio.h \
+	gtkanal.h \
+	gpkplotting.h \
+	lametime.h \
+	main.h \
+	parse.h \
+	portableio.h \
+	timestatus.h
+
+@WITH_BRHIST_FALSE@lame_SOURCES = main.c $(common_sources)
+@WITH_BRHIST_TRUE@lame_SOURCES = main.c $(common_sources) $(brhist_sources)
+@WITH_BRHIST_FALSE@mp3rtp_SOURCES = mp3rtp.c rtp.c rtp.h $(common_sources)
+@WITH_BRHIST_TRUE@mp3rtp_SOURCES = mp3rtp.c rtp.c rtp.h $(common_sources) \
+@WITH_BRHIST_TRUE@	$(brhist_sources)
+
+@WITH_BRHIST_FALSE@mp3x_SOURCES = mp3x.c gtkanal.c gpkplotting.c $(common_sources)
+@WITH_BRHIST_TRUE@mp3x_SOURCES = mp3x.c gtkanal.c gpkplotting.c \
+@WITH_BRHIST_TRUE@	$(common_sources) $(brhist_sources)
+
+mp3x_LDADD = $(LDADD) @GTK_LIBS@
+CLEANFILES = lclint.txt $(EXTRA_PROGRAMS)
+LCLINTFLAGS = \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  frontend/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  frontend/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+lame$(EXEEXT): $(lame_OBJECTS) $(lame_DEPENDENCIES) 
+	@rm -f lame$(EXEEXT)
+	$(LINK) $(lame_OBJECTS) $(lame_LDADD) $(LIBS)
+mp3rtp$(EXEEXT): $(mp3rtp_OBJECTS) $(mp3rtp_DEPENDENCIES) 
+	@rm -f mp3rtp$(EXEEXT)
+	$(LINK) $(mp3rtp_OBJECTS) $(mp3rtp_LDADD) $(LIBS)
+mp3x$(EXEEXT): $(mp3x_OBJECTS) $(mp3x_DEPENDENCIES) 
+	@rm -f mp3x$(EXEEXT)
+	$(LINK) $(mp3x_OBJECTS) $(mp3x_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+$(top_srcdir)/ansi2knr:
+	cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
+
+mostlyclean-kr:
+	-test "$U" = "" || rm -f *_.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brhist$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_audio$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpkplotting$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkanal$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lametime$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3rtp$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3x$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portableio$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtp$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timestatus$U.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+brhist_.c: brhist.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/brhist.c; then echo $(srcdir)/brhist.c; else echo brhist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+console_.c: console.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/console.c; then echo $(srcdir)/console.c; else echo console.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_audio_.c: get_audio.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_audio.c; then echo $(srcdir)/get_audio.c; else echo get_audio.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gpkplotting_.c: gpkplotting.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gpkplotting.c; then echo $(srcdir)/gpkplotting.c; else echo gpkplotting.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gtkanal_.c: gtkanal.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gtkanal.c; then echo $(srcdir)/gtkanal.c; else echo gtkanal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lametime_.c: lametime.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lametime.c; then echo $(srcdir)/lametime.c; else echo lametime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+main_.c: main.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/main.c; then echo $(srcdir)/main.c; else echo main.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp3rtp_.c: mp3rtp.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp3rtp.c; then echo $(srcdir)/mp3rtp.c; else echo mp3rtp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp3x_.c: mp3x.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp3x.c; then echo $(srcdir)/mp3x.c; else echo mp3x.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+parse_.c: parse.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/parse.c; then echo $(srcdir)/parse.c; else echo parse.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+portableio_.c: portableio.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/portableio.c; then echo $(srcdir)/portableio.c; else echo portableio.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rtp_.c: rtp.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rtp.c; then echo $(srcdir)/rtp.c; else echo rtp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+timestatus_.c: timestatus.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/timestatus.c; then echo $(srcdir)/timestatus.c; else echo timestatus.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+brhist_.$(OBJEXT) brhist_.lo console_.$(OBJEXT) console_.lo \
+get_audio_.$(OBJEXT) get_audio_.lo gpkplotting_.$(OBJEXT) \
+gpkplotting_.lo gtkanal_.$(OBJEXT) gtkanal_.lo lametime_.$(OBJEXT) \
+lametime_.lo main_.$(OBJEXT) main_.lo mp3rtp_.$(OBJEXT) mp3rtp_.lo \
+mp3x_.$(OBJEXT) mp3x_.lo parse_.$(OBJEXT) parse_.lo \
+portableio_.$(OBJEXT) portableio_.lo rtp_.$(OBJEXT) rtp_.lo \
+timestatus_.$(OBJEXT) timestatus_.lo : $(ANSI2KNR)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS
+
+
+# end global section
+
+lclint.txt: ${lame_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${lame_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/frontend/amiga_mpega.c b/frontend/amiga_mpega.c
new file mode 100644
index 0000000..12f144f
--- /dev/null
+++ b/frontend/amiga_mpega.c
@@ -0,0 +1,139 @@
+/* MPGLIB replacement using mpega.library (AmigaOS)
+ * Written by Thomas Wenzel and Sigbjrn (CISC) Skj�et.
+ *
+ * Big thanks to St�hane Tavernard for mpega.library.
+ *
+ */
+
+/* $Id: amiga_mpega.c,v 1.3 2005/11/01 13:01:56 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef AMIGA_MPEGA
+
+#define __USE_SYSBASE
+#include "lame.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+/* We need a small workaround here so GCC doesn't fail upon redefinition. :P */
+#define FLOAT _FLOAT
+#include <proto/exec.h>
+#include <proto/mpega.h>
+#undef _FLOAT
+
+#ifndef __GNUC__
+#include <dos.h>
+#endif
+
+struct Library *MPEGABase = NULL;
+MPEGA_STREAM *mstream = NULL;
+MPEGA_CTRL mctrl;
+
+static const int smpls[2][4] = {
+/* Layer x  I   II   III */
+    {0, 384, 1152, 1152}, /* MPEG-1     */
+    {0, 384, 1152, 576} /* MPEG-2(.5) */
+};
+
+
+#ifndef __GNUC__
+static int
+break_cleanup(void)
+{
+    /* Dummy break function to make atexit() work. :P */
+    return 1;
+}
+#endif
+
+static void
+exit_cleanup(void)
+{
+    if (mstream) {
+        MPEGA_close(mstream);
+        mstream = NULL;
+    }
+    if (MPEGABase) {
+        CloseLibrary(MPEGABase);
+        MPEGABase = NULL;
+    }
+}
+
+
+int
+lame_decode_initfile(const char *fullname, mp3data_struct * mp3data)
+{
+    mctrl.bs_access = NULL;
+
+    mctrl.layer_1_2.mono.quality = 2;
+    mctrl.layer_1_2.stereo.quality = 2;
+    mctrl.layer_1_2.mono.freq_div = 1;
+    mctrl.layer_1_2.stereo.freq_div = 1;
+    mctrl.layer_1_2.mono.freq_max = 48000;
+    mctrl.layer_1_2.stereo.freq_max = 48000;
+    mctrl.layer_3.mono.quality = 2;
+    mctrl.layer_3.stereo.quality = 2;
+    mctrl.layer_3.mono.freq_div = 1;
+    mctrl.layer_3.stereo.freq_div = 1;
+    mctrl.layer_3.mono.freq_max = 48000;
+    mctrl.layer_3.stereo.freq_max = 48000;
+    mctrl.layer_1_2.force_mono = 0;
+    mctrl.layer_3.force_mono = 0;
+
+    MPEGABase = OpenLibrary("mpega.library", 2);
+    if (!MPEGABase) {
+        error_printf("Unable to open mpega.library v2\n");
+        exit(1);
+    }
+#ifndef __GNUC__
+    onbreak(break_cleanup);
+#endif
+    atexit(exit_cleanup);
+
+    mp3data->header_parsed = 0;
+    mstream = MPEGA_open((char *) fullname, &mctrl);
+    if (!mstream)
+        return (-1);
+
+    mp3data->header_parsed = 1;
+    mp3data->stereo = mstream->dec_channels;
+    mp3data->samplerate = mstream->dec_frequency;
+    mp3data->bitrate = mstream->bitrate;
+    mp3data->nsamp = (float) mstream->ms_duration / 1000 * mstream->dec_frequency;
+    mp3data->mode = mstream->mode;
+    mp3data->mode_ext = 0; /* mpega.library doesn't supply this info! :( */
+    mp3data->framesize = smpls[mstream->norm - 1][mstream->layer];
+
+    return 0;
+}
+
+int
+lame_decode_fromfile(FILE * fd, short pcm_l[], short pcm_r[], mp3data_struct * mp3data)
+{
+    int     outsize = 0;
+    WORD   *b[MPEGA_MAX_CHANNELS];
+
+    b[0] = pcm_l;
+    b[1] = pcm_r;
+
+    mp3data->header_parsed = 0;
+    while ((outsize == 0) || (outsize == MPEGA_ERR_BADFRAME)) /* Skip bad frames */
+        outsize = MPEGA_decode_frame(mstream, b);
+
+    if (outsize < 0)
+        return (-1);
+
+    mp3data->header_parsed = 1;
+    mp3data->stereo = mstream->dec_channels;
+    mp3data->samplerate = mstream->dec_frequency;
+    mp3data->bitrate = mstream->bitrate;
+    mp3data->mode = mstream->mode;
+    mp3data->mode_ext = 0; /* mpega.library doesn't supply this info! :( */
+    mp3data->framesize = smpls[mstream->norm - 1][mstream->layer];
+
+    return outsize;
+}
+
+#endif /* AMIGA_MPEGA */
diff --git a/frontend/brhist.c b/frontend/brhist.c
new file mode 100644
index 0000000..664f548
--- /dev/null
+++ b/frontend/brhist.c
@@ -0,0 +1,388 @@
+/*
+ *	Bitrate histogram source file
+ *
+ *	Copyright (c) 2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: brhist.c,v 1.53 2008/04/05 17:38:50 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef BRHIST
+
+/* basic #define's */
+
+#ifndef BRHIST_WIDTH
+# define BRHIST_WIDTH    14
+#endif
+#ifndef BRHIST_RES
+# define BRHIST_RES      14
+#endif
+
+
+/* #includes */
+
+#ifdef STDC_HEADERS
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+#include "brhist.h"
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* Structure holding all data related to the Console I/O
+ * may be this should be a more global frontend structure. So it
+ * makes sense to print all files instead with
+ * printf ( "blah\n") with printf ( "blah%s\n", Console_IO.str_clreoln );
+ */
+
+extern Console_IO_t Console_IO;
+
+static struct {
+    int     vbr_bitrate_min_index;
+    int     vbr_bitrate_max_index;
+    int     kbps[BRHIST_WIDTH];
+    int     hist_printed_lines;
+    char    bar_asterisk[512 + 1]; /* buffer filled up with a lot of '*' to print a bar     */
+    char    bar_percent[512 + 1]; /* buffer filled up with a lot of '%' to print a bar     */
+    char    bar_coded[512 + 1]; /* buffer filled up with a lot of ' ' to print a bar     */
+    char    bar_space[512 + 1]; /* buffer filled up with a lot of ' ' to print a bar     */
+} brhist;
+
+static int
+calculate_index(const int *const array, const int len, const int value)
+{
+    int     i;
+
+    for (i = 0; i < len; i++)
+        if (array[i] == value)
+            return i;
+    return -1;
+}
+
+int
+brhist_init(const lame_global_flags * gf, const int bitrate_kbps_min, const int bitrate_kbps_max)
+{
+    brhist.hist_printed_lines = 0;
+
+    /* initialize histogramming data structure */
+    lame_bitrate_kbps(gf, brhist.kbps);
+    brhist.vbr_bitrate_min_index = calculate_index(brhist.kbps, BRHIST_WIDTH, bitrate_kbps_min);
+    brhist.vbr_bitrate_max_index = calculate_index(brhist.kbps, BRHIST_WIDTH, bitrate_kbps_max);
+
+    if (brhist.vbr_bitrate_min_index >= BRHIST_WIDTH ||
+        brhist.vbr_bitrate_max_index >= BRHIST_WIDTH) {
+        error_printf("lame internal error: VBR min %d kbps or VBR max %d kbps not allowed.\n",
+                     bitrate_kbps_min, bitrate_kbps_max);
+        return -1;
+    }
+
+    memset(brhist.bar_asterisk, '*', sizeof(brhist.bar_asterisk) - 1);
+    memset(brhist.bar_percent, '%', sizeof(brhist.bar_percent) - 1);
+    memset(brhist.bar_space, '-', sizeof(brhist.bar_space) - 1);
+    memset(brhist.bar_coded, '-', sizeof(brhist.bar_space) - 1);
+
+    return 0;
+}
+
+static int
+digits(unsigned number)
+{
+    int     ret = 1;
+
+    if (number >= 100000000) {
+        ret += 8;
+        number /= 100000000;
+    }
+    if (number >= 10000) {
+        ret += 4;
+        number /= 10000;
+    }
+    if (number >= 100) {
+        ret += 2;
+        number /= 100;
+    }
+    if (number >= 10) {
+        ret += 1;
+    }
+
+    return ret;
+}
+
+
+static void
+brhist_disp_line(int i, int br_hist_TOT, int br_hist_LR, int full, int frames)
+{
+    char    brppt[14];       /* [%] and max. 10 characters for kbps */
+    int     barlen_TOT;
+    int     barlen_LR;
+    int     ppt = 0;
+    int     res = digits(frames) + 3 + 4 + 1;
+
+    if (full != 0) {
+        /* some problems when br_hist_TOT \approx br_hist_LR: You can't see that there are still MS frames */
+        barlen_TOT = (br_hist_TOT * (Console_IO.disp_width - res) + full - 1) / full; /* round up */
+        barlen_LR = (br_hist_LR * (Console_IO.disp_width - res) + full - 1) / full; /* round up */
+    }
+    else {
+        barlen_TOT = barlen_LR = 0;
+    }
+
+    if (frames > 0)
+        ppt = (1000 * br_hist_TOT + frames / 2) / frames; /* round nearest */
+
+    sprintf(brppt, " [%*i]", digits(frames), br_hist_TOT);
+
+    if (Console_IO.str_clreoln[0]) /* ClearEndOfLine available */
+        console_printf("\n%3d%s %.*s%.*s%s",
+                       brhist.kbps[i], brppt,
+                       barlen_LR, brhist.bar_percent,
+                       barlen_TOT - barlen_LR, brhist.bar_asterisk, Console_IO.str_clreoln);
+    else
+        console_printf("\n%3d%s %.*s%.*s%*s",
+                       brhist.kbps[i], brppt,
+                       barlen_LR, brhist.bar_percent,
+                       barlen_TOT - barlen_LR, brhist.bar_asterisk,
+                       Console_IO.disp_width - res - barlen_TOT, "");
+
+    brhist.hist_printed_lines++;
+}
+
+
+
+static void
+progress_line(const lame_global_flags * gf, int full, int frames)
+{
+    char    rst[20] = "\0";
+    int     barlen_TOT = 0, barlen_COD = 0, barlen_RST = 0;
+    int     res = 1;
+    float   time_in_sec = 0;
+    unsigned int hour, min, sec;
+    int     fsize = lame_get_framesize(gf);
+    int     srate = lame_get_out_samplerate(gf);
+
+    if (full < frames) {
+        full = frames;
+    }
+    if (srate > 0) {
+        time_in_sec = (float)(full - frames);
+        time_in_sec *= fsize;
+        time_in_sec /= srate;
+    }
+    hour = (unsigned int)(time_in_sec / 3600);
+    time_in_sec -= hour * 3600;
+    min = (unsigned int)(time_in_sec / 60);
+    time_in_sec -= min * 60;
+    sec = (unsigned int)time_in_sec;
+    if (full != 0) {
+        if (hour > 0) {
+            sprintf(rst, "%*d:%02u:%02u", digits(hour), hour, min, sec);
+            res += digits(hour) + 1 + 5;
+        }
+        else {
+            sprintf(rst, "%02u:%02u", min, sec);
+            res += 5;
+        }
+        /* some problems when br_hist_TOT \approx br_hist_LR: You can't see that there are still MS frames */
+        barlen_TOT = (full * (Console_IO.disp_width - res) + full - 1) / full; /* round up */
+        barlen_COD = (frames * (Console_IO.disp_width - res) + full - 1) / full; /* round up */
+        barlen_RST = barlen_TOT - barlen_COD;
+        if (barlen_RST == 0) {
+            sprintf(rst, "%.*s", res - 1, brhist.bar_coded);
+        }
+    }
+    else {
+        barlen_TOT = barlen_COD = barlen_RST = 0;
+    }
+    if (Console_IO.str_clreoln[0]) { /* ClearEndOfLine available */
+        console_printf("\n%.*s%s%.*s%s",
+                       barlen_COD, brhist.bar_coded,
+                       rst, barlen_RST, brhist.bar_space, Console_IO.str_clreoln);
+    }
+    else {
+        console_printf("\n%.*s%s%.*s%*s",
+                       barlen_COD, brhist.bar_coded,
+                       rst, barlen_RST, brhist.bar_space, Console_IO.disp_width - res - barlen_TOT,
+                       "");
+    }
+    brhist.hist_printed_lines++;
+}
+
+
+static int
+stats_value(double x)
+{
+    if (x > 0.0) {
+        console_printf(" %5.1f", x);
+        return 6;
+    }
+    return 0;
+}
+
+static int
+stats_head(double x, const char *txt)
+{
+    if (x > 0.0) {
+        console_printf(txt);
+        return 6;
+    }
+    return 0;
+}
+
+
+static void
+stats_line(double *stat)
+{
+    int     n = 1;
+    console_printf("\n   kbps     ");
+    n += 12;
+    n += stats_head(stat[1], "  mono");
+    n += stats_head(stat[2], "   IS ");
+    n += stats_head(stat[3], "   LR ");
+    n += stats_head(stat[4], "   MS ");
+    console_printf(" %%    ");
+    n += 6;
+    n += stats_head(stat[5], " long ");
+    n += stats_head(stat[6], "switch");
+    n += stats_head(stat[7], " short");
+    n += stats_head(stat[8], " mixed");
+    n += console_printf(" %%");
+    if (Console_IO.str_clreoln[0]) { /* ClearEndOfLine available */
+        console_printf("%s", Console_IO.str_clreoln);
+    }
+    else {
+        console_printf("%*s", Console_IO.disp_width - n, "");
+    }
+    brhist.hist_printed_lines++;
+
+    n = 1;
+    console_printf("\n  %5.1f     ", stat[0]);
+    n += 12;
+    n += stats_value(stat[1]);
+    n += stats_value(stat[2]);
+    n += stats_value(stat[3]);
+    n += stats_value(stat[4]);
+    console_printf("      ");
+    n += 6;
+    n += stats_value(stat[5]);
+    n += stats_value(stat[6]);
+    n += stats_value(stat[7]);
+    n += stats_value(stat[8]);
+    if (Console_IO.str_clreoln[0]) { /* ClearEndOfLine available */
+        console_printf("%s", Console_IO.str_clreoln);
+    }
+    else {
+        console_printf("%*s", Console_IO.disp_width - n, "");
+    }
+    brhist.hist_printed_lines++;
+}
+
+
+/* Yes, not very good */
+#define LR  0
+#define MS  2
+
+void
+brhist_disp(const lame_global_flags * gf)
+{
+    int     i, lines_used = 0;
+    int     br_hist[BRHIST_WIDTH]; /* how often a frame size was used */
+    int     br_sm_hist[BRHIST_WIDTH][4]; /* how often a special frame size/stereo mode commbination was used */
+    int     st_mode[4];
+    int     bl_type[6];
+    int     frames;          /* total number of encoded frames */
+    int     most_often;      /* usage count of the most often used frame size, but not smaller than Console_IO.disp_width-BRHIST_RES (makes this sense?) and 1 */
+    double  sum = 0.;
+
+    double  stat[9] = { 0 };
+    int     st_frames = 0;
+
+
+    brhist.hist_printed_lines = 0; /* printed number of lines for the brhist functionality, used to skip back the right number of lines */
+
+    lame_bitrate_stereo_mode_hist(gf, br_sm_hist);
+    lame_bitrate_hist(gf, br_hist);
+    lame_stereo_mode_hist(gf, st_mode);
+    lame_block_type_hist(gf, bl_type);
+
+    frames = most_often = 0;
+    for (i = 0; i < BRHIST_WIDTH; i++) {
+        frames += br_hist[i];
+        sum += br_hist[i] * brhist.kbps[i];
+        if (most_often < br_hist[i])
+            most_often = br_hist[i];
+        if (br_hist[i])
+            ++lines_used;
+    }
+
+    for (i = 0; i < BRHIST_WIDTH; i++) {
+        int     show = br_hist[i];
+        show = show && (lines_used > 1);
+        if (show || (i >= brhist.vbr_bitrate_min_index && i <= brhist.vbr_bitrate_max_index))
+            brhist_disp_line(i, br_hist[i], br_sm_hist[i][LR], most_often, frames);
+    }
+    for (i = 0; i < 4; i++) {
+        st_frames += st_mode[i];
+    }
+    if (frames > 0) {
+        stat[0] = sum / frames;
+        stat[1] = 100. * (frames - st_frames) / frames;
+    }
+    if (st_frames > 0) {
+        stat[2] = 0.0;
+        stat[3] = 100. * st_mode[LR] / st_frames;
+        stat[4] = 100. * st_mode[MS] / st_frames;
+    }
+    if (bl_type[5] > 0) {
+        stat[5] = 100. * bl_type[0] / bl_type[5];
+        stat[6] = 100. * (bl_type[1] + bl_type[3]) / bl_type[5];
+        stat[7] = 100. * bl_type[2] / bl_type[5];
+        stat[8] = 100. * bl_type[4] / bl_type[5];
+    }
+    progress_line(gf, lame_get_totalframes(gf), frames);
+    stats_line(stat);
+}
+
+void
+brhist_jump_back(void)
+{
+    console_up(brhist.hist_printed_lines);
+    brhist.hist_printed_lines = 0;
+}
+
+/*
+ * 1)
+ *
+ * Taken from Termcap_Manual.html:
+ *
+ * With the Unix version of termcap, you must allocate space for the description yourself and pass
+ * the address of the space as the argument buffer. There is no way you can tell how much space is
+ * needed, so the convention is to allocate a buffer 2048 characters long and assume that is
+ * enough.  (Formerly the convention was to allocate 1024 characters and assume that was enough.
+ * But one day, for one kind of terminal, that was not enough.)
+ */
+
+#endif /* ifdef BRHIST */
diff --git a/frontend/brhist.h b/frontend/brhist.h
new file mode 100644
index 0000000..4808522
--- /dev/null
+++ b/frontend/brhist.h
@@ -0,0 +1,32 @@
+/*
+ *	Bitrate histogram include file
+ *
+ *	Copyright (c) 2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_BRHIST_H
+#define LAME_BRHIST_H
+
+#include "lame.h"
+
+int     brhist_init(const lame_global_flags * gf, const int bitrate_kbps_min,
+                    const int bitrate_kbps_max);
+void    brhist_disp(const lame_global_flags * gf);
+void    brhist_jump_back(void);
+
+#endif /* LAME_BRHIST_H */
diff --git a/frontend/console.c b/frontend/console.c
new file mode 100644
index 0000000..97938a3
--- /dev/null
+++ b/frontend/console.c
@@ -0,0 +1,322 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#if defined(HAVE_NCURSES_TERMCAP_H)
+# include <ncurses/termcap.h>
+#elif defined(HAVE_TERMCAP_H)
+# include <termcap.h>
+#elif defined(HAVE_TERMCAP)
+# include <curses.h>
+# if !defined(__bsdi__)
+#  include <term.h>
+# endif
+#endif
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#define CLASS_ID           0x434F4E53
+#define REPORT_BUFF_SIZE   1024
+
+#if defined(_WIN32)  &&  !defined(__CYGWIN__)
+# include <windows.h>
+#endif
+
+
+
+static int
+my_console_printing(FILE * fp, const char *format, va_list ap)
+{
+    if (fp != NULL)
+        return vfprintf(fp, format, ap);
+    return 0;
+}
+
+static int
+my_error_printing(FILE * fp, const char *format, va_list ap)
+{
+    if (fp != NULL)
+        return vfprintf(fp, format, ap);
+    return 0;
+}
+
+static int
+my_report_printing(FILE * fp, const char *format, va_list ap)
+{
+    if (fp != NULL)
+        return vfprintf(fp, format, ap);
+    return 0;
+}
+
+
+/*
+ * Taken from Termcap_Manual.html:
+ *
+ * With the Unix version of termcap, you must allocate space for the description yourself and pass
+ * the address of the space as the argument buffer. There is no way you can tell how much space is
+ * needed, so the convention is to allocate a buffer 2048 characters long and assume that is
+ * enough.  (Formerly the convention was to allocate 1024 characters and assume that was enough.
+ * But one day, for one kind of terminal, that was not enough.)
+ */
+
+#ifdef HAVE_TERMCAP
+static void
+apply_termcap_settings(Console_IO_t * const mfp)
+{
+    const char *term_name;
+    char    term_buff[2048];
+    char   *tp;
+    char    tc[10];
+    int     val;
+
+    /* try to catch additional information about special console sequences */
+
+    if ((term_name = getenv("TERM")) == NULL) {
+        /*  rh 061105:
+            silently ignore it and fallback to the behaviour as if
+            TERMCAP wasn't defined at all
+         */
+        return;
+        /*
+        fprintf(mfp->Error_fp, "LAME: Can't get \"TERM\" environment string.\n");
+        return -1;
+        */
+    }
+    if (tgetent(term_buff, term_name) != 1) {
+        /*  rh 061105:
+            silently ignore it and fallback to the behaviour as if
+            TERMCAP wasn't defined at all
+         */
+        return;
+        /*
+        fprintf(mfp->Error_fp, "LAME: Can't find termcap entry for terminal \"%s\"\n", term_name);
+        return -1;
+        */
+    }
+
+    val = tgetnum("co");
+    if (val >= 40 && val <= 512)
+        mfp->disp_width = val;
+    val = tgetnum("li");
+    if (val >= 16 && val <= 256)
+        mfp->disp_height = val;
+
+    *(tp = tc) = '\0';
+    tp = tgetstr("up", &tp);
+    if (tp != NULL)
+        strcpy(mfp->str_up, tp);
+
+    *(tp = tc) = '\0';
+    tp = tgetstr("ce", &tp);
+    if (tp != NULL)
+        strcpy(mfp->str_clreoln, tp);
+
+    *(tp = tc) = '\0';
+    tp = tgetstr("md", &tp);
+    if (tp != NULL)
+        strcpy(mfp->str_emph, tp);
+
+    *(tp = tc) = '\0';
+    tp = tgetstr("me", &tp);
+    if (tp != NULL)
+        strcpy(mfp->str_norm, tp);
+}
+#endif /* TERMCAP_AVAILABLE */
+
+static int
+init_console(Console_IO_t * const mfp)
+{
+    /* setup basics of brhist I/O channels */
+    mfp->disp_width = 80;
+    mfp->disp_height = 25;
+    mfp->Console_fp = stderr;
+    mfp->Error_fp = stderr;
+    mfp->Report_fp = NULL;
+
+    /*mfp -> Console_buff = calloc ( 1, REPORT_BUFF_SIZE ); */
+    setvbuf(mfp->Console_fp, mfp->Console_buff, _IOFBF, sizeof(mfp->Console_buff));
+/*  setvbuf ( mfp -> Error_fp  , NULL                   , _IONBF, 0                                ); */
+
+#if defined(_WIN32)  &&  !defined(__CYGWIN__)
+    mfp->Console_Handle = GetStdHandle(STD_ERROR_HANDLE);
+#endif
+
+    strcpy(mfp->str_up, "\033[A");
+
+#ifdef HAVE_TERMCAP
+    apply_termcap_settings(mfp);
+#endif /* TERMCAP_AVAILABLE */
+
+    mfp->ClassID = CLASS_ID;
+
+#if defined(_WIN32)  &&  !defined(__CYGWIN__)
+    mfp->Console_file_type = GetFileType(Console_IO.Console_Handle);
+#else
+    mfp->Console_file_type = 0;
+#endif
+    return 0;
+}
+
+static void
+deinit_console(Console_IO_t * const mfp)
+{
+    if (mfp->Report_fp != NULL) {
+        fclose(mfp->Report_fp);
+        mfp->Report_fp = NULL;
+    }
+    fflush(mfp->Console_fp);
+    setvbuf(mfp->Console_fp, NULL, _IONBF, (size_t) 0);
+
+    memset(mfp->Console_buff, 0x55, REPORT_BUFF_SIZE);
+}
+
+
+/*  LAME console
+ */
+Console_IO_t Console_IO;
+
+int
+frontend_open_console(void)
+{
+    return init_console(&Console_IO);
+}
+
+void
+frontend_close_console(void)
+{
+    deinit_console(&Console_IO);
+}
+
+void
+frontend_debugf(const char *format, va_list ap)
+{
+    (void) my_report_printing(Console_IO.Report_fp, format, ap);
+}
+
+void
+frontend_msgf(const char *format, va_list ap)
+{
+    (void) my_console_printing(Console_IO.Console_fp, format, ap);
+}
+
+void
+frontend_errorf(const char *format, va_list ap)
+{
+    (void) my_error_printing(Console_IO.Error_fp, format, ap);
+}
+
+int
+console_printf(const char *format, ...)
+{
+    va_list args;
+    int     ret;
+
+    va_start(args, format);
+    ret = my_console_printing(Console_IO.Console_fp, format, args);
+    va_end(args);
+
+    return ret;
+}
+
+int
+error_printf(const char *format, ...)
+{
+    va_list args;
+    int     ret;
+
+    va_start(args, format);
+    ret = my_console_printing(Console_IO.Error_fp, format, args);
+    va_end(args);
+
+    return ret;
+}
+
+int
+report_printf(const char *format, ...)
+{
+    va_list args;
+    int     ret;
+
+    va_start(args, format);
+    ret = my_console_printing(Console_IO.Report_fp, format, args);
+    va_end(args);
+
+    return ret;
+}
+
+void
+console_flush()
+{
+    fflush(Console_IO.Console_fp);
+}
+
+void
+error_flush()
+{
+    fflush(Console_IO.Error_fp);
+}
+
+void
+report_flush()
+{
+    fflush(Console_IO.Report_fp);
+}
+
+void
+console_up(int n_lines)
+{
+#if defined(_WIN32)  &&  !defined(__CYGWIN__)
+    if (Console_IO.Console_file_type != FILE_TYPE_PIPE) {
+        COORD   Pos;
+        CONSOLE_SCREEN_BUFFER_INFO CSBI;
+
+        console_flush();
+        GetConsoleScreenBufferInfo(Console_IO.Console_Handle, &CSBI);
+        Pos.Y = CSBI.dwCursorPosition.Y - n_lines;
+        Pos.X = 0;
+        SetConsoleCursorPosition(Console_IO.Console_Handle, Pos);
+    }
+#else
+    while (n_lines-- > 0)
+        fputs(Console_IO.str_up, Console_IO.Console_fp);
+    console_flush();
+#endif
+}
+
+
+void
+set_debug_file(const char *fn)
+{
+    if (Console_IO.Report_fp == NULL) {
+        Console_IO.Report_fp = fopen(fn, "a");
+        if (Console_IO.Report_fp != NULL) {
+            error_printf("writing debug info into: %s\n", fn);
+        }
+        else {
+            error_printf("Error: can't open for debug info: %s\n", fn);
+        }
+    }
+}
+
+/* end of console.c */
diff --git a/frontend/console.h b/frontend/console.h
new file mode 100644
index 0000000..51f8faa
--- /dev/null
+++ b/frontend/console.h
@@ -0,0 +1,57 @@
+/*
+ * frontend/console.h
+ *
+ * This
+ *
+ *
+ */
+
+#ifndef LAME_CONSOLE_H
+#define LAME_CONSOLE_H
+
+#if defined(_WIN32)  &&  !defined(__CYGWIN__)
+# include <windows.h>
+#endif
+
+typedef struct {
+    unsigned long ClassID;
+    unsigned long ClassProt;
+    FILE   *Console_fp;      /* filepointer to stream reporting information */
+    FILE   *Error_fp;        /* filepointer to stream fatal error reporting information */
+    FILE   *Report_fp;       /* filepointer to stream reports (normally a text file or /dev/null) */
+#if defined(_WIN32)  &&  !defined(__CYGWIN__)
+    HANDLE  Console_Handle;
+#endif
+    int     disp_width;
+    int     disp_height;
+    char    str_up[10];
+    char    str_clreoln[10];
+    char    str_emph[10];
+    char    str_norm[10];
+    char    Console_buff[2048];
+    int     Console_file_type;
+} Console_IO_t;
+
+extern Console_IO_t Console_IO;
+extern int frontend_open_console(void);
+extern void frontend_close_console(void);
+
+extern void frontend_msgf(const char *format, va_list ap);
+extern void frontend_debugf(const char *format, va_list ap);
+extern void frontend_errorf(const char *format, va_list ap);
+
+int     console_printf(const char *format, ...);
+int     error_printf(const char *format, ...);
+int     report_printf(const char *format, ...);
+
+void    console_flush(void);
+void    error_flush(void);
+void    report_flush(void);
+
+void    console_up(int n_lines);
+
+void    set_debug_file(const char *fn);
+
+#endif /* LAME_CONSOLE_H */
+
+/* end of console.h */
diff --git a/frontend/depcomp b/frontend/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/frontend/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/frontend/get_audio.c b/frontend/get_audio.c
new file mode 100644
index 0000000..04bf3bf
--- /dev/null
+++ b/frontend/get_audio.c
@@ -0,0 +1,1806 @@
+/*
+ *	Get Audio routines source file
+ *
+ *	Copyright (c) 1999 Albert L Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: get_audio.c,v 1.125.2.2 2009/01/18 15:44:28 robert Exp $ */
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+
+#define         MAX_U_32_NUM            0xFFFFFFFF
+
+
+#include <math.h>
+#include <sys/stat.h>
+
+#ifdef __sun__
+/* woraround for SunOS 4.x, it has SEEK_* defined here */
+#include <unistd.h>
+#endif
+
+#include "lame.h"
+#include "main.h"
+#include "get_audio.h"
+#include "portableio.h"
+#include "timestatus.h"
+#include "lametime.h"
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* global data for get_audio.c. */
+typedef struct get_audio_global_data {
+    int     count_samples_carefully;
+    int     pcmbitwidth;
+    int     pcmswapbytes;
+    int     pcm_is_unsigned_8bit;
+    unsigned int num_samples_read;
+    FILE   *musicin;
+    hip_t   hip;
+} get_audio_global_data;
+
+static get_audio_global_data global = { 0, 0, 0, 0, 0, 0, 0 };
+
+
+
+#ifdef AMIGA_MPEGA
+int     lame_decode_initfile(const char *fullname, mp3data_struct * const mp3data);
+#else
+int     lame_decode_initfile(FILE * fd, mp3data_struct * mp3data, int *enc_delay, int *enc_padding);
+#endif
+
+/* read mp3 file until mpglib returns one frame of PCM data */
+int     lame_decode_fromfile(FILE * fd, short int pcm_l[], short int pcm_r[],
+                             mp3data_struct * mp3data);
+
+
+static int read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read);
+static int read_samples_mp3(lame_global_flags * const gfp, FILE * const musicin,
+                            short int mpg123pcm[2][1152]);
+void    CloseSndFile(sound_file_format input, FILE * musicin);
+FILE   *OpenSndFile(lame_global_flags * gfp, char *, int *enc_delay, int *enc_padding);
+
+
+static  size_t
+min_size_t(size_t a, size_t b)
+{
+    if (a < b) {
+        return a;
+    }
+    return b;
+}
+
+enum ByteOrder machine_byte_order(void);
+
+enum ByteOrder
+machine_byte_order(void)
+{
+    long one= 1;
+    return !(*((char *)(&one))) ? ByteOrderBigEndian : ByteOrderLittleEndian;
+}
+
+
+
+/* Replacement for forward fseek(,,SEEK_CUR), because fseek() fails on pipes */
+
+
+static int
+fskip(FILE * fp, long offset, int whence)
+{
+#ifndef PIPE_BUF
+    char    buffer[4096];
+#else
+    char    buffer[PIPE_BUF];
+#endif
+
+/* S_ISFIFO macro is defined on newer Linuxes */
+#ifndef S_ISFIFO
+# ifdef _S_IFIFO
+    /* _S_IFIFO is defined on Win32 and Cygwin */
+#  define	S_ISFIFO(m)	(((m)&_S_IFIFO) == _S_IFIFO)
+# endif
+#endif
+
+#ifdef S_ISFIFO
+    /* fseek is known to fail on pipes with several C-Library implementations
+       workaround: 1) test for pipe
+       2) for pipes, only relatvie seeking is possible
+       3)            and only in forward direction!
+       else fallback to old code
+     */
+    {
+        int const fd = fileno(fp);
+        struct stat file_stat;
+
+        if (fstat(fd, &file_stat) == 0) {
+            if (S_ISFIFO(file_stat.st_mode)) {
+                if (whence != SEEK_CUR || offset < 0) {
+                    return -1;
+                }
+                while (offset > 0) {
+                    size_t const bytes_to_skip = min_size_t(sizeof(buffer), offset);
+                    size_t const read = fread(buffer, 1, bytes_to_skip, fp);
+                    if (read < 1) {
+                        return -1;
+                    }
+                    offset -= read;
+                }
+                return 0;
+            }
+        }
+    }
+#endif
+    if (0 == fseek(fp, offset, whence)) {
+        return 0;
+    }
+
+    if (whence != SEEK_CUR || offset < 0) {
+        if (silent < 10) {
+            error_printf
+                ("fskip problem: Mostly the return status of functions is not evaluate so it is more secure to polute <stderr>.\n");
+        }
+        return -1;
+    }
+
+    while (offset > 0) {
+        size_t const bytes_to_skip = min_size_t(sizeof(buffer), offset);
+        size_t const read = fread(buffer, 1, bytes_to_skip, fp);
+        if (read < 1) {
+            return -1;
+        }
+        offset -= read;
+    }
+
+    return 0;
+}
+
+
+FILE   *
+init_outfile(char *outPath, int decode)
+{
+    FILE   *outf;
+#ifdef __riscos__
+    char   *p;
+#endif
+
+    /* open the output file */
+    if (0 == strcmp(outPath, "-")) {
+        lame_set_stream_binary_mode(outf = stdout);
+    }
+    else {
+        if ((outf = fopen(outPath, "w+b")) == NULL)
+            return NULL;
+#ifdef __riscos__
+        /* Assign correct file type */
+        for (p = outPath; *p; p++) /* ugly, ugly to modify a string */
+            switch (*p) {
+            case '.':
+                *p = '/';
+                break;
+            case '/':
+                *p = '.';
+                break;
+            }
+        SetFiletype(outPath, decode ? 0xFB1 /*WAV*/ : 0x1AD /*AMPEG*/);
+#else
+        (void) decode;
+#endif
+    }
+    return outf;
+}
+
+
+
+
+
+
+void
+init_infile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding)
+{
+    /* open the input file */
+    global. count_samples_carefully = 0;
+    global. num_samples_read = 0;
+    global. pcmbitwidth = in_bitwidth;
+    global. pcmswapbytes = swapbytes;
+    global. pcm_is_unsigned_8bit = in_signed == 1 ? 0 : 1;
+    global. musicin = OpenSndFile(gfp, inPath, enc_delay, enc_padding);
+}
+
+void
+close_infile(void)
+{
+    CloseSndFile(input_format, global.musicin);
+}
+
+
+void
+SwapBytesInWords(short *ptr, int short_words)
+{                       /* Some speedy code */
+    unsigned long val;
+    unsigned long *p = (unsigned long *) ptr;
+
+#ifndef lint
+# if defined(CHAR_BIT)
+#  if CHAR_BIT != 8
+#   error CHAR_BIT != 8
+#  endif
+# else
+#  error can not determine number of bits in a char
+# endif
+#endif /* lint */
+
+    assert(sizeof(short) == 2);
+
+
+#if defined(SIZEOF_UNSIGNED_LONG) && SIZEOF_UNSIGNED_LONG == 4
+    for (; short_words >= 2; short_words -= 2, p++) {
+        val = *p;
+        *p = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0x00FF00FF);
+    }
+    ptr = (short *) p;
+    for (; short_words >= 1; short_words -= 1, ptr++) {
+        val = *ptr;
+        *ptr = (short) (((val << 8) & 0xFF00) | ((val >> 8) & 0x00FF));
+    }
+#elif defined(SIZEOF_UNSIGNED_LONG) && SIZEOF_UNSIGNED_LONG == 8
+    for (; short_words >= 4; short_words -= 4, p++) {
+        val = *p;
+        *p = ((val << 8) & 0xFF00FF00FF00FF00) | ((val >> 8) & 0x00FF00FF00FF00FF);
+    }
+    ptr = (short *) p;
+    for (; short_words >= 1; short_words -= 1, ptr++) {
+        val = *ptr;
+        *ptr = ((val << 8) & 0xFF00) | ((val >> 8) & 0x00FF);
+    }
+#else
+# ifdef SIZEOF_UNSIGNED_LONG
+#  warning Using unoptimized SwapBytesInWords().
+# endif
+    for (; short_words >= 1; short_words -= 1, ptr++) {
+        val = *ptr;
+        *ptr = ((val << 8) & 0xFF00) | ((val >> 8) & 0x00FF);
+    }
+#endif
+
+    assert(short_words == 0);
+}
+
+
+
+static int
+get_audio_common(lame_global_flags * const gfp,
+                 int buffer[2][1152], short buffer16[2][1152]);
+
+/************************************************************************
+*
+* get_audio()
+*
+* PURPOSE:  reads a frame of audio data from a file to the buffer,
+*   aligns the data for future processing, and separates the
+*   left and right channels
+*
+************************************************************************/
+int
+get_audio(lame_global_flags * const gfp, int buffer[2][1152])
+{
+    return (get_audio_common(gfp, buffer, NULL));
+}
+
+/*
+  get_audio16 - behave as the original get_audio function, with a limited
+                16 bit per sample output
+*/
+int
+get_audio16(lame_global_flags * const gfp, short buffer[2][1152])
+{
+    return (get_audio_common(gfp, NULL, buffer));
+}
+
+/************************************************************************
+  get_audio_common - central functionality of get_audio*
+    in: gfp
+        buffer    output to the int buffer or 16-bit buffer
+   out: buffer    int output    (if buffer != NULL)
+        buffer16  16-bit output (if buffer == NULL) 
+returns: samples read
+note: either buffer or buffer16 must be allocated upon call
+*/
+static int
+get_audio_common(lame_global_flags * const gfp, int buffer[2][1152], short buffer16[2][1152])
+{
+    int     num_channels = lame_get_num_channels(gfp);
+    int     insamp[2 * 1152];
+    short   buf_tmp16[2][1152];
+    int     samples_read;
+    int     framesize;
+    int     samples_to_read;
+    unsigned int remaining, tmp_num_samples;
+    int     i;
+    int    *p;
+
+    /* 
+     * NOTE: LAME can now handle arbritray size input data packets,
+     * so there is no reason to read the input data in chuncks of
+     * size "framesize".  EXCEPT:  the LAME graphical frame analyzer 
+     * will get out of sync if we read more than framesize worth of data.
+     */
+
+    samples_to_read = framesize = lame_get_framesize(gfp);
+    assert(framesize <= 1152);
+
+    /* get num_samples */
+    tmp_num_samples = lame_get_num_samples(gfp);
+
+    /* if this flag has been set, then we are carefull to read
+     * exactly num_samples and no more.  This is useful for .wav and .aiff
+     * files which have id3 or other tags at the end.  Note that if you
+     * are using LIBSNDFILE, this is not necessary 
+     */
+    if (global.count_samples_carefully) {
+        remaining = tmp_num_samples - Min(tmp_num_samples, global.num_samples_read);
+        if (remaining < (unsigned int) framesize && 0 != tmp_num_samples)
+            /* in case the input is a FIFO (at least it's reproducible with
+               a FIFO) tmp_num_samples may be 0 and therefore remaining
+               would be 0, but we need to read some samples, so don't
+               change samples_to_read to the wrong value in this case */
+            samples_to_read = remaining;
+    }
+
+    if (is_mpeg_file_format(input_format)) {
+        if (buffer != NULL)
+            samples_read = read_samples_mp3(gfp, global.musicin, buf_tmp16);
+        else
+            samples_read = read_samples_mp3(gfp, global.musicin, buffer16);
+        if (samples_read < 0) {
+            return samples_read;
+        }
+    }
+    else {
+        samples_read = read_samples_pcm(global.musicin, insamp, num_channels * samples_to_read);
+        if (samples_read < 0) {
+            return samples_read;
+        }
+        p = insamp + samples_read;
+        samples_read /= num_channels;
+        if (buffer != NULL) { /* output to int buffer */
+            if (num_channels == 2) {
+                for (i = samples_read; --i >= 0;) {
+                    buffer[1][i] = *--p;
+                    buffer[0][i] = *--p;
+                }
+            }
+            else if (num_channels == 1) {
+                memset(buffer[1], 0, samples_read * sizeof(int));
+                for (i = samples_read; --i >= 0;) {
+                    buffer[0][i] = *--p;
+                }
+            }
+            else
+                assert(0);
+        }
+        else {          /* convert from int; output to 16-bit buffer */
+            if (num_channels == 2) {
+                for (i = samples_read; --i >= 0;) {
+                    buffer16[1][i] = *--p >> (8 * sizeof(int) - 16);
+                    buffer16[0][i] = *--p >> (8 * sizeof(int) - 16);
+                }
+            }
+            else if (num_channels == 1) {
+                memset(buffer16[1], 0, samples_read * sizeof(short));
+                for (i = samples_read; --i >= 0;) {
+                    buffer16[0][i] = *--p >> (8 * sizeof(int) - 16);
+                }
+            }
+            else
+                assert(0);
+        }
+    }
+
+    /* LAME mp3 output 16bit -  convert to int, if necessary */
+    if (is_mpeg_file_format(input_format)) {
+        if (buffer != NULL) {
+            for (i = samples_read; --i >= 0;)
+                buffer[0][i] = buf_tmp16[0][i] << (8 * sizeof(int) - 16);
+            if (num_channels == 2) {
+                for (i = samples_read; --i >= 0;)
+                    buffer[1][i] = buf_tmp16[1][i] << (8 * sizeof(int) - 16);
+            }
+            else if (num_channels == 1) {
+                memset(buffer[1], 0, samples_read * sizeof(int));
+            }
+            else
+                assert(0);
+        }
+    }
+
+
+    /* if num_samples = MAX_U_32_NUM, then it is considered infinitely long.
+       Don't count the samples */
+    if (tmp_num_samples != MAX_U_32_NUM)
+        global. num_samples_read += samples_read;
+
+    return samples_read;
+}
+
+
+
+static int
+read_samples_mp3(lame_global_flags * const gfp, FILE * const musicin, short int mpg123pcm[2][1152])
+{
+    int     out;
+#if defined(AMIGA_MPEGA)  ||  defined(HAVE_MPGLIB)
+    static const char type_name[] = "MP3 file";
+
+    out = lame_decode_fromfile(musicin, mpg123pcm[0], mpg123pcm[1], &mp3input_data);
+    /*
+     * out < 0:  error, probably EOF
+     * out = 0:  not possible with lame_decode_fromfile() ???
+     * out > 0:  number of output samples
+     */
+    if (out < 0) {
+        memset(mpg123pcm, 0, sizeof(**mpg123pcm) * 2 * 1152);
+        return 0;
+    }
+
+    if (lame_get_num_channels(gfp) != mp3input_data.stereo) {
+        if (silent < 10) {
+            error_printf("Error: number of channels has changed in %s - not supported\n",
+                         type_name);
+        }
+        out = -1;
+    }
+    if (lame_get_in_samplerate(gfp) != mp3input_data.samplerate) {
+        if (silent < 10) {
+            error_printf("Error: sample frequency has changed in %s - not supported\n", type_name);
+        }
+        out = -1;
+    }
+#else
+    out = -1;
+#endif
+    return out;
+}
+
+
+int
+WriteWaveHeader(FILE * const fp, const int pcmbytes,
+                const int freq, const int channels, const int bits)
+{
+    int     bytes = (bits + 7) / 8;
+
+    /* quick and dirty, but documented */
+    fwrite("RIFF", 1, 4, fp); /* label */
+    Write32BitsLowHigh(fp, pcmbytes + 44 - 8); /* length in bytes without header */
+    fwrite("WAVEfmt ", 2, 4, fp); /* 2 labels */
+    Write32BitsLowHigh(fp, 2 + 2 + 4 + 4 + 2 + 2); /* length of PCM format declaration area */
+    Write16BitsLowHigh(fp, 1); /* is PCM? */
+    Write16BitsLowHigh(fp, channels); /* number of channels */
+    Write32BitsLowHigh(fp, freq); /* sample frequency in [Hz] */
+    Write32BitsLowHigh(fp, freq * channels * bytes); /* bytes per second */
+    Write16BitsLowHigh(fp, channels * bytes); /* bytes per sample time */
+    Write16BitsLowHigh(fp, bits); /* bits per sample */
+    fwrite("data", 1, 4, fp); /* label */
+    Write32BitsLowHigh(fp, pcmbytes); /* length in bytes of raw PCM data */
+
+    return ferror(fp) ? -1 : 0;
+}
+
+
+
+
+#if defined(LIBSNDFILE)
+
+/*
+** Copyright (C) 1999 Albert Faber
+**
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+
+
+
+void
+CloseSndFile(sound_file_format input, FILE * musicin)
+{
+    SNDFILE *gs_pSndFileIn = (SNDFILE *) musicin;
+    if (is_mpeg_file_format(input)) {
+#ifndef AMIGA_MPEGA
+        if (fclose(musicin) != 0) {
+            if (silent < 10) {
+                error_printf("Could not close audio input file\n");
+            }
+            exit(2);
+        }
+#endif
+    }
+    else {
+        if (gs_pSndFileIn) {
+            if (sf_close(gs_pSndFileIn) != 0) {
+                if (silent < 10) {
+                    error_printf("Could not close sound file \n");
+                }
+                exit(2);
+            }
+        }
+    }
+}
+
+
+
+FILE   *
+OpenSndFile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding)
+{
+    char   *lpszFileName = inPath;
+    FILE   *musicin;
+    SNDFILE *gs_pSndFileIn = NULL;
+    SF_INFO gs_wfInfo;
+
+    if (is_mpeg_file_format(input_format)) {
+#ifdef AMIGA_MPEGA
+        if (-1 == lame_decode_initfile(lpszFileName, &mp3input_data)) {
+            if (silent < 10) {
+                error_printf("Error reading headers in mp3 input file %s.\n", lpszFileName);
+            }
+            exit(1);
+        }
+#endif
+#ifdef HAVE_MPGLIB
+        if ((musicin = fopen(lpszFileName, "rb")) == NULL) {
+            if (silent < 10) {
+                error_printf("Could not find \"%s\".\n", lpszFileName);
+            }
+            exit(1);
+        }
+        if (-1 == lame_decode_initfile(musicin, &mp3input_data, enc_delay, enc_padding)) {
+            if (silent < 10) {
+                error_printf("Error reading headers in mp3 input file %s.\n", lpszFileName);
+            }
+            exit(1);
+        }
+#endif
+
+        if (-1 == lame_set_num_channels(gfp, mp3input_data.stereo)) {
+            if (silent < 10) {
+                error_printf("Unsupported number of channels: %ud\n", mp3input_data.stereo);
+            }
+            exit(1);
+        }
+        (void) lame_set_in_samplerate(gfp, mp3input_data.samplerate);
+        (void) lame_set_num_samples(gfp, mp3input_data.nsamp);
+    }
+    else if (input_format == sf_ogg) {
+        if (silent < 10) {
+            error_printf("sorry, vorbis support in LAME is deprecated.\n");
+        }
+        exit(1);
+    }
+    else {
+        /* Try to open the sound file */
+        memset(&gs_wfInfo, 0, sizeof(gs_wfInfo));
+        gs_pSndFileIn = sf_open(lpszFileName, SFM_READ, &gs_wfInfo);
+
+        if (gs_pSndFileIn == NULL) {
+            if (in_signed == 0 && in_bitwidth != 8) {
+                fputs("Unsigned input only supported with bitwidth 8\n", stderr);
+                exit(1);
+            }
+            /* set some defaults incase input is raw PCM */
+            gs_wfInfo.seekable = (input_format != sf_raw); /* if user specified -r, set to not seekable */
+            gs_wfInfo.samplerate = lame_get_in_samplerate(gfp);
+            gs_wfInfo.channels = lame_get_num_channels(gfp);
+            gs_wfInfo.format = SF_FORMAT_RAW;
+            if ((in_endian == ByteOrderLittleEndian) ^ (swapbytes != 0)) {
+                gs_wfInfo.format |= SF_ENDIAN_LITTLE;
+            }
+            else {
+                gs_wfInfo.format |= SF_ENDIAN_BIG;
+            }
+            switch (in_bitwidth) {
+            case 8:
+                gs_wfInfo.format |= in_signed == 0 ? SF_FORMAT_PCM_U8 : SF_FORMAT_PCM_S8;
+                break;
+            case 16:
+                gs_wfInfo.format |= SF_FORMAT_PCM_16;
+                break;
+            case 24:
+                gs_wfInfo.format |= SF_FORMAT_PCM_24;
+                break;
+            case 32:
+                gs_wfInfo.format |= SF_FORMAT_PCM_32;
+                break;
+            default:
+                break;
+            }
+            gs_pSndFileIn = sf_open(lpszFileName, SFM_READ, &gs_wfInfo);
+        }
+
+        musicin = (FILE *) gs_pSndFileIn;
+
+        /* Check result */
+        if (gs_pSndFileIn == NULL) {
+            sf_perror(gs_pSndFileIn);
+            if (silent < 10) {
+                error_printf("Could not open sound file \"%s\".\n", lpszFileName);
+            }
+            exit(1);
+        }
+
+        if ((gs_wfInfo.format & SF_FORMAT_RAW) == SF_FORMAT_RAW) {
+            input_format = sf_raw;
+        }
+
+#ifdef _DEBUG_SND_FILE
+        DEBUGF("\n\nSF_INFO structure\n");
+        DEBUGF("samplerate        :%d\n", gs_wfInfo.samplerate);
+        DEBUGF("samples           :%d\n", gs_wfInfo.frames);
+        DEBUGF("channels          :%d\n", gs_wfInfo.channels);
+        DEBUGF("format            :");
+
+        /* new formats from sbellon@sbellon.de  1/2000 */
+
+        switch (gs_wfInfo.format & SF_FORMAT_TYPEMASK) {
+        case SF_FORMAT_WAV:
+            DEBUGF("Microsoft WAV format (big endian). ");
+            break;
+        case SF_FORMAT_AIFF:
+            DEBUGF("Apple/SGI AIFF format (little endian). ");
+            break;
+        case SF_FORMAT_AU:
+            DEBUGF("Sun/NeXT AU format (big endian). ");
+            break;
+            /*
+               case SF_FORMAT_AULE:
+               DEBUGF("DEC AU format (little endian). ");
+               break;
+             */
+        case SF_FORMAT_RAW:
+            DEBUGF("RAW PCM data. ");
+            break;
+        case SF_FORMAT_PAF:
+            DEBUGF("Ensoniq PARIS file format. ");
+            break;
+        case SF_FORMAT_SVX:
+            DEBUGF("Amiga IFF / SVX8 / SV16 format. ");
+            break;
+        case SF_FORMAT_NIST:
+            DEBUGF("Sphere NIST format. ");
+            break;
+        default:
+            assert(0);
+            break;
+        }
+
+        switch (gs_wfInfo.format & SF_FORMAT_SUBMASK) {
+            /*
+               case SF_FORMAT_PCM:
+               DEBUGF("PCM data in 8, 16, 24 or 32 bits.");
+               break;
+             */
+        case SF_FORMAT_FLOAT:
+            DEBUGF("32 bit Intel x86 floats.");
+            break;
+        case SF_FORMAT_ULAW:
+            DEBUGF("U-Law encoded.");
+            break;
+        case SF_FORMAT_ALAW:
+            DEBUGF("A-Law encoded.");
+            break;
+        case SF_FORMAT_IMA_ADPCM:
+            DEBUGF("IMA ADPCM.");
+            break;
+        case SF_FORMAT_MS_ADPCM:
+            DEBUGF("Microsoft ADPCM.");
+            break;
+            /*
+               case SF_FORMAT_PCM_BE:
+               DEBUGF("Big endian PCM data.");
+               break;
+               case SF_FORMAT_PCM_LE:
+               DEBUGF("Little endian PCM data.");
+               break;
+             */
+        case SF_FORMAT_PCM_S8:
+            DEBUGF("Signed 8 bit PCM.");
+            break;
+        case SF_FORMAT_PCM_U8:
+            DEBUGF("Unsigned 8 bit PCM.");
+            break;
+        case SF_FORMAT_PCM_16:
+            DEBUGF("Signed 16 bit PCM.");
+            break;
+        case SF_FORMAT_PCM_24:
+            DEBUGF("Signed 24 bit PCM.");
+            break;
+        case SF_FORMAT_PCM_32:
+            DEBUGF("Signed 32 bit PCM.");
+            break;
+            /*
+               case SF_FORMAT_SVX_FIB:
+               DEBUGF("SVX Fibonacci Delta encoding.");
+               break;
+               case SF_FORMAT_SVX_EXP:
+               DEBUGF("SVX Exponential Delta encoding.");
+               break;
+             */
+        default:
+            assert(0);
+            break;
+        }
+
+        DEBUGF("\n");
+        DEBUGF("sections          :%d\n", gs_wfInfo.sections);
+        DEBUGF("seekable          :\n", gs_wfInfo.seekable);
+#endif
+        /* Check result */
+        if (gs_pSndFileIn == NULL) {
+            sf_perror(gs_pSndFileIn);
+            if (silent < 10) {
+                error_printf("Could not open sound file \"%s\".\n", lpszFileName);
+            }
+            exit(1);
+        }
+
+
+        (void) lame_set_num_samples(gfp, gs_wfInfo.frames);
+        if (-1 == lame_set_num_channels(gfp, gs_wfInfo.channels)) {
+            if (silent < 10) {
+                error_printf("Unsupported number of channels: %ud\n", gs_wfInfo.channels);
+            }
+            exit(1);
+        }
+        (void) lame_set_in_samplerate(gfp, gs_wfInfo.samplerate);
+        global. pcmbitwidth = 32;
+    }
+
+    if (lame_get_num_samples(gfp) == MAX_U_32_NUM) {
+        /* try to figure out num_samples */
+        double  flen = lame_get_file_size(lpszFileName);
+
+        if (flen >= 0) {
+            /* try file size, assume 2 bytes per sample */
+            if (is_mpeg_file_format(input_format)) {
+                if (mp3input_data.bitrate > 0) {
+                    double  totalseconds = (flen * 8.0 / (1000.0 * mp3input_data.bitrate));
+                    unsigned long tmp_num_samples = totalseconds * lame_get_in_samplerate(gfp);
+
+                    (void) lame_set_num_samples(gfp, tmp_num_samples);
+                    mp3input_data.nsamp = tmp_num_samples;
+                }
+            }
+            else {
+                lame_set_num_samples(gfp, flen / (2 * lame_get_num_channels(gfp)));
+            }
+        }
+    }
+
+
+    return musicin;
+}
+
+
+/************************************************************************
+*
+* read_samples()
+*
+* PURPOSE:  reads the PCM samples from a file to the buffer
+*
+*  SEMANTICS:
+* Reads #samples_read# number of shorts from #musicin# filepointer
+* into #sample_buffer[]#.  Returns the number of samples read.
+*
+************************************************************************/
+
+static int
+read_samples_pcm(FILE * const musicin, int sample_buffer[2304], int samples_to_read)
+{
+    int     samples_read;
+
+    samples_read = sf_read_int((SNDFILE *) musicin, sample_buffer, samples_to_read);
+
+#if 0
+    switch (global.pcmbitwidth) {
+    case 8:
+        for (i = 0; i < samples_read; i++)
+            sample_buffer[i] <<= (8 * sizeof(int) - 8);
+        break;
+    case 16:
+        for (i = 0; i < samples_read; i++)
+            sample_buffer[i] <<= (8 * sizeof(int) - 16);
+        break;
+    case 24:
+        for (i = 0; i < samples_read; i++)
+            sample_buffer[i] <<= (8 * sizeof(int) - 24);
+        break;
+    case 32:
+        break;
+    default:
+        if (silent < 10) {
+            error_printf("Only 8, 16, 24 and 32 bit input files supported \n");
+        }
+        exit(1);
+    }
+#endif
+
+    return samples_read;
+}
+
+
+#else /* defined(LIBSNDFILE) */
+
+/************************************************************************
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************
+ *
+ * OLD ISO/LAME routines follow.  Used if you dont have LIBSNDFILE
+ * or for stdin/stdout support
+ *
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************
+ ************************************************************************/
+
+
+
+/************************************************************************
+unpack_read_samples - read and unpack signed low-to-high byte or unsigned
+                      single byte input. (used for read_samples function)
+                      Output integers are stored in the native byte order
+                      (little or big endian).  -jd
+  in: samples_to_read
+      bytes_per_sample
+      swap_order    - set for high-to-low byte order input stream
+ i/o: pcm_in
+ out: sample_buffer  (must be allocated up to samples_to_read upon call)
+returns: number of samples read
+*/
+static int
+unpack_read_samples(const int samples_to_read, const int bytes_per_sample,
+                    const int swap_order, int *sample_buffer, FILE * pcm_in)
+{
+    size_t  samples_read;
+    int     i;
+    int    *op;              /* output pointer */
+    unsigned char *ip = (unsigned char *) sample_buffer; /* input pointer */
+    const int b = sizeof(int) * 8;
+
+#define GA_URS_IFLOOP( ga_urs_bps ) \
+    if( bytes_per_sample == ga_urs_bps ) \
+	for( i = samples_read * bytes_per_sample; (i -= bytes_per_sample) >=0;)
+
+    samples_read = fread(sample_buffer, bytes_per_sample, samples_to_read, pcm_in);
+    op = sample_buffer + samples_read;
+
+    if (swap_order == 0) {
+        GA_URS_IFLOOP(1)
+            * --op = ip[i] << (b - 8);
+        GA_URS_IFLOOP(2)
+            * --op = ip[i] << (b - 16) | ip[i + 1] << (b - 8);
+        GA_URS_IFLOOP(3)
+            * --op = ip[i] << (b - 24) | ip[i + 1] << (b - 16) | ip[i + 2] << (b - 8);
+        GA_URS_IFLOOP(4)
+            * --op =
+            ip[i] << (b - 32) | ip[i + 1] << (b - 24) | ip[i + 2] << (b - 16) | ip[i + 3] << (b -
+                                                                                              8);
+    }
+    else {
+        GA_URS_IFLOOP(1)
+            * --op = (ip[i] ^ 0x80) << (b - 8) | 0x7f << (b - 16); /* convert from unsigned */
+        GA_URS_IFLOOP(2)
+            * --op = ip[i] << (b - 8) | ip[i + 1] << (b - 16);
+        GA_URS_IFLOOP(3)
+            * --op = ip[i] << (b - 8) | ip[i + 1] << (b - 16) | ip[i + 2] << (b - 24);
+        GA_URS_IFLOOP(4)
+            * --op =
+            ip[i] << (b - 8) | ip[i + 1] << (b - 16) | ip[i + 2] << (b - 24) | ip[i + 3] << (b -
+                                                                                             32);
+    }
+#undef GA_URS_IFLOOP
+    return (samples_read);
+}
+
+
+
+/************************************************************************
+*
+* read_samples()
+*
+* PURPOSE:  reads the PCM samples from a file to the buffer
+*
+*  SEMANTICS:
+* Reads #samples_read# number of shorts from #musicin# filepointer
+* into #sample_buffer[]#.  Returns the number of samples read.
+*
+************************************************************************/
+
+static int
+read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read)
+{
+    int     samples_read;
+    int     swap_byte_order;     /* byte order of input stream */
+
+    switch (global.pcmbitwidth) {
+    case 32:
+    case 24:
+    case 16:
+        if (in_signed == 0) {
+            error_printf("Unsigned input only supported with bitwidth 8\n");
+            exit(1);
+        }
+        {
+            swap_byte_order = (in_endian != ByteOrderLittleEndian) ? 1 : 0;
+            if (global.pcmswapbytes) {
+                swap_byte_order = !swap_byte_order;
+            }
+            samples_read = unpack_read_samples(samples_to_read, global.pcmbitwidth / 8,
+                                               swap_byte_order, sample_buffer, musicin);
+
+        }
+        break;
+
+    case 8:
+        {
+            samples_read = unpack_read_samples(samples_to_read, 1, global.pcm_is_unsigned_8bit,
+                                               sample_buffer, musicin);
+        }
+        break;
+
+    default:
+        {
+            if (silent < 10) {
+                error_printf("Only 8, 16, 24 and 32 bit input files supported \n");
+            }
+            exit(1);
+        }
+        break;
+    }
+    if (ferror(musicin)) {
+        if (silent < 10) {
+            error_printf("Error reading input file\n");
+        }
+        exit(1);
+    }
+
+    return samples_read;
+}
+
+
+
+/* AIFF Definitions */
+
+static int const IFF_ID_FORM = 0x464f524d; /* "FORM" */
+static int const IFF_ID_AIFF = 0x41494646; /* "AIFF" */
+static int const IFF_ID_AIFC = 0x41494643; /* "AIFC" */
+static int const IFF_ID_COMM = 0x434f4d4d; /* "COMM" */
+static int const IFF_ID_SSND = 0x53534e44; /* "SSND" */
+static int const IFF_ID_MPEG = 0x4d504547; /* "MPEG" */
+
+static int const IFF_ID_NONE = 0x4e4f4e45; /* "NONE" */ /* AIFF-C data format */
+static int const IFF_ID_2CBE = 0x74776f73; /* "twos" */ /* AIFF-C data format */
+static int const IFF_ID_2CLE = 0x736f7774; /* "sowt" */ /* AIFF-C data format */
+
+static int const WAV_ID_RIFF = 0x52494646; /* "RIFF" */
+static int const WAV_ID_WAVE = 0x57415645; /* "WAVE" */
+static int const WAV_ID_FMT = 0x666d7420; /* "fmt " */
+static int const WAV_ID_DATA = 0x64617461; /* "data" */
+
+#ifndef WAVE_FORMAT_PCM
+static short const WAVE_FORMAT_PCM = 0x0001;
+#endif
+#ifndef WAVE_FORMAT_EXTENSIBLE
+static short const WAVE_FORMAT_EXTENSIBLE = 0xFFFE;
+#endif
+
+
+/*****************************************************************************
+ *
+ *	Read Microsoft Wave headers
+ *
+ *	By the time we get here the first 32-bits of the file have already been
+ *	read, and we're pretty sure that we're looking at a WAV file.
+ *
+ *****************************************************************************/
+
+static int
+parse_wave_header(lame_global_flags * gfp, FILE * sf)
+{
+    int     format_tag = 0;
+    int     channels = 0;
+    int     block_align = 0;
+    int     bits_per_sample = 0;
+    int     samples_per_sec = 0;
+    int     avg_bytes_per_sec = 0;
+
+
+    int     is_wav = 0;
+    long    data_length = 0, file_length, subSize = 0;
+    int     loop_sanity = 0;
+
+    file_length = Read32BitsHighLow(sf);
+    if (Read32BitsHighLow(sf) != WAV_ID_WAVE)
+        return -1;
+
+    for (loop_sanity = 0; loop_sanity < 20; ++loop_sanity) {
+        int     type = Read32BitsHighLow(sf);
+
+        if (type == WAV_ID_FMT) {
+            subSize = Read32BitsLowHigh(sf);
+            if (subSize < 16) {
+                /*DEBUGF(
+                   "'fmt' chunk too short (only %ld bytes)!", subSize);  */
+                return -1;
+            }
+
+            format_tag = Read16BitsLowHigh(sf);
+            subSize -= 2;
+            channels = Read16BitsLowHigh(sf);
+            subSize -= 2;
+            samples_per_sec = Read32BitsLowHigh(sf);
+            subSize -= 4;
+            avg_bytes_per_sec = Read32BitsLowHigh(sf);
+            subSize -= 4;
+            block_align = Read16BitsLowHigh(sf);
+            subSize -= 2;
+            bits_per_sample = Read16BitsLowHigh(sf);
+            subSize -= 2;
+
+            /* WAVE_FORMAT_EXTENSIBLE support */
+            if ((subSize > 9) && (format_tag == WAVE_FORMAT_EXTENSIBLE)) {
+                Read16BitsLowHigh(sf); /* cbSize */
+                Read16BitsLowHigh(sf); /* ValidBitsPerSample */
+                Read32BitsLowHigh(sf); /* ChannelMask */
+                /* SubType coincident with format_tag for PCM int or float */
+                format_tag = Read16BitsLowHigh(sf);
+                subSize -= 10;
+            }
+
+            /* DEBUGF("   skipping %d bytes\n", subSize); */
+
+            if (subSize > 0) {
+                if (fskip(sf, (long) subSize, SEEK_CUR) != 0)
+                    return -1;
+            };
+
+        }
+        else if (type == WAV_ID_DATA) {
+            subSize = Read32BitsLowHigh(sf);
+            data_length = subSize;
+            is_wav = 1;
+            /* We've found the audio data. Read no further! */
+            break;
+
+        }
+        else {
+            subSize = Read32BitsLowHigh(sf);
+            if (fskip(sf, (long) subSize, SEEK_CUR) != 0) {
+                return -1;
+            }
+        }
+    }
+
+    if (is_wav) {
+        if (format_tag != WAVE_FORMAT_PCM) {
+            if (silent < 10) {
+                error_printf("Unsupported data format: 0x%04X\n", format_tag);
+            }
+            return 0;       /* oh no! non-supported format  */
+        }
+
+
+        /* make sure the header is sane */
+        if (-1 == lame_set_num_channels(gfp, channels)) {
+            if (silent < 10) {
+                error_printf("Unsupported number of channels: %u\n", channels);
+            }
+            return 0;
+        }
+        (void) lame_set_in_samplerate(gfp, samples_per_sec);
+        global. pcmbitwidth = bits_per_sample;
+        global. pcm_is_unsigned_8bit = 1;
+        (void) lame_set_num_samples(gfp, data_length / (channels * ((bits_per_sample + 7) / 8)));
+        return 1;
+    }
+    return -1;
+}
+
+
+
+/************************************************************************
+* aiff_check2
+*
+* PURPOSE:	Checks AIFF header information to make sure it is valid.
+*	        returns 0 on success, 1 on errors
+************************************************************************/
+
+static int
+aiff_check2(IFF_AIFF * const pcm_aiff_data)
+{
+    if (pcm_aiff_data->sampleType != (unsigned long) IFF_ID_SSND) {
+        if (silent < 10) {
+            error_printf("ERROR: input sound data is not PCM\n");
+        }
+        return 1;
+    }
+    switch (pcm_aiff_data->sampleSize) {
+    case 32:
+    case 24:
+    case 16:
+    case 8:
+        break;
+    default:
+        if (silent < 10) {
+            error_printf("ERROR: input sound data is not 8, 16, 24 or 32 bits\n");
+        }
+        return 1;
+    }
+    if (pcm_aiff_data->numChannels != 1 && pcm_aiff_data->numChannels != 2) {
+        if (silent < 10) {
+            error_printf("ERROR: input sound data is not mono or stereo\n");
+        }
+        return 1;
+    }
+    if (pcm_aiff_data->blkAlgn.blockSize != 0) {
+        if (silent < 10) {
+            error_printf("ERROR: block size of input sound data is not 0 bytes\n");
+        }
+        return 1;
+    }
+    /* A bug, since we correctly skip the offset earlier in the code.
+       if (pcm_aiff_data->blkAlgn.offset != 0) {
+       error_printf("Block offset is not 0 bytes in '%s'\n", file_name);
+       return 1;
+       } */
+
+    return 0;
+}
+
+
+static long
+make_even_number_of_bytes_in_length(long x)
+{
+    if ((x & 0x01) != 0) {
+        return x + 1;
+    }
+    return x;
+}
+
+
+/*****************************************************************************
+ *
+ *	Read Audio Interchange File Format (AIFF) headers.
+ *
+ *	By the time we get here the first 32 bits of the file have already been
+ *	read, and we're pretty sure that we're looking at an AIFF file.
+ *
+ *****************************************************************************/
+
+static int
+parse_aiff_header(lame_global_flags * gfp, FILE * sf)
+{
+    long    chunkSize = 0, subSize = 0, typeID = 0, dataType = IFF_ID_NONE;
+    IFF_AIFF aiff_info;
+    int     seen_comm_chunk = 0, seen_ssnd_chunk = 0;
+    long    pcm_data_pos = -1;
+
+    memset(&aiff_info, 0, sizeof(aiff_info));
+    chunkSize = Read32BitsHighLow(sf);
+
+    typeID = Read32BitsHighLow(sf);
+    if ((typeID != IFF_ID_AIFF) && (typeID != IFF_ID_AIFC))
+        return -1;
+
+    while (chunkSize > 0) {
+        long    ckSize;
+        int     type = Read32BitsHighLow(sf);
+        chunkSize -= 4;
+
+        /* DEBUGF(
+           "found chunk type %08x '%4.4s'\n", type, (char*)&type); */
+
+        /* don't use a switch here to make it easier to use 'break' for SSND */
+        if (type == IFF_ID_COMM) {
+            seen_comm_chunk = seen_ssnd_chunk + 1;
+            subSize = Read32BitsHighLow(sf);
+            ckSize = make_even_number_of_bytes_in_length(subSize);
+            chunkSize -= ckSize;
+
+            aiff_info.numChannels = Read16BitsHighLow(sf);
+            ckSize -= 2;
+            aiff_info.numSampleFrames = Read32BitsHighLow(sf);
+            ckSize -= 4;
+            aiff_info.sampleSize = Read16BitsHighLow(sf);
+            ckSize -= 2;
+            aiff_info.sampleRate = ReadIeeeExtendedHighLow(sf);
+            ckSize -= 10;
+            if (typeID == IFF_ID_AIFC) {
+                dataType = Read32BitsHighLow(sf);
+                ckSize -= 4;
+            }
+            if (fskip(sf, ckSize, SEEK_CUR) != 0)
+                return -1;
+        }
+        else if (type == IFF_ID_SSND) {
+            seen_ssnd_chunk = 1;
+            subSize = Read32BitsHighLow(sf);
+            ckSize = make_even_number_of_bytes_in_length(subSize);
+            chunkSize -= ckSize;
+
+            aiff_info.blkAlgn.offset = Read32BitsHighLow(sf);
+            ckSize -= 4;
+            aiff_info.blkAlgn.blockSize = Read32BitsHighLow(sf);
+            ckSize -= 4;
+
+            aiff_info.sampleType = IFF_ID_SSND;
+
+            if (seen_comm_chunk > 0) {
+                if (fskip(sf, (long) aiff_info.blkAlgn.offset, SEEK_CUR) != 0)
+                    return -1;
+                /* We've found the audio data. Read no further! */
+                break;
+            }
+            pcm_data_pos = ftell(sf);
+            if (pcm_data_pos >= 0) {
+                pcm_data_pos += aiff_info.blkAlgn.offset;
+            }
+            if (fskip(sf, ckSize, SEEK_CUR) != 0)
+                return -1;
+        }
+        else {
+            subSize = Read32BitsHighLow(sf);
+            ckSize = make_even_number_of_bytes_in_length(subSize);
+            chunkSize -= ckSize;
+
+            if (fskip(sf, ckSize, SEEK_CUR) != 0)
+                return -1;
+        }
+    }
+    if (dataType == IFF_ID_2CLE) {
+        global. pcmswapbytes = swapbytes;
+    }
+    else if (dataType == IFF_ID_2CBE) {
+        global. pcmswapbytes = !swapbytes;
+    }
+    else if (dataType == IFF_ID_NONE) {
+        global. pcmswapbytes = !swapbytes;
+    }
+    else {
+        return -1;
+    }
+
+    /* DEBUGF("Parsed AIFF %d\n", is_aiff); */
+    if (seen_comm_chunk && (seen_ssnd_chunk > 0 || aiff_info.numSampleFrames == 0)) {
+        /* make sure the header is sane */
+        if (0 != aiff_check2(&aiff_info))
+            return 0;
+        if (-1 == lame_set_num_channels(gfp, aiff_info.numChannels)) {
+            if (silent < 10) {
+                error_printf("Unsupported number of channels: %u\n", aiff_info.numChannels);
+            }
+            return 0;
+        }
+        (void) lame_set_in_samplerate(gfp, (int) aiff_info.sampleRate);
+        (void) lame_set_num_samples(gfp, aiff_info.numSampleFrames);
+        global. pcmbitwidth = aiff_info.sampleSize;
+        global. pcm_is_unsigned_8bit = 0;
+        
+        if (pcm_data_pos >= 0) {
+            if (fseek(sf, pcm_data_pos, SEEK_SET) != 0) {
+                if (silent < 10) {
+                    error_printf("Can't rewind stream to audio data position\n");
+                }
+                return 0;
+            }
+        }
+
+        return 1;
+    }
+    return -1;
+}
+
+
+
+/************************************************************************
+*
+* parse_file_header
+*
+* PURPOSE: Read the header from a bytestream.  Try to determine whether
+*		   it's a WAV file or AIFF without rewinding, since rewind
+*		   doesn't work on pipes and there's a good chance we're reading
+*		   from stdin (otherwise we'd probably be using libsndfile).
+*
+* When this function returns, the file offset will be positioned at the
+* beginning of the sound data.
+*
+************************************************************************/
+
+static int
+parse_file_header(lame_global_flags * gfp, FILE * sf)
+{
+
+    int     type = Read32BitsHighLow(sf);
+    /*
+       DEBUGF(
+       "First word of input stream: %08x '%4.4s'\n", type, (char*) &type); 
+     */
+    global. count_samples_carefully = 0;
+    global. pcm_is_unsigned_8bit = in_signed == 1 ? 0 : 1;
+    /*input_format = sf_raw; commented out, because it is better to fail
+       here as to encode some hundreds of input files not supported by LAME
+       If you know you have RAW PCM data, use the -r switch
+     */
+
+    if (type == WAV_ID_RIFF) {
+        /* It's probably a WAV file */
+        int const ret = parse_wave_header(gfp, sf); 
+        if (ret > 0) {
+            global. count_samples_carefully = 1;
+            return sf_wave;
+        }
+        if (ret < 0) {
+            if (silent < 10) {
+                error_printf("Warning: corrupt or unsupported WAVE format\n");
+            }
+        }
+    }
+    else if (type == IFF_ID_FORM) {
+        /* It's probably an AIFF file */
+        int const ret = parse_aiff_header(gfp, sf);
+        if (ret > 0) {
+            global. count_samples_carefully = 1;
+            return sf_aiff;
+        }
+        if (ret < 0) {
+            if (silent < 10) {
+                error_printf("Warning: corrupt or unsupported AIFF format\n");
+            }
+        }
+    }
+    else {
+        if (silent < 10) {
+            error_printf("Warning: unsupported audio format\n");
+        }
+    }
+    return sf_unknown;
+}
+
+
+
+void
+CloseSndFile(sound_file_format input, FILE * musicin)
+{
+    (void) input;
+    if (fclose(musicin) != 0) {
+        if (silent < 10) {
+            error_printf("Could not close audio input file\n");
+        }
+        exit(2);
+    }
+}
+
+
+
+
+
+FILE   *
+OpenSndFile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding)
+{
+    FILE   *musicin;
+
+    /* set the defaults from info incase we cannot determine them from file */
+    lame_set_num_samples(gfp, MAX_U_32_NUM);
+
+
+    if (!strcmp(inPath, "-")) {
+        lame_set_stream_binary_mode(musicin = stdin); /* Read from standard input. */
+    }
+    else {
+        if ((musicin = fopen(inPath, "rb")) == NULL) {
+            if (silent < 10) {
+                error_printf("Could not find \"%s\".\n", inPath);
+            }
+            exit(1);
+        }
+    }
+
+    if (is_mpeg_file_format(input_format)) {
+#ifdef AMIGA_MPEGA
+        if (-1 == lame_decode_initfile(inPath, &mp3input_data)) {
+            if (silent < 10) {
+                error_printf("Error reading headers in mp3 input file %s.\n", inPath);
+            }
+            exit(1);
+        }
+#endif
+#ifdef HAVE_MPGLIB
+        if (-1 == lame_decode_initfile(musicin, &mp3input_data, enc_delay, enc_padding)) {
+            if (silent < 10) {
+                error_printf("Error reading headers in mp3 input file %s.\n", inPath);
+            }
+            exit(1);
+        }
+#endif
+        if (-1 == lame_set_num_channels(gfp, mp3input_data.stereo)) {
+            if (silent < 10) {
+                error_printf("Unsupported number of channels: %ud\n", mp3input_data.stereo);
+            }
+            exit(1);
+        }
+        (void) lame_set_in_samplerate(gfp, mp3input_data.samplerate);
+        (void) lame_set_num_samples(gfp, mp3input_data.nsamp);
+    }
+    else if (input_format == sf_ogg) {
+        if (silent < 10) {
+            error_printf("sorry, vorbis support in LAME is deprecated.\n");
+        }
+        exit(1);
+    }
+    else if (input_format == sf_raw) {
+        /* assume raw PCM */
+        if (silent < 10) {
+            console_printf("Assuming raw pcm input file");
+            if (swapbytes)
+                console_printf(" : Forcing byte-swapping\n");
+            else
+                console_printf("\n");
+        }
+        global. pcmswapbytes = swapbytes;
+    }
+    else {
+        input_format = parse_file_header(gfp, musicin);
+    }
+    if (input_format == sf_unknown) {
+        exit(1);
+    }
+
+
+    if (lame_get_num_samples(gfp) == MAX_U_32_NUM && musicin != stdin) {
+
+        double  flen = lame_get_file_size(inPath); /* try to figure out num_samples */
+        if (flen >= 0) {
+            /* try file size, assume 2 bytes per sample */
+            if (is_mpeg_file_format(input_format)) {
+                if (mp3input_data.bitrate > 0) {
+                    double  totalseconds = (flen * 8.0 / (1000.0 * mp3input_data.bitrate));
+                    unsigned long tmp_num_samples =
+                        (unsigned long) (totalseconds * lame_get_in_samplerate(gfp));
+
+                    (void) lame_set_num_samples(gfp, tmp_num_samples);
+                    mp3input_data.nsamp = tmp_num_samples;
+                }
+            }
+            else {
+                (void) lame_set_num_samples(gfp,
+                                            (unsigned long) (flen /
+                                                             (2 * lame_get_num_channels(gfp))));
+            }
+        }
+    }
+    return musicin;
+}
+#endif /* defined(LIBSNDFILE) */
+
+
+
+
+
+#if defined(HAVE_MPGLIB)
+static int
+check_aid(const unsigned char *header)
+{
+    return 0 == memcmp(header, "AiD\1", 4);
+}
+
+/*
+ * Please check this and don't kill me if there's a bug
+ * This is a (nearly?) complete header analysis for a MPEG-1/2/2.5 Layer I, II or III
+ * data stream
+ */
+
+static int
+is_syncword_mp123(const void *const headerptr)
+{
+    const unsigned char *const p = headerptr;
+    static const char abl2[16] = { 0, 7, 7, 7, 0, 7, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8 };
+
+    if ((p[0] & 0xFF) != 0xFF)
+        return 0;       /* first 8 bits must be '1' */
+    if ((p[1] & 0xE0) != 0xE0)
+        return 0;       /* next 3 bits are also */
+    if ((p[1] & 0x18) == 0x08)
+        return 0;       /* no MPEG-1, -2 or -2.5 */
+    switch (p[1] & 0x06) {
+    default:
+    case 0x00:         /* illegal Layer */
+        return 0;
+
+    case 0x02:         /* Layer3 */
+        if (input_format != sf_mp3 && input_format != sf_mp123) {
+            return 0;
+        }
+        input_format = sf_mp3;
+        break;
+
+    case 0x04:         /* Layer2 */
+        if (input_format != sf_mp2 && input_format != sf_mp123) {
+            return 0;
+        }
+        input_format = sf_mp2;
+        break;
+
+    case 0x06:         /* Layer1 */
+        if (input_format != sf_mp1 && input_format != sf_mp123) {
+            return 0;
+        }
+        input_format = sf_mp1;
+        break;
+    }
+    if ((p[1] & 0x06) == 0x00)
+        return 0;       /* no Layer I, II and III */
+    if ((p[2] & 0xF0) == 0xF0)
+        return 0;       /* bad bitrate */
+    if ((p[2] & 0x0C) == 0x0C)
+        return 0;       /* no sample frequency with (32,44.1,48)/(1,2,4)     */
+    if ((p[1] & 0x18) == 0x18 && (p[1] & 0x06) == 0x04 && abl2[p[2] >> 4] & (1 << (p[3] >> 6)))
+        return 0;
+    if ((p[3] & 3) == 2)
+        return 0;       /* reserved enphasis mode */
+    return 1;
+}
+
+int
+lame_decode_initfile(FILE * fd, mp3data_struct * mp3data, int *enc_delay, int *enc_padding)
+{
+    /*  VBRTAGDATA pTagData; */
+    /* int xing_header,len2,num_frames; */
+    unsigned char buf[100];
+    int     ret;
+    size_t  len;
+    int     aid_header;
+    short int pcm_l[1152], pcm_r[1152];
+    int     freeformat = 0;
+
+    memset(mp3data, 0, sizeof(mp3data_struct));
+    if (global.hip) {
+        hip_decode_exit(global.hip);
+    }
+    global.hip = hip_decode_init();
+
+    len = 4;
+    if (fread(buf, 1, len, fd) != len)
+        return -1;      /* failed */
+    if (buf[0] == 'I' && buf[1] == 'D' && buf[2] == '3') {
+        if (silent < 10) {
+            console_printf("ID3v2 found. "
+                           "Be aware that the ID3 tag is currently lost when transcoding.\n");
+        }
+        len = 6;
+        if (fread(&buf, 1, len, fd) != len)
+            return -1;  /* failed */
+        buf[2] &= 127;
+        buf[3] &= 127;
+        buf[4] &= 127;
+        buf[5] &= 127;
+        len = (((((buf[2] << 7) + buf[3]) << 7) + buf[4]) << 7) + buf[5];
+        fskip(fd, len, SEEK_CUR);
+        len = 4;
+        if (fread(&buf, 1, len, fd) != len)
+            return -1;  /* failed */
+    }
+    aid_header = check_aid(buf);
+    if (aid_header) {
+        if (fread(&buf, 1, 2, fd) != 2)
+            return -1;  /* failed */
+        aid_header = (unsigned char) buf[0] + 256 * (unsigned char) buf[1];
+        if (silent < 10) {
+            console_printf("Album ID found.  length=%i \n", aid_header);
+        }
+        /* skip rest of AID, except for 6 bytes we have already read */
+        fskip(fd, aid_header - 6, SEEK_CUR);
+
+        /* read 4 more bytes to set up buffer for MP3 header check */
+        if (fread(&buf, 1, len, fd) != len)
+            return -1;  /* failed */
+    }
+    len = 4;
+    while (!is_syncword_mp123(buf)) {
+        unsigned int i;
+        for (i = 0; i < len - 1; i++)
+            buf[i] = buf[i + 1];
+        if (fread(buf + len - 1, 1, 1, fd) != 1)
+            return -1;  /* failed */
+    }
+
+    if ((buf[2] & 0xf0) == 0) {
+        if (silent < 10) {
+            console_printf("Input file is freeformat.\n");
+        }
+        freeformat = 1;
+    }
+    /* now parse the current buffer looking for MP3 headers.    */
+    /* (as of 11/00: mpglib modified so that for the first frame where  */
+    /* headers are parsed, no data will be decoded.   */
+    /* However, for freeformat, we need to decode an entire frame, */
+    /* so mp3data->bitrate will be 0 until we have decoded the first */
+    /* frame.  Cannot decode first frame here because we are not */
+    /* yet prepared to handle the output. */
+    ret = hip_decode1_headersB(global.hip, buf, len, pcm_l, pcm_r, mp3data, enc_delay, enc_padding);
+    if (-1 == ret)
+        return -1;
+
+    /* repeat until we decode a valid mp3 header.  */
+    while (!mp3data->header_parsed) {
+        len = fread(buf, 1, sizeof(buf), fd);
+        if (len != sizeof(buf))
+            return -1;
+        ret = hip_decode1_headersB(global.hip, buf, len, pcm_l, pcm_r, mp3data, enc_delay, enc_padding);
+        if (-1 == ret)
+            return -1;
+    }
+
+    if (mp3data->bitrate == 0 && !freeformat) {
+        if (silent < 10) {
+            error_printf("fail to sync...\n");
+        }
+        return lame_decode_initfile(fd, mp3data, enc_delay, enc_padding);
+    }
+
+    if (mp3data->totalframes > 0) {
+        /* mpglib found a Xing VBR header and computed nsamp & totalframes */
+    }
+    else {
+        /* set as unknown.  Later, we will take a guess based on file size
+         * ant bitrate */
+        mp3data->nsamp = MAX_U_32_NUM;
+    }
+
+
+    /*
+       report_printf("ret = %i NEED_MORE=%i \n",ret,MP3_NEED_MORE);
+       report_printf("stereo = %i \n",mp.fr.stereo);
+       report_printf("samp = %i  \n",freqs[mp.fr.sampling_frequency]);
+       report_printf("framesize = %i  \n",framesize);
+       report_printf("bitrate = %i  \n",mp3data->bitrate);
+       report_printf("num frames = %ui  \n",num_frames);
+       report_printf("num samp = %ui  \n",mp3data->nsamp);
+       report_printf("mode     = %i  \n",mp.fr.mode);
+     */
+
+    return 0;
+}
+
+/*
+For lame_decode_fromfile:  return code
+  -1     error
+   n     number of samples output.  either 576 or 1152 depending on MP3 file.
+
+
+For lame_decode1_headers():  return code
+  -1     error
+   0     ok, but need more data before outputing any samples
+   n     number of samples output.  either 576 or 1152 depending on MP3 file.
+*/
+int
+lame_decode_fromfile(FILE * fd, short pcm_l[], short pcm_r[], mp3data_struct * mp3data)
+{
+    int     ret = 0;
+    size_t  len = 0;
+    unsigned char buf[1024];
+
+    /* first see if we still have data buffered in the decoder: */
+    ret = hip_decode1_headers(global.hip, buf, len, pcm_l, pcm_r, mp3data);
+    if (ret != 0)
+        return ret;
+
+
+    /* read until we get a valid output frame */
+    while (1) {
+        len = fread(buf, 1, 1024, fd);
+        if (len == 0) {
+            /* we are done reading the file, but check for buffered data */
+            ret = hip_decode1_headers(global.hip, buf, len, pcm_l, pcm_r, mp3data);
+            if (ret <= 0) {
+                hip_decode_exit(global.hip); /* release mp3decoder memory */
+                global.hip = 0;
+                return -1; /* done with file */
+            }
+            break;
+        }
+
+        ret = hip_decode1_headers(global.hip, buf, len, pcm_l, pcm_r, mp3data);
+        if (ret == -1) {
+            hip_decode_exit(global.hip); /* release mp3decoder memory */
+            global.hip = 0;
+            return -1;
+        }
+        if (ret > 0)
+            break;
+    }
+    return ret;
+}
+#endif /* defined(HAVE_MPGLIB) */
+
+
+int
+is_mpeg_file_format(int input_file_format)
+{
+    switch (input_file_format) {
+    case sf_mp1:
+        return 1;
+    case sf_mp2:
+        return 2;
+    case sf_mp3:
+        return 3;
+    case sf_mp123:
+        return -1;
+    default:
+        break;
+    }
+    return 0;
+}
+
+/* end of get_audio.c */
diff --git a/frontend/get_audio.h b/frontend/get_audio.h
new file mode 100644
index 0000000..edc1764
--- /dev/null
+++ b/frontend/get_audio.h
@@ -0,0 +1,108 @@
+/*
+ *	Get Audio routines include file
+ *
+ *	Copyright (c) 1999 Albert L Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef LAME_GET_AUDIO_H
+#define LAME_GET_AUDIO_H
+#include "lame.h"
+#include <stdio.h>
+
+typedef enum sound_file_format_e {
+    sf_unknown,
+    sf_raw,
+    sf_wave,
+    sf_aiff,
+    sf_mp1,                  /* MPEG Layer 1, aka mpg */
+    sf_mp2,                  /* MPEG Layer 2 */
+    sf_mp3,                  /* MPEG Layer 3 */
+    sf_mp123,                /* MPEG Layer 1,2 or 3; whatever .mp3, .mp2, .mp1 or .mpg contains */
+    sf_ogg
+} sound_file_format;
+
+
+int     is_mpeg_file_format( int input_format );
+
+FILE   *init_outfile(char *outPath, int decode);
+void    init_infile(lame_global_flags *, char *inPath, int *enc_delay, int *enc_padding);
+void    close_infile(void);
+int     get_audio(lame_global_flags * const gfp, int buffer[2][1152]);
+int     get_audio16(lame_global_flags * const gfp, short buffer[2][1152]);
+int     WriteWaveHeader(FILE * const fp, const int pcmbytes,
+                        const int freq, const int channels, const int bits);
+
+
+
+/* the simple lame decoder */
+/* After calling lame_init(), lame_init_params() and
+ * init_infile(), call this routine to read the input MP3 file 
+ * and output .wav data to the specified file pointer
+ * lame_decoder will ignore the first 528 samples, since these samples
+ * represent the mpglib decoding delay (and are all 0).  
+ *skip = number of additional
+ * samples to skip, to (for example) compensate for the encoder delay,
+ * only used when decoding mp3 
+*/
+int     lame_decoder(lame_global_flags * gfp, FILE * outf, int skip, char *inPath, char *outPath,
+                     int *enc_delay, int *enc_padding);
+
+
+
+void    SwapBytesInWords(short *loc, int words);
+
+
+
+#ifdef LIBSNDFILE
+
+#include "sndfile.h"
+
+
+#else
+/*****************************************************************
+ * LAME/ISO built in audio file I/O routines 
+ *******************************************************************/
+#include "portableio.h"
+
+
+typedef struct blockAlign_struct {
+    unsigned long offset;
+    unsigned long blockSize;
+} blockAlign;
+
+typedef struct IFF_AIFF_struct {
+    short   numChannels;
+    unsigned long numSampleFrames;
+    short   sampleSize;
+    double  sampleRate;
+    unsigned long sampleType;
+    blockAlign blkAlgn;
+} IFF_AIFF;
+
+extern int aiff_read_headers(FILE *, IFF_AIFF *);
+extern int aiff_seek_to_sound_data(FILE *);
+extern int aiff_write_headers(FILE *, IFF_AIFF *);
+extern int parse_wavheader(void);
+extern int parse_aiff(const char fn[]);
+extern void aiff_check(const char *, IFF_AIFF *, int *);
+
+
+
+#endif /* ifdef LIBSNDFILE */
+#endif /* ifndef LAME_GET_AUDIO_H */
diff --git a/frontend/gpkplotting.c b/frontend/gpkplotting.c
new file mode 100644
index 0000000..034d0a0
--- /dev/null
+++ b/frontend/gpkplotting.c
@@ -0,0 +1,331 @@
+/*
+ *	GTK plotting routines source file
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: gpkplotting.c,v 1.11 2007/07/24 17:46:08 bouvigne Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "gpkplotting.h"
+
+#ifdef STDC_HEADERS
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static gint num_plotwindows = 0;
+static gint max_plotwindows = 10;
+static GdkPixmap *pixmaps[10];
+static GtkWidget *pixmapboxes[10];
+
+
+
+
+/* compute a gdkcolor */
+void
+setcolor(GtkWidget * widget, GdkColor * color, gint red, gint green, gint blue)
+{
+
+    /* colors in GdkColor are taken from 0 to 65535, not 0 to 255.    */
+    color->red = red * (65535 / 255);
+    color->green = green * (65535 / 255);
+    color->blue = blue * (65535 / 255);
+    color->pixel = (gulong) (color->red * 65536 + color->green * 256 + color->blue);
+    /* find closest in colormap, if needed */
+    gdk_color_alloc(gtk_widget_get_colormap(widget), color);
+}
+
+
+void
+gpk_redraw(GdkPixmap * pixmap, GtkWidget * pixmapbox)
+{
+    /* redraw the entire pixmap */
+    gdk_draw_pixmap(pixmapbox->window,
+                    pixmapbox->style->fg_gc[GTK_WIDGET_STATE(pixmapbox)],
+                    pixmap, 0, 0, 0, 0, pixmapbox->allocation.width, pixmapbox->allocation.height);
+}
+
+
+static GdkPixmap **
+findpixmap(GtkWidget * widget)
+{
+    int     i;
+    for (i = 0; i < num_plotwindows && widget != pixmapboxes[i]; i++);
+    if (i >= num_plotwindows) {
+        g_print("findpixmap(): bad argument widget \n");
+        return NULL;
+    }
+    return &pixmaps[i];
+}
+
+void
+gpk_graph_draw(GtkWidget * widget, /* plot on this widged */
+               int n,        /* number of data points */
+               gdouble * xcord, gdouble * ycord, /* data */
+               gdouble xmn, gdouble ymn, /* coordinates of corners */
+               gdouble xmx, gdouble ymx, int clear, /* clear old plot first */
+               char *title,  /* add a title (only if clear=1) */
+               GdkColor * color)
+{
+    GdkPixmap **ppixmap;
+    GdkPoint *points;
+    int     i;
+    gint16  width, height;
+    GdkFont *fixed_font;
+    GdkGC  *gc;
+
+    gc = gdk_gc_new(widget->window);
+    gdk_gc_set_foreground(gc, color);
+
+
+
+    if ((ppixmap = findpixmap(widget))) {
+        width = widget->allocation.width;
+        height = widget->allocation.height;
+
+
+        if (clear) {
+            /* white background */
+            gdk_draw_rectangle(*ppixmap, widget->style->white_gc, TRUE, 0, 0, width, height);
+            /* title */
+#ifdef _WIN32
+            fixed_font = gdk_font_load("-misc-fixed-large-r-*-*-*-100-*-*-*-*-*-*");
+#else
+            fixed_font = gdk_font_load("-misc-fixed-medium-r-*-*-*-100-*-*-*-*-iso8859-1");
+#endif
+
+            gdk_draw_text(*ppixmap, fixed_font,
+                          widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+                          0, 10, title, strlen(title));
+        }
+
+
+        points = g_malloc(n * sizeof(GdkPoint));
+        for (i = 0; i < n; i++) {
+            points[i].x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn));
+            points[i].y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx));
+        }
+        gdk_draw_lines(*ppixmap, gc, points, n);
+        g_free(points);
+        gpk_redraw(*ppixmap, widget);
+    }
+    gdk_gc_destroy(gc);
+}
+
+
+
+void
+gpk_rectangle_draw(GtkWidget * widget, /* plot on this widged */
+                   gdouble * xcord, gdouble * ycord, /* corners */
+                   gdouble xmn, gdouble ymn, /* coordinates of corners */
+                   gdouble xmx, gdouble ymx, GdkColor * color)
+{
+    GdkPixmap **ppixmap;
+    GdkPoint points[2];
+    int     i;
+    gint16  width, height;
+    GdkGC  *gc;
+
+
+    gc = gdk_gc_new(widget->window);
+    gdk_gc_set_foreground(gc, color);
+
+
+    if ((ppixmap = findpixmap(widget))) {
+        width = widget->allocation.width;
+        height = widget->allocation.height;
+
+
+        for (i = 0; i < 2; i++) {
+            points[i].x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn));
+            points[i].y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx));
+        }
+        width = points[1].x - points[0].x + 1;
+        height = points[1].y - points[0].y + 1;
+        gdk_draw_rectangle(*ppixmap, gc, TRUE, points[0].x, points[0].y, width, height);
+        gpk_redraw(*ppixmap, widget);
+    }
+    gdk_gc_destroy(gc);
+}
+
+
+
+void
+gpk_bargraph_draw(GtkWidget * widget, /* plot on this widged */
+                  int n,     /* number of data points */
+                  gdouble * xcord, gdouble * ycord, /* data */
+                  gdouble xmn, gdouble ymn, /* coordinates of corners */
+                  gdouble xmx, gdouble ymx, int clear, /* clear old plot first */
+                  char *title, /* add a title (only if clear=1) */
+                  int barwidth, /* bar width. 0=compute based on window size */
+                  GdkColor * color)
+{
+    GdkPixmap **ppixmap;
+    GdkPoint points[2];
+    int     i;
+    gint16  width, height, x, y, barheight;
+    GdkFont *fixed_font;
+    GdkGC  *gc;
+    int     titleSplit;
+
+
+    gc = gdk_gc_new(widget->window);
+    gdk_gc_set_foreground(gc, color);
+
+
+    if ((ppixmap = findpixmap(widget))) {
+        width = widget->allocation.width;
+        height = widget->allocation.height;
+
+
+        if (clear) {
+            /* white background */
+            gdk_draw_rectangle(*ppixmap, widget->style->white_gc, TRUE, 0, 0, width, height);
+            /* title */
+#ifdef _WIN32
+            fixed_font = gdk_font_load("-misc-fixed-large-r-*-*-*-100-*-*-*-*-*-*");
+#else
+            fixed_font = gdk_font_load("-misc-fixed-medium-r-*-*-*-100-*-*-*-*-iso8859-1");
+#endif
+
+            titleSplit = strcspn(title, "\n");
+
+            if (titleSplit && (titleSplit != strlen(title))) {
+                gdk_draw_text(*ppixmap, fixed_font,
+                              widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+                              0, 10, title, titleSplit);
+
+                gdk_draw_text(*ppixmap, fixed_font,
+                              widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+                              0, 22, title + titleSplit + 1, (strlen(title) - titleSplit) - 1);
+
+
+            }
+            else {
+                gdk_draw_text(*ppixmap, fixed_font,
+                              widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+                              0, 10, title, strlen(title));
+            }
+        }
+
+
+        for (i = 0; i < n; i++) {
+            points[1].x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn));
+            points[1].y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx));
+            points[0].x = points[1].x;
+            points[0].y = height - 1;
+
+            x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn));
+            y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx));
+            if (!barwidth)
+                barwidth = (width / (n + 1)) - 1;
+            barwidth = barwidth > 5 ? 5 : barwidth;
+            barwidth = barwidth < 1 ? 1 : barwidth;
+            barheight = height - 1 - y;
+            /* gdk_draw_lines(*ppixmap,gc,points,2); */
+            gdk_draw_rectangle(*ppixmap, gc, TRUE, x, y, barwidth, barheight);
+
+        }
+        gpk_redraw(*ppixmap, widget);
+    }
+    gdk_gc_destroy(gc);
+}
+
+
+
+
+
+/* Create a new backing pixmap of the appropriate size */
+static  gint
+configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer data)
+{
+    GdkPixmap **ppixmap;
+    if ((ppixmap = findpixmap(widget))) {
+        if (*ppixmap)
+            gdk_pixmap_unref(*ppixmap);
+        *ppixmap = gdk_pixmap_new(widget->window,
+                                  widget->allocation.width, widget->allocation.height, -1);
+        gdk_draw_rectangle(*ppixmap,
+                           widget->style->white_gc,
+                           TRUE, 0, 0, widget->allocation.width, widget->allocation.height);
+    }
+    return TRUE;
+}
+
+
+
+/* Redraw the screen from the backing pixmap */
+static  gint
+expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer data)
+{
+    GdkPixmap **ppixmap;
+    if ((ppixmap = findpixmap(widget))) {
+        gdk_draw_pixmap(widget->window,
+                        widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+                        *ppixmap,
+                        event->area.x, event->area.y,
+                        event->area.x, event->area.y, event->area.width, event->area.height);
+    }
+
+    return FALSE;
+}
+
+
+
+
+
+GtkWidget *
+gpk_plot_new(int width, int height)
+{
+    GtkWidget *pixmapbox;
+
+    pixmapbox = gtk_drawing_area_new();
+    gtk_drawing_area_size(GTK_DRAWING_AREA(pixmapbox), width, height);
+    gtk_signal_connect(GTK_OBJECT(pixmapbox), "expose_event", (GtkSignalFunc) expose_event, NULL);
+    gtk_signal_connect(GTK_OBJECT(pixmapbox), "configure_event",
+                       (GtkSignalFunc) configure_event, NULL);
+    gtk_widget_set_events(pixmapbox, GDK_EXPOSURE_MASK);
+
+    if (num_plotwindows < max_plotwindows) {
+        pixmapboxes[num_plotwindows] = pixmapbox;
+        pixmaps[num_plotwindows] = NULL;
+        num_plotwindows++;
+    }
+    else {
+        g_print("gtk_plotarea_new(): exceeded maximum of 10 plotarea windows\n");
+    }
+
+    return pixmapbox;
+}
diff --git a/frontend/gpkplotting.h b/frontend/gpkplotting.h
new file mode 100644
index 0000000..2c69c8c
--- /dev/null
+++ b/frontend/gpkplotting.h
@@ -0,0 +1,51 @@
+/*
+ *	GTK plotting routines include file
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_GPKPLOTTING_H
+#define LAME_GPKPLOTTING_H
+
+#include <gtk/gtk.h>
+
+/* allocate a graphing widget */
+GtkWidget *gpk_plot_new(int width, int height);
+
+/* graph a function in the graphing widged */
+void    gpk_graph_draw(GtkWidget * widget,
+                       int n, gdouble * xcord, gdouble * ycord,
+                       gdouble xmn, gdouble ymn, gdouble xmx, gdouble ymx,
+                       int clear, char *title, GdkColor * color);
+
+/* draw a rectangle in the graphing widget */
+void    gpk_rectangle_draw(GtkWidget * widget, /* plot on this widged */
+                           gdouble xcord[2], gdouble ycord[2], /* corners */
+                           gdouble xmn, gdouble ymn, /* coordinates of corners */
+                           gdouble xmx, gdouble ymx, GdkColor * color); /* color to use */
+
+/* make a bar graph in the graphing widged */
+void    gpk_bargraph_draw(GtkWidget * widget,
+                          int n, gdouble * xcord, gdouble * ycord,
+                          gdouble xmn, gdouble ymn, gdouble xmx, gdouble ymx,
+                          int clear, char *title, int bwidth, GdkColor * color);
+
+/* set forground color  */
+void    setcolor(GtkWidget * widget, GdkColor * color, int red, int green, int blue);
+
+#endif
diff --git a/frontend/gtkanal.c b/frontend/gtkanal.c
new file mode 100644
index 0000000..02f3bbe
--- /dev/null
+++ b/frontend/gtkanal.c
@@ -0,0 +1,1639 @@
+/*
+ *      GTK plotting routines source file
+ *
+ *      Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: gtkanal.c,v 1.41.8.3 2009/01/18 15:44:28 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include "main.h"
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "lame-analysis.h"
+#include "get_audio.h"
+#include "gtkanal.h"
+#include "gpkplotting.h"
+#include "lame_global_flags.h"
+
+/* this file should be removed. The few data items accessed in 'gfc'
+   should be made accessable by writing a lame_set_variable() function */
+#include "util.h"
+
+#include "console.h"
+
+
+#ifdef _WIN32
+#  include <windows.h>
+#  define msleep(t) Sleep(t)
+#else
+#  include <unistd.h>
+#  define msleep(t) usleep((t) * 1000)
+#endif
+
+
+
+
+/*! Stringify \a x. */
+#define STR(x)   #x
+/*! Stringify \a x, perform macro expansion. */
+#define XSTR(x)  STR(x)
+
+#define MP3X_MAJOR_VERSION      0 /* Major version number */
+#define MP3X_MINOR_VERSION     82 /* Minor version number */
+#define MP3X_ALPHA_VERSION      0 /* Set number if this is an alpha version, otherwise zero */
+#define MP3X_BETA_VERSION       0 /* Set number if this is a beta version, otherwise zero */
+
+
+plotting_data *pinfo;
+plotting_data *pplot;
+plotting_data Pinfo[NUMPINFO];
+
+
+/* global variables for the state of the system */
+static gint idle_keepgoing;  /* processing of frames is ON */
+static gint idle_count_max;  /* number of frames to process before plotting */
+static gint idle_count;      /* pause & plot when idle_count=idel_count_max */
+static gint idle_end = 0;    /* process all frames, stop at last frame  */
+static gint idle_back = 0;   /* set when we are displaying the old data */
+static int mp3done = 0;      /* last frame has been read */
+static GtkWidget *frameprogress; /* progress bar */
+static GtkWidget *framecounter; /* progress counter */
+
+static int subblock_draw[3] = { 1, 1, 1 };
+
+/* main window */
+GtkWidget *window;
+/* Backing pixmap for drawing areas */
+GtkWidget *pcmbox;           /* PCM data plotted here */
+GtkWidget *winbox;           /* mpg123 synthesis data plotted here */
+GtkWidget *enerbox[2];       /* spectrum, gr=0,1 plotted here */
+GtkWidget *mdctbox[2];       /* mdct coefficients gr=0,1 plotted here */
+GtkWidget *sfbbox[2];        /* scalefactors gr=0,1 plotted here */
+GtkWidget *headerbox;        /* mpg123 header info shown here */
+
+
+struct gtkinfostruct {
+    int     filetype;        /* input file type 0=WAV, 1=MP3 */
+    int     msflag;          /* toggle between L&R vs M&S PCM data display */
+    int     chflag;          /* toggle between L & R channels */
+    int     kbflag;          /* toggle between wave # and barks */
+    int     flag123;         /* show mpg123 frame info, OR ISO encoder frame info */
+    double  avebits;         /* running average bits per frame */
+    int     approxbits;      /* (approx) bits per frame */
+    int     maxbits;         /* max bits per frame used so far */
+    int     totemph;         /* total of frames with de-emphasis */
+    int     totms;           /* total frames with ms_stereo */
+    int     totis;           /* total frames with i_stereo */
+    int     totshort;        /* total granules with short blocks */
+    int     totmix;          /* total granules with mixed blocks */
+    int     totpreflag;      /* total granules with preflag */
+    int     pupdate;         /* plot while processing, or only when needed */
+    int     sfblines;        /* plot scalefactor bands in MDCT plot */
+    int     difference;      /* plot original - decoded instead of orig vs. decoded */
+    int     totalframes;
+} gtkinfo;
+
+
+static lame_global_flags *gfp;
+lame_internal_flags *gfc;
+hip_t hip;
+
+/**********************************************************************
+ * read one frame and encode it
+ **********************************************************************/
+int
+gtkmakeframe(void)
+{
+    int     iread = 0;
+    static int init = 0;
+    static int mpglag;
+    static short int Buffer[2][1152];
+    short int mpg123pcm[2][1152];
+    int     ch, j;
+    int     mp3count = 0;
+    int     mp3out = 0;
+    int     channels_out;
+    unsigned char mp3buffer[LAME_MAXMP3BUFFER];
+    static int frameNum = 0;
+    int     framesize = lame_get_framesize(gfp);
+
+    channels_out = (lame_get_mode(gfp) == MONO) ? 1 : 2;
+
+    pinfo->frameNum = frameNum;
+    pinfo->sampfreq = lame_get_out_samplerate(gfp);
+    pinfo->framesize = framesize;
+    pinfo->stereo = channels_out;
+
+    /* If the analsys code is enabled, lame will writes data into gfc->pinfo,
+     * and mpg123 will write data into pinfo.  Set these so
+     * the libraries put this data in the right place: */
+    gfc->pinfo = pinfo;
+    hip_set_pinfo(hip, pinfo);
+
+    if (is_mpeg_file_format(input_format)) {
+        iread = get_audio16(gfp, Buffer);
+
+
+        /* add a delay of framesize-DECDELAY, which will make the total delay
+         * exactly one frame, so we can sync MP3 output with WAV input */
+        for (ch = 0; ch < channels_out; ch++) {
+            for (j = 0; j < framesize - DECDELAY; j++)
+                pinfo->pcmdata2[ch][j] = pinfo->pcmdata2[ch][j + framesize];
+            for (j = 0; j < framesize; j++) /*rescale from int to short int */
+                pinfo->pcmdata2[ch][j + framesize - DECDELAY] = Buffer[ch][j];
+        }
+
+        pinfo->frameNum123 = frameNum - 1;
+        ++frameNum;
+
+    }
+    else {
+
+        /* feed data to encoder until encoder produces some output */
+        while (lame_get_frameNum(gfp) == pinfo->frameNum) {
+
+            if (!init) {
+                init = 1;
+                mpglag = 1;
+                if (hip) {
+                    hip_decode_exit(hip);
+                }
+                hip = hip_decode_init();
+                hip_set_pinfo(hip, pinfo);
+            }
+
+            iread = get_audio16(gfp, Buffer);
+            if (iread > framesize) {
+                /* NOTE: frame analyzer requires that we encode one frame
+                 * for each pass through this loop.  If lame_encode_buffer()
+                 * is feed data too quickly, it will sometimes encode multiple frames
+                 * breaking this loop.
+                 */
+                error_printf("Warning: get_audio is returning too much data.\n");
+            }
+            if (iread <= 0)
+                break;  /* eof */
+
+            mp3count = lame_encode_buffer(gfp, Buffer[0], Buffer[1], iread,
+                                          mp3buffer, sizeof(mp3buffer));
+
+            assert(!(mp3count > 0 && lame_get_frameNum(gfp) == pinfo->frameNum));
+            /* not possible to produce mp3 data without encoding at least
+             * one frame of data which would increment frameNum */
+        }
+        frameNum = lame_get_frameNum(gfp); /* use the internal MP3 frame counter */
+
+
+        /* decode one frame of output */
+        mp3out = hip_decode1(hip, mp3buffer, mp3count, mpg123pcm[0], mpg123pcm[1]); /* re-synthesis to pcm */
+        /* mp3out = 0:  need more data to decode */
+        /* mp3out = -1:  error.  Lets assume 0 pcm output */
+        /* mp3out = number of samples output */
+        if (mp3out > 0)
+            assert(mp3out == pinfo->framesize);
+        if (mp3out != 0) {
+            /* decoded output is for frame pinfo->frameNum123
+             * add a delay of framesize-DECDELAY, which will make the total delay
+             * exactly one frame */
+            pinfo->frameNum123 = pinfo->frameNum - mpglag;
+            for (ch = 0; ch < pinfo->stereo; ch++) {
+                for (j = 0; j < pinfo->framesize - DECDELAY; j++)
+                    pinfo->pcmdata2[ch][j] = pinfo->pcmdata2[ch][j + pinfo->framesize];
+                for (j = 0; j < pinfo->framesize; j++) {
+                    pinfo->pcmdata2[ch][j + pinfo->framesize - DECDELAY] =
+                        (mp3out == -1) ? 0 : mpg123pcm[ch][j];
+                }
+            }
+        }
+        else {
+            if (mpglag == MAXMPGLAG) {
+                error_printf("READ_AHEAD set too low - not enough frame buffering.\n"
+                             "MP3x display of input and output PCM data out of sync.\n");
+                error_flush();
+            }
+            else
+                mpglag++;
+            pinfo->frameNum123 = -1; /* no frame output */
+        }
+    }
+    return iread;
+}
+
+
+void
+plot_frame(void)
+{
+    int     i, j, n, ch, gr;
+    gdouble *xcord, *ycord;
+    gdouble xmx, xmn, ymx, ymn;
+    double *data, *data2, *data3;
+    char    title2[80];
+    char    label[80], label2[80];
+    char   *title;
+    plotting_data *pplot1;
+    plotting_data *pplot2 = NULL;
+
+    double  en, samp;
+    int     sampindex, version = 0;
+    int     barthick;
+    static int firstcall = 1;
+    static GdkColor *barcolor, *color, *grcolor[2];
+    static GdkColor yellow, gray, cyan, magenta, orange, pink, red, green, blue, black, oncolor,
+        offcolor;
+    int     blocktype[2][2];
+    int     headbits;
+    int     mode_gr = 2;
+
+    /* find the frame where mpg123 produced output coming from input frame
+     * pinfo.  i.e.:   out_frame + out_frame_lag = input_frame  */
+    for (i = 1; i <= MAXMPGLAG; i++) {
+        if ((pplot - i)->frameNum123 == pplot->frameNum) {
+            pplot2 = pplot - i;
+            break;
+        }
+    }
+    if (i > MAXMPGLAG) {
+        error_printf("input/output pcm syncing problem.  should not happen!\n");
+        pplot2 = pplot - 1;
+    }
+
+
+    /* however, the PCM data is delayed by 528 samples in the encoder filterbanks.
+     * We added another 1152-528 delay to this so the PCM data is *exactly* one
+     * frame behind the header & MDCT information */
+    pplot1 = pplot2 + 1; /* back one frame for header info, MDCT */
+
+    /* allocate these GC's only once */
+    if (firstcall) {
+        firstcall = 0;
+        /*    grcolor[0] = &magenta; */
+        grcolor[0] = &blue;
+        grcolor[1] = &green;
+        barcolor = &gray;
+
+        setcolor(headerbox, &oncolor, 255, 0, 0);
+        setcolor(headerbox, &offcolor, 175, 175, 175);
+        setcolor(pcmbox, &red, 255, 0, 0);
+        setcolor(pcmbox, &pink, 255, 0, 255);
+        setcolor(pcmbox, &magenta, 255, 0, 100);
+        setcolor(pcmbox, &orange, 255, 127, 0);
+        setcolor(pcmbox, &cyan, 0, 255, 255);
+        setcolor(pcmbox, &green, 0, 255, 0);
+        setcolor(pcmbox, &blue, 0, 0, 255);
+        setcolor(pcmbox, &black, 0, 0, 0);
+        setcolor(pcmbox, &gray, 100, 100, 100);
+        setcolor(pcmbox, &yellow, 255, 255, 0);
+
+    }
+
+  /*******************************************************************
+   * frame header info
+   *******************************************************************/
+    if (pplot1->sampfreq)
+        samp = pplot1->sampfreq;
+    else
+        samp = 1;
+    sampindex = SmpFrqIndex((long) samp, &version);
+
+    ch = gtkinfo.chflag;
+
+    headbits = 32 + ((pplot1->stereo == 2) ? 256 : 136);
+    gtkinfo.approxbits = (pplot1->bitrate * 1000 * 1152.0 / samp) - headbits;
+    sprintf(title2, "%3.1fkHz %ikbs ", samp / 1000, pplot1->bitrate);
+    gtk_text_freeze(GTK_TEXT(headerbox));
+    gtk_text_backward_delete(GTK_TEXT(headerbox), gtk_text_get_length(GTK_TEXT(headerbox)));
+    gtk_text_set_point(GTK_TEXT(headerbox), 0);
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, &oncolor, NULL, title2, -1);
+    title = " mono ";
+    if (2 == pplot1->stereo)
+        title = pplot1->js ? " js " : " s ";
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, &oncolor, NULL, title, -1);
+    color = pplot1->ms_stereo ? &oncolor : &offcolor;
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "ms ", -1);
+    color = pplot1->i_stereo ? &oncolor : &offcolor;
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "is ", -1);
+
+    color = pplot1->crc ? &oncolor : &offcolor;
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "crc ", -1);
+    color = pplot1->padding ? &oncolor : &offcolor;
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "pad ", -1);
+
+    color = pplot1->emph ? &oncolor : &offcolor;
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "em ", -1);
+
+    sprintf(title2, "bv=%i,%i ", pplot1->big_values[0][ch], pplot1->big_values[1][ch]);
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, &black, NULL, title2, -1);
+
+    color = pplot1->scfsi[ch] ? &oncolor : &offcolor;
+    sprintf(title2, "scfsi=%i            ", pplot1->scfsi[ch]);
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, title2, -1);
+    if (gtkinfo.filetype)
+        sprintf(title2, " mdb=%i %i/NA", pplot1->maindata, pplot1->totbits);
+    else
+        sprintf(title2, " mdb=%i   %i/%i",
+                pplot1->maindata, pplot1->totbits, pplot1->totbits + pplot->resvsize);
+    gtk_text_insert(GTK_TEXT(headerbox), NULL, &oncolor, NULL, title2, -1);
+    gtk_text_thaw(GTK_TEXT(headerbox));
+
+
+
+  /*******************************************************************
+   * block type
+   *******************************************************************/
+    for (gr = 0; gr < mode_gr; gr++)
+        if (gtkinfo.flag123)
+            blocktype[gr][ch] = pplot1->mpg123blocktype[gr][ch];
+        else
+            blocktype[gr][ch] = pplot->blocktype[gr][ch];
+
+
+  /*******************************************************************
+   * draw the PCM data *
+   *******************************************************************/
+    n = 1600;           /* PCM frame + FFT window:   224 + 1152 + 224  */
+    xcord = g_malloc(n * sizeof(gdouble));
+    ycord = g_malloc(n * sizeof(gdouble));
+
+
+    if (gtkinfo.msflag)
+        title = ch ? "Side Channel" : "Mid Channel";
+    else
+        title = ch ? "Right Channel" : "Left Channel";
+
+    sprintf(title2, "%s  mask_ratio=%3.2f  %3.2f  ener_ratio=%3.2f  %3.2f",
+            title,
+            pplot->ms_ratio[0], pplot->ms_ratio[1],
+            pplot->ms_ener_ratio[0], pplot->ms_ener_ratio[1]);
+
+
+    ymn = -32767;
+    ymx = 32767;
+    xmn = 0;
+    xmx = 1600 - 1;
+
+    /*  0  ... 224      draw in black, connecting to 224 pixel
+     * 1375 .. 1599     draw in black  connecting to 1375 pixel
+     * 224 ... 1375     MP3 frame.  draw in blue
+     */
+
+    /* draw the title */
+    gpk_graph_draw(pcmbox, 0, xcord, ycord, xmn, ymn, xmx, ymx, 1, title2, &black);
+
+
+    /* draw some hash marks dividing the frames */
+    ycord[0] = ymx * .8;
+    ycord[1] = ymn * .8;
+    for (gr = 0; gr <= 2; gr++) {
+        xcord[0] = 223.5 + gr * 576;
+        xcord[1] = 223.5 + gr * 576;
+        gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow);
+    }
+    for (gr = 0; gr < mode_gr; gr++) {
+        if (blocktype[gr][ch] == 2)
+            for (i = 1; i <= 2; i++) {
+                xcord[0] = 223.5 + gr * 576 + i * 192;
+                xcord[1] = 223.5 + gr * 576 + i * 192;
+                gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow);
+            }
+    }
+    /* bars representing FFT windows */
+    xcord[0] = 0;
+    ycord[0] = ymn + 3000;
+    xcord[1] = 1024 - 1;
+    ycord[1] = ymn + 1000;
+    gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, grcolor[0]);
+    xcord[0] = 576;
+    ycord[0] = ymn + 2000;
+    xcord[1] = 576 + 1024 - 1;
+    ycord[1] = ymn;
+    gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, grcolor[1]);
+
+
+    /* plot PCM data */
+    for (i = 0; i < n; i++) {
+        xcord[i] = i;
+        if (gtkinfo.msflag)
+            ycord[i] = ch ? .5 * (pplot->pcmdata[0][i] - pplot->pcmdata[1][i]) :
+                .5 * (pplot->pcmdata[0][i] + pplot->pcmdata[1][i]);
+        else
+            ycord[i] = pplot->pcmdata[ch][i];
+    }
+
+    /* skip plot if we are doing an mp3 file */
+    if (!gtkinfo.filetype) {
+        gpk_graph_draw(pcmbox, n, xcord, ycord, xmn, ymn, xmx, ymx, 0, title2, &black);
+    }
+
+
+  /*******************************************************************/
+    /* draw the PCM re-synthesis data */
+  /*******************************************************************/
+    n = 1152;
+    /*
+       sprintf(title2,"Re-synthesis  mask_ratio=%3.2f  %3.2f  ener_ratio=%3.2f  %3.2f",
+       pplot->ms_ratio[0],pplot->ms_ratio[1],
+       pplot->ms_ener_ratio[0],pplot->ms_ener_ratio[1]);
+     */
+    title = "Re-synthesis";
+    if (gtkinfo.difference)
+        title = "Re-synthesis difference (amplified 20db)";
+
+
+    ymn = -32767;
+    ymx = 32767;
+    xmn = 0;
+    xmx = 1600 - 1;
+    gpk_graph_draw(winbox, 0, xcord, ycord, xmn, ymn, xmx, ymx, 1, title, &black);
+    /* draw some hash marks dividing the frames */
+    ycord[0] = ymx * .8;
+    ycord[1] = ymn * .8;
+    for (gr = 0; gr <= 2; gr++) {
+        xcord[0] = 223.5 + gr * 576;
+        xcord[1] = 223.5 + gr * 576;
+        gpk_rectangle_draw(winbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow);
+    }
+    for (gr = 0; gr < 2; gr++) {
+        if (blocktype[gr][ch] == 2)
+            for (i = 1; i <= 2; i++) {
+                xcord[0] = 223.5 + gr * 576 + i * 192;
+                xcord[1] = 223.5 + gr * 576 + i * 192;
+                gpk_rectangle_draw(winbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow);
+            }
+    }
+
+    /* this piece of PCM data from previous frame */
+    n = 224;
+    for (j = 1152 - n, i = 0; i < n; i++, j++) {
+        xcord[i] = i;
+        if (gtkinfo.msflag)
+            ycord[i] = ch ? .5 * (pplot1->pcmdata2[0][j] -
+                                  pplot1->pcmdata2[1][j]) :
+                .5 * (pplot1->pcmdata2[0][j] + pplot1->pcmdata2[1][j]);
+        else
+            ycord[i] = pplot1->pcmdata2[ch][j];
+    }
+
+    /* this piece of PCM data from current frame */
+    n = 1152;
+    for (i = 0; i < n; i++) {
+        xcord[i + 224] = i + 224;
+        if (gtkinfo.msflag)
+            ycord[i + 224] = ch ? .5 * (pplot2->pcmdata2[0][i] - pplot2->pcmdata2[1][i]) :
+                .5 * (pplot2->pcmdata2[0][i] + pplot2->pcmdata2[1][i]);
+        else
+            ycord[i + 224] = pplot2->pcmdata2[ch][i];
+    }
+
+    n = 1152 + 224;
+    if (gtkinfo.difference) {
+        for (i = 0; i < n; i++) {
+            if (gtkinfo.msflag)
+                ycord[i] -= ch ? .5 * (pplot->pcmdata[0][i] - pplot->pcmdata[1][i]) :
+                    .5 * (pplot->pcmdata[0][i] + pplot->pcmdata[1][i]);
+            else
+                ycord[i] -= pplot->pcmdata[ch][i];
+        }
+        ycord[i] *= 100;
+    }
+
+
+    gpk_graph_draw(winbox, n, xcord, ycord, xmn, ymn, xmx, ymx, 0, title, &black);
+
+
+
+
+
+  /*******************************************************************/
+    /* draw the MDCT energy spectrum */
+  /*******************************************************************/
+    for (gr = 0; gr < mode_gr; gr++) {
+        int     bits, bits2;
+        char   *blockname = "";
+        switch (blocktype[gr][ch]) {
+        case 0:
+            blockname = "normal";
+            break;
+        case 1:
+            blockname = "start";
+            break;
+        case 2:
+            blockname = "short";
+            break;
+        case 3:
+            blockname = "end";
+            break;
+        }
+        strcpy(label, blockname);
+        if (pplot1->mixed[gr][ch])
+            strcat(label, "(mixed)");
+
+
+
+
+        n = 576;
+        if (gtkinfo.flag123) {
+            data = pplot1->mpg123xr[gr][0];
+            data2 = pplot1->mpg123xr[gr][1];
+        }
+        else {
+            data = pplot->xr[gr][0];
+            data2 = pplot->xr[gr][1];
+        }
+
+
+        xmn = 0;
+        xmx = n - 1;
+        ymn = 0;
+        ymx = 11;
+
+        /* draw title, erase old plot */
+        if (gtkinfo.flag123) {
+            bits = pplot1->mainbits[gr][ch];
+            bits2 = pplot1->sfbits[gr][ch];
+        }
+        else {
+            bits = pplot->LAMEmainbits[gr][ch];
+            bits2 = pplot->LAMEsfbits[gr][ch];
+        }
+        sprintf(title2, "MDCT%1i(%s) bits=%i/%i ", gr, label, bits, bits2);
+        gpk_bargraph_draw(mdctbox[gr], 0, xcord, ycord, xmn, ymn, xmx, ymx, 1, title2, 0, barcolor);
+
+        /* draw some hash marks showing scalefactor bands */
+        if (gtkinfo.sfblines) {
+            int     fac, nsfb, *scalefac;
+            if (blocktype[gr][ch] == SHORT_TYPE) {
+                nsfb = SBMAX_s;
+                i = nsfb - 7;
+                fac = 3;
+                scalefac = gfc->scalefac_band.s;
+            }
+            else {
+                nsfb = SBMAX_l;
+                i = nsfb - 10;
+                fac = 1;
+                scalefac = gfc->scalefac_band.l;
+            }
+            for (; i < nsfb; i++) {
+                ycord[0] = .8 * ymx;
+                ycord[1] = ymn;
+                xcord[0] = fac * scalefac[i];
+                xcord[1] = xcord[0];
+                gpk_rectangle_draw(mdctbox[gr], xcord, ycord, xmn, ymn, xmx, ymx, &yellow);
+            }
+        }
+
+
+
+        ymn = 9e20;
+        ymx = -9e20;
+        for (i = 0; i < n; i++) {
+            double  coeff;
+            xcord[i] = i;
+            if (gtkinfo.msflag) {
+                coeff = ch ? .5 * (data[i] - data2[i]) : .5 * (data[i] + data2[i]);
+            }
+            else {
+                coeff = ch ? data2[i] : data[i];
+            }
+            if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3])
+                coeff = 0;
+            ycord[i] = coeff * coeff * 1e10;
+            ycord[i] = log10(MAX(ycord[i], (double) 1));
+
+#if 0
+            if (ch == 0)
+                if (i == 26)
+                    if (data[i] != 0)
+                        console_printf("%i %i i=%i  mdct: (db) %f  %f \n", pplot->frameNum, gr, i,
+                                       10 * log10(data[i] * data[i]),
+                                       10 * log10(.33 *
+                                                  (data[i - 1] * data[i - 1] + data[i] * data[i] +
+                                                   data[i + 1] * data[i + 1]))
+                            );
+#endif
+
+            ymx = (ycord[i] > ymx) ? ycord[i] : ymx;
+            ymn = (ycord[i] < ymn) ? ycord[i] : ymn;
+        }
+        /*  print the min/max
+           sprintf(title2,"MDCT%1i %5.2f %5.2f  bits=%i",gr,ymn,ymx,
+           pplot1->mainbits[gr][ch]);
+         */
+        if (gtkinfo.flag123)
+            bits = pplot1->mainbits[gr][ch];
+        else
+            bits = pplot->LAMEmainbits[gr][ch];
+
+
+        sprintf(title2, "MDCT%1i(%s) bits=%i ", gr, label, bits);
+
+        xmn = 0;
+        xmx = n - 1;
+        ymn = 0;
+        ymx = 11;
+        gpk_bargraph_draw(mdctbox[gr], n, xcord, ycord, xmn, ymn, xmx, ymx, 0, title2, 0, barcolor);
+    }
+
+
+
+
+  /*******************************************************************
+   * draw the psy model energy spectrum (k space)
+   * l3psy.c computes pe, en, thm for THIS granule.
+   *******************************************************************/
+    if (gtkinfo.kbflag) {
+        for (gr = 0; gr < mode_gr; gr++) {
+            n = HBLKSIZE; /* only show half the spectrum */
+
+            data = &pplot->energy[gr][ch][0];
+
+            ymn = 9e20;
+            ymx = -9e20;
+            for (i = 0; i < n; i++) {
+                xcord[i] = i + 1;
+                if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3])
+                    ycord[i] = 0;
+                else
+                    ycord[i] = log10(MAX(data[i], (double) 1));
+                ymx = (ycord[i] > ymx) ? ycord[i] : ymx;
+                ymn = (ycord[i] < ymn) ? ycord[i] : ymn;
+            }
+            for (en = 0, j = 0; j < BLKSIZE; j++)
+                en += pplot->energy[gr][ch][j];
+
+            sprintf(title2, "FFT%1i  pe=%5.2fK  en=%5.2e ", gr, pplot->pe[gr][ch] / 1000, en);
+
+            ymn = 3;
+            ymx = 15;
+            xmn = 1;
+            xmx = n;
+            gpk_bargraph_draw(enerbox[gr], n, xcord, ycord,
+                              xmn, ymn, xmx, ymx, 1, title2, 0, barcolor);
+
+        }
+    }
+    else {
+    /*******************************************************************
+     * draw the psy model energy spectrum (scalefactor bands)
+     *******************************************************************/
+        for (gr = 0; gr < mode_gr; gr++) {
+
+            if (blocktype[gr][ch] == 2) {
+                n = 3 * SBMAX_s;
+                data = &pplot->en_s[gr][ch][0];
+                data2 = &pplot->thr_s[gr][ch][0];
+                data3 = &pplot->xfsf_s[gr][ch][0];
+            }
+            else {
+                n = SBMAX_l;
+                data = &pplot->en[gr][ch][0];
+                data2 = &pplot->thr[gr][ch][0];
+                data3 = &pplot->xfsf[gr][ch][0];
+            }
+            ymn = 9e20;
+            ymx = -9e20;
+            for (i = 0; i < n; i++) {
+                xcord[i] = i + 1;
+                if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3])
+                    ycord[i] = 0;
+                else
+                    ycord[i] = log10(MAX(data[i], (double) 1));
+                /*
+                   ymx=(ycord[i] > ymx) ? ycord[i] : ymx;
+                   ymn=(ycord[i] < ymn) ? ycord[i] : ymn;
+                 */
+            }
+
+
+
+            /* en = max energy difference amoung the 3 short FFTs for this granule */
+            en = pplot->ers[gr][ch];
+            if (en > 999)
+                en = 999;
+            sprintf(title2,
+                    "FFT%1i pe=%5.2fK/%3.1f \nnoise ovr_b:%i/max:%3.1f/ovr:%3.1f/tot:%3.1f/ssd:%i",
+                    gr, pplot->pe[gr][ch] / 1000, en, pplot->over[gr][ch], pplot->max_noise[gr][ch],
+                    pplot->over_noise[gr][ch], pplot->tot_noise[gr][ch], pplot->over_SSD[gr][ch]);
+
+            barthick = 3;
+            if (blocktype[gr][ch] == SHORT_TYPE)
+                barthick = 2;
+            if (!(subblock_draw[0] && subblock_draw[1] && subblock_draw[2]))
+                barthick = 3;
+
+            ymn = 3;
+            ymx = 15;
+            xmn = 1;
+            xmx = n + 1; /* a little extra because of the bar thickness */
+            gpk_bargraph_draw(enerbox[gr], n, xcord, ycord,
+                              xmn, ymn, xmx, ymx, 1, title2, barthick, barcolor);
+
+            for (i = 0; i < n; i++) {
+                xcord[i] = i + 1 + .20;
+                if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3])
+                    ycord[i] = 0;
+                else
+                    ycord[i] = log10(MAX(data2[i], (double) 1));
+            }
+
+            gpk_bargraph_draw(enerbox[gr], n, xcord, ycord,
+                              xmn, ymn, xmx, ymx, 0, title2, barthick, grcolor[gr]);
+
+            for (i = 0; i < n; i++) {
+                xcord[i] = i + 1 + .40;
+                if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3])
+                    ycord[i] = 0;
+                else
+                    ycord[i] = log10(MAX(data3[i], (double) 1));
+            }
+            gpk_bargraph_draw(enerbox[gr], n, xcord, ycord,
+                              xmn, ymn, xmx, ymx, 0, title2, barthick, &red);
+
+        }
+    }
+
+  /*******************************************************************
+   * draw scalefactors
+   *******************************************************************/
+    for (gr = 0; gr < mode_gr; gr++) {
+        int     ggain;
+        if (blocktype[gr][ch] == 2) {
+            n = 3 * SBMAX_s;
+            if (gtkinfo.flag123)
+                data = pplot1->sfb_s[gr][ch];
+            else
+                data = pplot->LAMEsfb_s[gr][ch];
+        }
+        else {
+            n = SBMAX_l;
+            if (gtkinfo.flag123)
+                data = pplot1->sfb[gr][ch];
+            else
+                data = pplot->LAMEsfb[gr][ch];
+        }
+
+        ymn = -1;
+        ymx = 10;
+        for (i = 0; i < n; i++) {
+            xcord[i] = i + 1;
+            if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3])
+                ycord[i] = 0;
+            else
+                ycord[i] = -data[i];
+
+            ymx = (ycord[i] > ymx - 2) ? ycord[i] + 2 : ymx;
+            ymn = (ycord[i] < ymn) ? ycord[i] - 1 : ymn;
+        }
+
+        if (blocktype[gr][ch] == 2) {
+            sprintf(label2,
+                    "SFB scale=%i preflag=%i  %i%i%i",
+                    pplot1->scalefac_scale[gr][ch],
+                    pplot1->preflag[gr][ch],
+                    pplot1->sub_gain[gr][ch][0],
+                    pplot1->sub_gain[gr][ch][1], pplot1->sub_gain[gr][ch][2]);
+        }
+        else {
+            sprintf(label2, "SFB scale=%i preflag=%i", pplot1->scalefac_scale[gr][ch],
+                    pplot1->preflag[gr][ch]);
+        }
+
+        if (gtkinfo.flag123)
+            ggain = (pplot1->qss[gr][ch]);
+        else
+            ggain = (pplot->LAMEqss[gr][ch]);
+
+        sprintf(title2, " ggain=%i", ggain);
+        strcat(label2, title2);
+
+        xmn = 1;
+        xmx = n + 1;
+        gpk_bargraph_draw(sfbbox[gr], n, xcord, ycord,
+                          xmn, ymn, xmx, ymx, 1, label2, 0, grcolor[gr]);
+
+        ycord[0] = ycord[1] = 0;
+        xcord[0] = 1;
+        xcord[1] = n + 1;
+        gpk_rectangle_draw(sfbbox[gr], xcord, ycord, xmn, ymn, xmx, ymx, &yellow);
+
+
+    }
+
+
+}
+
+
+
+static void
+update_progress(void)
+{
+    char    label[80];
+
+    int     tf = lame_get_totalframes(gfp);
+    if (gtkinfo.totalframes > 0)
+        tf = gtkinfo.totalframes;
+
+    sprintf(label, "Frame:%4i/%4i  %6.2fs", pplot->frameNum, (int) tf - 1, pplot->frametime);
+    gtk_progress_set_value(GTK_PROGRESS(frameprogress), (gdouble) pplot->frameNum);
+    gtk_label_set_text(GTK_LABEL(framecounter), label);
+}
+
+
+
+static void
+analyze(void)
+{
+    if (idle_keepgoing) {
+        idle_count = 0;
+        idle_count_max = 0;
+        idle_keepgoing = 0;
+        idle_end = 0;
+    }
+    plot_frame();
+    update_progress();
+}
+
+static void
+plotclick(GtkWidget * widget, gpointer data)
+{
+    analyze();
+}
+
+
+
+
+static int
+frameadv1(GtkWidget * widget, gpointer data)
+{
+    int     i;
+    if (idle_keepgoing) {
+        if (idle_back) {
+            /* frame displayed is the old frame.  to advance, just swap in new frame */
+            idle_back--;
+            pplot = &Pinfo[READ_AHEAD + idle_back];
+        }
+        else {
+            /* advance the frame by reading in a new frame */
+            pplot = &Pinfo[READ_AHEAD];
+            if (mp3done) {
+                /* dont try to read any more frames, and quit if "finish MP3" was selected */
+                /* if (idle_finish) gtk_main_quit(); */
+                idle_count_max = 0;
+                idle_end = 0;
+            }
+            else {
+                /* read in the next frame */
+                for (i = NUMPINFO - 1; i > 0; i--)
+                    memcpy(&Pinfo[i], &Pinfo[i - 1], sizeof(plotting_data));
+                pinfo = &Pinfo[0];
+                pinfo->num_samples = gtkmakeframe();
+                if (pinfo->num_samples == 0 && gtkinfo.totalframes == 0)
+                    /* allow an extra frame to flush decoder buffers */
+                    gtkinfo.totalframes = pinfo->frameNum + 2;
+
+                if (pinfo->sampfreq)
+                    pinfo->frametime = (pinfo->frameNum) * 1152.0 / pinfo->sampfreq;
+                else
+                    pinfo->frametime = 0;
+
+                /* eof?
+                   if (!pinfo->num_samples) if (idle_finish) gtk_main_quit();
+                 */
+
+                pinfo->totbits = 0;
+                {
+                    int     gr, ch;
+                    for (gr = 0; gr < 2; gr++)
+                        for (ch = 0; ch < 2; ch++) {
+                            gtkinfo.totshort += (pinfo->mpg123blocktype[gr][ch] == 2);
+                            gtkinfo.totmix += !(pinfo->mixed[gr][ch] == 0);
+                            gtkinfo.totpreflag += (pinfo->preflag[gr][ch] == 1);
+                            pinfo->totbits += pinfo->mainbits[gr][ch];
+                        }
+                }
+                if (pinfo->frameNum > 0) /* start averaging at second frame */
+                    gtkinfo.avebits = (gtkinfo.avebits * ((pinfo->frameNum) - 1)
+                                       + pinfo->totbits) / (pinfo->frameNum);
+
+                gtkinfo.maxbits = MAX(gtkinfo.maxbits, pinfo->totbits);
+                gtkinfo.totemph += !(pinfo->emph == 0);
+                gtkinfo.totms += !(pinfo->ms_stereo == 0);
+                gtkinfo.totis += !(pinfo->i_stereo == 0);
+
+                if (gtkinfo.totalframes > 0)
+                    if (pplot->frameNum >= gtkinfo.totalframes - 1)
+                        mp3done = 1;
+            }
+        }
+
+        idle_count++;
+        if (gtkinfo.pupdate)
+            plot_frame();
+        update_progress();
+        if ((idle_count >= idle_count_max) && (!idle_end))
+            analyze();
+    }
+    else {
+        /*no processing to do, sleep in order to not monopolize CPU */
+        msleep(10);
+    }
+    return 1;
+}
+
+
+static void
+frameadv(GtkWidget * widget, gpointer data)
+{
+    int     adv;
+
+    if (!strcmp((char *) data, "-1")) {
+        /* ignore if we've already gone back as far as possible */
+        if (pplot->frameNum == 0 || (idle_back == NUMBACK))
+            return;
+        idle_back++;
+        pplot = &Pinfo[READ_AHEAD + idle_back];
+        analyze();
+        return;
+    }
+
+
+    adv = 1;
+    if (!strcmp((char *) data, "1"))
+        adv = 1;
+    if (!strcmp((char *) data, "10"))
+        adv = 10;
+    if (!strcmp((char *) data, "100"))
+        adv = 100;
+    if (!strcmp((char *) data, "finish"))
+        idle_end = 1;
+
+
+    if (idle_keepgoing) {
+        /* already running - que up additional frame advance requests */
+        idle_count_max += adv;
+    }
+    else {
+        /* turn on idleing */
+        idle_count_max = adv;
+        idle_count = 0;
+        idle_keepgoing = 1;
+    }
+}
+
+
+
+
+/* another callback */
+static void
+delete_event(GtkWidget * widget, GdkEvent * event, gpointer data)
+{
+    /* set MP3 done flag in case the File/Quit menu item has been selected */
+    mp3done = 1;
+
+    gtk_main_quit();
+}
+
+
+
+
+
+
+
+static void
+channel_option(GtkWidget * widget, gpointer data)
+{
+    long    option;
+    option = (long) data;
+    switch (option) {
+    case 1:
+        gtkinfo.msflag = 0;
+        gtkinfo.chflag = 0;
+        break;
+    case 2:
+        gtkinfo.msflag = 0;
+        gtkinfo.chflag = 1;
+        break;
+    case 3:
+        gtkinfo.msflag = 1;
+        gtkinfo.chflag = 0;
+        break;
+    case 4:
+        gtkinfo.msflag = 1;
+        gtkinfo.chflag = 1;
+    }
+    analyze();
+}
+static void
+spec_option(GtkWidget * widget, gpointer data)
+{
+    long    option;
+    option = (long) data;
+    switch (option) {
+    case 1:
+        gtkinfo.kbflag = 0;
+        break;
+    case 2:
+        gtkinfo.kbflag = 1;
+        break;
+    case 3:
+        gtkinfo.flag123 = 0;
+        break;
+    case 4:
+        gtkinfo.flag123 = 1;
+        break;
+    case 5:
+        gtkinfo.pupdate = 1;
+        break;
+    case 6:
+        gtkinfo.pupdate = 0;
+        break;
+    case 7:
+        gtkinfo.sfblines = !gtkinfo.sfblines;
+        break;
+    case 8:
+        gtkinfo.difference = !gtkinfo.difference;
+        break;
+    }
+    analyze();
+}
+
+static  gint
+key_press_event(GtkWidget * widget, GdkEventKey * event)
+{
+    /* is a switch() statement in lame forbidden? */
+    if (event->keyval == '1') {
+        subblock_draw[0] = 1;
+        subblock_draw[1] = 0;
+        subblock_draw[2] = 0;
+        analyze();
+    }
+    else if (event->keyval == '2') {
+        subblock_draw[0] = 0;
+        subblock_draw[1] = 1;
+        subblock_draw[2] = 0;
+        analyze();
+    }
+    else if (event->keyval == '3') {
+        subblock_draw[0] = 0;
+        subblock_draw[1] = 0;
+        subblock_draw[2] = 1;
+        analyze();
+    }
+    else if (event->keyval == '0') {
+        subblock_draw[0] = 1;
+        subblock_draw[1] = 1;
+        subblock_draw[2] = 1;
+        analyze();
+    }
+    /* analyze(); */ /* dont redraw entire window for every key! */
+    return 0;
+}
+
+
+/*! Get the mp3x version string. */
+/*!
+  \param void
+  \return a pointer to a string which describes the version of mp3x.
+*/
+const char *
+get_mp3x_version(void)
+{
+#if   MP3X_ALPHA_VERSION > 0
+    static /*@observer@ */ const char *const str =
+        XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION)
+        " (alpha " XSTR(MP3X_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
+#elif MP3X_BETA_VERSION > 0
+    static /*@observer@ */ const char *const str =
+        XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION)
+        " (beta " XSTR(MP3X_BETA_VERSION) ", " __DATE__ ")";
+#else
+    static /*@observer@ */ const char *const str =
+        XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION);
+#endif
+
+    return str;
+}
+
+
+static void
+text_window(GtkWidget * widget, gpointer data)
+{
+    long    option;
+    GtkWidget *hbox, *vbox, *button, *box;
+    GtkWidget *textwindow, *vscrollbar;
+    char    text[256];
+
+    option = (long) data;
+
+    textwindow = gtk_window_new(GTK_WINDOW_DIALOG);
+    gtk_signal_connect_object(GTK_OBJECT(window), "delete_event",
+                              GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(textwindow));
+
+    gtk_container_set_border_width(GTK_CONTAINER(textwindow), 0);
+    vbox = gtk_vbox_new(FALSE, 0);
+    hbox = gtk_hbox_new(FALSE, 0);
+
+    button = gtk_button_new_with_label("close");
+    gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
+                              GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(textwindow));
+
+    box = gtk_text_new(NULL, NULL);
+    gtk_text_set_editable(GTK_TEXT(box), FALSE);
+    vscrollbar = gtk_vscrollbar_new(GTK_TEXT(box)->vadj);
+
+
+    switch (option) {
+    case 0:
+        gtk_window_set_title(GTK_WINDOW(textwindow), "Documentation");
+        gtk_widget_set_usize(box, 450, 500);
+        gtk_text_set_word_wrap(GTK_TEXT(box), TRUE);
+        /* text should be moved outside this function, may be in a separate file */
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "Frame header information: "
+                        "First the bitrate, sampling frequency and mono, stereo or jstereo "
+                        "indicators are displayed .  If the bitstream is jstereo, then mid/side "
+                        "stereo or intensity stereo may be on (indicated in red).  If "
+                        "de-emphasis is used, this is also indicated in red.  The mdb value is "
+                        "main_data_begin.  The encoded data starts this many bytes *before* the "
+                        "frame header.  A large value of mdb means the bitstream has saved some "
+                        "bits into the reservoir, which it may allocate for some future frame. "
+                        "The two numbers after mdb are the size (in bits) used to encode the "
+                        "MDCT coefficients for this frame, followed byt the size of the bit "
+                        "resevoir before encoding this frame.  The maximum frame size and a "
+                        "running average are given in the Stats pull down menu.  A large "
+                        "maximum frame size indicates the bitstream has made use of the bit "
+                        "reservoir. \n\n", -1);
+
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "PCM data (top graph): "
+                        "The PCM data is plotted in black.  The layer3 frame is divided into 2 "
+                        "granules of 576 samples (marked with yellow vertical lines).  In the "
+                        "case of normal, start and stop blocks, the MDCT coefficients for each "
+                        "granule are computed using a 1152 sample window centered over the "
+                        "granule.  In the case of short blocks, the granule is further divided "
+                        "into 3 blocks of 192 samples (also marked with yellow vertical lines)."
+                        "The MDCT coefficients for these blocks are computed using 384 sample "
+                        "windows centered over the 192 sample window.  (This info not available "
+                        "when analyzing .mp3 files.)  For the psycho-acoustic model, a windowed "
+                        "FFT is computed for each granule.  The range of these windows "
+                        "is denoted by the blue and green bars.\n\n", -1);
+
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "PCM re-synthesis data (second graph): "
+                        "Same as the PCM window described above.  The data displayed is the "
+                        "result of encoding and then decoding the original sample. \n\n", -1);
+
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "MDCT windows: "
+                        "Shows the energy in the MDCT spectrum for granule 0 (left window) "
+                        "and granule 1 (right window).  The text also shows the blocktype "
+                        "used, the number of bits used to encode the coefficients and the "
+                        "number of extra bits allocated from the reservoir.  The MDCT pull down "
+                        "window will toggle between the original unquantized MDCT coefficients "
+                        "and the compressed (quantized) coefficients.\n\n", -1);
+
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "FFT window: "
+                        "The gray bars show the energy in the FFT spectrum used by the "
+                        "psycho-acoustic model.  Granule 0 is in the left window, granule 1 in "
+                        "the right window.  The green and blue bars show how much distortion is "
+                        "allowable, as computed by the psycho-acoustic model. The red bars show "
+                        "the actual distortion after encoding.  There is one FFT for each "
+                        "granule, computed with a 1024 Hann window centered over the "
+                        "appropriate granule.  (the range of this 1024 sample window is shown "
+                        "by the blue and green bars in the PCM data window).  The Spectrum pull "
+                        "down window will toggle between showing the energy in equally spaced "
+                        "frequency domain and the scale factor bands used by layer3.  Finally, "
+                        "the perceptual entropy, total energy and number of scalefactor bands "
+                        "with audible distortion is shown.  (This info not available when "
+                        "analyzing .mp3 files.)", -1);
+
+        break;
+    case 1:
+        /* Set the about box information */
+        gtk_window_set_title(GTK_WINDOW(textwindow), "About");
+        gtk_widget_set_usize(box, 350, 260);
+
+        sprintf(text, "LAME version %s \n%s\n\n", get_lame_version(), get_lame_url());
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+
+        sprintf(text, "psycho-acoustic model:  GPSYCHO version %s\n", get_psy_version());
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+
+        sprintf(text, "frame analyzer: MP3x version %s\n\n", get_mp3x_version());
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "decoder:  mpg123/mpglib  .59q  \nMichael Hipp (www.mpg123.de)\n\n", -1);
+
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL,
+                        "Encoder, decoder & psy-models based on ISO\ndemonstration source. ", -1);
+        break;
+
+    case 2:
+        gtk_window_set_title(GTK_WINDOW(textwindow), "Statistics");
+        gtk_widget_set_usize(box, 350, 260);
+        sprintf(text, "frames processed so far: %i \n", Pinfo[0].frameNum + 1);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "granules processed so far: %i \n\n", 4 * (Pinfo[0].frameNum + 1));
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "mean bits/frame (approximate): %i\n", gtkinfo.approxbits);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "mean bits/frame (from LAME): %i\n", 4 * Pinfo[0].mean_bits);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "bitsize of largest frame: %i \n", gtkinfo.maxbits);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "average bits/frame: %3.1f \n\n", gtkinfo.avebits);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "ms_stereo frames: %i \n", gtkinfo.totms);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "i_stereo frames: %i \n", gtkinfo.totis);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "de-emphasis frames: %i \n", gtkinfo.totemph);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "short block granules: %i \n", gtkinfo.totshort);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "mixed block granules: %i \n", gtkinfo.totmix);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        sprintf(text, "preflag granules: %i \n", gtkinfo.totpreflag);
+        gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1);
+        break;
+    }
+
+
+
+    gtk_widget_show(vscrollbar);
+    gtk_widget_show(box);
+    gtk_widget_show(vbox);
+    gtk_widget_show(hbox);
+    gtk_widget_show(button);
+
+    gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(hbox), vscrollbar, FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
+    gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, TRUE, 0);
+    gtk_container_add(GTK_CONTAINER(textwindow), vbox);
+    gtk_widget_show(textwindow);
+
+}
+
+
+
+
+/* #include <strings.h>*/
+
+
+/* This is the GtkItemFactoryEntry structure used to generate new menus.
+   Item 1: The menu path. The letter after the underscore indicates an
+           accelerator key once the menu is open.
+   Item 2: The accelerator key for the entry
+   Item 3: The callback function.
+   Item 4: The callback action.  This changes the parameters with
+           which the function is called.  The default is 0.
+   Item 5: The item type, used to define what kind of an item it is.
+           Here are the possible values:
+
+           NULL               -> "<Item>"
+           ""                 -> "<Item>"
+           "<Title>"          -> create a title item
+           "<Item>"           -> create a simple item
+           "<CheckItem>"      -> create a check item
+           "<ToggleItem>"     -> create a toggle item
+           "<RadioItem>"      -> create a radio item
+           <path>             -> path of a radio item to link against
+           "<Separator>"      -> create a separator
+           "<Branch>"         -> create an item to hold sub items
+           "<LastBranch>"     -> create a right justified branch
+*/
+
+
+#define C(chr)       "<control>" #chr
+#define func(name)   (GtkItemFactoryCallback) (name)
+
+static const GtkItemFactoryEntry menu_items[] = {
+    {"/_File", NULL, NULL, 0, "<Branch>"},
+#if 0
+    {"/File/_New", C(N), func(print_hello), 0, NULL},
+    {"/File/_Open", C(O), func(print_hello), 0, NULL},
+    {"/File/_Save", C(S), func(print_hello), 0, NULL},
+    {"/File/Save _As", NULL, NULL, 0, NULL},
+    {"/File/sep1", NULL, NULL, 0, "<Separator>"},
+    {"/File/Quit", C(Q), func(gtk_main_quit), 0, NULL},
+#endif
+    {"/File/_Quit", C(Q), func(delete_event), 0, NULL},
+
+    {"/_Plotting", NULL, NULL, 0, "<Branch>"},
+    {"/Plotting/_While advancing", NULL, func(spec_option), 5, NULL},
+    {"/Plotting/_After advancing", NULL, func(spec_option), 6, NULL},
+    {"/Plotting/Toggle SFB lines", NULL, func(spec_option), 7, NULL},
+    {"/Plotting/Toggle orig-diff", NULL, func(spec_option), 8, NULL},
+
+    {"/_Channel", NULL, NULL, 0, "<Branch>"},
+    {"/Channel/show _Left", NULL, func(channel_option), 1, NULL},
+    {"/Channel/show _Right", NULL, func(channel_option), 2, NULL},
+    {"/Channel/show _Mid", NULL, func(channel_option), 3, NULL},
+    {"/Channel/show _Side", NULL, func(channel_option), 4, NULL},
+
+    {"/_Spectrum", NULL, NULL, 0, "<Branch>"},
+    {"/Spectrum/_Scalefactor bands", NULL, func(spec_option), 1, NULL},
+    {"/Spectrum/_Wave number", NULL, func(spec_option), 2, NULL},
+
+    {"/_MDCT", NULL, NULL, 0, "<Branch>"},
+    {"/MDCT/_Original", NULL, func(spec_option), 3, NULL},
+    {"/MDCT/_Compressed", NULL, func(spec_option), 4, NULL},
+    {"/MDCT/_Toggle SFB lines", NULL, func(spec_option), 7, NULL},
+
+    {"/_Stats", NULL, NULL, 0, "<Branch>"},
+    {"/Stats/_Show", NULL, func(text_window), 2, NULL},
+
+    {"/_Help", NULL, NULL, 0, "<LastBranch>"},
+    {"/_Help/_Documentation", NULL, func(text_window), 0, NULL},
+    {"/_Help/_About", NULL, func(text_window), 1, NULL},
+};
+
+#undef C
+#undef func
+
+
+static void
+get_main_menu(GtkWidget * windows, GtkWidget ** menubar)
+{
+    unsigned int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
+    GtkItemFactory *item_factory;
+    GtkAccelGroup *accel_group;
+
+    accel_group = gtk_accel_group_new();
+
+    /* This function initializes the item factory.
+       Param 1: The type of menu - can be GTK_TYPE_MENU_BAR, GTK_TYPE_MENU,
+       or GTK_TYPE_OPTION_MENU.
+       Param 2: The path of the menu.
+       Param 3: A pointer to a gtk_accel_group.  The item factory sets up
+       the accelerator table while generating menus.
+     */
+
+    item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group);
+
+    /* This function generates the menu items. Pass the item factory,
+       the number of items in the array, the array itself, and any
+       callback data for the the menu items. */
+    gtk_item_factory_create_items(item_factory, nmenu_items, (GtkItemFactoryEntry *) menu_items,
+                                  NULL);
+
+    /* Attach the new accelerator group to the window. */
+    gtk_accel_group_attach(accel_group, GTK_OBJECT(windows));
+
+    if (menubar)
+        /* Finally, return the actual menu bar created by the item factory. */
+        *menubar = gtk_item_factory_get_widget(item_factory, "<main>");
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+int
+gtkcontrol(lame_global_flags * gfp2, char *inPath)
+{
+    /* GtkWidget is the storage type for widgets */
+    GtkWidget *button;
+    GtkAdjustment *adj;
+    GtkWidget *mbox;         /* main box */
+    GtkWidget *box1;         /* frame control buttons go */
+    GtkWidget *box2;         /* frame counters */
+    GtkWidget *box3;         /* frame header info */
+    GtkWidget *table;        /* table for all the plotting areas */
+    GtkWidget *menubar;
+
+    gint    tableops, graphx, graphy;
+    char    frameinfo[80];
+
+    graphx = 600;       /* minimum allowed size of pixmap */
+    graphy = 95;
+
+    gfp = gfp2;
+    gfc = gfp->internal_flags;
+
+    /* set some global defaults/variables */
+    gtkinfo.filetype = is_mpeg_file_format(input_format) ? 1 : 0;
+    gtkinfo.msflag = 0;
+    gtkinfo.chflag = 0;
+    gtkinfo.kbflag = 0;
+    gtkinfo.flag123 = is_mpeg_file_format(input_format) ? 1 : 0; /* MP3 file=use mpg123 output */
+    gtkinfo.pupdate = 0;
+    gtkinfo.avebits = 0;
+    gtkinfo.maxbits = 0;
+    gtkinfo.approxbits = 0;
+    gtkinfo.totemph = 0;
+    gtkinfo.totms = 0;
+    gtkinfo.totis = 0;
+    gtkinfo.totshort = 0;
+    gtkinfo.totmix = 0;
+    gtkinfo.sfblines = 1;
+    gtkinfo.difference = 0;
+    gtkinfo.totalframes = 0;
+
+    memset((char *) Pinfo, 0, sizeof(Pinfo));
+    pplot = &Pinfo[READ_AHEAD];
+
+    strcpy(frameinfo, "MP3x: ");
+    strncat(frameinfo, inPath, 70);
+
+    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title(GTK_WINDOW(window), frameinfo);
+    gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(delete_event), NULL);
+
+    gtk_signal_connect_object(GTK_OBJECT(window), "key_press_event",
+                              GTK_SIGNAL_FUNC(key_press_event), GTK_OBJECT(window));
+
+    gtk_container_set_border_width(GTK_CONTAINER(window), 0);
+
+
+    mbox = gtk_vbox_new(FALSE, 0);
+
+
+    /* layout of mbox */
+    box1 = gtk_hbox_new(FALSE, 0);
+    box2 = gtk_hbox_new(FALSE, 0);
+    box3 = gtk_hbox_new(FALSE, 0);
+    table = gtk_table_new(5, 2, FALSE);
+    tableops = GTK_FILL | GTK_EXPAND | GTK_SHRINK;
+    get_main_menu(window, &menubar);
+
+    gtk_box_pack_start(GTK_BOX(mbox), menubar, FALSE, TRUE, 0);
+    gtk_box_pack_end(GTK_BOX(mbox), box1, FALSE, TRUE, 0);
+    gtk_box_pack_end(GTK_BOX(mbox), box2, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(mbox), box3, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(mbox), table, TRUE, TRUE, 0);
+    gtk_container_add(GTK_CONTAINER(window), mbox);
+
+
+    /*********************************************************************/
+    /* stuff in box3  frame header info */
+    /*********************************************************************/
+    /*
+       headerbox = gtk_label_new(" ");
+       gtk_label_set_justify(GTK_LABEL(headerbox),GTK_JUSTIFY_LEFT);
+     */
+    headerbox = gtk_text_new(NULL, NULL);
+    gtk_text_set_editable(GTK_TEXT(headerbox), FALSE);
+    gtk_widget_set_usize(headerbox, 200, 20);
+    gtk_widget_show(headerbox);
+    gtk_box_pack_start(GTK_BOX(box3), headerbox, TRUE, TRUE, 0);
+
+
+
+    /*********************************************************************/
+    /* stuff in box2   frame counters  */
+    /*********************************************************************/
+    framecounter = gtk_label_new("");
+    gtk_widget_show(framecounter);
+    gtk_box_pack_start(GTK_BOX(box2), framecounter, FALSE, TRUE, 0);
+
+    adj = (GtkAdjustment *) gtk_adjustment_new(0, 0, (gint) lame_get_totalframes(gfp) - 1, 0, 0, 0);
+    frameprogress = gtk_progress_bar_new_with_adjustment(adj);
+    /* Set the format of the string that can be displayed in the
+     * trough of the progress bar:
+     * %p - percentage
+     * %v - value
+     * %l - lower range value
+     * %u - upper range value */
+    gtk_progress_set_format_string(GTK_PROGRESS(frameprogress), "%p%%");
+    gtk_progress_set_value(GTK_PROGRESS(frameprogress), (gdouble) 0);
+    gtk_progress_set_show_text(GTK_PROGRESS(frameprogress), TRUE);
+    gtk_widget_show(frameprogress);
+    gtk_box_pack_end(GTK_BOX(box2), frameprogress, FALSE, TRUE, 0);
+
+
+
+    /*********************************************************************/
+    /* stuff in box1  buttons along bottom */
+    /*********************************************************************/
+    button = gtk_button_new_with_label("-1");
+    gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "-1");
+    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+    gtk_widget_show(button);
+
+    button = gtk_button_new_with_label("+1");
+    gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "1");
+    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+    gtk_widget_show(button);
+
+    button = gtk_button_new_with_label("+10");
+    gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "10");
+    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+    gtk_widget_show(button);
+
+    button = gtk_button_new_with_label("+100");
+    gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "100");
+    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+    gtk_widget_show(button);
+
+    button = gtk_button_new_with_label("last frame");
+    gtk_signal_connect(GTK_OBJECT(button), "clicked",
+                       GTK_SIGNAL_FUNC(frameadv), (gpointer) "finish");
+    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+    gtk_widget_show(button);
+
+    button = gtk_button_new_with_label("stop/plot");
+    gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(plotclick), NULL);
+    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+    gtk_widget_show(button);
+
+
+    /*********************************************************************/
+    /* stuff in table.  all the plotting windows */
+    /*********************************************************************/
+    pcmbox = gpk_plot_new(graphx, graphy);
+    gtk_table_attach(GTK_TABLE(table), pcmbox, 0, 2, 0, 1, tableops, tableops, 2, 2);
+    gtk_widget_show(pcmbox);
+
+    winbox = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), winbox, 0, 2, 1, 2, tableops, tableops, 2, 2);
+    gtk_widget_show(winbox);
+
+
+    mdctbox[0] = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), mdctbox[0], 0, 1, 2, 3, tableops, tableops, 2, 2);
+    gtk_widget_show(mdctbox[0]);
+
+    mdctbox[1] = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), mdctbox[1], 1, 2, 2, 3, tableops, tableops, 2, 2);
+    gtk_widget_show(mdctbox[1]);
+
+    enerbox[0] = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), enerbox[0], 0, 1, 3, 4, tableops, tableops, 2, 2);
+    gtk_widget_show(enerbox[0]);
+
+    enerbox[1] = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), enerbox[1], 1, 2, 3, 4, tableops, tableops, 2, 2);
+    gtk_widget_show(enerbox[1]);
+
+    sfbbox[0] = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), sfbbox[0], 0, 1, 4, 5, tableops, tableops, 2, 2);
+    gtk_widget_show(sfbbox[0]);
+
+    sfbbox[1] = gpk_plot_new(graphy, graphy);
+    gtk_table_attach(GTK_TABLE(table), sfbbox[1], 1, 2, 4, 5, tableops, tableops, 2, 2);
+    gtk_widget_show(sfbbox[1]);
+
+
+
+
+    gtk_idle_add((GtkFunction) frameadv1, NULL);
+    gtk_widget_show(menubar);
+    gtk_widget_show(box2);
+    gtk_widget_show(box3);
+    gtk_widget_show(table);
+    gtk_widget_show(box1);
+    gtk_widget_show(mbox);
+    gtk_widget_show(window); /* show smallest allowed window */
+
+    /* make window bigger.   */
+    /* now the user will be able to shrink it, if desired */
+    /* gtk_widget_set_usize(mbox,500,500);  */
+    /* gtk_widget_show (window); */ /* show smallest allowed window */
+
+
+
+    idle_keepgoing = 1; /* processing of frames is ON */
+    idle_count_max = READ_AHEAD + 1; /* number of frames to process before plotting */
+    idle_count = 0;     /* pause & plot when idle_count=idle_count_max */
+
+    gtk_main();
+    assert(mp3done);
+    return (0);
+}
diff --git a/frontend/gtkanal.h b/frontend/gtkanal.h
new file mode 100644
index 0000000..0ce210c
--- /dev/null
+++ b/frontend/gtkanal.h
@@ -0,0 +1,25 @@
+/*
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_GTKCONTROL_H
+#define LAME_GTKCONTROL_H
+
+
+int     gtkcontrol(lame_global_flags * gfp2, char *inPath);
+
+#endif
diff --git a/frontend/lame_vc6.dsp b/frontend/lame_vc6.dsp
new file mode 100644
index 0000000..45536d0
--- /dev/null
+++ b/frontend/lame_vc6.dsp
@@ -0,0 +1,188 @@
+# Microsoft Developer Studio Project File - Name="lame" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Console Application" 0x0103

+

+CFG=LAME - WIN32 DEBUG

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "lame_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "lame_vc6.mak" CFG="LAME - WIN32 DEBUG"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "lame - Win32 Release" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE "lame - Win32 Debug" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE "lame - Win32 Release NASM" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "lame - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\frontend"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c

+# ADD CPP /nologo /W3 /O2 /Ob2 /I ".." /I "../mpglib" /I "../libmp3lame" /I "../include" /I "../" /D "NDEBUG" /D "WIN32" /D "_WIN32" /D "_CONSOLE" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "HAVE_CONFIG_H" /YX /FD /c

+# ADD BASE RSC /l 0x40c /d "NDEBUG"

+# ADD RSC /l 0x40c /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\output\Release\lame.exe" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none

+

+!ELSEIF  "$(CFG)" == "lame - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\frontend"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c

+# ADD CPP /nologo /W3 /Gm /ZI /Od /I "../" /I "../mpglib" /I "../libmp3lame" /I "../include" /D "_DEBUG" /D "WIN32" /D "_WIN32" /D "_CONSOLE" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "HAVE_CONFIG_H" /YX /FD /GZ /c

+# ADD BASE RSC /l 0x40c /d "_DEBUG"

+# ADD RSC /l 0x40c /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\output\Debug\lame.exe" /pdbtype:sept /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none

+

+!ELSEIF  "$(CFG)" == "lame - Win32 Release NASM"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "lame___Win32_Release_NASM"

+# PROP BASE Intermediate_Dir "lame___Win32_Release_NASM"

+# PROP BASE Ignore_Export_Lib 0

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release_NASM"

+# PROP Intermediate_Dir "..\obj\Release_NASM\frontend"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /O2 /Ob2 /I ".." /I "../mpglib" /I "../libmp3lame" /I "../include" /I "../" /D "NDEBUG" /D "WIN32" /D "_WIN32" /D "_CONSOLE" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "HAVE_CONFIG_H" /YX /FD /c

+# ADD CPP /nologo /W3 /O2 /Ob2 /I ".." /I "../mpglib" /I "../libmp3lame" /I "../include" /I "../" /D "NDEBUG" /D "WIN32" /D "_WIN32" /D "_CONSOLE" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "HAVE_CONFIG_H" /D "HAVE_NASM" /D "MMX_choose_table" /YX /FD /c

+# ADD BASE RSC /l 0x40c /d "NDEBUG"

+# ADD RSC /l 0x40c /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../output/lame.exe"

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\output\Release_NASM\lame.exe" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none

+

+!ENDIF 

+

+# Begin Target

+

+# Name "lame - Win32 Release"

+# Name "lame - Win32 Debug"

+# Name "lame - Win32 Release NASM"

+# Begin Group "Source Files"

+

+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

+# Begin Source File

+

+SOURCE=.\brhist.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\console.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\get_audio.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\lametime.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\main.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\parse.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\portableio.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\timestatus.c

+# End Source File

+# End Group

+# Begin Group "Header Files"

+

+# PROP Default_Filter "h;hpp;hxx;hm;inl"

+# Begin Source File

+

+SOURCE=.\brhist.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\console.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\get_audio.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\lametime.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\main.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\parse.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\portableio.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\timestatus.h

+# End Source File

+# End Group

+# End Target

+# End Project

diff --git a/frontend/lame_vc8.vcproj b/frontend/lame_vc8.vcproj
new file mode 100644
index 0000000..53bcc80
--- /dev/null
+++ b/frontend/lame_vc8.vcproj
@@ -0,0 +1,550 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="lame_vc8"

+	ProjectGUID="{A5BC73DF-E8BB-45D5-984E-A209170D40BB}"

+	RootNamespace="lame_vc8"

+	Keyword="Win32Proj"

+	TargetFrameworkVersion="131072"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+		<Platform

+			Name="x64"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include;../libmp3lame"

+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_DEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="4"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame.exe"

+				LinkIncremental="1"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../;../include;../libmp3lame"

+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;NDEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame.exe"

+				LinkIncremental="1"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				OptimizeReferences="2"

+				EnableCOMDATFolding="2"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug GTK|Win32"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include;../libmp3lame"

+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_DEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame.exe"

+				LinkIncremental="1"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../;../include;../libmp3lame"

+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;NDEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame.exe"

+				LinkIncremental="1"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				OptimizeReferences="2"

+				EnableCOMDATFolding="2"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug GTK|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include;../libmp3lame"

+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_DEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="../output/lame.exe"

+				LinkIncremental="1"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source"

+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"

+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

+			>

+			<File

+				RelativePath=".\brhist.c"

+				>

+			</File>

+			<File

+				RelativePath=".\console.c"

+				>

+			</File>

+			<File

+				RelativePath=".\get_audio.c"

+				>

+			</File>

+			<File

+				RelativePath=".\lametime.c"

+				>

+			</File>

+			<File

+				RelativePath=".\main.c"

+				>

+			</File>

+			<File

+				RelativePath=".\parse.c"

+				>

+			</File>

+			<File

+				RelativePath=".\portableio.c"

+				>

+			</File>

+			<File

+				RelativePath=".\timestatus.c"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header"

+			Filter="h;hpp;hxx;hm;inl;inc;xsd"

+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"

+			>

+			<File

+				RelativePath=".\brhist.h"

+				>

+			</File>

+			<File

+				RelativePath=".\console.h"

+				>

+			</File>

+			<File

+				RelativePath=".\get_audio.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lametime.h"

+				>

+			</File>

+			<File

+				RelativePath=".\main.h"

+				>

+			</File>

+			<File

+				RelativePath=".\parse.h"

+				>

+			</File>

+			<File

+				RelativePath=".\portableio.h"

+				>

+			</File>

+			<File

+				RelativePath=".\timestatus.h"

+				>

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/frontend/lametime.c b/frontend/lametime.c
new file mode 100644
index 0000000..7cde228
--- /dev/null
+++ b/frontend/lametime.c
@@ -0,0 +1,169 @@
+/*
+ *	Lame time routines source file
+ *
+ *	Copyright (c) 2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: lametime.c,v 1.18.8.1 2009/01/18 15:44:28 robert Exp $ */
+
+/*
+ * name:        GetCPUTime ( void )
+ *
+ * description: returns CPU time used by the process
+ * input:       none
+ * output:      time in seconds
+ * known bugs:  may not work in SMP and RPC
+ * conforming:  ANSI C
+ *
+ * There is some old difficult to read code at the end of this file.
+ * Can someone integrate this into this function (if useful)?
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <time.h>
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#include "lametime.h"
+
+#if !defined(CLOCKS_PER_SEC)
+# warning Your system does not define CLOCKS_PER_SEC, guessing one...
+# define CLOCKS_PER_SEC 1000000
+#endif
+
+
+double
+GetCPUTime(void)
+{
+    clock_t t;
+
+#if defined(_MSC_VER)  ||  defined(__BORLANDC__)
+    t = clock();
+#else
+    t = clock();
+#endif
+    return t / (double) CLOCKS_PER_SEC;
+}
+
+
+/*
+ * name:        GetRealTime ( void )
+ *
+ * description: returns real (human) time elapsed relative to a fixed time (mostly 1970-01-01 00:00:00)
+ * input:       none
+ * output:      time in seconds
+ * known bugs:  bad precision with time()
+ */
+
+#if defined(__unix__)  ||  defined(SVR4)  ||  defined(BSD)
+
+# include <sys/time.h>
+# include <unistd.h>
+
+double
+GetRealTime(void)
+{                       /* conforming:  SVr4, BSD 4.3 */
+    struct timeval t;
+
+    if (0 != gettimeofday(&t, NULL))
+        assert(0);
+    return t.tv_sec + 1.e-6 * t.tv_usec;
+}
+
+#elif defined(WIN16)  ||  defined(WIN32)
+
+# include <stdio.h>
+# include <sys/types.h>
+# include <sys/timeb.h>
+
+double
+GetRealTime(void)
+{                       /* conforming:  Win 95, Win NT */
+    struct timeb t;
+
+    ftime(&t);
+    return t.time + 1.e-3 * t.millitm;
+}
+
+#else
+
+double
+GetRealTime(void)
+{                       /* conforming:  SVr4, SVID, POSIX, X/OPEN, BSD 4.3 */ /* BUT NOT GUARANTEED BY ANSI */
+    time_t  t;
+
+    t = time(NULL);
+    return (double) t;
+}
+
+#endif
+
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+# include <io.h>
+# include <fcntl.h>
+#else
+# include <unistd.h>
+#endif
+
+int
+lame_set_stream_binary_mode(FILE * const fp)
+{
+#if   defined __EMX__
+    _fsetmode(fp, "b");
+#elif defined __BORLANDC__
+    setmode(_fileno(fp), O_BINARY);
+#elif defined __CYGWIN__
+    setmode(fileno(fp), _O_BINARY);
+#elif defined _WIN32
+    _setmode(_fileno(fp), _O_BINARY);
+#else
+    (void) fp;          /* doing nothing here, silencing the compiler only. */
+#endif
+    return 0;
+}
+
+
+#if defined(__riscos__)
+# include <kernel.h>
+# include <sys/swis.h>
+#elif defined(_WIN32)
+# include <sys/types.h>
+# include <sys/stat.h>
+#else
+# include <sys/stat.h>
+#endif
+
+off_t
+lame_get_file_size(const char *const filename)
+{
+    struct stat sb;
+
+    if (0 == stat(filename, &sb))
+        return sb.st_size;
+    return (off_t) - 1;
+}
+
+/* End of lametime.c */
diff --git a/frontend/lametime.h b/frontend/lametime.h
new file mode 100644
index 0000000..cd416b1
--- /dev/null
+++ b/frontend/lametime.h
@@ -0,0 +1,34 @@
+/*
+ *	Lame time routines include file
+ *
+ *	Copyright (c) 2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_LAMETIME_H
+#define LAME_LAMETIME_H
+
+#include <sys/types.h>
+#include "lame.h"
+
+extern double GetCPUTime(void);
+extern double GetRealTime(void);
+
+extern int lame_set_stream_binary_mode(FILE * const fp);
+extern off_t lame_get_file_size(const char *const filename);
+
+#endif /* LAME_LAMETIME_H */
diff --git a/frontend/main.c b/frontend/main.c
new file mode 100644
index 0000000..b8ce403
--- /dev/null
+++ b/frontend/main.c
@@ -0,0 +1,864 @@
+/*
+ *      Command line frontend program
+ *
+ *      Copyright (c) 1999 Mark Taylor
+ *                    2000 Takehiro TOMINAGA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: main.c,v 1.107.2.1 2009/01/18 15:44:28 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef __sun__
+/* woraround for SunOS 4.x, it has SEEK_* defined here */
+#include <unistd.h>
+#endif
+
+#if defined(_WIN32)
+# include <windows.h>
+#endif
+
+
+/*
+ main.c is example code for how to use libmp3lame.a.  To use this library,
+ you only need the library and lame.h.  All other .h files are private
+ to the library.
+*/
+#include "lame.h"
+
+#include "console.h"
+#include "brhist.h"
+#include "parse.h"
+#include "main.h"
+#include "get_audio.h"
+#include "portableio.h"
+#include "timestatus.h"
+
+/* PLL 14/04/2000 */
+#if macintosh
+#include <console.h>
+#endif
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+
+
+/************************************************************************
+*
+* main
+*
+* PURPOSE:  MPEG-1,2 Layer III encoder with GPSYCHO
+* psychoacoustic model.
+*
+************************************************************************/
+
+static int
+parse_args_from_string(lame_global_flags * const gfp, const char *p, char *inPath, char *outPath)
+{                       /* Quick & very Dirty */
+    char   *q;
+    char   *f;
+    char   *r[128];
+    int     c = 0;
+    int     ret;
+
+    if (p == NULL || *p == '\0')
+        return 0;
+
+    f = q = malloc(strlen(p) + 1);
+    strcpy(q, p);
+
+    r[c++] = "lhama";
+    while (1) {
+        r[c++] = q;
+        while (*q != ' ' && *q != '\0')
+            q++;
+        if (*q == '\0')
+            break;
+        *q++ = '\0';
+    }
+    r[c] = NULL;
+
+    ret = parse_args(gfp, c, r, inPath, outPath, NULL, NULL);
+    free(f);
+    return ret;
+}
+
+
+
+
+
+static FILE *
+init_files(lame_global_flags * gf, char *inPath, char *outPath, int *enc_delay, int *enc_padding)
+{
+    FILE   *outf;
+    /* Mostly it is not useful to use the same input and output name.
+       This test is very easy and buggy and don't recognize different names
+       assigning the same file
+     */
+    if (0 != strcmp("-", outPath) && 0 == strcmp(inPath, outPath)) {
+        error_printf("Input file and Output file are the same. Abort.\n");
+        return NULL;
+    }
+
+    /* open the wav/aiff/raw pcm or mp3 input file.  This call will
+     * open the file, try to parse the headers and
+     * set gf.samplerate, gf.num_channels, gf.num_samples.
+     * if you want to do your own file input, skip this call and set
+     * samplerate, num_channels and num_samples yourself.
+     */
+    init_infile(gf, inPath, enc_delay, enc_padding);
+    if ((outf = init_outfile(outPath, lame_get_decode_only(gf))) == NULL) {
+        error_printf("Can't init outfile '%s'\n", outPath);
+        return NULL;
+    }
+
+    return outf;
+}
+
+
+
+
+
+
+/* the simple lame decoder */
+/* After calling lame_init(), lame_init_params() and
+ * init_infile(), call this routine to read the input MP3 file
+ * and output .wav data to the specified file pointer*/
+/* lame_decoder will ignore the first 528 samples, since these samples
+ * represent the mpglib delay (and are all 0).  skip = number of additional
+ * samples to skip, to (for example) compensate for the encoder delay */
+
+int
+lame_decoder(lame_global_flags * gfp, FILE * outf, int skip_start, char *inPath, char *outPath,
+             int *enc_delay, int *enc_padding)
+{
+    short int Buffer[2][1152];
+    int     iread;
+    int     skip_end = 0;
+    double  wavsize;
+    int     i;
+    void    (*WriteFunction) (FILE * fp, char *p, int n);
+    int     tmp_num_channels = lame_get_num_channels(gfp);
+
+
+
+    if (silent < 10)
+        console_printf("\rinput:  %s%s(%g kHz, %i channel%s, ",
+                       strcmp(inPath, "-") ? inPath : "<stdin>",
+                       strlen(inPath) > 26 ? "\n\t" : "  ",
+                       lame_get_in_samplerate(gfp) / 1.e3,
+                       tmp_num_channels, tmp_num_channels != 1 ? "s" : "");
+
+    switch (input_format) {
+    case sf_mp123: /* FIXME: !!! */
+      error_printf("Internal error.  Aborting.");
+      exit(-1);
+
+    case sf_mp3:
+        if (skip_start == 0) {
+            if (*enc_delay > -1 || *enc_padding > -1) {
+                if (*enc_delay > -1)
+                    skip_start = *enc_delay + 528 + 1;
+                if (*enc_padding > -1)
+                    skip_end = *enc_padding - (528 + 1);
+            }
+            else
+                skip_start = lame_get_encoder_delay(gfp) + 528 + 1;
+        }
+        else {
+            /* user specified a value of skip. just add for decoder */
+            skip_start += 528 + 1; /* mp3 decoder has a 528 sample delay, plus user supplied "skip" */
+        }
+
+        if (silent < 10)
+            console_printf("MPEG-%u%s Layer %s", 2 - lame_get_version(gfp),
+                           lame_get_out_samplerate(gfp) < 16000 ? ".5" : "", "III");
+        break;
+    case sf_mp2:
+        skip_start += 240 + 1;
+        if (silent < 10)
+            console_printf("MPEG-%u%s Layer %s", 2 - lame_get_version(gfp),
+                           lame_get_out_samplerate(gfp) < 16000 ? ".5" : "", "II");
+        break;
+    case sf_mp1:
+        skip_start += 240 + 1;
+        if (silent < 10)
+            console_printf("MPEG-%u%s Layer %s", 2 - lame_get_version(gfp),
+                           lame_get_out_samplerate(gfp) < 16000 ? ".5" : "", "I");
+        break;
+    case sf_raw:
+        if (silent < 10)
+            console_printf("raw PCM data");
+        mp3input_data.nsamp = lame_get_num_samples(gfp);
+        mp3input_data.framesize = 1152;
+        skip_start = 0; /* other formats have no delay */ /* is += 0 not better ??? */
+        break;
+    case sf_wave:
+        if (silent < 10)
+            console_printf("Microsoft WAVE");
+        mp3input_data.nsamp = lame_get_num_samples(gfp);
+        mp3input_data.framesize = 1152;
+        skip_start = 0; /* other formats have no delay */ /* is += 0 not better ??? */
+        break;
+    case sf_aiff:
+        if (silent < 10)
+            console_printf("SGI/Apple AIFF");
+        mp3input_data.nsamp = lame_get_num_samples(gfp);
+        mp3input_data.framesize = 1152;
+        skip_start = 0; /* other formats have no delay */ /* is += 0 not better ??? */
+        break;
+    default:
+        if (silent < 10)
+            console_printf("unknown");
+        mp3input_data.nsamp = lame_get_num_samples(gfp);
+        mp3input_data.framesize = 1152;
+        skip_start = 0; /* other formats have no delay */ /* is += 0 not better ??? */
+        assert(0);
+        break;
+    }
+
+    if (silent < 10) {
+        console_printf(")\noutput: %s%s(16 bit, Microsoft WAVE)\n",
+                       strcmp(outPath, "-") ? outPath : "<stdout>",
+                       strlen(outPath) > 45 ? "\n\t" : "  ");
+
+        if (skip_start > 0)
+            console_printf("skipping initial %i samples (encoder+decoder delay)\n", skip_start);
+        if (skip_end > 0)
+            console_printf("skipping final %i samples (encoder padding-decoder delay)\n", skip_end);
+    }
+
+    if (0 == disable_wav_header)
+        WriteWaveHeader(outf, 0x7FFFFFFF, lame_get_in_samplerate(gfp), tmp_num_channels, 16);
+    /* unknown size, so write maximum 32 bit signed value */
+
+    wavsize = -(skip_start + skip_end);
+    WriteFunction = swapbytes ? WriteBytesSwapped : WriteBytes;
+    mp3input_data.totalframes = mp3input_data.nsamp / mp3input_data.framesize;
+
+    assert(tmp_num_channels >= 1 && tmp_num_channels <= 2);
+
+    do {
+        iread = get_audio16(gfp, Buffer); /* read in 'iread' samples */
+        if (iread >= 0) {
+            mp3input_data.framenum += iread / mp3input_data.framesize;
+            wavsize += iread;
+
+            if (silent <= 0) {
+                decoder_progress(&mp3input_data);
+                console_flush();
+            }
+
+            skip_start -= (i = skip_start < iread ? skip_start : iread); /* 'i' samples are to skip in this frame */
+
+            if (skip_end > 1152 && mp3input_data.framenum + 2 > mp3input_data.totalframes) {
+                iread -= (skip_end - 1152);
+                skip_end = 1152;
+            }
+            else if (mp3input_data.framenum == mp3input_data.totalframes && iread != 0)
+                iread -= skip_end;
+
+            for (; i < iread; i++) {
+                if (disable_wav_header) {
+                    WriteFunction(outf, (char *) &Buffer[0][i], sizeof(short));
+                    if (tmp_num_channels == 2)
+                        WriteFunction(outf, (char *) &Buffer[1][i], sizeof(short));
+                }
+                else {
+                    Write16BitsLowHigh(outf, Buffer[0][i]);
+                    if (tmp_num_channels == 2)
+                        Write16BitsLowHigh(outf, Buffer[1][i]);
+                }
+            }
+            if (flush_write == 1) {
+                fflush(outf);
+            }
+        }
+    } while (iread > 0);
+
+    i = (16 / 8) * tmp_num_channels;
+    assert(i > 0);
+    if (wavsize <= 0) {
+        if (silent < 10)
+            error_printf("WAVE file contains 0 PCM samples\n");
+        wavsize = 0;
+    }
+    else if (wavsize > 0xFFFFFFD0 / i) {
+        if (silent < 10)
+            error_printf("Very huge WAVE file, can't set filesize accordingly\n");
+        wavsize = 0xFFFFFFD0;
+    }
+    else {
+        wavsize *= i;
+    }
+
+    /* if outf is seekable, rewind and adjust length */
+    if (!disable_wav_header && strcmp("-", outPath)
+	&& !fseek(outf, 0l, SEEK_SET))
+	WriteWaveHeader(outf, (int) wavsize, lame_get_in_samplerate(gfp),
+			tmp_num_channels, 16);
+    fclose(outf);
+
+    if (silent <= 0)
+        decoder_progress_finish();
+    return 0;
+}
+
+
+
+static void
+print_lame_tag_leading_info(lame_global_flags * gf)
+{
+    if (lame_get_bWriteVbrTag(gf))
+        console_printf("Writing LAME Tag...");
+}
+
+static void
+print_trailing_info(lame_global_flags * gf)
+{
+    if (lame_get_bWriteVbrTag(gf))
+        console_printf("done\n");
+
+    if (lame_get_findReplayGain(gf)) {
+        int     RadioGain = lame_get_RadioGain(gf);
+        console_printf("ReplayGain: %s%.1fdB\n", RadioGain > 0 ? "+" : "",
+                       ((float) RadioGain) / 10.0);
+        if (RadioGain > 0x1FE || RadioGain < -0x1FE)
+            error_printf
+                    ("WARNING: ReplayGain exceeds the -51dB to +51dB range. Such a result is too\n"
+                    "         high to be stored in the header.\n");
+    }
+
+    /* if (the user requested printing info about clipping) and (decoding
+    on the fly has actually been performed) */
+    if (print_clipping_info && lame_get_decode_on_the_fly(gf)) {
+        float   noclipGainChange = (float) lame_get_noclipGainChange(gf) / 10.0f;
+        float   noclipScale = lame_get_noclipScale(gf);
+
+        if (noclipGainChange > 0.0) { /* clipping occurs */
+            console_printf
+                    ("WARNING: clipping occurs at the current gain. Set your decoder to decrease\n"
+                    "         the  gain  by  at least %.1fdB or encode again ", noclipGainChange);
+
+            /* advice the user on the scale factor */
+            if (noclipScale > 0) {
+                console_printf("using  --scale %.2f\n", noclipScale);
+                console_printf("         or less (the value under --scale is approximate).\n");
+            }
+            else {
+                /* the user specified his own scale factor. We could suggest
+                * the scale factor of (32767.0/gfp->PeakSample)*(gfp->scale)
+                * but it's usually very inaccurate. So we'd rather advice him to
+                * disable scaling first and see our suggestion on the scale factor then. */
+                console_printf("using --scale <arg>\n"
+                        "         (For   a   suggestion  on  the  optimal  value  of  <arg>  encode\n"
+                        "         with  --scale 1  first)\n");
+            }
+
+        }
+        else {          /* no clipping */
+            if (noclipGainChange > -0.1)
+                console_printf
+                        ("\nThe waveform does not clip and is less than 0.1dB away from full scale.\n");
+            else
+                console_printf
+                        ("\nThe waveform does not clip and is at least %.1fdB away from full scale.\n",
+                         -noclipGainChange);
+        }
+    }
+
+}
+
+
+
+
+static int
+write_xing_frame(lame_global_flags * gf, FILE * outf)
+{
+    unsigned char mp3buffer[LAME_MAXMP3BUFFER];
+    size_t  imp3, owrite;
+    
+    imp3 = lame_get_lametag_frame(gf, mp3buffer, sizeof(mp3buffer));
+    if (imp3 > sizeof(mp3buffer)) {
+        error_printf("Error writing LAME-tag frame: buffer too small: buffer size=%d  frame size=%d\n"
+                    , sizeof(mp3buffer)
+                    , imp3
+                    );
+        return -1;
+    }
+    if (imp3 <= 0) {
+        return 0;
+    }
+    owrite = (int) fwrite(mp3buffer, 1, imp3, outf);
+    if (owrite != imp3) {
+        error_printf("Error writing LAME-tag \n");
+        return -1;
+    }
+    if (flush_write == 1) {
+        fflush(outf);
+    }
+    return imp3;
+}
+
+
+
+static int
+lame_encoder(lame_global_flags * gf, FILE * outf, int nogap, char *inPath, char *outPath)
+{
+    unsigned char mp3buffer[LAME_MAXMP3BUFFER];
+    int     Buffer[2][1152];
+    int     iread, imp3, owrite, id3v2_size;
+
+    encoder_progress_begin(gf, inPath, outPath);
+
+    imp3 = lame_get_id3v2_tag(gf, mp3buffer, sizeof(mp3buffer));
+    if ((size_t)imp3 > sizeof(mp3buffer)) {
+        encoder_progress_end(gf);
+        error_printf("Error writing ID3v2 tag: buffer too small: buffer size=%d  ID3v2 size=%d\n"
+                , sizeof(mp3buffer)
+                , imp3
+                    );
+        return 1;
+    }
+    owrite = (int) fwrite(mp3buffer, 1, imp3, outf);
+    if (owrite != imp3) {
+        encoder_progress_end(gf);
+        error_printf("Error writing ID3v2 tag \n");
+        return 1;
+    }
+    if (flush_write == 1) {
+        fflush(outf);
+    }    
+    id3v2_size = imp3;
+    
+    /* encode until we hit eof */
+    do {
+        /* read in 'iread' samples */
+        iread = get_audio(gf, Buffer);
+
+        if (iread >= 0) {
+            encoder_progress(gf);
+
+            /* encode */
+            imp3 = lame_encode_buffer_int(gf, Buffer[0], Buffer[1], iread,
+                                          mp3buffer, sizeof(mp3buffer));
+
+            /* was our output buffer big enough? */
+            if (imp3 < 0) {
+                if (imp3 == -1)
+                    error_printf("mp3 buffer is not big enough... \n");
+                else
+                    error_printf("mp3 internal error:  error code=%i\n", imp3);
+                return 1;
+            }
+            owrite = (int) fwrite(mp3buffer, 1, imp3, outf);
+            if (owrite != imp3) {
+                error_printf("Error writing mp3 output \n");
+                return 1;
+            }
+        }
+        if (flush_write == 1) {
+            fflush(outf);
+        }
+    } while (iread > 0);
+
+    if (nogap)
+        imp3 = lame_encode_flush_nogap(gf, mp3buffer, sizeof(mp3buffer)); /* may return one more mp3 frame */
+    else
+        imp3 = lame_encode_flush(gf, mp3buffer, sizeof(mp3buffer)); /* may return one more mp3 frame */
+
+    if (imp3 < 0) {
+        if (imp3 == -1)
+            error_printf("mp3 buffer is not big enough... \n");
+        else
+            error_printf("mp3 internal error:  error code=%i\n", imp3);
+        return 1;
+
+    }
+
+    encoder_progress_end(gf);
+    
+    owrite = (int) fwrite(mp3buffer, 1, imp3, outf);
+    if (owrite != imp3) {
+        error_printf("Error writing mp3 output \n");
+        return 1;
+    }
+    if (flush_write == 1) {
+        fflush(outf);
+    }
+
+    
+    imp3 = lame_get_id3v1_tag(gf, mp3buffer, sizeof(mp3buffer));
+    if ((size_t)imp3 > sizeof(mp3buffer)) {
+        error_printf("Error writing ID3v1 tag: buffer too small: buffer size=%d  ID3v1 size=%d\n"
+                , sizeof(mp3buffer)
+                , imp3
+                    );
+    }
+    else {
+        if (imp3 > 0) {
+            owrite = (int) fwrite(mp3buffer, 1, imp3, outf);
+            if (owrite != imp3) {
+                error_printf("Error writing ID3v1 tag \n");
+                return 1;
+            }
+            if (flush_write == 1) {
+                fflush(outf);
+            }
+        }
+    }
+    
+    if (silent <= 0) {
+        print_lame_tag_leading_info(gf);
+    }
+    if (fseek(outf, id3v2_size, SEEK_SET) != 0) {
+        error_printf("fatal error: can't update LAME-tag frame!\n");                    
+    }
+    else {
+        write_xing_frame(gf, outf);
+    }
+
+    if (silent <= 0) {
+        print_trailing_info(gf);
+    }    
+    return 0;
+}
+
+
+
+
+
+
+static void
+brhist_init_package(lame_global_flags * gf)
+{
+#ifdef BRHIST
+    if (brhist) {
+        if (brhist_init(gf, lame_get_VBR_min_bitrate_kbps(gf), lame_get_VBR_max_bitrate_kbps(gf))) {
+            /* fail to initialize */
+            brhist = 0;
+        }
+    }
+    else {
+        brhist_init(gf, 128, 128); /* Dirty hack */
+    }
+#endif
+}
+
+
+
+static
+    void
+parse_nogap_filenames(int nogapout, char *inPath, char *outPath, char *outdir)
+{
+
+    char   *slasher;
+    size_t  n;
+
+    strcpy(outPath, outdir);
+    if (!nogapout) {
+        strncpy(outPath, inPath, PATH_MAX + 1 - 4);
+        n = strlen(outPath);
+        /* nuke old extension, if one  */
+        if (outPath[n - 3] == 'w'
+            && outPath[n - 2] == 'a' && outPath[n - 1] == 'v' && outPath[n - 4] == '.') {
+            outPath[n - 3] = 'm';
+            outPath[n - 2] = 'p';
+            outPath[n - 1] = '3';
+        }
+        else {
+            outPath[n + 0] = '.';
+            outPath[n + 1] = 'm';
+            outPath[n + 2] = 'p';
+            outPath[n + 3] = '3';
+            outPath[n + 4] = 0;
+        }
+    }
+    else {
+        slasher = inPath;
+        slasher += PATH_MAX + 1 - 4;
+
+        /* backseek to last dir delemiter */
+        while (*slasher != '/' && *slasher != '\\' && slasher != inPath && *slasher != ':') {
+            slasher--;
+        }
+
+        /* skip one foward if needed */
+        if (slasher != inPath
+            && (outPath[strlen(outPath) - 1] == '/'
+                || outPath[strlen(outPath) - 1] == '\\' || outPath[strlen(outPath) - 1] == ':'))
+            slasher++;
+        else if (slasher == inPath
+                 && (outPath[strlen(outPath) - 1] != '/'
+                     &&
+                     outPath[strlen(outPath) - 1] != '\\' && outPath[strlen(outPath) - 1] != ':'))
+#ifdef _WIN32
+            strcat(outPath, "\\");
+#elif __OS2__
+            strcat(outPath, "\\");
+#else
+            strcat(outPath, "/");
+#endif
+
+        strncat(outPath, slasher, PATH_MAX + 1 - 4);
+        n = strlen(outPath);
+        /* nuke old extension  */
+        if (outPath[n - 3] == 'w'
+            && outPath[n - 2] == 'a' && outPath[n - 1] == 'v' && outPath[n - 4] == '.') {
+            outPath[n - 3] = 'm';
+            outPath[n - 2] = 'p';
+            outPath[n - 1] = '3';
+        }
+        else {
+            outPath[n + 0] = '.';
+            outPath[n + 1] = 'm';
+            outPath[n + 2] = 'p';
+            outPath[n + 3] = '3';
+            outPath[n + 4] = 0;
+        }
+    }
+}
+
+
+
+
+/***********************************************************************
+*
+*  Message Output
+*
+***********************************************************************/
+
+
+int
+main(int argc, char **argv)
+{
+    int     ret;
+    lame_global_flags *gf;
+    char    outPath[PATH_MAX + 1];
+    char    nogapdir[PATH_MAX + 1];
+    char    inPath[PATH_MAX + 1];
+
+    /* add variables for encoder delay/padding */
+    int     enc_delay = -1;
+    int     enc_padding = -1;
+
+    /* support for "nogap" encoding of up to 200 .wav files */
+#define MAX_NOGAP 200
+    int     nogapout = 0;
+    int     max_nogap = MAX_NOGAP;
+    char    nogap_inPath_[MAX_NOGAP][PATH_MAX+1];
+    char*   nogap_inPath[MAX_NOGAP];
+
+    int     i;
+    FILE   *outf;
+
+#if macintosh
+    argc = ccommand(&argv);
+#endif
+#if 0
+    /* rh 061207
+       the following fix seems to be a workaround for a problem in the
+       parent process calling LAME. It would be better to fix the broken
+       application => code disabled.
+     */
+#if defined(_WIN32)
+    /* set affinity back to all CPUs.  Fix for EAC/lame on SMP systems from
+       "Todd Richmond" <todd.richmond@openwave.com> */
+    typedef BOOL(WINAPI * SPAMFunc) (HANDLE, DWORD_PTR);
+    SPAMFunc func;
+    SYSTEM_INFO si;
+
+    if ((func = (SPAMFunc) GetProcAddress(GetModuleHandleW(L"KERNEL32.DLL"),
+                                          "SetProcessAffinityMask")) != NULL) {
+        GetSystemInfo(&si);
+        func(GetCurrentProcess(), si.dwActiveProcessorMask);
+    }
+#endif
+#endif
+
+#ifdef __EMX__
+    /* This gives wildcard expansion on Non-POSIX shells with OS/2 */
+    _wildcard(&argc, &argv);
+#endif
+
+    memset(nogap_inPath_, 0, sizeof(nogap_inPath_));
+    for (i = 0; i < MAX_NOGAP; ++i) {
+        nogap_inPath[i] = &nogap_inPath_[i][0];
+    }
+
+    memset(inPath, 0, sizeof(inPath));
+
+    frontend_open_console();
+
+    /* initialize libmp3lame */
+    input_format = sf_unknown;
+    if (NULL == (gf = lame_init())) {
+        error_printf("fatal error during initialization\n");
+        frontend_close_console();
+        return 1;
+    }
+    lame_set_errorf(gf, &frontend_errorf);
+    lame_set_debugf(gf, &frontend_debugf);
+    lame_set_msgf(gf, &frontend_msgf);
+    if (argc <= 1) {
+        usage(stderr, argv[0]); /* no command-line args, print usage, exit  */
+        lame_close(gf);
+        frontend_close_console();
+        return 1;
+    }
+
+    /* parse the command line arguments, setting various flags in the
+     * struct 'gf'.  If you want to parse your own arguments,
+     * or call libmp3lame from a program which uses a GUI to set arguments,
+     * skip this call and set the values of interest in the gf struct.
+     * (see the file API and lame.h for documentation about these parameters)
+     */
+    parse_args_from_string(gf, getenv("LAMEOPT"), inPath, outPath);
+    ret = parse_args(gf, argc, argv, inPath, outPath, nogap_inPath, &max_nogap);
+    if (ret < 0) {
+        lame_close(gf);
+        frontend_close_console();
+        return ret == -2 ? 0 : 1;
+    }
+    if (update_interval < 0.)
+        update_interval = 2.;
+
+    if (outPath[0] != '\0' && max_nogap > 0) {
+        strncpy(nogapdir, outPath, PATH_MAX + 1);
+        nogapout = 1;
+    }
+
+    /* initialize input file.  This also sets samplerate and as much
+       other data on the input file as available in the headers */
+    if (max_nogap > 0) {
+        /* for nogap encoding of multiple input files, it is not possible to
+         * specify the output file name, only an optional output directory. */
+        parse_nogap_filenames(nogapout, nogap_inPath[0], outPath, nogapdir);
+        outf = init_files(gf, nogap_inPath[0], outPath, &enc_delay, &enc_padding);
+    }
+    else {
+        outf = init_files(gf, inPath, outPath, &enc_delay, &enc_padding);
+    }
+    if (outf == NULL) {
+        lame_close(gf);
+        frontend_close_console();
+        return -1;
+    }
+    /* turn off automatic writing of ID3 tag data into mp3 stream 
+     * we have to call it before 'lame_init_params', because that
+     * function would spit out ID3v2 tag data.
+     */
+    lame_set_write_id3tag_automatic(gf, 0);
+
+    /* Now that all the options are set, lame needs to analyze them and
+     * set some more internal options and check for problems
+     */
+    i = lame_init_params(gf);
+    if (i < 0) {
+        if (i == -1) {
+            display_bitrates(stderr);
+        }
+        error_printf("fatal error during initialization\n");
+        lame_close(gf);
+        frontend_close_console();
+        return i;
+    }
+
+    if (silent > 0) {
+        brhist = 0;     /* turn off VBR histogram */
+    }
+
+
+    if (lame_get_decode_only(gf)) {
+        /* decode an mp3 file to a .wav */
+        if (mp3_delay_set)
+            lame_decoder(gf, outf, mp3_delay, inPath, outPath, &enc_delay, &enc_padding);
+        else
+            lame_decoder(gf, outf, 0, inPath, outPath, &enc_delay, &enc_padding);
+
+    }
+    else {
+        if (max_nogap > 0) {
+            /*
+             * encode multiple input files using nogap option
+             */
+            for (i = 0; i < max_nogap; ++i) {
+                int     use_flush_nogap = (i != (max_nogap - 1));
+                if (i > 0) {
+                    parse_nogap_filenames(nogapout, nogap_inPath[i], outPath, nogapdir);
+                    /* note: if init_files changes anything, like
+                       samplerate, num_channels, etc, we are screwed */
+                    outf = init_files(gf, nogap_inPath[i], outPath, &enc_delay, &enc_padding);
+                    /* reinitialize bitstream for next encoding.  this is normally done
+                     * by lame_init_params(), but we cannot call that routine twice */
+                    lame_init_bitstream(gf);
+                }
+                brhist_init_package(gf);
+                lame_set_nogap_total(gf, max_nogap);
+                lame_set_nogap_currentindex(gf, i);
+                
+                ret = lame_encoder(gf, outf, use_flush_nogap, nogap_inPath[i], outPath);
+
+                fclose(outf); /* close the output file */
+                close_infile(); /* close the input file */
+
+            }
+        }
+        else {
+            /*
+             * encode a single input file
+             */
+            brhist_init_package(gf);
+            
+            ret = lame_encoder(gf, outf, 0, inPath, outPath);
+
+            fclose(outf); /* close the output file */
+            close_infile(); /* close the input file */
+        }
+    }
+    lame_close(gf);
+    frontend_close_console();
+    return ret;
+}
diff --git a/frontend/main.h b/frontend/main.h
new file mode 100644
index 0000000..f7186a9
--- /dev/null
+++ b/frontend/main.h
@@ -0,0 +1,58 @@
+/*
+ *	Command line frontend program
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *                    2000 Takehiro TOMIANGA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#include "get_audio.h"
+
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+
+/* GLOBAL VARIABLES used by parse.c and main.c.  
+   instantiated in parce.c.  ugly, ugly */
+extern sound_file_format input_format;
+extern int swapbytes;        /* force byte swapping   default=0 */
+extern int silent;
+extern int brhist;
+
+extern int mp3_delay;        /* for decoder only */
+extern int mp3_delay_set;    /* for decoder only */
+extern float update_interval; /* to use Frank's time status display */
+extern int disable_wav_header; /* for decoder only */
+extern mp3data_struct mp3input_data; /* used by MP3 */
+extern int print_clipping_info; /* print info whether waveform clips */
+extern int in_signed;
+extern int in_unsigned;
+extern int in_bitwidth;
+extern int flush_write;
+
+#define         Min(A, B)       ((A) < (B) ? (A) : (B))
+#define         Max(A, B)       ((A) > (B) ? (A) : (B))
+
+
+enum ByteOrder { ByteOrderLittleEndian, ByteOrderBigEndian };
+extern enum ByteOrder in_endian;
diff --git a/frontend/mp3rtp.c b/frontend/mp3rtp.c
new file mode 100644
index 0000000..a755f4c
--- /dev/null
+++ b/frontend/mp3rtp.c
@@ -0,0 +1,278 @@
+/* $Id: mp3rtp.c,v 1.25.8.1 2008/08/05 14:16:06 robert Exp $ */
+
+/* Still under work ..., need a client for test, where can I get one? */
+
+/* 
+ *  experimental translation:
+ *
+ *  gcc -I..\include -I..\libmp3lame -o mp3rtp mp3rtp.c ../libmp3lame/libmp3lame.a lametime.c get_audio.c portableio.c ieeefloat.c timestatus.c parse.c rtp.c -lm
+ *
+ *  wavrec -t 14400 -s 44100 -S /proc/self/fd/1 | ./mp3rtp 10.1.1.42 -V2 -b128 -B256 - my_mp3file.mp3
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#include <time.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "lame.h"
+#include "main.h"
+#include "parse.h"
+#include "lametime.h"
+#include "timestatus.h"
+#include "get_audio.h"
+#include "rtp.h"
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/*
+ * Encode (via LAME) to mp3 with RTP streaming of the output.
+ *
+ * Author: Felix von Leitner <leitner@vim.org>
+ *
+ *   mp3rtp ip[:port[:ttl]] [lame encoding options] infile outfile
+ *
+ * examples:
+ *   arecord -b 16 -s 22050 -w | ./mp3rtp 224.17.23.42:5004:2 -b 56 - /dev/null
+ *   arecord -b 16 -s 44100 -w | ./mp3rtp 10.1.1.42 -V2 -b128 -B256 - my_mp3file.mp3
+ *
+ */
+
+struct rtpheader RTPheader;
+struct sockaddr_in rtpsi;
+int     rtpsocket;
+
+void
+rtp_output(const char *mp3buffer, const int mp3size)
+{
+    sendrtp(rtpsocket, &rtpsi, &RTPheader, mp3buffer, mp3size);
+    RTPheader.timestamp += 5;
+    RTPheader.b.sequence++;
+}
+
+#if 0
+struct rtpheader RTPheader;
+SOCKET  rtpsocket;
+
+void
+rtp_output(char *mp3buffer, int mp3size)
+{
+    rtp_send(rtpsocket, &RTPheader, mp3buffer, mp3size);
+    RTPheader.timestamp += 5;
+    RTPheader.b.sequence++;
+}
+#endif
+
+
+
+
+static unsigned int
+maxvalue(int Buffer[2][1152])
+{
+    unsigned int max = 0;
+    int     i;
+
+    for (i = 0; i < 1152; i++) {
+        if (abs(Buffer[0][i]) > max)
+            max = abs(Buffer[0][i]);
+        if (abs(Buffer[1][i]) > max)
+            max = abs(Buffer[1][i]);
+    }
+    return max >> 16;
+}
+
+static void
+levelmessage(unsigned int maxv)
+{
+    char    buff[] = "|  .  |  .  |  .  |  .  |  .  |  .  |  .  |  .  |  .  |  .  |  \r";
+    static unsigned int max = 0;
+    static unsigned int tmp = 0;
+
+    buff[tmp] = '+';
+    tmp = (maxv * 61 + 16384) / (32767 + 16384 / 61);
+    if (tmp > sizeof(buff) - 2)
+        tmp = sizeof(buff) - 2;
+    if (max < tmp)
+        max = tmp;
+    buff[max] = 'x';
+    buff[tmp] = '#';
+    console_printf(buff);
+    console_flush();
+}
+
+
+/************************************************************************
+*
+* main
+*
+* PURPOSE:  MPEG-1,2 Layer III encoder with GPSYCHO 
+* psychoacoustic model.
+*
+************************************************************************/
+
+int
+main(int argc, char **argv)
+{
+    unsigned char mp3buffer[LAME_MAXMP3BUFFER];
+    char    inPath[PATH_MAX + 1];
+    char    outPath[PATH_MAX + 1];
+    int     Buffer[2][1152];
+
+    lame_global_flags *gf;
+
+    int     ret;
+    int     wavsamples;
+    int     mp3bytes;
+    FILE   *outf;
+
+    char    ip[16];
+    unsigned port = 5004;
+    unsigned ttl = 2;
+    char    dummy;
+
+    int     enc_delay = -1;
+    int     enc_padding = -1;
+
+    frontend_open_console();
+    if (argc <= 2) {
+        console_printf("Encode (via LAME) to mp3 with RTP streaming of the output\n"
+                       "\n"
+                       "    mp3rtp ip[:port[:ttl]] [lame encoding options] infile outfile\n"
+                       "\n"
+                       "    examples:\n"
+                       "      arecord -b 16 -s 22050 -w | ./mp3rtp 224.17.23.42:5004:2 -b 56 - /dev/null\n"
+                       "      arecord -b 16 -s 44100 -w | ./mp3rtp 10.1.1.42 -V2 -b128 -B256 - my_mp3file.mp3\n"
+                       "\n");
+        frontend_close_console();
+        return 1;
+    }
+
+    switch (sscanf(argv[1], "%11[.0-9]:%u:%u%c", ip, &port, &ttl, &dummy)) {
+    case 1:
+    case 2:
+    case 3:
+        break;
+    default:
+        error_printf("Illegal destination selector '%s', must be ip[:port[:ttl]]\n", argv[1]);
+        frontend_close_console();
+        return -1;
+    }
+
+    rtpsocket = makesocket(ip, port, ttl, &rtpsi);
+    srand(getpid() ^ time(NULL));
+    initrtp(&RTPheader);
+
+    /* initialize encoder */
+    gf = lame_init();
+    if (NULL == gf) {
+        error_printf("fatal error during initialization\n");
+        frontend_close_console();
+        return 1;
+    }
+    lame_set_errorf(gf, &frontend_errorf);
+    lame_set_debugf(gf, &frontend_debugf);
+    lame_set_msgf(gf, &frontend_msgf);
+
+    /* Remove the argumets that are rtp related, and then 
+     * parse the command line arguments, setting various flags in the
+     * struct pointed to by 'gf'.  If you want to parse your own arguments,
+     * or call libmp3lame from a program which uses a GUI to set arguments,
+     * skip this call and set the values of interest in the gf struct.  
+     * (see lame.h for documentation about these parameters)
+     */
+
+    argv[1] = argv[0];
+    parse_args(gf, argc - 1, argv + 1, inPath, outPath, NULL, NULL);
+
+    /* open the output file.  Filename parsed into gf.inPath */
+    if (0 == strcmp(outPath, "-")) {
+        lame_set_stream_binary_mode(outf = stdout);
+    }
+    else {
+        if ((outf = fopen(outPath, "wb+")) == NULL) {
+            error_printf("Could not create \"%s\".\n", outPath);
+            frontend_close_console();
+            return 1;
+        }
+    }
+
+
+    /* open the wav/aiff/raw pcm or mp3 input file.  This call will
+     * open the file with name gf.inFile, try to parse the headers and
+     * set gf.samplerate, gf.num_channels, gf.num_samples.
+     * if you want to do your own file input, skip this call and set
+     * these values yourself.  
+     */
+    init_infile(gf, inPath, &enc_delay, &enc_padding);
+
+
+    /* Now that all the options are set, lame needs to analyze them and
+     * set some more options 
+     */
+    ret = lame_init_params(gf);
+    if (ret < 0) {
+        if (ret == -1)
+            display_bitrates(stderr);
+        error_printf("fatal error during initialization\n");
+        frontend_close_console();
+        return -1;
+    }
+
+    lame_print_config(gf); /* print useful information about options being used */
+
+    if (update_interval < 0.)
+        update_interval = 2.;
+
+    /* encode until we hit EOF */
+    while ((wavsamples = get_audio(gf, Buffer)) > 0) { /* read in 'wavsamples' samples */
+        levelmessage(maxvalue(Buffer));
+        mp3bytes = lame_encode_buffer_int(gf, /* encode the frame */
+                                          Buffer[0], Buffer[1], wavsamples,
+                                          mp3buffer, sizeof(mp3buffer));
+
+        rtp_output(mp3buffer, mp3bytes); /* write MP3 output to RTP port */
+        fwrite(mp3buffer, 1, mp3bytes, outf); /* write the MP3 output to file */
+    }
+
+    mp3bytes = lame_encode_flush(gf, /* may return one or more mp3 frame */
+                                 mp3buffer, sizeof(mp3buffer));
+    rtp_output(mp3buffer, mp3bytes); /* write MP3 output to RTP port */
+    fwrite(mp3buffer, 1, mp3bytes, outf); /* write the MP3 output to file */
+
+    lame_mp3_tags_fid(gf, outf); /* add VBR tags to mp3 file */
+
+    lame_close(gf);
+    fclose(outf);
+    close_infile();     /* close the sound input file */
+    frontend_close_console();
+    return 0;
+}
+
+/* end of mp3rtp.c */
diff --git a/frontend/mp3x.c b/frontend/mp3x.c
new file mode 100644
index 0000000..d849ef3
--- /dev/null
+++ b/frontend/mp3x.c
@@ -0,0 +1,80 @@
+/* $Id: mp3x.c,v 1.25 2008/03/09 17:13:23 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "lame-analysis.h"
+#include <gtk/gtk.h>
+#include "parse.h"
+#include "get_audio.h"
+#include "gtkanal.h"
+#include "lametime.h"
+
+#include "main.h"
+#include "console.h"
+
+
+
+
+
+/************************************************************************
+*
+* main
+*
+* PURPOSE:  MPEG-1,2 Layer III encoder with GPSYCHO
+* psychoacoustic model.
+*
+************************************************************************/
+int
+main(int argc, char **argv)
+{
+    char    mp3buffer[LAME_MAXMP3BUFFER];
+    lame_global_flags *gf;
+    char    outPath[PATH_MAX + 1];
+    char    inPath[PATH_MAX + 1];
+    int     ret;
+    int     enc_delay = -1;
+    int     enc_padding = -1;
+
+    frontend_open_console();
+    gf = lame_init();
+    if (NULL == gf) {
+        error_printf("fatal error during initialization\n");
+        frontend_close_console();
+        return 1;
+    }
+    lame_set_errorf(gf, &frontend_errorf);
+    lame_set_debugf(gf, &frontend_debugf);
+    lame_set_msgf(gf, &frontend_msgf);
+    if (argc <= 1) {
+        usage(stderr, argv[0]); /* no command-line args  */
+        frontend_close_console();
+        return -1;
+    }
+    ret = parse_args(gf, argc, argv, inPath, outPath, NULL, NULL);
+    if (ret < 0) {
+        frontend_close_console();
+        return ret == -2 ? 0 : 1;
+    }
+    (void) lame_set_analysis(gf, 1);
+
+    init_infile(gf, inPath, &enc_delay, &enc_padding);
+    lame_init_params(gf);
+    lame_print_config(gf);
+
+
+    gtk_init(&argc, &argv);
+    gtkcontrol(gf, inPath);
+
+    lame_encode_flush(gf, mp3buffer, sizeof(mp3buffer));
+    lame_close(gf);
+    close_infile();
+    frontend_close_console();
+    return 0;
+}
diff --git a/frontend/mp3x_vc6.dsp b/frontend/mp3x_vc6.dsp
new file mode 100644
index 0000000..10f054c
--- /dev/null
+++ b/frontend/mp3x_vc6.dsp
@@ -0,0 +1,181 @@
+# Microsoft Developer Studio Project File - Name="MP3x" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Console Application" 0x0103

+

+CFG=MP3x - Win32 Debug

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "mp3x_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "mp3x_vc6.mak" CFG="MP3x - Win32 Debug"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "MP3x - Win32 Debug" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE "MP3x - Win32 Release" (basierend auf  "Win32 (x86) Console Application")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "MP3x - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "MP3x___Win32_Debug"

+# PROP BASE Intermediate_Dir "MP3x___Win32_Debug"

+# PROP BASE Ignore_Export_Lib 0

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\frontend"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "./WinGtk/src/gtk+" /I "./WinGtk/src/glib" /I "./WinGtk/src/gtk+/gdk" /I "../include" /I "../libmp3lame" /I "../mp3x" /I "../frontend" /I ".." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_MPGLIB" /D "LAMESNDFILE" /D "BRHIST" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT BASE CPP /YX

+# ADD CPP /nologo /W3 /Gm /ZI /Od /I "./WinGtk/src/gtk+" /I "./WinGtk/src/glib" /I "./WinGtk/src/gtk+/gdk" /I "../include" /I "../libmp3lame" /I "../mp3x" /I "../frontend" /I ".." /D "_MBCS" /D "LAMESNDFILE" /D "BRHIST" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_MPGLIB" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409 /d "_DEBUG"

+# ADD RSC /l 0x409 /d "_DEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 glib-2.0.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gdk.lib gtk.lib /nologo /subsystem:console /debug /machine:I386 /out:"../output/mp3x.exe" /pdbtype:sept /libpath:"./WinGtk/src/gtk+/gtk" /libpath:"./WinGtk/src/gtk+/gdk" /libpath:"./WinGtk/src/glib"

+# ADD LINK32 glib-2.0.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gdk.lib gtk.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\output\Debug\mp3x.exe" /pdbtype:sept /libpath:"./WinGtk/src/gtk+/gtk" /libpath:"./WinGtk/src/gtk+/gdk" /libpath:"./WinGtk/src/glib" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none

+

+!ELSEIF  "$(CFG)" == "MP3x - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "MP3x___Win32_Release"

+# PROP BASE Intermediate_Dir "MP3x___Win32_Release"

+# PROP BASE Ignore_Export_Lib 0

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\frontend"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+# ADD BASE CPP /nologo /W3 /O2 /I "./WinGTK/gtk-plus" /I "./WinGTK/glib-1.2" /I "./WinGtk/src/gtk+" /I "./WinGtk/src/glib" /I "./WinGtk/src/gtk+/gdk" /I "../include" /I "../libmp3lame" /I "../mp3x" /I "../frontend" /I ".." /D "NDEBUG" /D "LAMEPARSE" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_MPGLIB" /D "LAMESNDFILE" /D "BRHIST" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT BASE CPP /YX

+# ADD CPP /nologo /W3 /O2 /I "./WinGTK/gtk-plus" /I "./WinGTK/glib-1.2" /I "./WinGtk/src/gtk+" /I "./WinGtk/src/glib" /I "./WinGtk/src/gtk+/gdk" /I "../include" /I "../libmp3lame" /I "../mp3x" /I "../frontend" /I ".." /D "NDEBUG" /D "LAMEPARSE" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_MPGLIB" /D "LAMESNDFILE" /D "BRHIST" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409 /d "NDEBUG"

+# ADD RSC /l 0x409 /d "NDEBUG"

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 glib-1.3.lib glib-2.0.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gdk.lib gtk.lib /nologo /subsystem:console /profile /map /machine:I386 /out:"../output/mp3x.exe" /libpath:"./WinGtk/src/gtk+/gtk" /libpath:"./WinGtk/src/gtk+/gdk" /libpath:"./WinGtk/src/glib"

+# ADD LINK32 glib-2.0.lib glib-2.0.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gdk.lib gtk.lib /nologo /subsystem:console /profile /map /machine:I386 /out:"..\output\Release\mp3x.exe" /libpath:"./WinGtk/src/gtk+/gtk" /libpath:"./WinGtk/src/gtk+/gdk" /libpath:"./WinGtk/src/glib" /opt:NOWIN98

+

+!ENDIF 

+

+# Begin Target

+

+# Name "MP3x - Win32 Debug"

+# Name "MP3x - Win32 Release"

+# Begin Group "Source"

+

+# PROP Default_Filter "c"

+# Begin Source File

+

+SOURCE=..\frontend\brhist.c

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\console.c

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\get_audio.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\gpkplotting.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\gtkanal.c

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\lametime.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\mp3x.c

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\parse.c

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\portableio.c

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\timestatus.c

+# End Source File

+# End Group

+# Begin Group "Include"

+

+# PROP Default_Filter "h"

+# Begin Source File

+

+SOURCE=..\frontend\brhist.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\configMS.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\console.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\get_audio.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\gpkplotting.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\lametime.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\parse.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\portableio.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\frontend\timestatus.h

+# End Source File

+# End Group

+# Begin Source File

+

+SOURCE=..\README.WINGTK

+# End Source File

+# End Target

+# End Project

diff --git a/frontend/mp3x_vc8.vcproj b/frontend/mp3x_vc8.vcproj
new file mode 100644
index 0000000..a1e5fc9
--- /dev/null
+++ b/frontend/mp3x_vc8.vcproj
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="mp3x_vc8"

+	ProjectGUID="{F6140F25-0460-49E5-A2EB-06CED33BF08F}"

+	RootNamespace="mp3x_vc8"

+	Keyword="Win32Proj"

+	TargetFrameworkVersion="131072"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Debug GTK|Win32"

+			OutputDirectory="../output"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../include;../libmp3lame"

+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_DEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H;HAVE_GTK"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="3"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="4"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="glib-2.0.lib gdk.lib gtk.lib"

+				OutputFile="$(OutDir)\mp3x.exe"

+				LinkIncremental="2"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="1"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"

+				RuntimeLibrary="2"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				LinkIncremental="1"

+				GenerateDebugInformation="true"

+				SubSystem="1"

+				OptimizeReferences="2"

+				EnableCOMDATFolding="2"

+				RandomizedBaseAddress="1"

+				DataExecutionPrevention="0"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source Files"

+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"

+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

+			>

+			<File

+				RelativePath=".\brhist.c"

+				>

+			</File>

+			<File

+				RelativePath=".\console.c"

+				>

+			</File>

+			<File

+				RelativePath=".\get_audio.c"

+				>

+			</File>

+			<File

+				RelativePath=".\gpkplotting.c"

+				>

+			</File>

+			<File

+				RelativePath=".\gtkanal.c"

+				>

+			</File>

+			<File

+				RelativePath=".\lametime.c"

+				>

+			</File>

+			<File

+				RelativePath=".\mp3x.c"

+				>

+			</File>

+			<File

+				RelativePath=".\parse.c"

+				>

+			</File>

+			<File

+				RelativePath=".\portableio.c"

+				>

+			</File>

+			<File

+				RelativePath=".\timestatus.c"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header Files"

+			Filter="h;hpp;hxx;hm;inl;inc;xsd"

+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"

+			>

+			<File

+				RelativePath=".\brhist.h"

+				>

+			</File>

+			<File

+				RelativePath=".\console.h"

+				>

+			</File>

+			<File

+				RelativePath=".\get_audio.h"

+				>

+			</File>

+			<File

+				RelativePath=".\gpkplotting.h"

+				>

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/frontend/parse.c b/frontend/parse.c
new file mode 100644
index 0000000..2c6a10c
--- /dev/null
+++ b/frontend/parse.c
@@ -0,0 +1,2341 @@
+/*
+ *      Command line parsing related functions
+ *
+ *      Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: parse.c,v 1.247.2.8 2009/12/11 22:44:25 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <ctype.h>
+
+#ifdef STDC_HEADERS
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef __OS2__
+#include <os2.h>
+#define PRTYC_IDLE 1
+#define PRTYC_REGULAR 2
+#define PRTYD_MINIMUM -31
+#define PRTYD_MAXIMUM 31
+#endif
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#include "lame.h"
+#include "set_get.h"
+
+#include "brhist.h"
+#include "parse.h"
+#include "main.h"
+#include "get_audio.h"
+#include "version.h"
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+                 
+#ifdef HAVE_ICONV
+#include <iconv.h>
+#include <errno.h>
+#endif
+
+#if defined DEBUG || _DEBUG || _ALLOW_INTERNAL_OPTIONS
+#define INTERNAL_OPTS 1
+#else
+#define INTERNAL_OPTS LAME_ALPHA_VERSION
+#endif
+
+#if (INTERNAL_OPTS!=0)
+#define DEV_HELP(a) a
+#else
+#define DEV_HELP(a)
+#endif
+
+
+
+/* GLOBAL VARIABLES.  set by parse_args() */
+/* we need to clean this up */
+sound_file_format input_format;
+int     swapbytes = 0;       /* force byte swapping   default=0 */
+int     silent;              /* Verbosity */
+int     ignore_tag_errors;   /* Ignore errors in values passed for tags */
+int     brhist;
+float   update_interval;     /* to use Frank's time status display */
+int     mp3_delay;           /* to adjust the number of samples truncated
+                                during decode */
+int     mp3_delay_set;       /* user specified the value of the mp3 encoder
+                                delay to assume for decoding */
+
+int     disable_wav_header;
+mp3data_struct mp3input_data; /* used by MP3 */
+int     print_clipping_info; /* print info whether waveform clips */
+
+
+int     in_signed = -1;
+
+enum ByteOrder in_endian = ByteOrderLittleEndian;
+
+int     in_bitwidth = 16;
+
+int     flush_write = 0;
+
+
+
+/**
+ *  Long Filename support for the WIN32 platform
+ *
+ */
+#ifdef WIN32
+#include <winbase.h>
+static void
+dosToLongFileName(char *fn)
+{
+    const int MSIZE = PATH_MAX + 1 - 4; /*  we wanna add ".mp3" later */
+    WIN32_FIND_DATAA lpFindFileData;
+    HANDLE  h = FindFirstFileA(fn, &lpFindFileData);
+    if (h != INVALID_HANDLE_VALUE) {
+        int     a;
+        char   *q, *p;
+        FindClose(h);
+        for (a = 0; a < MSIZE; a++) {
+            if ('\0' == lpFindFileData.cFileName[a])
+                break;
+        }
+        if (a >= MSIZE || a == 0)
+            return;
+        q = strrchr(fn, '\\');
+        p = strrchr(fn, '/');
+        if (p - q > 0)
+            q = p;
+        if (q == NULL)
+            q = strrchr(fn, ':');
+        if (q == NULL)
+            strncpy(fn, lpFindFileData.cFileName, a);
+        else {
+            a += q - fn + 1;
+            if (a >= MSIZE)
+                return;
+            strncpy(++q, lpFindFileData.cFileName, MSIZE - a);
+        }
+    }
+}
+#endif
+#if defined(WIN32)
+#include <windows.h>
+BOOL
+SetPriorityClassMacro(DWORD p)
+{
+    HANDLE  op = GetCurrentProcess();
+    return SetPriorityClass(op, p);
+}
+
+static void
+setWin32Priority(lame_global_flags * gfp, int Priority)
+{
+    switch (Priority) {
+    case 0:
+    case 1:
+        SetPriorityClassMacro(IDLE_PRIORITY_CLASS);
+        console_printf("==> Priority set to Low.\n");
+        break;
+    default:
+    case 2:
+        SetPriorityClassMacro(NORMAL_PRIORITY_CLASS);
+        console_printf("==> Priority set to Normal.\n");
+        break;
+    case 3:
+    case 4:
+        SetPriorityClassMacro(HIGH_PRIORITY_CLASS);
+        console_printf("==> Priority set to High.\n");
+        break;
+    }
+}
+#endif
+
+
+#if defined(__OS2__)
+/* OS/2 priority functions */
+static int
+setOS2Priority(lame_global_flags * gfp, int Priority)
+{
+    int     rc;
+
+    switch (Priority) {
+
+    case 0:
+        rc = DosSetPriority(0, /* Scope: only one process */
+                            PRTYC_IDLE, /* select priority class (idle, regular, etc) */
+                            0, /* set delta */
+                            0); /* Assume current process */
+        console_printf("==> Priority set to 0 (Low priority).\n");
+        break;
+
+    case 1:
+        rc = DosSetPriority(0, /* Scope: only one process */
+                            PRTYC_IDLE, /* select priority class (idle, regular, etc) */
+                            PRTYD_MAXIMUM, /* set delta */
+                            0); /* Assume current process */
+        console_printf("==> Priority set to 1 (Medium priority).\n");
+        break;
+
+    case 2:
+        rc = DosSetPriority(0, /* Scope: only one process */
+                            PRTYC_REGULAR, /* select priority class (idle, regular, etc) */
+                            PRTYD_MINIMUM, /* set delta */
+                            0); /* Assume current process */
+        console_printf("==> Priority set to 2 (Regular priority).\n");
+        break;
+
+    case 3:
+        rc = DosSetPriority(0, /* Scope: only one process */
+                            PRTYC_REGULAR, /* select priority class (idle, regular, etc) */
+                            0, /* set delta */
+                            0); /* Assume current process */
+        console_printf("==> Priority set to 3 (High priority).\n");
+        break;
+
+    case 4:
+        rc = DosSetPriority(0, /* Scope: only one process */
+                            PRTYC_REGULAR, /* select priority class (idle, regular, etc) */
+                            PRTYD_MAXIMUM, /* set delta */
+                            0); /* Assume current process */
+        console_printf("==> Priority set to 4 (Maximum priority). I hope you enjoy it :)\n");
+        break;
+
+    default:
+        console_printf("==> Invalid priority specified! Assuming idle priority.\n");
+    }
+
+
+    return 0;
+}
+#endif
+
+
+extern int
+id3tag_set_textinfo_ucs2(lame_global_flags* gfp, char const* id, unsigned short const* text);
+
+extern int
+id3tag_set_comment_ucs2(lame_global_flags* gfp, char const* lng, unsigned short const* desc, unsigned short const* text);
+
+/* possible text encodings */
+typedef enum TextEncoding
+{ TENC_RAW     /* bytes will be stored as-is into ID3 tags, which are Latin1/UCS2 per definition */
+, TENC_LATIN1  /* text will be converted from local encoding to Latin1, as ID3 needs it */
+, TENC_UCS2    /* text will be converted from local encoding to UCS-2, as ID3v2 wants it */
+} TextEncoding;
+
+#ifdef HAVE_ICONV
+
+/* search for Zero termination in multi-byte strings */
+static size_t
+strlenMultiByte(char const* str, size_t w)
+{    
+    size_t n = 0;
+    if (str != 0) {
+        size_t i, x = 0;
+        for (n = 0; ; ++n) {
+            x = 0;
+            for (i = 0; i < w; ++i) {
+                x += *str++ == 0 ? 1 : 0;
+            }
+            if (x == w) {
+                break;
+            }
+        }
+    }
+    return n;
+}
+
+
+static size_t
+currCharCodeSize(void)
+{
+    size_t n = 1;
+    char dst[32];
+    char* src = "A";
+    char* env_lang = getenv("LANG");
+    char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+    char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
+    iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1");
+    if (xiconv != (iconv_t)-1) {
+        for (n = 0; n < 32; ++n) {
+            char* i_ptr = src;
+            char* o_ptr = dst;
+            size_t srcln = 1;
+            size_t avail = n;
+            size_t rc = iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail);
+            if (rc != (size_t)-1) {
+                break;
+            }
+        }
+        iconv_close(xiconv);
+    }
+    return n;
+}
+
+#if 0
+static
+char* fromLatin1( char* src )
+{
+    char* dst = 0;
+    if (src != 0) {
+        size_t const l = strlen(src);
+        size_t const n = l*4;
+        dst = calloc(n+4, 4);
+        if (dst != 0) {
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
+            iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1");
+            if (xiconv != (iconv_t)-1) {
+                char* i_ptr = src;
+                char* o_ptr = dst;
+                size_t srcln = l;
+                size_t avail = n;                
+                iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail);
+                iconv_close(xiconv);
+            }
+        }
+    }
+    return dst;
+}
+
+static
+char* fromUcs2( char* src )
+{
+    char* dst = 0;
+    if (src != 0) {
+        size_t const l = strlenMultiByte(src, 2);
+        size_t const n = l*4;
+        dst = calloc(n+4, 4);
+        if (dst != 0) {
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
+            iconv_t xiconv = iconv_open(cur_code, "UCS-2LE");
+            if (xiconv != (iconv_t)-1) {
+                char* i_ptr = (char*)src;
+                char* o_ptr = dst;
+                size_t srcln = l*2;
+                size_t avail = n;                
+                iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail);
+                iconv_close(xiconv);
+            }
+        }
+    }
+    return dst;
+}
+#endif
+
+static
+char* toLatin1( char* src )
+{
+    size_t w = currCharCodeSize();
+    char* dst = 0;
+    if (src != 0) {
+        size_t const l = strlenMultiByte(src, w);
+        size_t const n = l*4;
+        dst = calloc(n+4, 4);
+        if (dst != 0) {
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
+            iconv_t xiconv = iconv_open("ISO_8859-1", cur_code);
+            if (xiconv != (iconv_t)-1) {
+                char* i_ptr = (char*)src;
+                char* o_ptr = dst;
+                size_t srcln = l*w;
+                size_t avail = n;                
+                iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail);
+                iconv_close(xiconv);
+            }
+        }
+    }
+    return dst;
+}
+
+
+static
+char* toUcs2( char* src )
+{
+    size_t w = currCharCodeSize();
+    char* dst = 0;
+    if (src != 0) {
+        size_t const l = strlenMultiByte(src, w);
+        size_t const n = (l+1)*4;
+        dst = calloc(n+4, 4);
+        if (dst != 0) {
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
+            iconv_t xiconv = iconv_open("UCS-2LE", cur_code);
+            dst[0] = 0xff;
+            dst[1] = 0xfe;
+            if (xiconv != (iconv_t)-1) {
+                char* i_ptr = (char*)src;
+                char* o_ptr = &dst[2];
+                size_t srcln = l*w;
+                size_t avail = n;                
+                iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail);
+                iconv_close(xiconv);
+            }
+        }
+    }
+    return dst;
+}
+
+
+static int
+set_id3v2tag(lame_global_flags* gfp, int type, unsigned short const* str)
+{
+    switch (type)
+    {
+        case 'a': return id3tag_set_textinfo_ucs2(gfp, "TPE1", str);
+        case 't': return id3tag_set_textinfo_ucs2(gfp, "TIT2", str);
+        case 'l': return id3tag_set_textinfo_ucs2(gfp, "TALB", str);
+        case 'g': return id3tag_set_textinfo_ucs2(gfp, "TCON", str);
+        case 'c': return id3tag_set_comment_ucs2(gfp, 0, 0, str);
+        case 'n': return id3tag_set_textinfo_ucs2(gfp, "TRCK", str);
+    }
+    return 0;
+}
+#endif
+
+static int
+set_id3tag(lame_global_flags* gfp, int type, char const* str)
+{
+    switch (type)
+    {
+        case 'a': return id3tag_set_artist(gfp, str), 0;
+        case 't': return id3tag_set_title(gfp, str), 0;
+        case 'l': return id3tag_set_album(gfp, str), 0;
+        case 'g': return id3tag_set_genre(gfp, str);
+        case 'c': return id3tag_set_comment(gfp, str), 0;
+        case 'n': return id3tag_set_track(gfp, str);
+        case 'y': return id3tag_set_year(gfp, str), 0;
+        case 'v': return id3tag_set_fieldvalue(gfp, str);
+    }
+    return 0;
+}
+
+static int
+id3_tag(lame_global_flags* gfp, int type, TextEncoding enc, char* str)
+{
+    void* x = 0;
+    int result;
+    switch (enc) 
+    {
+        default:
+        case TENC_RAW:    x = strdup(str);   break;
+#ifdef HAVE_ICONV
+        case TENC_LATIN1: x = toLatin1(str); break;
+        case TENC_UCS2:   x = toUcs2(str);   break;
+#endif
+    }
+    switch (enc)
+    {
+        default:
+        case TENC_RAW:
+        case TENC_LATIN1: result = set_id3tag(gfp, type, x);   break;
+#ifdef HAVE_ICONV
+        case TENC_UCS2:   result = set_id3v2tag(gfp, type, x); break;
+#endif
+    }
+    free(x);
+    return result;
+}
+
+
+
+
+/************************************************************************
+*
+* license
+*
+* PURPOSE:  Writes version and license to the file specified by fp
+*
+************************************************************************/
+
+static int
+lame_version_print(FILE * const fp)
+{
+    const char *b = get_lame_os_bitness();
+    const char *v = get_lame_version();
+    const char *u = get_lame_url();
+    const size_t lenb = strlen(b);
+    const size_t lenv = strlen(v);
+    const size_t lenu = strlen(u);
+    const size_t lw = 80;       /* line width of terminal in characters */
+    const size_t sw = 16;       /* static width of text */
+
+    if (lw >= lenb + lenv + lenu + sw || lw < lenu + 2)
+        /* text fits in 80 chars per line, or line even too small for url */
+        if (lenb > 0)
+            fprintf(fp, "LAME %s version %s (%s)\n\n", b, v, u);
+        else
+            fprintf(fp, "LAME version %s (%s)\n\n", v, u);
+    else
+        /* text too long, wrap url into next line, right aligned */
+    if (lenb > 0)
+        fprintf(fp, "LAME %s version %s\n%*s(%s)\n\n", b, v, lw - 2 - lenu, "", u);
+    else
+        fprintf(fp, "LAME version %s\n%*s(%s)\n\n", v, lw - 2 - lenu, "", u);
+
+    if (LAME_ALPHA_VERSION)
+        fprintf(fp, "warning: alpha versions should be used for testing only\n\n");
+
+
+    return 0;
+}
+
+static int
+print_license(FILE * const fp)
+{                       /* print version & license */
+    lame_version_print(fp);
+    fprintf(fp,
+            "Can I use LAME in my commercial program?\n"
+            "\n"
+            "Yes, you can, under the restrictions of the LGPL.  In particular, you\n"
+            "can include a compiled version of the LAME library (for example,\n"
+            "lame.dll) with a commercial program.  Some notable requirements of\n"
+            "the LGPL:\n" "\n");
+    fprintf(fp,
+            "1. In your program, you cannot include any source code from LAME, with\n"
+            "   the exception of files whose only purpose is to describe the library\n"
+            "   interface (such as lame.h).\n" "\n");
+    fprintf(fp,
+            "2. Any modifications of LAME must be released under the LGPL.\n"
+            "   The LAME project (www.mp3dev.org) would appreciate being\n"
+            "   notified of any modifications.\n" "\n");
+    fprintf(fp,
+            "3. You must give prominent notice that your program is:\n"
+            "      A. using LAME (including version number)\n"
+            "      B. LAME is under the LGPL\n"
+            "      C. Provide a copy of the LGPL.  (the file COPYING contains the LGPL)\n"
+            "      D. Provide a copy of LAME source, or a pointer where the LAME\n"
+            "         source can be obtained (such as www.mp3dev.org)\n"
+            "   An example of prominent notice would be an \"About the LAME encoding engine\"\n"
+            "   button in some pull down menu within the executable of your program.\n" "\n");
+    fprintf(fp,
+            "4. If you determine that distribution of LAME requires a patent license,\n"
+            "   you must obtain such license.\n" "\n" "\n");
+    fprintf(fp,
+            "*** IMPORTANT NOTE ***\n"
+            "\n"
+            "The decoding functions provided in LAME use the mpglib decoding engine which\n"
+            "is under the GPL.  They may not be used by any program not released under the\n"
+            "GPL unless you obtain such permission from the MPG123 project (www.mpg123.de).\n"
+            "\n");
+    return 0;
+}
+
+
+/************************************************************************
+*
+* usage
+*
+* PURPOSE:  Writes command line syntax to the file specified by fp
+*
+************************************************************************/
+
+int
+usage(FILE * const fp, const char *ProgramName)
+{                       /* print general syntax */
+    lame_version_print(fp);
+    fprintf(fp,
+            "usage: %s [options] <infile> [outfile]\n"
+            "\n"
+            "    <infile> and/or <outfile> can be \"-\", which means stdin/stdout.\n"
+            "\n"
+            "Try:\n"
+            "     \"%s --help\"           for general usage information\n"
+            " or:\n"
+            "     \"%s --preset help\"    for information on suggested predefined settings\n"
+            " or:\n"
+            "     \"%s --longhelp\"\n"
+            "  or \"%s -?\"              for a complete options list\n\n",
+            ProgramName, ProgramName, ProgramName, ProgramName, ProgramName);
+    return 0;
+}
+
+
+/************************************************************************
+*
+* usage
+*
+* PURPOSE:  Writes command line syntax to the file specified by fp
+*           but only the most important ones, to fit on a vt100 terminal
+*
+************************************************************************/
+
+int
+short_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName)
+{                       /* print short syntax help */
+    lame_version_print(fp);
+    fprintf(fp,
+            "usage: %s [options] <infile> [outfile]\n"
+            "\n"
+            "    <infile> and/or <outfile> can be \"-\", which means stdin/stdout.\n"
+            "\n" "RECOMMENDED:\n" "    lame -V2 input.wav output.mp3\n" "\n", ProgramName);
+    fprintf(fp,
+            "OPTIONS:\n"
+            "    -b bitrate      set the bitrate, default 128 kbps\n"
+            "    -h              higher quality, but a little slower.  Recommended.\n"
+            "    -f              fast mode (lower quality)\n"
+            "    -V n            quality setting for VBR.  default n=%i\n"
+            "                    0=high quality,bigger files. 9=smaller files\n",
+            lame_get_VBR_q(gfp));
+    fprintf(fp,
+            "    --preset type   type must be \"medium\", \"standard\", \"extreme\", \"insane\",\n"
+            "                    or a value for an average desired bitrate and depending\n"
+            "                    on the value specified, appropriate quality settings will\n"
+            "                    be used.\n"
+            "                    \"--preset help\" gives more info on these\n" "\n");
+    fprintf(fp,
+#if defined(WIN32)
+            "    --priority type  sets the process priority\n"
+            "                     0,1 = Low priority\n"
+            "                     2   = normal priority\n"
+            "                     3,4 = High priority\n" "\n"
+#endif
+#if defined(__OS2__)
+            "    --priority type  sets the process priority\n"
+            "                     0 = Low priority\n"
+            "                     1 = Medium priority\n"
+            "                     2 = Regular priority\n"
+            "                     3 = High priority\n"
+            "                     4 = Maximum priority\n" "\n"
+#endif
+            "    --longhelp      full list of options\n" "\n"
+            "    --license       print License information\n\n"
+            );
+
+    return 0;
+}
+
+/************************************************************************
+*
+* usage
+*
+* PURPOSE:  Writes command line syntax to the file specified by fp
+*
+************************************************************************/
+
+static void
+wait_for(FILE * const fp, int lessmode)
+{
+    if (lessmode) {
+        fflush(fp);
+        getchar();
+    }
+    else {
+        fprintf(fp, "\n");
+    }
+    fprintf(fp, "\n");
+}
+
+int
+long_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName, int lessmode)
+{                       /* print long syntax help */
+    lame_version_print(fp);
+    fprintf(fp,
+            "usage: %s [options] <infile> [outfile]\n"
+            "\n"
+            "    <infile> and/or <outfile> can be \"-\", which means stdin/stdout.\n"
+            "\n" "RECOMMENDED:\n" "    lame -V2 input.wav output.mp3\n" "\n", ProgramName);
+    fprintf(fp,
+            "OPTIONS:\n"
+            "  Input options:\n"
+            "    --scale <arg>   scale input (multiply PCM data) by <arg>\n"
+            "    --scale-l <arg> scale channel 0 (left) input (multiply PCM data) by <arg>\n"
+            "    --scale-r <arg> scale channel 1 (right) input (multiply PCM data) by <arg>\n"
+#if (defined HAVE_MPGLIB || defined AMIGA_MPEGA)
+            "    --mp1input      input file is a MPEG Layer I   file\n"
+            "    --mp2input      input file is a MPEG Layer II  file\n"
+            "    --mp3input      input file is a MPEG Layer III file\n"
+#endif
+            "    --nogap <file1> <file2> <...>\n"
+            "                    gapless encoding for a set of contiguous files\n"
+            "    --nogapout <dir>\n"
+            "                    output dir for gapless encoding (must precede --nogap)\n"
+            "    --nogaptags     allow the use of VBR tags in gapless encoding\n"
+           );
+    fprintf(fp,
+            "\n"
+            "  Input options for RAW PCM:\n"
+            "    -r              input is raw pcm\n"
+            "    -x              force byte-swapping of input\n"
+            "    -s sfreq        sampling frequency of input file (kHz) - default 44.1 kHz\n"
+            "    --bitwidth w    input bit width is w (default 16)\n"
+            "    --signed        input is signed (default)\n"
+            "    --unsigned      input is unsigned\n"
+            "    --little-endian input is little-endian (default)\n"
+            "    --big-endian    input is big-endian\n"
+           );
+
+    wait_for(fp, lessmode);
+    fprintf(fp,
+            "  Operational options:\n"
+            "    -a              downmix from stereo to mono file for mono encoding\n"
+            "    -m <mode>       (j)oint, (s)imple, (f)orce, (d)dual-mono, (m)ono\n"
+            "                    default is (j) or (s) depending on bitrate\n"
+            "                    joint  = joins the best possible of MS and LR stereo\n"
+            "                    simple = force LR stereo on all frames\n"
+            "                    force  = force MS stereo on all frames.\n"
+            "    --preset type   type must be \"medium\", \"standard\", \"extreme\", \"insane\",\n"
+            "                    or a value for an average desired bitrate and depending\n"
+            "                    on the value specified, appropriate quality settings will\n"
+            "                    be used.\n"
+            "                    \"--preset help\" gives more info on these\n"
+            "    --comp  <arg>   choose bitrate to achive a compression ratio of <arg>\n");
+    fprintf(fp, "    --replaygain-fast   compute RG fast but slightly inaccurately (default)\n"
+#ifdef DECODE_ON_THE_FLY
+            "    --replaygain-accurate   compute RG more accurately and find the peak sample\n"
+#endif
+            "    --noreplaygain  disable ReplayGain analysis\n"
+#ifdef DECODE_ON_THE_FLY
+            "    --clipdetect    enable --replaygain-accurate and print a message whether\n"
+            "                    clipping occurs and how far the waveform is from full scale\n"
+#endif
+        );
+    fprintf(fp,
+            "    --flush         flush output stream as soon as possible\n"
+            "    --freeformat    produce a free format bitstream\n"
+            "    --decode        input=mp3 file, output=wav\n"
+            "    -t              disable writing wav header when using --decode\n");
+
+    wait_for(fp, lessmode);
+    fprintf(fp,
+            "  Verbosity:\n"
+            "    --disptime <arg>print progress report every arg seconds\n"
+            "    -S              don't print progress report, VBR histograms\n"
+            "    --nohist        disable VBR histogram display\n"
+            "    --silent        don't print anything on screen\n"
+            "    --quiet         don't print anything on screen\n"
+            "    --brief         print more useful information\n"
+            "    --verbose       print a lot of useful information\n" "\n");
+    fprintf(fp,
+            "  Noise shaping & psycho acoustic algorithms:\n"
+            "    -q <arg>        <arg> = 0...9.  Default  -q 5 \n"
+            "                    -q 0:  Highest quality, very slow \n"
+            "                    -q 9:  Poor quality, but fast \n"
+            "    -h              Same as -q 2.   Recommended.\n"
+            "    -f              Same as -q 7.   Fast, ok quality\n");
+
+    wait_for(fp, lessmode);
+    fprintf(fp,
+            "  CBR (constant bitrate, the default) options:\n"
+            "    -b <bitrate>    set the bitrate in kbps, default 128 kbps\n"
+            "    --cbr           enforce use of constant bitrate\n"
+            "\n"
+            "  ABR options:\n"
+            "    --abr <bitrate> specify average bitrate desired (instead of quality)\n" "\n");
+    fprintf(fp,
+            "  VBR options:\n"
+            "    -V n            quality setting for VBR.  default n=%i\n"
+            "                    0=high quality,bigger files. 9=smaller files\n"
+            "    -v              the same as -V 4\n"
+            "    --vbr-old       use old variable bitrate (VBR) routine\n"
+            "    --vbr-new       use new variable bitrate (VBR) routine (default)\n"
+            ,
+            lame_get_VBR_q(gfp));
+    fprintf(fp,
+            "    -b <bitrate>    specify minimum allowed bitrate, default  32 kbps\n"
+            "    -B <bitrate>    specify maximum allowed bitrate, default 320 kbps\n"
+            "    -F              strictly enforce the -b option, for use with players that\n"
+            "                    do not support low bitrate mp3\n"
+            "    -t              disable writing LAME Tag\n"
+            "    -T              enable and force writing LAME Tag\n");
+
+    wait_for(fp, lessmode);
+    DEV_HELP(fprintf(fp,
+                     "  ATH related:\n"
+                     "    --noath         turns ATH down to a flat noise floor\n"
+                     "    --athshort      ignore GPSYCHO for short blocks, use ATH only\n"
+                     "    --athonly       ignore GPSYCHO completely, use ATH only\n"
+                     "    --athtype n     selects between different ATH types [0-4]\n"
+                     "    --athlower x    lowers ATH by x dB\n");
+             fprintf(fp, "    --athaa-type n  ATH auto adjust: 0 'no' else 'loudness based'\n"
+/** OBSOLETE "    --athaa-loudapprox n   n=1 total energy or n=2 equal loudness curve\n"*/
+                     "    --athaa-sensitivity x  activation offset in -/+ dB for ATH auto-adjustment\n"
+                     "\n");
+        )
+        fprintf(fp,
+                "  PSY related:\n"
+                DEV_HELP(
+                "    --short         use short blocks when appropriate\n"
+                "    --noshort       do not use short blocks\n"
+                "    --allshort      use only short blocks\n"
+                )
+        );
+    fprintf(fp,
+            "    --temporal-masking x   x=0 disables, x=1 enables temporal masking effect\n"
+            "    --nssafejoint   M/S switching criterion\n"
+            "    --nsmsfix <arg> M/S switching tuning [effective 0-3.5]\n"
+            "    --interch x     adjust inter-channel masking ratio\n"
+            "    --ns-bass x     adjust masking for sfbs  0 -  6 (long)  0 -  5 (short)\n"
+            "    --ns-alto x     adjust masking for sfbs  7 - 13 (long)  6 - 10 (short)\n"
+            "    --ns-treble x   adjust masking for sfbs 14 - 21 (long) 11 - 12 (short)\n");
+    fprintf(fp,
+            "    --ns-sfb21 x    change ns-treble by x dB for sfb21\n"
+            DEV_HELP("    --shortthreshold x,y  short block switching threshold,\n"
+                     "                          x for L/R/M channel, y for S channel\n"
+                     "  Noise Shaping related:\n"
+                     "    --substep n     use pseudo substep noise shaping method types 0-2\n")
+        );
+
+    wait_for(fp, lessmode);
+
+    fprintf(fp,
+            "  experimental switches:\n"
+            DEV_HELP(
+            "    -X n[,m]        selects between different noise measurements\n"
+            "                    n for long block, m for short. if m is omitted, m = n\n"
+            )
+            "    -Y              lets LAME ignore noise in sfb21, like in CBR\n"
+            DEV_HELP(
+            "    -Z [n]          currently no effects\n"
+            )
+            );
+
+    wait_for(fp, lessmode);
+
+    fprintf(fp,
+            "  MP3 header/stream options:\n"
+            "    -e <emp>        de-emphasis n/5/c  (obsolete)\n"
+            "    -c              mark as copyright\n"
+            "    -o              mark as non-original\n"
+            "    -p              error protection.  adds 16 bit checksum to every frame\n"
+            "                    (the checksum is computed correctly)\n"
+            "    --nores         disable the bit reservoir\n"
+            "    --strictly-enforce-ISO   comply as much as possible to ISO MPEG spec\n" "\n");
+    fprintf(fp,
+            "  Filter options:\n"
+            "  --lowpass <freq>        frequency(kHz), lowpass filter cutoff above freq\n"
+            "  --lowpass-width <freq>  frequency(kHz) - default 15%% of lowpass freq\n"
+            "  --highpass <freq>       frequency(kHz), highpass filter cutoff below freq\n"
+            "  --highpass-width <freq> frequency(kHz) - default 15%% of highpass freq\n");
+    fprintf(fp,
+            "  --resample <sfreq>  sampling frequency of output file(kHz)- default=automatic\n");
+
+    wait_for(fp, lessmode);
+    fprintf(fp,
+            "  ID3 tag options:\n"
+            "    --tt <title>    audio/song title (max 30 chars for version 1 tag)\n"
+            "    --ta <artist>   audio/song artist (max 30 chars for version 1 tag)\n"
+            "    --tl <album>    audio/song album (max 30 chars for version 1 tag)\n"
+            "    --ty <year>     audio/song year of issue (1 to 9999)\n"
+            "    --tc <comment>  user-defined text (max 30 chars for v1 tag, 28 for v1.1)\n"
+            "    --tn <track[/total]>   audio/song track number and (optionally) the total\n"
+            "                           number of tracks on the original recording. (track\n"
+            "                           and total each 1 to 255. just the track number\n"
+            "                           creates v1.1 tag, providing a total forces v2.0).\n"
+            "    --tg <genre>    audio/song genre (name or number in list)\n"
+            "    --ti <file>     audio/song albumArt (jpeg/png/gif file, 128KB max, v2.3)\n"
+            "    --tv <id=value> user-defined frame specified by id and value (v2.3 tag)\n");
+    fprintf(fp,
+            "    --add-id3v2     force addition of version 2 tag\n"
+            "    --id3v1-only    add only a version 1 tag\n"
+            "    --id3v2-only    add only a version 2 tag\n"
+            "    --space-id3v1   pad version 1 tag with spaces instead of nulls\n"
+            "    --pad-id3v2     same as '--pad-id3v2-size 128'\n"
+            "    --pad-id3v2-size <value> adds version 2 tag, pad with extra <value> bytes\n"
+            "    --genre-list    print alphabetically sorted ID3 genre list and exit\n"
+            "    --ignore-tag-errors  ignore errors in values passed for tags\n" "\n");
+    fprintf(fp,
+            "    Note: A version 2 tag will NOT be added unless one of the input fields\n"
+            "    won't fit in a version 1 tag (e.g. the title string is longer than 30\n"
+            "    characters), or the '--add-id3v2' or '--id3v2-only' options are used,\n"
+            "    or output is redirected to stdout.\n"
+#if defined(WIN32)
+            "\n\nMS-Windows-specific options:\n"
+            "    --priority <type>  sets the process priority:\n"
+            "                         0,1 = Low priority (IDLE_PRIORITY_CLASS)\n"
+            "                         2 = normal priority (NORMAL_PRIORITY_CLASS, default)\n"
+            "                         3,4 = High priority (HIGH_PRIORITY_CLASS))\n"
+            "    Note: Calling '--priority' without a parameter will select priority 0.\n"
+#endif
+#if defined(__OS2__)
+            "\n\nOS/2-specific options:\n"
+            "    --priority <type>  sets the process priority:\n"
+            "                         0 = Low priority (IDLE, delta = 0)\n"
+            "                         1 = Medium priority (IDLE, delta = +31)\n"
+            "                         2 = Regular priority (REGULAR, delta = -31)\n"
+            "                         3 = High priority (REGULAR, delta = 0)\n"
+            "                         4 = Maximum priority (REGULAR, delta = +31)\n"
+            "    Note: Calling '--priority' without a parameter will select priority 0.\n"
+#endif
+            "\nMisc:\n    --license       print License information\n\n"
+        );
+
+#if defined(HAVE_NASM)
+    wait_for(fp, lessmode);
+    fprintf(fp,
+            "  Platform specific:\n"
+            "    --noasm <instructions> disable assembly optimizations for mmx/3dnow/sse\n");
+    wait_for(fp, lessmode);
+#endif
+
+    display_bitrates(fp);
+
+    return 0;
+}
+
+static void
+display_bitrate(FILE * const fp, const char *const version, const int d, const int indx)
+{
+    int     i;
+    int nBitrates = 14;
+    if (d == 4)
+        nBitrates = 8;
+
+
+    fprintf(fp,
+            "\nMPEG-%-3s layer III sample frequencies (kHz):  %2d  %2d  %g\n"
+            "bitrates (kbps):", version, 32 / d, 48 / d, 44.1 / d);
+    for (i = 1; i <= nBitrates; i++)
+        fprintf(fp, " %2i", bitrate_table[indx][i]);
+    fprintf(fp, "\n");
+}
+
+int
+display_bitrates(FILE * const fp)
+{
+    display_bitrate(fp, "1", 1, 1);
+    display_bitrate(fp, "2", 2, 0);
+    display_bitrate(fp, "2.5", 4, 0);
+    fprintf(fp, "\n");
+    fflush(fp);
+    return 0;
+}
+
+
+/*  note: for presets it would be better to externalize them in a file.
+    suggestion:  lame --preset <file-name> ...
+            or:  lame --preset my-setting  ... and my-setting is defined in lame.ini
+ */
+
+/*
+Note from GB on 08/25/2002:
+I am merging --presets and --alt-presets. Old presets are now aliases for
+corresponding abr values from old alt-presets. This way we now have a
+unified preset system, and I hope than more people will use the new tuned
+presets instead of the old unmaintained ones.
+*/
+
+
+
+/************************************************************************
+*
+* usage
+*
+* PURPOSE:  Writes presetting info to #stdout#
+*
+************************************************************************/
+
+
+static void
+presets_longinfo_dm(FILE * msgfp)
+{
+    fprintf(msgfp,
+            "\n"
+            "The --preset switches are aliases over LAME settings.\n"
+            "\n" "\n");
+    fprintf(msgfp,
+            "To activate these presets:\n"
+            "\n" "   For VBR modes (generally highest quality):\n" "\n");
+    fprintf(msgfp,
+            "     \"--preset medium\" This preset should provide near transparency\n"
+            "                             to most people on most music.\n"
+            "\n"
+            "     \"--preset standard\" This preset should generally be transparent\n"
+            "                             to most people on most music and is already\n"
+            "                             quite high in quality.\n" "\n");
+    fprintf(msgfp,
+            "     \"--preset extreme\" If you have extremely good hearing and similar\n"
+            "                             equipment, this preset will generally provide\n"
+            "                             slightly higher quality than the \"standard\"\n"
+            "                             mode.\n" "\n");
+    fprintf(msgfp,
+            "   For CBR 320kbps (highest quality possible from the --preset switches):\n"
+            "\n"
+            "     \"--preset insane\"  This preset will usually be overkill for most\n"
+            "                             people and most situations, but if you must\n"
+            "                             have the absolute highest quality with no\n"
+            "                             regard to filesize, this is the way to go.\n" "\n");
+    fprintf(msgfp,
+            "   For ABR modes (high quality per given bitrate but not as high as VBR):\n"
+            "\n"
+            "     \"--preset <kbps>\"  Using this preset will usually give you good\n"
+            "                             quality at a specified bitrate. Depending on the\n"
+            "                             bitrate entered, this preset will determine the\n");
+    fprintf(msgfp,
+            "                             optimal settings for that particular situation.\n"
+            "                             While this approach works, it is not nearly as\n"
+            "                             flexible as VBR, and usually will not attain the\n"
+            "                             same level of quality as VBR at higher bitrates.\n" "\n");
+    fprintf(msgfp,
+            "The following options are also available for the corresponding profiles:\n"
+            "\n"
+            "   <fast>        standard\n"
+            "   <fast>        extreme\n"
+            "                 insane\n"
+            "   <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n"
+            "                      simply specify a bitrate. For example:\n"
+            "                      \"--preset 185\" activates this\n"
+            "                      preset and uses 185 as an average kbps.\n" "\n");
+    fprintf(msgfp,
+            "   \"fast\" - Enables the fast VBR mode for a particular profile.\n" "\n");
+    fprintf(msgfp,
+            "   \"cbr\"  - If you use the ABR mode (read above) with a significant\n"
+            "            bitrate such as 80, 96, 112, 128, 160, 192, 224, 256, 320,\n"
+            "            you can use the \"cbr\" option to force CBR mode encoding\n"
+            "            instead of the standard abr mode. ABR does provide higher\n"
+            "            quality but CBR may be useful in situations such as when\n"
+            "            streaming an mp3 over the internet may be important.\n" "\n");
+    fprintf(msgfp,
+            "    For example:\n"
+            "\n"
+            "    \"--preset fast standard <input file> <output file>\"\n"
+            " or \"--preset cbr 192 <input file> <output file>\"\n"
+            " or \"--preset 172 <input file> <output file>\"\n"
+            " or \"--preset extreme <input file> <output file>\"\n" "\n" "\n");
+    fprintf(msgfp,
+            "A few aliases are also available for ABR mode:\n"
+            "phone => 16kbps/mono        phon+/lw/mw-eu/sw => 24kbps/mono\n"
+            "mw-us => 40kbps/mono        voice => 56kbps/mono\n"
+            "fm/radio/tape => 112kbps    hifi => 160kbps\n"
+            "cd => 192kbps               studio => 256kbps\n");
+}
+
+
+extern void lame_set_msfix(lame_t gfp, double msfix);
+
+
+
+static int
+presets_set(lame_t gfp, int fast, int cbr, const char *preset_name, const char *ProgramName)
+{
+    int     mono = 0;
+
+    if ((strcmp(preset_name, "help") == 0) && (fast < 1)
+        && (cbr < 1)) {
+        lame_version_print(stdout);
+        presets_longinfo_dm(stdout);
+        return -1;
+    }
+
+
+
+    /*aliases for compatibility with old presets */
+
+    if (strcmp(preset_name, "phone") == 0) {
+        preset_name = "16";
+        mono = 1;
+    }
+    if ((strcmp(preset_name, "phon+") == 0) ||
+        (strcmp(preset_name, "lw") == 0) ||
+        (strcmp(preset_name, "mw-eu") == 0) || (strcmp(preset_name, "sw") == 0)) {
+        preset_name = "24";
+        mono = 1;
+    }
+    if (strcmp(preset_name, "mw-us") == 0) {
+        preset_name = "40";
+        mono = 1;
+    }
+    if (strcmp(preset_name, "voice") == 0) {
+        preset_name = "56";
+        mono = 1;
+    }
+    if (strcmp(preset_name, "fm") == 0) {
+        preset_name = "112";
+    }
+    if ((strcmp(preset_name, "radio") == 0) || (strcmp(preset_name, "tape") == 0)) {
+        preset_name = "112";
+    }
+    if (strcmp(preset_name, "hifi") == 0) {
+        preset_name = "160";
+    }
+    if (strcmp(preset_name, "cd") == 0) {
+        preset_name = "192";
+    }
+    if (strcmp(preset_name, "studio") == 0) {
+        preset_name = "256";
+    }
+
+    if (strcmp(preset_name, "medium") == 0) {
+        lame_set_VBR_q(gfp, 4);
+        if (fast > 0) {
+            lame_set_VBR(gfp, vbr_mtrh);
+        }
+        else {
+            lame_set_VBR(gfp, vbr_rh);
+        }
+        return 0;
+    }
+
+    if (strcmp(preset_name, "standard") == 0) {
+        lame_set_VBR_q(gfp, 2);
+        if (fast > 0) {
+            lame_set_VBR(gfp, vbr_mtrh);
+        }
+        else {
+            lame_set_VBR(gfp, vbr_rh);
+        }
+        return 0;
+    }
+
+    else if (strcmp(preset_name, "extreme") == 0) {
+        lame_set_VBR_q(gfp, 0);
+        if (fast > 0) {
+            lame_set_VBR(gfp, vbr_mtrh);
+        }
+        else {
+            lame_set_VBR(gfp, vbr_rh);
+        }
+        return 0;
+    }
+
+    else if ((strcmp(preset_name, "insane") == 0) && (fast < 1)) {
+
+        lame_set_preset(gfp, INSANE);
+
+        return 0;
+    }
+
+    /* Generic ABR Preset */
+    if (((atoi(preset_name)) > 0) && (fast < 1)) {
+        if ((atoi(preset_name)) >= 8 && (atoi(preset_name)) <= 320) {
+            lame_set_preset(gfp, atoi(preset_name));
+
+            if (cbr == 1)
+                lame_set_VBR(gfp, vbr_off);
+
+            if (mono == 1) {
+                lame_set_mode(gfp, MONO);
+            }
+
+            return 0;
+
+        }
+        else {
+            lame_version_print(Console_IO.Error_fp);
+            error_printf("Error: The bitrate specified is out of the valid range for this preset\n"
+                         "\n"
+                         "When using this mode you must enter a value between \"32\" and \"320\"\n"
+                         "\n" "For further information try: \"%s --preset help\"\n", ProgramName);
+            return -1;
+        }
+    }
+
+    lame_version_print(Console_IO.Error_fp);
+    error_printf("Error: You did not enter a valid profile and/or options with --preset\n"
+                 "\n"
+                 "Available profiles are:\n"
+                 "\n"
+                 "   <fast>        medium\n"
+                 "   <fast>        standard\n"
+                 "   <fast>        extreme\n"
+                 "                 insane\n"
+                 "          <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n"
+                 "                             simply specify a bitrate. For example:\n"
+                 "                             \"--preset 185\" activates this\n"
+                 "                             preset and uses 185 as an average kbps.\n" "\n");
+    error_printf("    Some examples:\n"
+                 "\n"
+                 " or \"%s --preset fast standard <input file> <output file>\"\n"
+                 " or \"%s --preset cbr 192 <input file> <output file>\"\n"
+                 " or \"%s --preset 172 <input file> <output file>\"\n"
+                 " or \"%s --preset extreme <input file> <output file>\"\n"
+                 "\n"
+                 "For further information try: \"%s --preset help\"\n", ProgramName, ProgramName,
+                 ProgramName, ProgramName, ProgramName);
+    return -1;
+}
+
+static void
+genre_list_handler(int num, const char *name, void *cookie)
+{
+    (void) cookie;
+    console_printf("%3d %s\n", num, name);
+}
+
+
+/************************************************************************
+*
+* parse_args
+*
+* PURPOSE:  Sets encoding parameters to the specifications of the
+* command line.  Default settings are used for parameters
+* not specified in the command line.
+*
+* If the input file is in WAVE or AIFF format, the sampling frequency is read
+* from the AIFF header.
+*
+* The input and output filenames are read into #inpath# and #outpath#.
+*
+************************************************************************/
+
+/* would use real "strcasecmp" but it isn't portable */
+static int
+local_strcasecmp(const char *s1, const char *s2)
+{
+    unsigned char c1;
+    unsigned char c2;
+
+    do {
+        c1 = tolower(*s1);
+        c2 = tolower(*s2);
+        if (!c1) {
+            break;
+        }
+        ++s1;
+        ++s2;
+    } while (c1 == c2);
+    return c1 - c2;
+}
+
+
+
+/* LAME is a simple frontend which just uses the file extension */
+/* to determine the file type.  Trying to analyze the file */
+/* contents is well beyond the scope of LAME and should not be added. */
+static int
+filename_to_type(const char *FileName)
+{
+    size_t  len = strlen(FileName);
+
+    if (len < 4)
+        return sf_unknown;
+
+    FileName += len - 4;
+    if (0 == local_strcasecmp(FileName, ".mpg"))
+        return sf_mp123;
+    if (0 == local_strcasecmp(FileName, ".mp1"))
+        return sf_mp123;
+    if (0 == local_strcasecmp(FileName, ".mp2"))
+        return sf_mp123;
+    if (0 == local_strcasecmp(FileName, ".mp3"))
+        return sf_mp123;
+    if (0 == local_strcasecmp(FileName, ".wav"))
+        return sf_wave;
+    if (0 == local_strcasecmp(FileName, ".aif"))
+        return sf_aiff;
+    if (0 == local_strcasecmp(FileName, ".raw"))
+        return sf_raw;
+    if (0 == local_strcasecmp(FileName, ".ogg"))
+        return sf_ogg;
+    return sf_unknown;
+}
+
+static int
+resample_rate(double freq)
+{
+    if (freq >= 1.e3)
+        freq *= 1.e-3;
+
+    switch ((int) freq) {
+    case 8:
+        return 8000;
+    case 11:
+        return 11025;
+    case 12:
+        return 12000;
+    case 16:
+        return 16000;
+    case 22:
+        return 22050;
+    case 24:
+        return 24000;
+    case 32:
+        return 32000;
+    case 44:
+        return 44100;
+    case 48:
+        return 48000;
+    default:
+        error_printf("Illegal resample frequency: %.3f kHz\n", freq);
+        return 0;
+    }
+}
+
+
+static int
+set_id3_albumart(lame_t gfp, char const* file_name)
+{
+    int ret = -1;
+    FILE *fpi = 0;
+    char *albumart = 0;
+
+    if (file_name == 0) {
+        return 0;
+    }
+    fpi = fopen(file_name, "rb");
+    if (!fpi) {
+        ret = 1;
+    }
+    else {
+        size_t size;
+
+        fseek(fpi, 0, SEEK_END);
+        size = ftell(fpi);
+        fseek(fpi, 0, SEEK_SET);
+        albumart = (char *)malloc(size);
+        if (!albumart) {
+            ret = 2;            
+        }
+        else {
+            if (fread(albumart, 1, size, fpi) != size) {
+                ret = 3;
+            }
+            else {
+                ret = id3tag_set_albumart(gfp, albumart, size) ? 4 : 0;
+            }
+            free(albumart);
+        }
+        fclose(fpi);
+    }
+    switch (ret) {
+    case 1: error_printf("Could not find: '%s'.\n", file_name); break;
+    case 2: error_printf("Insufficient memory for reading the albumart.\n"); break;
+    case 3: error_printf("Read error: '%s'.\n", file_name); break;
+    case 4: error_printf("Unsupported image: '%s'.\nSpecify JPEG/PNG/GIF image (128KB maximum)\n", file_name); break;
+    default: break;
+    }
+    return ret;
+}
+
+
+enum ID3TAG_MODE 
+{ ID3TAG_MODE_DEFAULT
+, ID3TAG_MODE_V1_ONLY
+, ID3TAG_MODE_V2_ONLY
+};
+
+/* Ugly, NOT final version */
+
+#define T_IF(str)          if ( 0 == local_strcasecmp (token,str) ) {
+#define T_ELIF(str)        } else if ( 0 == local_strcasecmp (token,str) ) {
+#define T_ELIF_INTERNAL(str)        } else if (INTERNAL_OPTS && (0 == local_strcasecmp (token,str)) ) {
+#define T_ELIF2(str1,str2) } else if ( 0 == local_strcasecmp (token,str1)  ||  0 == local_strcasecmp (token,str2) ) {
+#define T_ELSE             } else {
+#define T_END              }
+
+int
+parse_args(lame_global_flags * gfp, int argc, char **argv,
+           char *const inPath, char *const outPath, char **nogap_inPath, int *num_nogap)
+{
+    int     input_file = 0;  /* set to 1 if we parse an input file name  */
+    int     i;
+    int     autoconvert = 0;
+    double  val;
+    int     nogap = 0;
+    int     nogap_tags = 0;  /* set to 1 to use VBR tags in NOGAP mode */
+    const char *ProgramName = argv[0];
+    int     count_nogap = 0;
+    int     noreplaygain = 0; /* is RG explicitly disabled by the user */
+    int     id3tag_mode = ID3TAG_MODE_DEFAULT; 
+
+    inPath[0] = '\0';
+    outPath[0] = '\0';
+    /* turn on display options. user settings may turn them off below */
+    silent = 0;
+    ignore_tag_errors = 0;
+    brhist = 1;
+    mp3_delay = 0;
+    mp3_delay_set = 0;
+    print_clipping_info = 0;
+    disable_wav_header = 0;
+    id3tag_init(gfp);
+
+    /* process args */
+    for (i = 0; ++i < argc;) {
+        char    c;
+        char   *token;
+        char   *arg;
+        char   *nextArg;
+        int     argUsed;
+
+        token = argv[i];
+        if (*token++ == '-') {
+            argUsed = 0;
+            nextArg = i + 1 < argc ? argv[i + 1] : "";
+
+            if (!*token) { /* The user wants to use stdin and/or stdout. */
+                input_file = 1;
+                if (inPath[0] == '\0')
+                    strncpy(inPath, argv[i], PATH_MAX + 1);
+                else if (outPath[0] == '\0')
+                    strncpy(outPath, argv[i], PATH_MAX + 1);
+            }
+            if (*token == '-') { /* GNU style */
+                token++;
+
+                T_IF("resample")
+                    argUsed = 1;
+                (void) lame_set_out_samplerate(gfp, resample_rate(atof(nextArg)));
+
+                T_ELIF("vbr-old")
+                    lame_set_VBR(gfp, vbr_rh);
+
+                T_ELIF("vbr-new")
+                    lame_set_VBR(gfp, vbr_mtrh);
+
+                T_ELIF("vbr-mtrh")
+                    lame_set_VBR(gfp, vbr_mtrh);
+
+                T_ELIF("cbr")
+                    lame_set_VBR(gfp, vbr_off);
+
+                T_ELIF("abr")
+                    argUsed = 1;
+                lame_set_VBR(gfp, vbr_abr);
+                lame_set_VBR_mean_bitrate_kbps(gfp, atoi(nextArg));
+                /* values larger than 8000 are bps (like Fraunhofer), so it's strange to get 320000 bps MP3 when specifying 8000 bps MP3 */
+                if (lame_get_VBR_mean_bitrate_kbps(gfp) >= 8000)
+                    lame_set_VBR_mean_bitrate_kbps(gfp,
+                                                   (lame_get_VBR_mean_bitrate_kbps(gfp) +
+                                                    500) / 1000);
+
+                lame_set_VBR_mean_bitrate_kbps(gfp, Min(lame_get_VBR_mean_bitrate_kbps(gfp), 320));
+                lame_set_VBR_mean_bitrate_kbps(gfp, Max(lame_get_VBR_mean_bitrate_kbps(gfp), 8));
+
+                T_ELIF("r3mix")
+                    lame_set_preset(gfp, R3MIX);
+
+                T_ELIF("bitwidth")
+                    argUsed = 1;
+                in_bitwidth = atoi(nextArg);
+                
+                T_ELIF("signed")
+                    in_signed = 1;
+
+                T_ELIF("unsigned")
+                    in_signed = 0;
+
+                T_ELIF("little-endian")
+                    in_endian = ByteOrderLittleEndian;
+
+                T_ELIF("big-endian")
+                    in_endian = ByteOrderBigEndian;
+
+                T_ELIF("mp1input")
+                    input_format = sf_mp1;
+
+                T_ELIF("mp2input")
+                    input_format = sf_mp2;
+
+                T_ELIF("mp3input")
+                    input_format = sf_mp3;
+
+                T_ELIF("ogginput")
+                    error_printf("sorry, vorbis support in LAME is deprecated.\n");
+                return -1;
+
+                T_ELIF("phone")
+                    if (presets_set(gfp, 0, 0, token, ProgramName) < 0)
+                    return -1;
+                error_printf("Warning: --phone is deprecated, use --preset phone instead!");
+
+                T_ELIF("voice")
+                    if (presets_set(gfp, 0, 0, token, ProgramName) < 0)
+                    return -1;
+                error_printf("Warning: --voice is deprecated, use --preset voice instead!");
+
+                T_ELIF_INTERNAL("noshort")
+                    (void) lame_set_no_short_blocks(gfp, 1);
+
+                T_ELIF_INTERNAL("short")
+                    (void) lame_set_no_short_blocks(gfp, 0);
+
+                T_ELIF_INTERNAL("allshort")
+                    (void) lame_set_force_short_blocks(gfp, 1);
+
+
+                T_ELIF("decode")
+                    (void) lame_set_decode_only(gfp, 1);
+
+                T_ELIF("flush")
+                    flush_write = 1;
+
+                T_ELIF("decode-mp3delay")
+                    mp3_delay = atoi(nextArg);
+                mp3_delay_set = 1;
+                argUsed = 1;
+
+                T_ELIF("nores")
+                    lame_set_disable_reservoir(gfp, 1);
+
+                T_ELIF("strictly-enforce-ISO")
+                    lame_set_strict_ISO(gfp, 1);
+
+                T_ELIF("scale")
+                    argUsed = 1;
+                (void) lame_set_scale(gfp, (float) atof(nextArg));
+
+                T_ELIF("scale-l")
+                    argUsed = 1;
+                (void) lame_set_scale_left(gfp, (float) atof(nextArg));
+
+                T_ELIF("scale-r")
+                    argUsed = 1;
+                (void) lame_set_scale_right(gfp, (float) atof(nextArg));
+
+                T_ELIF("noasm")
+                    argUsed = 1;
+                if (!strcmp(nextArg, "mmx"))
+                    (void) lame_set_asm_optimizations(gfp, MMX, 0);
+                if (!strcmp(nextArg, "3dnow"))
+                    (void) lame_set_asm_optimizations(gfp, AMD_3DNOW, 0);
+                if (!strcmp(nextArg, "sse"))
+                    (void) lame_set_asm_optimizations(gfp, SSE, 0);
+
+                T_ELIF("freeformat")
+                    lame_set_free_format(gfp, 1);
+
+                T_ELIF("replaygain-fast")
+                    lame_set_findReplayGain(gfp, 1);
+
+#ifdef DECODE_ON_THE_FLY
+                T_ELIF("replaygain-accurate")
+                    lame_set_decode_on_the_fly(gfp, 1);
+                lame_set_findReplayGain(gfp, 1);
+#endif
+
+                T_ELIF("noreplaygain")
+                    noreplaygain = 1;
+                lame_set_findReplayGain(gfp, 0);
+
+
+#ifdef DECODE_ON_THE_FLY
+                T_ELIF("clipdetect")
+                    print_clipping_info = 1;
+                lame_set_decode_on_the_fly(gfp, 1);
+#endif
+
+                T_ELIF("nohist")
+                    brhist = 0;
+
+#if defined(__OS2__) || defined(WIN32)
+                T_ELIF("priority")
+                char   *endptr;
+                int     priority = (int) strtol(nextArg, &endptr, 10);
+                if (endptr != nextArg) {
+                    argUsed = 1;
+                }
+# if defined(__OS2__)
+                setOS2Priority(gfp, priority);
+# else /* WIN32 */
+                setWin32Priority(gfp, priority);
+# endif
+#endif
+
+                /* options for ID3 tag */
+                T_ELIF("tt")
+                    argUsed = 1;
+                    id3_tag(gfp, 't', TENC_RAW, nextArg);
+
+                T_ELIF("ta")
+                    argUsed = 1;
+                id3_tag(gfp, 'a', TENC_RAW, nextArg);
+
+                T_ELIF("tl")
+                    argUsed = 1;
+                id3_tag(gfp, 'l', TENC_RAW, nextArg);
+
+                T_ELIF("ty")
+                    argUsed = 1;
+                id3_tag(gfp, 'y', TENC_RAW, nextArg);
+
+                T_ELIF("tc")
+                    argUsed = 1;
+                id3_tag(gfp, 'c', TENC_RAW, nextArg);
+
+                T_ELIF("tn")
+                    int ret = id3_tag(gfp, 'n', TENC_RAW, nextArg);
+                    argUsed = 1;
+                    if (ret != 0) {
+                        if (0 == ignore_tag_errors) {
+                            if (id3tag_mode == ID3TAG_MODE_V1_ONLY) {
+                                error_printf("The track number has to be between 1 and 255 for ID3v1.\n");
+                                return -1;
+                            }
+                            else if (id3tag_mode == ID3TAG_MODE_V2_ONLY) {
+                                /* track will be stored as-is in ID3v2 case, so no problem here */
+                            }
+                            else {
+                                if (silent < 10) {
+                                    error_printf("The track number has to be between 1 and 255 for ID3v1, ignored for ID3v1.\n");
+                                }
+                            }
+                        }
+                    }
+
+                T_ELIF("tg")
+                    int ret = id3_tag(gfp, 'g', TENC_RAW, nextArg);
+                    argUsed = 1;
+                    if (ret != 0) {
+                        if (0 == ignore_tag_errors) {
+                            if (ret == -1) {
+                                error_printf("Unknown ID3v1 genre number: '%s'.\n", nextArg);
+                                return -1;
+                            }
+                            else if (ret == -2) {
+                                if (id3tag_mode == ID3TAG_MODE_V1_ONLY) {
+                                    error_printf("Unknown ID3v1 genre: '%s'.\n", nextArg);
+                                    return -1;
+                                }
+                                else if (id3tag_mode == ID3TAG_MODE_V2_ONLY) {
+                                    /* genre will be stored as-is in ID3v2 case, so no problem here */
+                                }
+                                else {
+                                    if (silent < 10) {
+                                        error_printf("Unknown ID3v1 genre: '%s'.  Setting ID3v1 genre to 'Other'\n", nextArg);
+                                    }
+                                }
+                            }
+                            else {
+                                error_printf("Internal error.\n");
+                                return -1;
+                            }
+                        }
+                    }
+
+                T_ELIF("tv")
+                    argUsed = 1;
+                    if (id3_tag(gfp, 'v', TENC_RAW, nextArg)) {
+                        if (silent < 10) {
+                            error_printf("Invalid field value: '%s'. Ignored\n", nextArg);
+                        }
+                    }
+
+                T_ELIF("ti")
+                    argUsed = 1;
+                    if (set_id3_albumart(gfp, nextArg) != 0) {
+                        if (! ignore_tag_errors) {
+                            return -1;
+                        }
+                    }
+
+                T_ELIF("ignore-tag-errors")
+                        ignore_tag_errors = 1;
+
+                T_ELIF("add-id3v2")
+                    id3tag_add_v2(gfp);
+
+                T_ELIF("id3v1-only")
+                    id3tag_v1_only(gfp);
+                    id3tag_mode = ID3TAG_MODE_V1_ONLY;
+
+                T_ELIF("id3v2-only")
+                    id3tag_v2_only(gfp);
+                    id3tag_mode = ID3TAG_MODE_V2_ONLY;
+
+                T_ELIF("space-id3v1")
+                    id3tag_space_v1(gfp);
+
+                T_ELIF("pad-id3v2")
+                    id3tag_pad_v2(gfp);
+
+                T_ELIF("pad-id3v2-size")
+                    int n = atoi(nextArg);
+                    n = n <= 128000 ? n : 128000;
+                    n = n >= 0      ? n : 0;
+                    id3tag_set_pad(gfp, n);
+                    argUsed = 1;
+
+
+                T_ELIF("genre-list")
+                    id3tag_genre_list(genre_list_handler, NULL);
+                    return -2;
+
+#ifdef HAVE_ICONV
+                    /* some experimental switches for setting ID3 tags
+                     * with proper character encodings
+                    */
+                T_ELIF("lTitle")  argUsed = 1; id3_tag(gfp, 't', TENC_LATIN1, nextArg);
+                T_ELIF("lArtist") argUsed = 1; id3_tag(gfp, 'a', TENC_LATIN1, nextArg);
+                T_ELIF("lAlbum")  argUsed = 1; id3_tag(gfp, 'l', TENC_LATIN1, nextArg);
+                T_ELIF("lGenre")  argUsed = 1; id3_tag(gfp, 'g', TENC_LATIN1, nextArg);
+                T_ELIF("lComment")argUsed = 1; id3_tag(gfp, 'c', TENC_LATIN1, nextArg);
+                T_ELIF("lFieldvalue")
+                    argUsed = 1;
+                    if (id3_tag(gfp, 'v', TENC_LATIN1, nextArg)) {
+                        if (silent < 10) {
+                            error_printf("Invalid field value: '%s'. Ignored\n", nextArg);
+                        }
+                    }
+
+                T_ELIF("uTitle")  argUsed = 1; id3_tag(gfp, 't', TENC_UCS2, nextArg);
+                T_ELIF("uArtist") argUsed = 1; id3_tag(gfp, 'a', TENC_UCS2, nextArg);
+                T_ELIF("uAlbum")  argUsed = 1; id3_tag(gfp, 'l', TENC_UCS2, nextArg);
+                T_ELIF("uGenre")  argUsed = 1; id3_tag(gfp, 'g', TENC_UCS2, nextArg);
+                T_ELIF("uComment")argUsed = 1; id3_tag(gfp, 'c', TENC_UCS2, nextArg);
+                /*
+                T_ELIF("uFieldvalue")
+                    argUsed = 1;
+                    if (id3_tag(gfp, 'v', TENC_UCS2, nextArg)) {
+                        if (silent < 10) {
+                            error_printf("Invalid field value: '%s'. Ignored\n", nextArg);
+                        }
+                    }
+                */
+#endif
+
+                T_ELIF("lowpass")
+                    val = atof(nextArg);
+                argUsed = 1;
+                if (val < 0) {
+                    lame_set_lowpassfreq(gfp, -1);
+                }
+                else {
+                    /* useful are 0.001 kHz...50 kHz, 50 Hz...50000 Hz */
+                    if (val < 0.001 || val > 50000.) {
+                        error_printf("Must specify lowpass with --lowpass freq, freq >= 0.001 kHz\n");
+                        return -1;
+                    }
+                    lame_set_lowpassfreq(gfp, (int) (val * (val < 50. ? 1.e3 : 1.e0) + 0.5));
+                }
+                
+                T_ELIF("lowpass-width")
+                    val = atof(nextArg);
+                argUsed = 1;
+                /* useful are 0.001 kHz...16 kHz, 16 Hz...50000 Hz */
+                if (val < 0.001 || val > 50000.) {
+                    error_printf
+                        ("Must specify lowpass width with --lowpass-width freq, freq >= 0.001 kHz\n");
+                    return -1;
+                }
+                lame_set_lowpasswidth(gfp, (int) (val * (val < 16. ? 1.e3 : 1.e0) + 0.5));
+
+                T_ELIF("highpass")
+                    val = atof(nextArg);
+                argUsed = 1;
+                if (val < 0.0) {
+                    lame_set_highpassfreq(gfp, -1);
+                }
+                else {
+                    /* useful are 0.001 kHz...16 kHz, 16 Hz...50000 Hz */
+                    if (val < 0.001 || val > 50000.) {
+                        error_printf("Must specify highpass with --highpass freq, freq >= 0.001 kHz\n");
+                        return -1;
+                    }
+                    lame_set_highpassfreq(gfp, (int) (val * (val < 16. ? 1.e3 : 1.e0) + 0.5));
+                }
+                
+                T_ELIF("highpass-width")
+                    val = atof(nextArg);
+                argUsed = 1;
+                /* useful are 0.001 kHz...16 kHz, 16 Hz...50000 Hz */
+                if (val < 0.001 || val > 50000.) {
+                    error_printf
+                        ("Must specify highpass width with --highpass-width freq, freq >= 0.001 kHz\n");
+                    return -1;
+                }
+                lame_set_highpasswidth(gfp, (int) val);
+
+                T_ELIF("comp")
+                    argUsed = 1;
+                val = atof(nextArg);
+                if (val < 1.0) {
+                    error_printf("Must specify compression ratio >= 1.0\n");
+                    return -1;
+                }
+                lame_set_compression_ratio(gfp, (float) val);
+
+                T_ELIF("notemp")
+                    (void) lame_set_useTemporal(gfp, 0);
+
+                T_ELIF("interch")
+                    argUsed = 1;
+                (void) lame_set_interChRatio(gfp, (float) atof(nextArg));
+
+                T_ELIF("temporal-masking")
+                    argUsed = 1;
+                (void) lame_set_useTemporal(gfp, atoi(nextArg) ? 1 : 0);
+
+                T_ELIF("nspsytune")
+                    ;
+
+                T_ELIF("nssafejoint")
+                    lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
+
+                T_ELIF("nsmsfix")
+                    argUsed = 1;
+                (void) lame_set_msfix(gfp, atof(nextArg));
+
+                T_ELIF("ns-bass")
+                    argUsed = 1;
+                {
+                    double  d;
+                    int     k;
+                    d = atof(nextArg);
+                    k = (int) (d * 4);
+                    if (k < -32)
+                        k = -32;
+                    if (k > 31)
+                        k = 31;
+                    if (k < 0)
+                        k += 64;
+                    lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 2));
+                }
+
+                T_ELIF("ns-alto")
+                    argUsed = 1;
+                {
+                    double  d;
+                    int     k;
+                    d = atof(nextArg);
+                    k = (int) (d * 4);
+                    if (k < -32)
+                        k = -32;
+                    if (k > 31)
+                        k = 31;
+                    if (k < 0)
+                        k += 64;
+                    lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 8));
+                }
+
+                T_ELIF("ns-treble")
+                    argUsed = 1;
+                {
+                    double  d;
+                    int     k;
+                    d = atof(nextArg);
+                    k = (int) (d * 4);
+                    if (k < -32)
+                        k = -32;
+                    if (k > 31)
+                        k = 31;
+                    if (k < 0)
+                        k += 64;
+                    lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 14));
+                }
+
+                T_ELIF("ns-sfb21")
+                    /*  to be compatible with Naoki's original code,
+                     *  ns-sfb21 specifies how to change ns-treble for sfb21 */
+                    argUsed = 1;
+                {
+                    double  d;
+                    int     k;
+                    d = atof(nextArg);
+                    k = (int) (d * 4);
+                    if (k < -32)
+                        k = -32;
+                    if (k > 31)
+                        k = 31;
+                    if (k < 0)
+                        k += 64;
+                    lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 20));
+                }
+
+                T_ELIF("nspsytune2") {
+                }
+
+                /* some more GNU-ish options could be added
+                 * brief         => few messages on screen (name, status report)
+                 * o/output file => specifies output filename
+                 * O             => stdout
+                 * i/input file  => specifies input filename
+                 * I             => stdin
+                 */
+                T_ELIF2("quiet", "silent")
+                    silent = 10; /* on a scale from 1 to 10 be very silent */
+
+                T_ELIF("brief")
+                    silent = -5; /* print few info on screen */
+
+                T_ELIF("verbose")
+                    silent = -10; /* print a lot on screen */
+
+                T_ELIF2("version", "license")
+                    print_license(stdout);
+                return -2;
+
+                T_ELIF2("help", "usage")
+                    short_help(gfp, stdout, ProgramName);
+                return -2;
+
+                T_ELIF("longhelp")
+                    long_help(gfp, stdout, ProgramName, 0 /* lessmode=NO */ );
+                return -2;
+
+                T_ELIF("?")
+#ifdef __unix__
+                FILE   *fp = popen("less -Mqc", "w");
+                long_help(gfp, fp, ProgramName, 0 /* lessmode=NO */ );
+                pclose(fp);
+#else
+                    long_help(gfp, stdout, ProgramName, 1 /* lessmode=YES */ );
+#endif
+                return -2;
+
+                T_ELIF2("preset", "alt-preset")
+                    argUsed = 1;
+                {
+                    int     fast = 0, cbr = 0;
+
+                    while ((strcmp(nextArg, "fast") == 0) || (strcmp(nextArg, "cbr") == 0)) {
+
+                        if ((strcmp(nextArg, "fast") == 0) && (fast < 1))
+                            fast = 1;
+                        if ((strcmp(nextArg, "cbr") == 0) && (cbr < 1))
+                            cbr = 1;
+
+                        argUsed++;
+                        nextArg = i + argUsed < argc ? argv[i + argUsed] : "";
+                    }
+
+                    if (presets_set(gfp, fast, cbr, nextArg, ProgramName) < 0)
+                        return -1;
+                }
+
+                T_ELIF("disptime")
+                    argUsed = 1;
+                update_interval = (float) atof(nextArg);
+
+                T_ELIF("nogaptags")
+                    nogap_tags = 1;
+
+                T_ELIF("nogapout")
+                    strcpy(outPath, nextArg);
+                argUsed = 1;
+
+                T_ELIF("nogap")
+                    nogap = 1;
+
+
+                T_ELIF_INTERNAL("tune") /*without helptext */
+                    argUsed = 1;
+                {
+                    extern void lame_set_tune(lame_t, float);
+                    lame_set_tune(gfp, (float) atof(nextArg));
+                }
+
+                T_ELIF_INTERNAL("shortthreshold") {
+                    float   x, y;
+                    int     n = sscanf(nextArg, "%f,%f", &x, &y);
+                    if (n == 1) {
+                        y = x;
+                    }
+                    argUsed = 1;
+                    (void) lame_set_short_threshold(gfp, x, y);
+                }
+
+                T_ELIF_INTERNAL("maskingadjust") /*without helptext */
+                    argUsed = 1;
+                (void) lame_set_maskingadjust(gfp, (float) atof(nextArg));
+
+                T_ELIF_INTERNAL("maskingadjustshort") /*without helptext */
+                    argUsed = 1;
+                (void) lame_set_maskingadjust_short(gfp, (float) atof(nextArg));
+
+                T_ELIF_INTERNAL("athcurve") /*without helptext */
+                    argUsed = 1;
+                (void) lame_set_ATHcurve(gfp, (float) atof(nextArg));
+
+                T_ELIF_INTERNAL("no-preset-tune") /*without helptext */
+                    (void) lame_set_preset_notune(gfp, 0);
+
+                T_ELIF_INTERNAL("substep")
+                    argUsed = 1;
+                (void) lame_set_substep(gfp, atoi(nextArg));
+
+                T_ELIF_INTERNAL("sbgain") /*without helptext */
+                    argUsed = 1;
+                (void) lame_set_subblock_gain(gfp, atoi(nextArg));
+
+                T_ELIF_INTERNAL("sfscale") /*without helptext */
+                    (void) lame_set_sfscale(gfp, 1);
+
+                T_ELIF_INTERNAL("noath")
+                    (void) lame_set_noATH(gfp, 1);
+
+                T_ELIF_INTERNAL("athonly")
+                    (void) lame_set_ATHonly(gfp, 1);
+
+                T_ELIF_INTERNAL("athshort")
+                    (void) lame_set_ATHshort(gfp, 1);
+
+                T_ELIF_INTERNAL("athlower")
+                    argUsed = 1;
+                (void) lame_set_ATHlower(gfp, (float) atof(nextArg));
+
+                T_ELIF_INTERNAL("athtype")
+                    argUsed = 1;
+                (void) lame_set_ATHtype(gfp, atoi(nextArg));
+
+                T_ELIF_INTERNAL("athaa-type") /*  switch for developing, no DOCU */
+                    argUsed = 1; /* once was 1:Gaby, 2:Robert, 3:Jon, else:off */
+                lame_set_athaa_type(gfp, atoi(nextArg)); /* now: 0:off else:Jon */
+
+                T_ELIF ("athaa-sensitivity")
+                    argUsed=1;
+                lame_set_athaa_sensitivity(gfp, (float) atof(nextArg));
+
+                T_ELIF_INTERNAL("debug-file") /* switch for developing, no DOCU */
+                    argUsed = 1; /* file name to print debug info into */
+                {
+                    set_debug_file(nextArg);
+                }
+
+                T_ELSE {
+                    error_printf("%s: unrecognized option --%s\n", ProgramName, token);
+                    return -1;
+                }
+                T_END   i += argUsed;
+
+            }
+            else {
+                while ((c = *token++) != '\0') {
+                    arg = *token ? token : nextArg;
+                    switch (c) {
+                    case 'm':
+                        argUsed = 1;
+
+                        switch (*arg) {
+                        case 's':
+                            (void) lame_set_mode(gfp, STEREO);
+                            break;
+                        case 'd':
+                            (void) lame_set_mode(gfp, DUAL_CHANNEL);
+                            break;
+                        case 'f':
+                            lame_set_force_ms(gfp, 1);
+                            /* FALLTHROUGH */
+                        case 'j':
+                            (void) lame_set_mode(gfp, JOINT_STEREO);
+                            break;
+                        case 'm':
+                            (void) lame_set_mode(gfp, MONO);
+                            break;
+                        case 'a':
+                            (void) lame_set_mode(gfp, JOINT_STEREO);
+                            break;
+                        default:
+                            error_printf("%s: -m mode must be s/d/j/f/m not %s\n", ProgramName,
+                                         arg);
+                            return -1;
+                        }
+                        break;
+
+                    case 'V':
+                        argUsed = 1;
+                        /* to change VBR default look in lame.h */
+                        if (lame_get_VBR(gfp) == vbr_off)
+                            lame_set_VBR(gfp, vbr_default);
+                        lame_set_VBR_quality(gfp, (float)atof(arg));
+                        break;
+                    case 'v':
+                        /* to change VBR default look in lame.h */
+                        if (lame_get_VBR(gfp) == vbr_off)
+                            lame_set_VBR(gfp, vbr_default);
+                        break;
+
+                    case 'q':
+                        argUsed = 1;
+                        {
+                            int     tmp_quality = atoi(arg);
+
+                            /* XXX should we move this into lame_set_quality()? */
+                            if (tmp_quality < 0)
+                                tmp_quality = 0;
+                            if (tmp_quality > 9)
+                                tmp_quality = 9;
+
+                            (void) lame_set_quality(gfp, tmp_quality);
+                        }
+                        break;
+                    case 'f':
+                        (void) lame_set_quality(gfp, 7);
+                        break;
+                    case 'h':
+                        (void) lame_set_quality(gfp, 2);
+                        break;
+
+                    case 's':
+                        argUsed = 1;
+                        val = atof(arg);
+                        (void) lame_set_in_samplerate(gfp,
+                                                      (int) (val * (val <= 192 ? 1.e3 : 1.e0) +
+                                                             0.5));
+                        break;
+                    case 'b':
+                        argUsed = 1;
+                        lame_set_brate(gfp, atoi(arg));
+                        lame_set_VBR_min_bitrate_kbps(gfp, lame_get_brate(gfp));
+                        break;
+                    case 'B':
+                        argUsed = 1;
+                        lame_set_VBR_max_bitrate_kbps(gfp, atoi(arg));
+                        break;
+                    case 'F':
+                        lame_set_VBR_hard_min(gfp, 1);
+                        break;
+                    case 't': /* dont write VBR tag */
+                        (void) lame_set_bWriteVbrTag(gfp, 0);
+                        disable_wav_header = 1;
+                        break;
+                    case 'T': /* do write VBR tag */
+                        (void) lame_set_bWriteVbrTag(gfp, 1);
+                        nogap_tags = 1;
+                        disable_wav_header = 0;
+                        break;
+                    case 'r': /* force raw pcm input file */
+#if defined(LIBSNDFILE)
+                        error_printf
+                            ("WARNING: libsndfile may ignore -r and perform fseek's on the input.\n"
+                             "Compile without libsndfile if this is a problem.\n");
+#endif
+                        input_format = sf_raw;
+                        break;
+                    case 'x': /* force byte swapping */
+                        swapbytes = 1;
+                        break;
+                    case 'p': /* (jo) error_protection: add crc16 information to stream */
+                        lame_set_error_protection(gfp, 1);
+                        break;
+                    case 'a': /* autoconvert input file from stereo to mono - for mono mp3 encoding */
+                        autoconvert = 1;
+                        (void) lame_set_mode(gfp, MONO);
+                        break;
+                    case 'd':   /*(void) lame_set_allow_diff_short( gfp, 1 ); */
+                    case 'k':   /*lame_set_lowpassfreq(gfp, -1);
+                                  lame_set_highpassfreq(gfp, -1); */
+                        error_printf("WARNING: -%c is obsolete.\n", c);
+                        break;
+                    case 'S':
+                        silent = 10;
+                        break;
+                    case 'X':
+                        /*  experimental switch -X:
+                            the differnt types of quant compare are tough
+                            to communicate to endusers, so they shouldn't
+                            bother to toy around with them
+                         */
+                        {
+                            int     x, y;
+                            int     n = sscanf(arg, "%d,%d", &x, &y);
+                            if (n == 1) {
+                                y = x;
+                            }
+                            argUsed = 1;
+                            if (INTERNAL_OPTS) {
+                                lame_set_quant_comp(gfp, x);
+                                lame_set_quant_comp_short(gfp, y);
+                            }
+                        }
+                        break;
+                    case 'Y':
+                        lame_set_experimentalY(gfp, 1);
+                        break;
+                    case 'Z':
+                        /*  experimental switch -Z:
+                            this switch is obsolete
+                         */
+                        {
+                            int     n = 1;
+                            argUsed = sscanf(arg, "%d", &n);
+                            if (INTERNAL_OPTS) {
+                                lame_set_experimentalZ(gfp, n);
+                            }
+                        }
+                        break;
+                    case 'e':
+                        argUsed = 1;
+
+                        switch (*arg) {
+                        case 'n':
+                            lame_set_emphasis(gfp, 0);
+                            break;
+                        case '5':
+                            lame_set_emphasis(gfp, 1);
+                            break;
+                        case 'c':
+                            lame_set_emphasis(gfp, 3);
+                            break;
+                        default:
+                            error_printf("%s: -e emp must be n/5/c not %s\n", ProgramName, arg);
+                            return -1;
+                        }
+                        break;
+                    case 'c':
+                        lame_set_copyright(gfp, 1);
+                        break;
+                    case 'o':
+                        lame_set_original(gfp, 0);
+                        break;
+
+                    case '?':
+                        long_help(gfp, stdout, ProgramName, 0 /* LESSMODE=NO */ );
+                        return -1;
+
+                    default:
+                        error_printf("%s: unrecognized option -%c\n", ProgramName, c);
+                        return -1;
+                    }
+                    if (argUsed) {
+                        if (arg == token)
+                            token = ""; /* no more from token */
+                        else
+                            ++i; /* skip arg we used */
+                        arg = "";
+                        argUsed = 0;
+                    }
+                }
+            }
+        }
+        else {
+            if (nogap) {
+                if ((num_nogap != NULL) && (count_nogap < *num_nogap)) {
+                    strncpy(nogap_inPath[count_nogap++], argv[i], PATH_MAX + 1);
+                    input_file = 1;
+                }
+                else {
+                    /* sorry, calling program did not allocate enough space */
+                    error_printf
+                        ("Error: 'nogap option'.  Calling program does not allow nogap option, or\n"
+                         "you have exceeded maximum number of input files for the nogap option\n");
+                    *num_nogap = -1;
+                    return -1;
+                }
+            }
+            else {
+                /* normal options:   inputfile  [outputfile], and
+                   either one can be a '-' for stdin/stdout */
+                if (inPath[0] == '\0') {
+                    strncpy(inPath, argv[i], PATH_MAX + 1);
+                    input_file = 1;
+                }
+                else {
+                    if (outPath[0] == '\0')
+                        strncpy(outPath, argv[i], PATH_MAX + 1);
+                    else {
+                        error_printf("%s: excess arg %s\n", ProgramName, argv[i]);
+                        return -1;
+                    }
+                }
+            }
+        }
+    }                   /* loop over args */
+
+    if (!input_file) {
+        usage(Console_IO.Console_fp, ProgramName);
+        return -1;
+    }
+
+    if (inPath[0] == '-')
+        silent = (silent <= 1 ? 1 : silent);
+#ifdef WIN32
+    else
+        dosToLongFileName(inPath);
+#endif
+
+    if (outPath[0] == '\0' && count_nogap == 0) {
+        if (inPath[0] == '-') {
+            /* if input is stdin, default output is stdout */
+            strcpy(outPath, "-");
+        }
+        else {
+            strncpy(outPath, inPath, PATH_MAX + 1 - 4);
+            if (lame_get_decode_only(gfp)) {
+                strncat(outPath, ".wav", 4);
+            }
+            else {
+                strncat(outPath, ".mp3", 4);
+            }
+        }
+    }
+
+    /* RG is enabled by default */
+    if (!noreplaygain)
+        lame_set_findReplayGain(gfp, 1);
+
+    /* disable VBR tags with nogap unless the VBR tags are forced */
+    if (nogap && lame_get_bWriteVbrTag(gfp) && nogap_tags == 0) {
+        console_printf("Note: Disabling VBR Xing/Info tag since it interferes with --nogap\n");
+        lame_set_bWriteVbrTag(gfp, 0);
+    }
+
+    /* some file options not allowed with stdout */
+    if (outPath[0] == '-') {
+        (void) lame_set_bWriteVbrTag(gfp, 0); /* turn off VBR tag */
+    }
+
+    /* if user did not explicitly specify input is mp3, check file name */
+    if (input_format == sf_unknown)
+        input_format = filename_to_type(inPath);
+
+#if !(defined HAVE_MPGLIB || defined AMIGA_MPEGA)
+    if (is_mpeg_file_format(input_format)) {
+        error_printf("Error: libmp3lame not compiled with mpg123 *decoding* support \n");
+        return -1;
+    }
+#endif
+
+
+    if (input_format == sf_ogg) {
+        error_printf("sorry, vorbis support in LAME is deprecated.\n");
+        return -1;
+    }
+    /* default guess for number of channels */
+    if (autoconvert)
+        (void) lame_set_num_channels(gfp, 2);
+    else if (MONO == lame_get_mode(gfp))
+        (void) lame_set_num_channels(gfp, 1);
+    else
+        (void) lame_set_num_channels(gfp, 2);
+
+    if (lame_get_free_format(gfp)) {
+        if (lame_get_brate(gfp) < 8 || lame_get_brate(gfp) > 640) {
+            error_printf("For free format, specify a bitrate between 8 and 640 kbps\n");
+            error_printf("with the -b <bitrate> option\n");
+            return -1;
+        }
+    }
+    if (num_nogap != NULL)
+        *num_nogap = count_nogap;
+    return 0;
+}
+
+
+/* end of parse.c */
diff --git a/frontend/parse.h b/frontend/parse.h
new file mode 100644
index 0000000..cde4553
--- /dev/null
+++ b/frontend/parse.h
@@ -0,0 +1,13 @@
+
+int     usage(FILE * const fp, const char *ProgramName);
+int     short_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName);
+int     long_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName,
+                  int lessmode);
+int     display_bitrates(FILE * const fp);
+
+int     parse_args(lame_global_flags * gfp, int argc, char **argv, char *const inPath,
+                   char *const outPath, char **nogap_inPath, int *max_nogap);
+
+void    parse_close();
+
+/* end of parse.h */
diff --git a/frontend/portableio.c b/frontend/portableio.c
new file mode 100644
index 0000000..61c1d30
--- /dev/null
+++ b/frontend/portableio.c
@@ -0,0 +1,490 @@
+/* Copyright (C) 1988-1991 Apple Computer, Inc.
+ * All Rights Reserved.
+ *
+ * Warranty Information
+ * Even though Apple has reviewed this software, Apple makes no warranty
+ * or representation, either express or implied, with respect to this
+ * software, its quality, accuracy, merchantability, or fitness for a
+ * particular purpose.  As a result, this software is provided "as is,"
+ * and you, its user, are assuming the entire risk as to its quality
+ * and accuracy.
+ *
+ * This code may be used and freely distributed as long as it includes
+ * this copyright notice and the warranty information.
+ *
+ *
+ * Motorola processors (Macintosh, Sun, Sparc, MIPS, etc)
+ * pack bytes from high to low (they are big-endian).
+ * Use the HighLow routines to match the native format
+ * of these machines.
+ *
+ * Intel-like machines (PCs, Sequent)
+ * pack bytes from low to high (the are little-endian).
+ * Use the LowHigh routines to match the native format
+ * of these machines.
+ *
+ * These routines have been tested on the following machines:
+ *	Apple Macintosh, MPW 3.1 C compiler
+ *	Apple Macintosh, THINK C compiler
+ *	Silicon Graphics IRIS, MIPS compiler
+ *	Cray X/MP and Y/MP
+ *	Digital Equipment VAX
+ *
+ *
+ * Implemented by Malcolm Slaney and Ken Turkowski.
+ *
+ * Malcolm Slaney contributions during 1988-1990 include big- and little-
+ * endian file I/O, conversion to and from Motorola's extended 80-bit
+ * floating-point format, and conversions to and from IEEE single-
+ * precision floating-point format.
+ *
+ * In 1991, Ken Turkowski implemented the conversions to and from
+ * IEEE double-precision format, added more precision to the extended
+ * conversions, and accommodated conversions involving +/- infinity,
+ * NaN's, and denormalized numbers.
+ *
+ * $Id: portableio.c,v 1.13 2007/10/14 19:54:32 robert Exp $
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include	<stdio.h>
+#if defined(__riscos__) && defined(FPA10)
+#include	"ymath.h"
+#else
+#include	<math.h>
+#endif
+#include	"portableio.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/****************************************************************
+ * Big/little-endian independent I/O routines.
+ ****************************************************************/
+
+/*
+ * It is a hoax to call this code portable-IO:
+ * 
+ *   - It doesn't work on machines with CHAR_BIT != 8
+ *   - it also don't test this error condition
+ *   - otherwise it tries to handle CHAR_BIT != 8 by things like 
+ *     masking 'putc(i&0xff,fp)'
+ *   - It doesn't handle EOF in any way
+ *   - it only works with ints with 32 or more bits
+ *   - It is a collection of initial buggy code with patching the known errors
+ *     instead of CORRECTING them! 
+ *     For that see comments on the old Read16BitsHighLow()
+ */
+
+#ifdef KLEMM_36
+
+signed int
+ReadByte(FILE * fp)
+{
+    int     result = getc(fp);
+    return result == EOF ? 0 : (signed char) (result & 0xFF);
+}
+
+unsigned int
+ReadByteUnsigned(FILE * fp)
+{
+    int     result = getc(fp);
+    return result == EOF ? 0 : (unsigned char) (result & 0xFF);
+}
+
+#else
+
+int
+ReadByte(FILE * fp)
+{
+    int     result;
+
+    result = getc(fp) & 0xff;
+    if (result & 0x80)
+        result = result - 0x100;
+    return result;
+}
+
+#endif
+
+#ifdef KLEMM_36
+
+int
+Read16BitsLowHigh(FILE * fp)
+{
+    int     low = ReadByteUnsigned(fp);
+    int     high = ReadByte(fp);
+
+    return (high << 8) | low;
+}
+
+#else
+int
+Read16BitsLowHigh(FILE * fp)
+{
+    int     first, second, result;
+
+    first = 0xff & getc(fp);
+    second = 0xff & getc(fp);
+
+    result = (second << 8) + first;
+#ifndef	THINK_C42
+    if (result & 0x8000)
+        result = result - 0x10000;
+#endif /* THINK_C */
+    return (result);
+}
+#endif
+
+
+#ifdef KLEMM_36
+
+int
+Read16BitsHighLow(FILE * fp)
+{
+    int     high = ReadByte(fp);
+    int     low = ReadByteUnsigned(fp);
+
+    return (high << 8) | low;
+}
+
+#else
+int
+Read16BitsHighLow(FILE * fp)
+{
+    int     first, second, result;
+
+    /* Reads the High bits, the value is -128...127 
+     * (which gave after upscaling the -32768...+32512
+     * Why this value is not converted to signed char?
+     */
+    first = 0xff & getc(fp);
+    /* Reads the Lows bits, the value is 0...255 
+     * This is correct. This value gives an additional offset
+     * for the High bits
+     */
+    second = 0xff & getc(fp);
+
+    /* This is right */
+    result = (first << 8) + second;
+
+    /* Now we are starting to correct the nasty bug of the first instruction
+     * The value of the high bits is wrong. Always. So we must correct this
+     * value. This seems to be not necessary for THINK_C42. This is either
+     * a 16 bit compiler with 16 bit ints (where this bug is hidden and 0x10000
+     * is not in the scope of an int) or it is not a C compiler, but only a
+     * C like compiler. In the first case the '#ifndef THINK_C42' is wrong
+     * because it's not a property of the THINK_C42 compiler, but of all compilers
+     * with sizeof(int)*CHAR_BIT < 18.
+     * Another nasty thing is that the rest of the code doesn't work for 16 bit ints,
+     * so this patch don't solve the 16 bit problem.
+     */
+#ifndef	THINK_C42
+    if (result & 0x8000)
+        result = result - 0x10000;
+#endif /* THINK_C */
+    return (result);
+}
+#endif
+
+void
+Write8Bits(FILE * fp, int i)
+{
+    putc(i & 0xff, fp);
+}
+
+
+void
+Write16BitsLowHigh(FILE * fp, int i)
+{
+    putc(i & 0xff, fp);
+    putc((i >> 8) & 0xff, fp);
+}
+
+
+void
+Write16BitsHighLow(FILE * fp, int i)
+{
+    putc((i >> 8) & 0xff, fp);
+    putc(i & 0xff, fp);
+}
+
+#ifdef KLEMM_36
+
+int
+Read24BitsHighLow(FILE * fp)
+{
+    int     high = ReadByte(fp);
+    int     med = ReadByteUnsigned(fp);
+    int     low = ReadByteUnsigned(fp);
+
+    return (high << 16) | (med << 8) | low;
+}
+
+#else
+int
+Read24BitsHighLow(FILE * fp)
+{
+    int     first, second, third;
+    int     result;
+
+    first = 0xff & getc(fp);
+    second = 0xff & getc(fp);
+    third = 0xff & getc(fp);
+
+    result = (first << 16) + (second << 8) + third;
+    if (result & 0x800000)
+        result = result - 0x1000000;
+    return (result);
+}
+#endif
+
+#define	Read32BitsLowHigh(f)	Read32Bits(f)
+
+#ifdef KLEMM_36
+
+int
+Read32Bits(FILE * fp)
+{
+    int     low = ReadByteUnsigned(fp);
+    int     medl = ReadByteUnsigned(fp);
+    int     medh = ReadByteUnsigned(fp);
+    int     high = ReadByte(fp);
+
+    return (high << 24) | (medh << 16) | (medl << 8) | low;
+}
+
+#else
+
+int
+Read32Bits(FILE * fp)
+{
+    int     first, second, result;
+
+    first = 0xffff & Read16BitsLowHigh(fp);
+    second = 0xffff & Read16BitsLowHigh(fp);
+
+    result = (second << 16) + first;
+#ifdef	CRAY
+    if (result & 0x80000000)
+        result = result - 0x100000000;
+#endif /* CRAY */
+    return (result);
+}
+#endif
+
+
+#ifdef KLEMM_36
+
+int
+Read32BitsHighLow(FILE * fp)
+{
+    int     high = ReadByte(fp);
+    int     medh = ReadByteUnsigned(fp);
+    int     medl = ReadByteUnsigned(fp);
+    int     low = ReadByteUnsigned(fp);
+
+    return (high << 24) | (medh << 16) | (medl << 8) | low;
+}
+
+#else
+
+int
+Read32BitsHighLow(FILE * fp)
+{
+    int     first, second, result;
+
+    first = 0xffff & Read16BitsHighLow(fp);
+    second = 0xffff & Read16BitsHighLow(fp);
+
+    result = (first << 16) + second;
+#ifdef	CRAY
+    if (result & 0x80000000)
+        result = result - 0x100000000;
+#endif
+    return (result);
+}
+
+#endif
+
+void
+Write32Bits(FILE * fp, int i)
+{
+    Write16BitsLowHigh(fp, (int) (i & 0xffffL));
+    Write16BitsLowHigh(fp, (int) ((i >> 16) & 0xffffL));
+}
+
+
+void
+Write32BitsLowHigh(FILE * fp, int i)
+{
+    Write16BitsLowHigh(fp, (int) (i & 0xffffL));
+    Write16BitsLowHigh(fp, (int) ((i >> 16) & 0xffffL));
+}
+
+
+void
+Write32BitsHighLow(FILE * fp, int i)
+{
+    Write16BitsHighLow(fp, (int) ((i >> 16) & 0xffffL));
+    Write16BitsHighLow(fp, (int) (i & 0xffffL));
+}
+
+#ifdef KLEMM_36
+void
+ReadBytes(FILE * fp, char *p, int n)
+{
+    memset(p, 0, n);
+    fread(p, 1, n, fp);
+}
+#else
+void
+ReadBytes(FILE * fp, char *p, int n)
+{
+    /* What about fread? */
+
+    while (!feof(fp) & (n-- > 0))
+        *p++ = getc(fp);
+}
+#endif
+
+void
+ReadBytesSwapped(FILE * fp, char *p, int n)
+{
+    register char *q = p;
+
+    /* What about fread? */
+
+    while (!feof(fp) & (n-- > 0))
+        *q++ = getc(fp);
+
+    /* If not all bytes could be read, the resorting is different
+     * from the normal resorting. Is this intention or another bug?
+     */
+    for (q--; p < q; p++, q--) {
+        n = *p;
+        *p = *q;
+        *q = n;
+    }
+}
+
+#ifdef KLEMM_36
+void
+WriteBytes(FILE * fp, char *p, int n)
+{
+    /* return n == */
+    fwrite(p, 1, n, fp);
+}
+#else
+void
+WriteBytes(FILE * fp, char *p, int n)
+{
+    /* No error condition checking */
+    while (n-- > 0)
+        putc(*p++, fp);
+}
+#endif
+#ifdef KLEMM_36
+void
+WriteBytesSwapped(FILE * fp, char *p, int n)
+{
+    p += n;
+    while (n-- > 0)
+        putc(*--p, fp);
+}
+#else
+void
+WriteBytesSwapped(FILE * fp, char *p, int n)
+{
+    p += n - 1;
+    while (n-- > 0)
+        putc(*p--, fp);
+}
+#endif
+
+
+
+/****************************************************************
+ * The following two routines make up for deficiencies in many
+ * compilers to convert properly between unsigned integers and
+ * floating-point.  Some compilers which have this bug are the
+ * THINK_C compiler for the Macintosh and the C compiler for the
+ * Silicon Graphics MIPS-based Iris.
+ ****************************************************************/
+
+#ifdef applec           /* The Apple C compiler works */
+# define FloatToUnsigned(f)	((unsigned long)(f))
+# define UnsignedToFloat(u)	((double)(u))
+#else /* applec */
+# define FloatToUnsigned(f)	((unsigned long)(((long)((f) - 2147483648.0)) + 2147483647L + 1))
+# define UnsignedToFloat(u)	(((double)((long)((u) - 2147483647L - 1))) + 2147483648.0)
+#endif /* applec */
+/****************************************************************
+ * Extended precision IEEE floating-point conversion routines
+ ****************************************************************/
+
+static double
+ConvertFromIeeeExtended(char *bytes)
+{
+    double  f;
+    long    expon;
+    unsigned long hiMant, loMant;
+
+#ifdef	TEST
+    printf("ConvertFromIEEEExtended(%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx,%lx\r",
+           (long) bytes[0], (long) bytes[1], (long) bytes[2], (long) bytes[3],
+           (long) bytes[4], (long) bytes[5], (long) bytes[6],
+           (long) bytes[7], (long) bytes[8], (long) bytes[9]);
+#endif
+
+    expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF);
+    hiMant = ((unsigned long) (bytes[2] & 0xFF) << 24)
+        | ((unsigned long) (bytes[3] & 0xFF) << 16)
+        | ((unsigned long) (bytes[4] & 0xFF) << 8)
+        | ((unsigned long) (bytes[5] & 0xFF));
+    loMant = ((unsigned long) (bytes[6] & 0xFF) << 24)
+        | ((unsigned long) (bytes[7] & 0xFF) << 16)
+        | ((unsigned long) (bytes[8] & 0xFF) << 8)
+        | ((unsigned long) (bytes[9] & 0xFF));
+
+    /* This case should also be called if the number is below the smallest
+     * positive double variable */
+    if (expon == 0 && hiMant == 0 && loMant == 0) {
+        f = 0;
+    }
+    else {
+        /* This case should also be called if the number is too large to fit into 
+         * a double variable */
+
+        if (expon == 0x7FFF) { /* Infinity or NaN */
+            f = HUGE_VAL;
+        }
+        else {
+            expon -= 16383;
+            f = ldexp(UnsignedToFloat(hiMant), (int) (expon -= 31));
+            f += ldexp(UnsignedToFloat(loMant), (int) (expon -= 32));
+        }
+    }
+
+    if (bytes[0] & 0x80)
+        return -f;
+    else
+        return f;
+}
+
+
+
+
+
+double
+ReadIeeeExtendedHighLow(FILE * fp)
+{
+    char    bytes[10];
+
+    ReadBytes(fp, bytes, 10);
+    return ConvertFromIeeeExtended(bytes);
+}
diff --git a/frontend/portableio.h b/frontend/portableio.h
new file mode 100644
index 0000000..c24abc6
--- /dev/null
+++ b/frontend/portableio.h
@@ -0,0 +1,91 @@
+#ifndef LAME_PORTABLEIO_H
+#define LAME_PORTABLEIO_H
+/* Copyright (C) 1988-1991 Apple Computer, Inc.
+ * All Rights Reserved.
+ *
+ * Warranty Information
+ * Even though Apple has reviewed this software, Apple makes no warranty
+ * or representation, either express or implied, with respect to this
+ * software, its quality, accuracy, merchantability, or fitness for a 
+ * particular purpose.  As a result, this software is provided "as is,"
+ * and you, its user, are assuming the entire risk as to its quality
+ * and accuracy.
+ *
+ * This code may be used and freely distributed as long as it includes
+ * this copyright notice and the warranty information.
+ *
+ * Machine-independent I/O routines for 8-, 16-, 24-, and 32-bit integers.
+ *
+ * Motorola processors (Macintosh, Sun, Sparc, MIPS, etc)
+ * pack bytes from high to low (they are big-endian).
+ * Use the HighLow routines to match the native format
+ * of these machines.
+ *
+ * Intel-like machines (PCs, Sequent)
+ * pack bytes from low to high (the are little-endian).
+ * Use the LowHigh routines to match the native format
+ * of these machines.
+ *
+ * These routines have been tested on the following machines:
+ *	Apple Macintosh, MPW 3.1 C compiler
+ *	Apple Macintosh, THINK C compiler
+ *	Silicon Graphics IRIS, MIPS compiler
+ *	Cray X/MP and Y/MP
+ *	Digital Equipment VAX
+ *
+ *
+ * Implemented by Malcolm Slaney and Ken Turkowski.
+ *
+ * Malcolm Slaney contributions during 1988-1990 include big- and little-
+ * endian file I/O, conversion to and from Motorola's extended 80-bit
+ * floating-point format, and conversions to and from IEEE single-
+ * precision floating-point format.
+ *
+ * In 1991, Ken Turkowski implemented the conversions to and from
+ * IEEE double-precision format, added more precision to the extended
+ * conversions, and accommodated conversions involving +/- infinity,
+ * NaN's, and denormalized numbers.
+ *
+ * $Id: portableio.h,v 1.4 2005/11/01 13:01:57 robert Exp $
+ */
+
+#include	<stdio.h>
+
+#ifndef	__cplusplus
+# define	CLINK
+#else
+# define	CLINK "C"
+#endif
+
+extern CLINK int ReadByte(FILE * fp);
+extern CLINK int Read16BitsLowHigh(FILE * fp);
+extern CLINK int Read16BitsHighLow(FILE * fp);
+extern CLINK void Write8Bits(FILE * fp, int i);
+extern CLINK void Write16BitsLowHigh(FILE * fp, int i);
+extern CLINK void Write16BitsHighLow(FILE * fp, int i);
+extern CLINK int Read24BitsHighLow(FILE * fp);
+extern CLINK int Read32Bits(FILE * fp);
+extern CLINK int Read32BitsHighLow(FILE * fp);
+extern CLINK void Write32Bits(FILE * fp, int i);
+extern CLINK void Write32BitsLowHigh(FILE * fp, int i);
+extern CLINK void Write32BitsHighLow(FILE * fp, int i);
+extern CLINK void ReadBytes(FILE * fp, char *p, int n);
+extern CLINK void ReadBytesSwapped(FILE * fp, char *p, int n);
+extern CLINK void WriteBytes(FILE * fp, char *p, int n);
+extern CLINK void WriteBytesSwapped(FILE * fp, char *p, int n);
+extern CLINK double ReadIeeeFloatHighLow(FILE * fp);
+extern CLINK double ReadIeeeFloatLowHigh(FILE * fp);
+extern CLINK double ReadIeeeDoubleHighLow(FILE * fp);
+extern CLINK double ReadIeeeDoubleLowHigh(FILE * fp);
+extern CLINK double ReadIeeeExtendedHighLow(FILE * fp);
+extern CLINK double ReadIeeeExtendedLowHigh(FILE * fp);
+extern CLINK void WriteIeeeFloatLowHigh(FILE * fp, double num);
+extern CLINK void WriteIeeeFloatHighLow(FILE * fp, double num);
+extern CLINK void WriteIeeeDoubleLowHigh(FILE * fp, double num);
+extern CLINK void WriteIeeeDoubleHighLow(FILE * fp, double num);
+extern CLINK void WriteIeeeExtendedLowHigh(FILE * fp, double num);
+extern CLINK void WriteIeeeExtendedHighLow(FILE * fp, double num);
+
+#define	Read32BitsLowHigh(f)	Read32Bits(f)
+#define WriteString(f,s)	fwrite(s,strlen(s),sizeof(char),f)
+#endif
diff --git a/frontend/rtp.c b/frontend/rtp.c
new file mode 100644
index 0000000..b914a63
--- /dev/null
+++ b/frontend/rtp.c
@@ -0,0 +1,385 @@
+/* $Id: rtp.c,v 1.16.8.1 2008/08/05 14:16:06 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#ifndef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+#pragma alloca
+#  else
+#   ifndef alloca       /* predefined by HP cc +Olibcalls */
+char   *alloca();
+#   endif
+#  endif
+# endif
+#endif
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+struct rtpbits {
+    int     sequence:16;     /* sequence number: random */
+    int     pt:7;            /* payload type: 14 for MPEG audio */
+    int     m:1;             /* marker: 0 */
+    int     cc:4;            /* number of CSRC identifiers: 0 */
+    int     x:1;             /* number of extension headers: 0 */
+    int     p:1;             /* is there padding appended: 0 */
+    int     v:2;             /* version: 2 */
+};
+
+struct rtpheader {           /* in network byte order */
+    struct rtpbits b;
+    int     timestamp;       /* start: random */
+    int     ssrc;            /* random */
+    int     iAudioHeader;    /* =0?! */
+};
+
+void
+initrtp(struct rtpheader *foo)
+{
+    foo->b.v = 2;
+    foo->b.p = 0;
+    foo->b.x = 0;
+    foo->b.cc = 0;
+    foo->b.m = 0;
+    foo->b.pt = 14;     /* MPEG Audio */
+#ifdef FEFE
+    foo->b.sequence = 42;
+    foo->timestamp = 0;
+#else
+    foo->b.sequence = rand() & 65535;
+    foo->timestamp = rand();
+#endif
+    foo->ssrc = rand();
+    foo->iAudioHeader = 0;
+}
+
+int
+sendrtp(int fd, struct sockaddr_in *sSockAddr, struct rtpheader *foo, const void *data, int len)
+{
+    char   *buf = alloca(len + sizeof(struct rtpheader));
+    int    *cast = (int *) foo;
+    int    *outcast = (int *) buf;
+    outcast[0] = htonl(cast[0]);
+    outcast[1] = htonl(cast[1]);
+    outcast[2] = htonl(cast[2]);
+    outcast[3] = htonl(cast[3]);
+    memmove(buf + sizeof(struct rtpheader), data, len);
+    return sendto(fd, buf, len + sizeof(*foo), 0,
+                  (struct sockaddr *) sSockAddr, sizeof(*sSockAddr));
+/*  return write(fd,buf,len+sizeof(*foo))==len+sizeof(*foo); */
+}
+
+/* create a sender socket. */
+int
+makesocket(char *szAddr, unsigned short port, unsigned char TTL, struct sockaddr_in *sSockAddr)
+{
+    int     iRet, iLoop = 1;
+    struct sockaddr_in sin;
+    unsigned char cTtl = TTL;
+    char    cLoop = 0;
+    unsigned int tempaddr;
+
+    int     iSocket = socket(AF_INET, SOCK_DGRAM, 0);
+    if (iSocket < 0) {
+        error_printf("socket() failed.\n");
+        exit(1);
+    }
+
+    tempaddr = inet_addr(szAddr);
+    sSockAddr->sin_family = sin.sin_family = AF_INET;
+    sSockAddr->sin_port = sin.sin_port = htons(port);
+    sSockAddr->sin_addr.s_addr = tempaddr;
+
+    iRet = setsockopt(iSocket, SOL_SOCKET, SO_REUSEADDR, &iLoop, sizeof(int));
+    if (iRet < 0) {
+        error_printf("setsockopt SO_REUSEADDR failed\n");
+        exit(1);
+    }
+
+    if ((ntohl(tempaddr) >> 28) == 0xe) {
+        /* only set multicast parameters for multicast destination IPs */
+        iRet = setsockopt(iSocket, IPPROTO_IP, IP_MULTICAST_TTL, &cTtl, sizeof(char));
+        if (iRet < 0) {
+            error_printf("setsockopt IP_MULTICAST_TTL failed.  multicast in kernel?\n");
+            exit(1);
+        }
+
+        cLoop = 1;      /* !? */
+        iRet = setsockopt(iSocket, IPPROTO_IP, IP_MULTICAST_LOOP, &cLoop, sizeof(char));
+        if (iRet < 0) {
+            error_printf("setsockopt IP_MULTICAST_LOOP failed.  multicast in kernel?\n");
+            exit(1);
+        }
+    }
+
+    return iSocket;
+}
+
+
+
+
+#if 0
+/* */
+/* code contributed by Anonymous source.  Supposed to be much better */
+/* then original code, but only seems to run on windows with MSVC.   */
+/* and I cannot test it */
+/* */
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+struct rtpbits {
+    int     sequence:16;     /* sequence number: random */
+    int     pt:7;            /* payload type: 14 for MPEG audio */
+    int     m:1;             /* marker: 0 */
+    int     cc:4;            /* number of CSRC identifiers: 0 */
+    int     x:1;             /* number of extension headers: 0 */
+    int     p:1;             /* is there padding appended: 0 */
+    int     v:2;             /* version: 2 */
+};
+
+struct rtpheader {           /* in network byte order */
+    struct rtpbits b;
+    int     timestamp;       /* start: random */
+    int     ssrc;            /* random */
+    int     iAudioHeader;    /* =0?! */
+};
+
+void
+rtp_initialization(struct rtpheader *foo)
+{
+    foo->b.v = 2;
+    foo->b.p = 0;
+    foo->b.x = 0;
+    foo->b.cc = 0;
+    foo->b.m = 0;
+    foo->b.pt = 14;     /* MPEG Audio */
+#ifdef FEFE
+    foo->b.sequence = 42;
+    foo->timestamp = 0;
+#else
+    foo->b.sequence = rand() & 65535;
+    foo->timestamp = rand();
+#endif
+    foo->ssrc = rand();
+    foo->iAudioHeader = 0;
+}
+
+int
+rtp_send(SOCKET s, struct rtpheader *foo, void *data, int len)
+{
+    char   *buffer = malloc(len + sizeof(struct rtpheader));
+    int    *cast = (int *) foo;
+    int    *outcast = (int *) buffer;
+    int     count, size;
+
+    outcast[0] = htonl(cast[0]);
+    outcast[1] = htonl(cast[1]);
+    outcast[2] = htonl(cast[2]);
+    outcast[3] = htonl(cast[3]);
+    memmove(buffer + sizeof(struct rtpheader), data, len);
+/*    return sendto (fd,buf,len+sizeof(*foo),0,(struct sockaddr *)sSockAddr,sizeof(*sSockAddr)); */
+/*  return write(fd,buf,len+sizeof(*foo))==len+sizeof(*foo); */
+    size = len + sizeof(*foo);
+    count = send(s, buffer, size, 0);
+    free(buffer);
+
+    return count != size;
+}
+
+/* create a sender socket. */
+int
+rtp_socket(SOCKET * ps, char *address, unsigned short port, int TTL)
+{
+/*    int iRet ; */
+    int     iLoop = 1;
+/*    struct  sockaddr_in sin ; */
+    char    cTTL = (char) TTL;
+    char    cLoop = 0;
+/*    unsigned int tempaddr ; */
+    BOOL    True = TRUE;
+    INT     error;
+    char   *c = "";
+    UINT    ip;
+    PHOSTENT host;
+    SOCKET  s;
+    SOCKADDR_IN source, dest;
+#if 0
+    int     s = socket(AF_INET, SOCK_DGRAM, 0);
+    if (s < 0) {
+        error_printf("socket() failed.\n");
+        exit(1);
+    }
+
+    tempaddr = inet_addr(address);
+    sSockAddr->sin_family = sin.sin_family = AF_INET;
+    sSockAddr->sin_port = sin.sin_port = htons(port);
+    sSockAddr->sin_addr.s_addr = tempaddr;
+
+    iRet = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &iLoop, sizeof(int));
+    if (iRet < 0) {
+        error_printf("setsockopt SO_REUSEADDR failed\n");
+        exit(1);
+    }
+
+    if ((ntohl(tempaddr) >> 28) == 0xe) {
+        /* only set multicast parameters for multicast destination IPs */
+        iRet = setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &cTTL, sizeof(char));
+        if (iRet < 0) {
+            error_printf("setsockopt IP_MULTICAST_TTL failed.    multicast in kernel?\n");
+            exit(1);
+        }
+
+        cLoop = 1;      /* !? */
+        iRet = setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &cLoop, sizeof(char));
+        if (iRet < 0) {
+            error_printf("setsockopt IP_MULTICAST_LOOP failed.    multicast in kernel?\n");
+            exit(1);
+        }
+    }
+#endif
+    source.sin_family = AF_INET;
+    source.sin_addr.s_addr = htonl(INADDR_ANY);
+    source.sin_port = htons(0);
+
+    dest.sin_family = AF_INET;
+    dest.sin_addr.s_addr = inet_addr(address);
+
+    if (!strcmp(address, "255.255.255.255")) {
+    }
+    else if (dest.sin_addr.s_addr == INADDR_NONE) {
+        host = gethostbyname(address);
+
+        if (host) {
+            dest.sin_addr = *(PIN_ADDR) host->h_addr;
+        }
+        else {
+            printf("Unknown host %s\r\n", address);
+            return 1;
+        }
+    }
+
+    dest.sin_port = htons((u_short) port);
+
+    ip = ntohl(dest.sin_addr.s_addr);
+
+    if (IN_CLASSA(ip))
+        c = "class A";
+    if (IN_CLASSB(ip))
+        c = "class B";
+    if (IN_CLASSC(ip))
+        c = "class C";
+    if (IN_CLASSD(ip))
+        c = "class D";
+    if (ip == INADDR_LOOPBACK)
+        c = "loopback";
+    if (ip == INADDR_BROADCAST)
+        c = "broadcast";
+
+    s = socket(AF_INET, SOCK_DGRAM, PF_UNSPEC);
+
+    if (s == INVALID_SOCKET) {
+        error = WSAGetLastError();
+        printf("socket () error %d\r\n", error);
+        return error;
+    }
+
+    error = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &True, sizeof(BOOL));
+
+    error = bind(s, (struct sockaddr *) &source, sizeof(source));
+
+    if (error == SOCKET_ERROR) {
+        error = WSAGetLastError();
+        printf("bind () error %d\r\n", error);
+        closesocket(s);
+        return error;
+    }
+
+    if (ip == INADDR_BROADCAST) {
+        printf("broadcast %s:%u %s\r\n", inet_ntoa(dest.sin_addr), ntohs(dest.sin_port), c);
+
+        error = setsockopt(s, SOL_SOCKET, SO_BROADCAST, (const char *)
+                           &True, sizeof(BOOL));
+
+        if (error == SOCKET_ERROR) {
+            error = WSAGetLastError();
+            printf("setsockopt (%u, SOL_SOCKET, SO_BROADCAST, ...) error %d\r\n", s, error);
+            closesocket(s);
+            return error;
+        }
+    }
+
+    if (IN_CLASSD(ip)) {
+        printf("multicast %s:%u %s\r\n", inet_ntoa(dest.sin_addr), ntohs(dest.sin_port), c);
+
+/*        error = setsockopt (s, IPPROTO_IP, IP_MULTICAST_TTL, (const char *) &TTL, sizeof (int)) ; */
+        error = setsockopt(s, IPPROTO_IP, 3, (const char *) &TTL, sizeof(int));
+
+        if (error == SOCKET_ERROR) {
+            error = WSAGetLastError();
+            printf("setsockopt (%u, IPPROTO_IP, IP_MULTICAST_TTL, ...) error %d\r\n", s, error);
+            closesocket(s);
+            return error;
+        }
+    }
+
+    error = connect(s, (PSOCKADDR) & dest, sizeof(SOCKADDR_IN));
+
+    if (error == SOCKET_ERROR) {
+        printf("connect: error %d\n", WSAGetLastError());
+        closesocket(s);
+        return error;
+    }
+
+    *ps = s;
+
+    return 0;
+}
+
+
+
+#endif
diff --git a/frontend/rtp.h b/frontend/rtp.h
new file mode 100644
index 0000000..ce641b7
--- /dev/null
+++ b/frontend/rtp.h
@@ -0,0 +1,38 @@
+#ifndef LAME_RTP_H
+#define LAME_RTP_H
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+struct rtpbits {
+    int     sequence:16;     /* sequence number: random */
+    int     pt:7;            /* payload type: 14 for MPEG audio */
+    int     m:1;             /* marker: 0 */
+    int     cc:4;            /* number of CSRC identifiers: 0 */
+    int     x:1;             /* number of extension headers: 0 */
+    int     p:1;             /* is there padding appended: 0 */
+    int     v:2;             /* version: 2 */
+};
+
+struct rtpheader {           /* in network byte order */
+    struct rtpbits b;
+    int     timestamp;       /* start: random */
+    int     ssrc;            /* random */
+    int     iAudioHeader;    /* =0?! */
+};
+
+void    initrtp(struct rtpheader *foo);
+int     sendrtp(int fd, struct sockaddr_in *sSockAddr, struct rtpheader *foo, const void *data,
+                int len);
+int     makesocket(char *szAddr, unsigned short port, unsigned char TTL,
+                   struct sockaddr_in *sSockAddr);
+void    rtp_output(const char *mp3buffer, int mp3size);
+
+#if 0
+int     rtp_send(SOCKET s, struct rtpheader *foo, void *data, int len);
+
+int     rtp_socket(SOCKET * ps, char *Address, unsigned short port, int TTL);
+#endif
+
+
+#endif
diff --git a/frontend/timestatus.c b/frontend/timestatus.c
new file mode 100644
index 0000000..8152381
--- /dev/null
+++ b/frontend/timestatus.c
@@ -0,0 +1,348 @@
+/*
+ *      time status related function source file
+ *
+ *      Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: timestatus.c,v 1.46 2008/04/12 18:18:06 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+/* Hope it works now, otherwise complain or flame ;-)
+ */
+
+
+#if 1
+# define SPEED_CHAR     "x" /* character x */
+# define SPEED_MULT     1.
+#else
+# define SPEED_CHAR     "%%"
+# define SPEED_MULT     100.
+#endif
+
+#include <assert.h>
+#include <time.h>
+#include <string.h>
+
+#include "lame.h"
+#include "main.h"
+#include "lametime.h"
+#include "timestatus.h"
+
+#if defined(BRHIST)
+# include "brhist.h"
+#endif
+#include "console.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+typedef struct {
+    double  last_time;       /* result of last call to clock */
+    double  elapsed_time;    /* total time */
+    double  estimated_time;  /* estimated total duration time [s] */
+    double  speed_index;     /* speed relative to realtime coding [100%] */
+} timestatus_t;
+
+/*
+ *  Calculates from the input (see below) the following values:
+ *    - total estimated time
+ *    - a speed index
+ */
+
+static void
+ts_calc_times(timestatus_t * const tstime, /* tstime->elapsed_time: elapsed time */
+              const int sample_freq, /* sample frequency [Hz/kHz]  */
+              const int frameNum, /* Number of the current Frame */
+              const int totalframes, /* total umber of Frames */
+              const int framesize)
+{                       /* Size of a frame [bps/kbps] */
+    assert(sample_freq >= 8000 && sample_freq <= 48000);
+
+    if (frameNum > 0 && tstime->elapsed_time > 0) {
+        tstime->estimated_time = tstime->elapsed_time * totalframes / frameNum;
+        tstime->speed_index = framesize * frameNum / (sample_freq * tstime->elapsed_time);
+    }
+    else {
+        tstime->estimated_time = 0.;
+        tstime->speed_index = 0.;
+    }
+}
+
+/* Decomposes a given number of seconds into a easy to read hh:mm:ss format
+ * padded with an additional character
+ */
+
+static void
+ts_time_decompose(const unsigned long time_in_sec, const char padded_char)
+{
+    const unsigned long hour = time_in_sec / 3600;
+    const unsigned int min = time_in_sec / 60 % 60;
+    const unsigned int sec = time_in_sec % 60;
+
+    if (hour == 0)
+        console_printf("   %2u:%02u%c", min, sec, padded_char);
+    else if (hour < 100)
+        console_printf("%2lu:%02u:%02u%c", hour, min, sec, padded_char);
+    else
+        console_printf("%6lu h%c", hour, padded_char);
+}
+
+static void
+timestatus(const lame_global_flags * const gfp)
+{
+    static timestatus_t real_time;
+    static timestatus_t proc_time;
+    int     percent;
+    static int init = 0;     /* What happens here? A work around instead of a bug fix ??? */
+    double  tmx, delta;
+    int samp_rate     = lame_get_out_samplerate(gfp)
+      , frameNum      = lame_get_frameNum(gfp)
+      , totalframes   = lame_get_totalframes(gfp)
+      , framesize     = lame_get_framesize(gfp)
+      ;
+
+    if (totalframes < frameNum) {
+        totalframes = frameNum;
+    }
+    if (frameNum == 0) {
+        real_time.last_time = GetRealTime();
+        proc_time.last_time = GetCPUTime();
+        real_time.elapsed_time = 0;
+        proc_time.elapsed_time = 0;
+    }
+
+    /* we need rollover protection for GetCPUTime, and maybe GetRealTime(): */
+    tmx = GetRealTime();
+    delta = tmx - real_time.last_time;
+    if (delta < 0)
+        delta = 0;      /* ignore, clock has rolled over */
+    real_time.elapsed_time += delta;
+    real_time.last_time = tmx;
+
+
+    tmx = GetCPUTime();
+    delta = tmx - proc_time.last_time;
+    if (delta < 0)
+        delta = 0;      /* ignore, clock has rolled over */
+    proc_time.elapsed_time += delta;
+    proc_time.last_time = tmx;
+
+    if (frameNum == 0 && init == 0) {
+        console_printf("\r"
+                       "    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA \n"
+                       "     0/       ( 0%%)|    0:00/     :  |    0:00/     :  |         "
+                       SPEED_CHAR "|     :  \r"
+                       /* , Console_IO.str_clreoln, Console_IO.str_clreoln */ );
+        init = 1;
+        return;
+    }
+    /* reset init counter for next time we are called with frameNum==0 */
+    if (frameNum > 0)
+        init = 0;
+
+    ts_calc_times(&real_time, samp_rate, frameNum, totalframes, framesize);
+    ts_calc_times(&proc_time, samp_rate, frameNum, totalframes, framesize);
+
+    if (frameNum < totalframes) {
+        percent = (int) (100. * frameNum / totalframes + 0.5);
+    }
+    else {
+        percent = 100;
+    }
+
+    console_printf("\r%6i/%-6i", frameNum, totalframes);
+    console_printf(percent < 100 ? " (%2d%%)|" : "(%3.3d%%)|", percent);
+    ts_time_decompose((unsigned long) proc_time.elapsed_time, '/');
+    ts_time_decompose((unsigned long) proc_time.estimated_time, '|');
+    ts_time_decompose((unsigned long) real_time.elapsed_time, '/');
+    ts_time_decompose((unsigned long) real_time.estimated_time, '|');
+    console_printf(proc_time.speed_index <= 1. ?
+                   "%9.4f" SPEED_CHAR "|" : "%#9.5g" SPEED_CHAR "|",
+                   SPEED_MULT * proc_time.speed_index);
+    ts_time_decompose((unsigned long) (real_time.estimated_time - real_time.elapsed_time), ' ');
+}
+
+static void
+timestatus_finish(void)
+{
+    console_printf("\n");
+}
+
+
+void
+encoder_progress_begin( lame_global_flags const* gf
+                      , char              const* inPath
+                      , char              const* outPath
+                      )
+{
+    if (silent < 10) {
+        lame_print_config(gf); /* print useful information about options being used */
+
+        console_printf("Encoding %s%s to %s\n",
+                       strcmp(inPath, "-") ? inPath : "<stdin>",
+                       strlen(inPath) + strlen(outPath) < 66 ? "" : "\n     ",
+                       strcmp(outPath, "-") ? outPath : "<stdout>");
+
+        console_printf("Encoding as %g kHz ", 1.e-3 * lame_get_out_samplerate(gf));
+
+        {
+            static const char *mode_names[2][4] = {
+                {"stereo", "j-stereo", "dual-ch", "single-ch"},
+                {"stereo", "force-ms", "dual-ch", "single-ch"}
+            };
+            switch (lame_get_VBR(gf)) {
+            case vbr_rh:
+                console_printf("%s MPEG-%u%s Layer III VBR(q=%g) qval=%i\n",
+                               mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)],
+                               2 - lame_get_version(gf),
+                               lame_get_out_samplerate(gf) < 16000 ? ".5" : "",
+                               lame_get_VBR_quality(gf),
+                               lame_get_quality(gf));
+                break;
+            case vbr_mt:
+            case vbr_mtrh:
+                console_printf("%s MPEG-%u%s Layer III VBR(q=%g)\n",
+                               mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)],
+                               2 - lame_get_version(gf),
+                               lame_get_out_samplerate(gf) < 16000 ? ".5" : "",
+                               lame_get_VBR_quality(gf));
+                break;
+            case vbr_abr:
+                console_printf("%s MPEG-%u%s Layer III (%gx) average %d kbps qval=%i\n",
+                               mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)],
+                               2 - lame_get_version(gf),
+                               lame_get_out_samplerate(gf) < 16000 ? ".5" : "",
+                               0.1 * (int) (10. * lame_get_compression_ratio(gf) + 0.5),
+                               lame_get_VBR_mean_bitrate_kbps(gf),
+                               lame_get_quality(gf));
+                break;
+            default:
+                console_printf("%s MPEG-%u%s Layer III (%gx) %3d kbps qval=%i\n",
+                               mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)],
+                               2 - lame_get_version(gf),
+                               lame_get_out_samplerate(gf) < 16000 ? ".5" : "",
+                               0.1 * (int) (10. * lame_get_compression_ratio(gf) + 0.5),
+                               lame_get_brate(gf),
+                               lame_get_quality(gf));
+                break;
+            }
+        }
+
+        if (silent <= -10) {
+            lame_print_internals(gf);
+        }
+    }
+}
+
+void
+encoder_progress( lame_global_flags const* gf )
+{
+    if (silent <= 0) {
+        int const frames = lame_get_frameNum(gf);
+        if (update_interval <= 0) {     /*  most likely --disptime x not used */
+            if ((frames % 100) != 0) {  /*  true, most of the time */
+                return;
+            }
+        }
+        else {
+            static double last_time = 0.0;
+            if (frames != 0 && frames != 9) {
+                double const act = GetRealTime();
+                double const dif = act - last_time;
+                if (dif >= 0 && dif < update_interval) {
+                    return;
+                }
+            }
+            last_time = GetRealTime(); /* from now! disp_time seconds */
+        }
+#ifdef BRHIST
+        if (brhist) {
+            brhist_jump_back();
+        }
+#endif
+        timestatus(gf);
+#ifdef BRHIST
+        if (brhist) {
+            brhist_disp(gf);
+        }
+#endif
+        console_flush();
+    }
+}
+
+void
+encoder_progress_end( lame_global_flags const* gf )
+{
+    if (silent <= 0) {
+#ifdef BRHIST
+        if (brhist) {
+            brhist_jump_back();
+        }
+#endif
+        timestatus(gf);
+#ifdef BRHIST
+        if (brhist) {
+            brhist_disp(gf);
+        }
+#endif
+        timestatus_finish();
+    }
+}
+
+
+/* these functions are used in get_audio.c */
+
+void
+decoder_progress(const mp3data_struct * const mp3data)
+{
+    static int last;
+    console_printf("\rFrame#%6i/%-6i %3i kbps",
+                   mp3data->framenum, mp3data->totalframes, mp3data->bitrate);
+
+    /* Programmed with a single frame hold delay */
+    /* Attention: static data */
+
+    /* MP2 Playback is still buggy. */
+    /* "'00' subbands 4-31 in intensity_stereo, bound==4" */
+    /* is this really intensity_stereo or is it MS stereo? */
+
+    if (mp3data->mode == JOINT_STEREO) {
+        int     curr = mp3data->mode_ext;
+        console_printf("  %s  %c",
+                       curr & 2 ? last & 2 ? " MS " : "LMSR" : last & 2 ? "LMSR" : "L  R",
+                       curr & 1 ? last & 1 ? 'I' : 'i' : last & 1 ? 'i' : ' ');
+        last = curr;
+    }
+    else {
+        console_printf("         ");
+        last = 0;
+    }
+/*    console_printf ("%s", Console_IO.str_clreoln ); */
+    console_printf("        \b\b\b\b\b\b\b\b");
+}
+
+void
+decoder_progress_finish()
+{
+    console_printf("\n");
+}
diff --git a/frontend/timestatus.h b/frontend/timestatus.h
new file mode 100644
index 0000000..30cc59b
--- /dev/null
+++ b/frontend/timestatus.h
@@ -0,0 +1,34 @@
+/*
+ *	time status related function include file
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_TIMESTATUS_H
+#define LAME_TIMESTATUS_H
+
+void    encoder_progress_begin( lame_global_flags const*    gfp
+                              , char const*                 inpath
+                              , char const*                 outpath );
+void    encoder_progress( lame_global_flags const* gfp );
+void    encoder_progress_end(lame_global_flags const* gfp);
+
+void    decoder_progress(const mp3data_struct * const);
+void    decoder_progress_finish();
+
+#endif /* LAME_TIMESTATUS_H */
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..680a68a
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,8 @@
+## $Id: Makefile.am,v 1.2.16.1 2010/02/26 03:40:57 robert Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+pkginclude_HEADERS = lame.h
+
+EXTRA_DIST = \
+	lame.def
diff --git a/include/Makefile.in b/include/Makefile.in
new file mode 100644
index 0000000..0ae0247
--- /dev/null
+++ b/include/Makefile.in
@@ -0,0 +1,433 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/Makefile.am.global
+subdir = include
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkgincludedir)"
+pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(pkginclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = lame.def
+pkginclude_HEADERS = lame.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  include/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
+	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
+	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	done
+
+uninstall-pkgincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(pkgincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkgincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool ctags distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-pkgincludeHEADERS install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/include/lame.def b/include/lame.def
new file mode 100644
index 0000000..de9d6dd
--- /dev/null
+++ b/include/lame.def
@@ -0,0 +1,286 @@
+LIBRARY  libmp3lame.DLL
+EXPORTS
+
+lame_init		@1
+
+lame_set_num_samples	@2
+lame_get_num_samples	@3
+
+lame_set_in_samplerate	@4
+lame_get_in_samplerate	@5
+
+lame_set_num_channels	@6
+lame_get_num_channels	@7
+
+lame_set_scale		@8
+lame_get_scale		@9
+
+lame_set_scale_left	@10
+lame_get_scale_left	@11
+
+lame_set_scale_right	@12
+lame_get_scale_right	@13
+
+lame_set_out_samplerate	@14
+lame_get_out_samplerate	@15
+
+lame_set_analysis	@16
+lame_get_analysis	@17
+
+lame_set_bWriteVbrTag	@18
+lame_get_bWriteVbrTag	@19
+
+lame_set_decode_only	@20
+lame_get_decode_only	@21
+
+lame_set_quality	@22
+lame_get_quality	@23
+
+lame_set_mode		@24
+lame_get_mode		@25
+
+lame_set_force_ms	@26
+lame_get_force_ms	@27
+
+lame_set_free_format	@28
+lame_get_free_format	@29
+
+
+lame_set_findReplayGain	@30
+lame_get_findReplayGain	@31
+
+lame_set_decode_on_the_fly	@32
+lame_get_decode_on_the_fly	@33
+
+lame_set_nogap_total	@34
+lame_get_nogap_total	@35
+
+lame_set_nogap_currentindex	@36
+lame_get_nogap_currentindex	@37
+
+
+lame_set_errorf		@38
+lame_set_debugf		@39
+lame_set_msgf		@40
+
+lame_set_brate		@41
+lame_get_brate		@42
+ 
+lame_set_compression_ratio	@43
+lame_get_compression_ratio	@44
+
+lame_set_preset		@45
+
+lame_set_asm_optimizations	@46
+
+
+lame_set_copyright	@47
+lame_get_copyright	@48
+
+lame_set_original	@49
+lame_get_original	@50
+
+lame_set_error_protection	@51
+lame_get_error_protection	@52
+
+lame_set_padding_type	@53
+lame_get_padding_type	@54
+
+lame_set_extension	@55
+lame_get_extension	@56
+
+lame_set_strict_ISO	@57
+lame_get_strict_ISO	@58
+
+lame_set_disable_reservoir	@59
+lame_get_disable_reservoir	@60
+
+lame_set_quant_comp	@61
+lame_get_quant_comp	@62
+lame_set_quant_comp_short	@63
+lame_get_quant_comp_short	@64
+
+lame_set_experimentalX	@65
+lame_get_experimentalX	@66
+
+lame_set_experimentalY	@67
+lame_get_experimentalY	@68
+
+lame_set_experimentalZ	@69
+lame_get_experimentalZ	@70
+
+lame_set_exp_nspsytune	@71
+lame_get_exp_nspsytune	@72
+
+lame_set_msfix		@73
+lame_get_msfix		@74
+
+lame_set_VBR		@75
+lame_get_VBR		@76
+
+lame_set_VBR_q		@77
+lame_get_VBR_q		@78
+
+lame_set_VBR_mean_bitrate_kbps	@79
+lame_get_VBR_mean_bitrate_kbps	@80
+
+lame_set_VBR_min_bitrate_kbps	@81
+lame_get_VBR_min_bitrate_kbps	@82
+
+lame_set_VBR_max_bitrate_kbps	@83
+lame_get_VBR_max_bitrate_kbps	@84
+
+lame_set_VBR_hard_min	@85
+lame_get_VBR_hard_min	@86
+
+lame_set_preset_expopts	@87
+
+lame_set_lowpassfreq	@88
+lame_get_lowpassfreq	@89
+
+lame_set_lowpasswidth	@90
+lame_get_lowpasswidth	@91
+
+lame_set_highpassfreq	@92
+lame_get_highpassfreq	@93
+
+lame_set_highpasswidth	@94
+lame_get_highpasswidth	@95
+
+lame_set_ATHonly	@96
+lame_get_ATHonly	@97
+
+lame_set_ATHshort	@98
+lame_get_ATHshort	@99
+
+lame_set_noATH		@100
+lame_get_noATH		@101
+
+lame_set_ATHtype	@102
+lame_get_ATHtype	@103
+
+lame_set_ATHlower	@104
+lame_get_ATHlower	@105
+
+lame_set_athaa_type	@106
+lame_get_athaa_type	@107
+
+lame_set_athaa_loudapprox	@108
+lame_get_athaa_loudapprox	@109
+
+lame_set_athaa_sensitivity	@110
+lame_get_athaa_sensitivity	@111
+
+lame_set_cwlimit	@112
+lame_get_cwlimit	@113
+
+lame_set_useTemporal	@114
+lame_get_useTemporal	@115
+
+lame_set_interChRatio	@116
+lame_get_interChRatio	@117
+
+lame_set_no_short_blocks	@118
+lame_get_no_short_blocks	@119
+lame_set_force_short_blocks	@120
+lame_get_force_short_blocks	@121
+lame_set_allow_diff_short	@122
+lame_get_allow_diff_short	@123
+
+lame_set_emphasis	@124
+lame_get_emphasis	@125
+
+lame_get_version	@126
+lame_get_encoder_delay	@127
+lame_get_encoder_padding	@128
+lame_get_framesize	@129
+
+lame_get_mf_samples_to_encode	@130
+lame_get_size_mp3buffer	@131
+lame_get_frameNum	@132
+lame_get_totalframes	@133
+
+lame_get_RadioGain	@134
+lame_get_AudiophileGain	@135
+lame_get_PeakSample	@136
+lame_get_noclipGainChange	@137
+lame_get_noclipScale	@138
+
+lame_init_params	@139
+
+get_lame_version	@140
+get_lame_short_version @141
+get_lame_very_short_version	@142
+get_psy_version		@143        
+get_lame_url		@144           
+
+get_lame_version_numerical	@145
+
+lame_print_config	@146
+lame_print_internals	@147
+
+lame_encode_buffer	@148
+lame_encode_buffer_interleaved	@149
+lame_encode_buffer_float	@150
+lame_encode_buffer_long	@151
+lame_encode_buffer_long2	@152
+lame_encode_buffer_int	@153
+lame_encode_flush	@154
+lame_encode_flush_nogap	@155
+
+lame_init_bitstream	@156
+
+lame_bitrate_hist	@157
+lame_bitrate_kbps	@158
+lame_stereo_mode_hist	@159
+lame_bitrate_stereo_mode_hist	@160
+lame_block_type_hist	@161
+lame_bitrate_block_type_hist	@162
+lame_mp3_tags_fid	@163
+lame_close		@164
+lame_get_lametag_frame	@165
+get_lame_os_bitness	@166
+lame_set_VBR_quality	@167
+lame_get_VBR_quality	@168
+
+
+bitrate_table		@500
+samplerate_table	@501
+
+lame_decode_init	@1000
+lame_decode		@1001
+lame_decode_headers	@1002
+lame_decode1		@1003
+lame_decode1_headers	@1004
+lame_decode1_headersB	@1005
+lame_decode_exit	@1006
+
+hip_decode_init	@1100
+hip_decode_exit	@1101
+hip_decode		@1102
+hip_decode_headers	@1103
+hip_decode1		@1104
+hip_decode1_headers	@1105
+hip_decode1_headersB	@1106
+
+id3tag_genre_list	@2000
+id3tag_init   		@2001
+id3tag_add_v2   	@2002
+id3tag_v1_only  	@2003
+id3tag_v2_only  	@2004
+id3tag_space_v1 	@2005
+id3tag_pad_v2   	@2006
+id3tag_set_title	@2007
+id3tag_set_artist	@2008
+id3tag_set_album	@2009
+id3tag_set_year		@2010
+id3tag_set_comment	@2011
+id3tag_set_track	@2012
+id3tag_set_genre	@2013
+id3tag_set_fieldvalue	@2014
+id3tag_set_albumart	@2015
+lame_get_id3v1_tag	@2016
+lame_get_id3v2_tag	@2017
+lame_set_write_id3tag_automatic	@2018
+lame_get_write_id3tag_automatic	@2019
+id3tag_set_pad	@2020
diff --git a/include/lame.h b/include/lame.h
new file mode 100644
index 0000000..0550b4b
--- /dev/null
+++ b/include/lame.h
@@ -0,0 +1,1243 @@
+/*
+ *	Interface to MP3 LAME encoding engine
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: lame.h,v 1.170.2.4 2009/01/18 15:44:28 robert Exp $ */
+
+#ifndef LAME_LAME_H
+#define LAME_LAME_H
+
+/* for size_t typedef */
+#include <stddef.h>
+/* for va_list typedef */
+#include <stdarg.h>
+/* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */
+#include <stdio.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#if defined(WIN32) || defined(_WIN32)
+#undef CDECL
+#define CDECL __cdecl
+#else
+#define CDECL
+#endif
+
+
+#define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1
+
+
+typedef enum vbr_mode_e {
+  vbr_off=0,
+  vbr_mt,               /* obsolete, same as vbr_mtrh */
+  vbr_rh,
+  vbr_abr,
+  vbr_mtrh,
+  vbr_max_indicator,    /* Don't use this! It's used for sanity checks.       */
+  vbr_default=vbr_mtrh    /* change this to change the default VBR mode of LAME */
+} vbr_mode;
+
+
+/* MPEG modes */
+typedef enum MPEG_mode_e {
+  STEREO = 0,
+  JOINT_STEREO,
+  DUAL_CHANNEL,   /* LAME doesn't supports this! */
+  MONO,
+  NOT_SET,
+  MAX_INDICATOR   /* Don't use this! It's used for sanity checks. */
+} MPEG_mode;
+
+/* Padding types */
+typedef enum Padding_type_e {
+  PAD_NO = 0,
+  PAD_ALL,
+  PAD_ADJUST,
+  PAD_MAX_INDICATOR   /* Don't use this! It's used for sanity checks. */
+} Padding_type;
+
+
+
+/*presets*/
+typedef enum preset_mode_e {
+    /*values from 8 to 320 should be reserved for abr bitrates*/
+    /*for abr I'd suggest to directly use the targeted bitrate as a value*/
+    ABR_8 = 8,
+    ABR_320 = 320,
+
+    V9 = 410, /*Vx to match Lame and VBR_xx to match FhG*/
+    VBR_10 = 410,
+    V8 = 420,
+    VBR_20 = 420,
+    V7 = 430,
+    VBR_30 = 430,
+    V6 = 440,
+    VBR_40 = 440,
+    V5 = 450,
+    VBR_50 = 450,
+    V4 = 460,
+    VBR_60 = 460,
+    V3 = 470,
+    VBR_70 = 470,
+    V2 = 480,
+    VBR_80 = 480,
+    V1 = 490,
+    VBR_90 = 490,
+    V0 = 500,
+    VBR_100 = 500,
+
+
+
+    /*still there for compatibility*/
+    R3MIX = 1000,
+    STANDARD = 1001,
+    EXTREME = 1002,
+    INSANE = 1003,
+    STANDARD_FAST = 1004,
+    EXTREME_FAST = 1005,
+    MEDIUM = 1006,
+    MEDIUM_FAST = 1007
+} preset_mode;
+
+
+/*asm optimizations*/
+typedef enum asm_optimizations_e {
+    MMX = 1,
+    AMD_3DNOW = 2,
+    SSE = 3
+} asm_optimizations;
+
+
+/* psychoacoustic model */
+typedef enum Psy_model_e {
+    PSY_GPSYCHO = 1,
+    PSY_NSPSYTUNE = 2
+} Psy_model;
+
+
+struct lame_global_struct;
+typedef struct lame_global_struct lame_global_flags;
+typedef lame_global_flags *lame_t;
+
+
+
+
+/***********************************************************************
+ *
+ *  The LAME API
+ *  These functions should be called, in this order, for each
+ *  MP3 file to be encoded.  See the file "API" for more documentation
+ *
+ ***********************************************************************/
+
+
+/*
+ * REQUIRED:
+ * initialize the encoder.  sets default for all encoder parameters,
+ * returns NULL if some malloc()'s failed
+ * otherwise returns pointer to structure needed for all future
+ * API calls.
+ */
+lame_global_flags * CDECL lame_init(void);
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/* obsolete version */
+int CDECL lame_init_old(lame_global_flags *);
+#endif
+
+/*
+ * OPTIONAL:
+ * set as needed to override defaults
+ */
+
+/********************************************************************
+ *  input stream description
+ ***********************************************************************/
+/* number of samples.  default = 2^32-1   */
+int CDECL lame_set_num_samples(lame_global_flags *, unsigned long);
+unsigned long CDECL lame_get_num_samples(const lame_global_flags *);
+
+/* input sample rate in Hz.  default = 44100hz */
+int CDECL lame_set_in_samplerate(lame_global_flags *, int);
+int CDECL lame_get_in_samplerate(const lame_global_flags *);
+
+/* number of channels in input stream. default=2  */
+int CDECL lame_set_num_channels(lame_global_flags *, int);
+int CDECL lame_get_num_channels(const lame_global_flags *);
+
+/*
+  scale the input by this amount before encoding.  default=0 (disabled)
+  (not used by decoding routines)
+*/
+int CDECL lame_set_scale(lame_global_flags *, float);
+float CDECL lame_get_scale(const lame_global_flags *);
+
+/*
+  scale the channel 0 (left) input by this amount before encoding.
+    default=0 (disabled)
+  (not used by decoding routines)
+*/
+int CDECL lame_set_scale_left(lame_global_flags *, float);
+float CDECL lame_get_scale_left(const lame_global_flags *);
+
+/*
+  scale the channel 1 (right) input by this amount before encoding.
+    default=0 (disabled)
+  (not used by decoding routines)
+*/
+int CDECL lame_set_scale_right(lame_global_flags *, float);
+float CDECL lame_get_scale_right(const lame_global_flags *);
+
+/*
+  output sample rate in Hz.  default = 0, which means LAME picks best value
+  based on the amount of compression.  MPEG only allows:
+  MPEG1    32, 44.1,   48khz
+  MPEG2    16, 22.05,  24
+  MPEG2.5   8, 11.025, 12
+  (not used by decoding routines)
+*/
+int CDECL lame_set_out_samplerate(lame_global_flags *, int);
+int CDECL lame_get_out_samplerate(const lame_global_flags *);
+
+
+/********************************************************************
+ *  general control parameters
+ ***********************************************************************/
+/* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */
+int CDECL lame_set_analysis(lame_global_flags *, int);
+int CDECL lame_get_analysis(const lame_global_flags *);
+
+/*
+  1 = write a Xing VBR header frame.
+  default = 1
+  this variable must have been added by a Hungarian notation Windows programmer :-)
+*/
+int CDECL lame_set_bWriteVbrTag(lame_global_flags *, int);
+int CDECL lame_get_bWriteVbrTag(const lame_global_flags *);
+
+/* 1=decode only.  use lame/mpglib to convert mp3/ogg to wav.  default=0 */
+int CDECL lame_set_decode_only(lame_global_flags *, int);
+int CDECL lame_get_decode_only(const lame_global_flags *);
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/* 1=encode a Vorbis .ogg file.  default=0 */
+/* DEPRECATED */
+int CDECL lame_set_ogg(lame_global_flags *, int);
+int CDECL lame_get_ogg(const lame_global_flags *);
+#endif
+
+/*
+  internal algorithm selection.  True quality is determined by the bitrate
+  but this variable will effect quality by selecting expensive or cheap algorithms.
+  quality=0..9.  0=best (very slow).  9=worst.
+  recommended:  2     near-best quality, not too slow
+                5     good quality, fast
+                7     ok quality, really fast
+*/
+int CDECL lame_set_quality(lame_global_flags *, int);
+int CDECL lame_get_quality(const lame_global_flags *);
+
+/*
+  mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono
+  default: lame picks based on compression ration and input channels
+*/
+int CDECL lame_set_mode(lame_global_flags *, MPEG_mode);
+MPEG_mode CDECL lame_get_mode(const lame_global_flags *);
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/*
+  mode_automs.  Use a M/S mode with a switching threshold based on
+  compression ratio
+  DEPRECATED
+*/
+int CDECL lame_set_mode_automs(lame_global_flags *, int);
+int CDECL lame_get_mode_automs(const lame_global_flags *);
+#endif
+
+/*
+  force_ms.  Force M/S for all frames.  For testing only.
+  default = 0 (disabled)
+*/
+int CDECL lame_set_force_ms(lame_global_flags *, int);
+int CDECL lame_get_force_ms(const lame_global_flags *);
+
+/* use free_format?  default = 0 (disabled) */
+int CDECL lame_set_free_format(lame_global_flags *, int);
+int CDECL lame_get_free_format(const lame_global_flags *);
+
+/* perform ReplayGain analysis?  default = 0 (disabled) */
+int CDECL lame_set_findReplayGain(lame_global_flags *, int);
+int CDECL lame_get_findReplayGain(const lame_global_flags *);
+
+/* decode on the fly. Search for the peak sample. If the ReplayGain
+ * analysis is enabled then perform the analysis on the decoded data
+ * stream. default = 0 (disabled)
+ * NOTE: if this option is set the build-in decoder should not be used */
+int CDECL lame_set_decode_on_the_fly(lame_global_flags *, int);
+int CDECL lame_get_decode_on_the_fly(const lame_global_flags *);
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/* DEPRECATED: now does the same as lame_set_findReplayGain()
+   default = 0 (disabled) */
+int CDECL lame_set_ReplayGain_input(lame_global_flags *, int);
+int CDECL lame_get_ReplayGain_input(const lame_global_flags *);
+
+/* DEPRECATED: now does the same as
+   lame_set_decode_on_the_fly() && lame_set_findReplayGain()
+   default = 0 (disabled) */
+int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int);
+int CDECL lame_get_ReplayGain_decode(const lame_global_flags *);
+
+/* DEPRECATED: now does the same as lame_set_decode_on_the_fly()
+   default = 0 (disabled) */
+int CDECL lame_set_findPeakSample(lame_global_flags *, int);
+int CDECL lame_get_findPeakSample(const lame_global_flags *);
+#endif
+
+/* counters for gapless encoding */
+int CDECL lame_set_nogap_total(lame_global_flags*, int);
+int CDECL lame_get_nogap_total(const lame_global_flags*);
+
+int CDECL lame_set_nogap_currentindex(lame_global_flags* , int);
+int CDECL lame_get_nogap_currentindex(const lame_global_flags*);
+
+
+/*
+ * OPTIONAL:
+ * Set printf like error/debug/message reporting functions.
+ * The second argument has to be a pointer to a function which looks like
+ *   void my_debugf(const char *format, va_list ap)
+ *   {
+ *       (void) vfprintf(stdout, format, ap);
+ *   }
+ * If you use NULL as the value of the pointer in the set function, the
+ * lame buildin function will be used (prints to stderr).
+ * To quiet any output you have to replace the body of the example function
+ * with just "return;" and use it in the set function.
+ */
+int CDECL lame_set_errorf(lame_global_flags *,
+                          void (*func)(const char *, va_list));
+int CDECL lame_set_debugf(lame_global_flags *,
+                          void (*func)(const char *, va_list));
+int CDECL lame_set_msgf  (lame_global_flags *,
+                          void (*func)(const char *, va_list));
+
+
+
+/* set one of brate compression ratio.  default is compression ratio of 11.  */
+int CDECL lame_set_brate(lame_global_flags *, int);
+int CDECL lame_get_brate(const lame_global_flags *);
+int CDECL lame_set_compression_ratio(lame_global_flags *, float);
+float CDECL lame_get_compression_ratio(const lame_global_flags *);
+
+
+int CDECL lame_set_preset( lame_global_flags*  gfp, int );
+int CDECL lame_set_asm_optimizations( lame_global_flags*  gfp, int, int );
+
+
+
+/********************************************************************
+ *  frame params
+ ***********************************************************************/
+/* mark as copyright.  default=0 */
+int CDECL lame_set_copyright(lame_global_flags *, int);
+int CDECL lame_get_copyright(const lame_global_flags *);
+
+/* mark as original.  default=1 */
+int CDECL lame_set_original(lame_global_flags *, int);
+int CDECL lame_get_original(const lame_global_flags *);
+
+/* error_protection.  Use 2 bytes from each frame for CRC checksum. default=0 */
+int CDECL lame_set_error_protection(lame_global_flags *, int);
+int CDECL lame_get_error_protection(const lame_global_flags *);
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/* padding_type. 0=pad no frames  1=pad all frames 2=adjust padding(default) */
+int CDECL lame_set_padding_type(lame_global_flags *, Padding_type);
+Padding_type CDECL lame_get_padding_type(const lame_global_flags *);
+#endif
+
+/* MP3 'private extension' bit  Meaningless.  default=0 */
+int CDECL lame_set_extension(lame_global_flags *, int);
+int CDECL lame_get_extension(const lame_global_flags *);
+
+/* enforce strict ISO compliance.  default=0 */
+int CDECL lame_set_strict_ISO(lame_global_flags *, int);
+int CDECL lame_get_strict_ISO(const lame_global_flags *);
+
+
+/********************************************************************
+ * quantization/noise shaping
+ ***********************************************************************/
+
+/* disable the bit reservoir. For testing only. default=0 */
+int CDECL lame_set_disable_reservoir(lame_global_flags *, int);
+int CDECL lame_get_disable_reservoir(const lame_global_flags *);
+
+/* select a different "best quantization" function. default=0  */
+int CDECL lame_set_quant_comp(lame_global_flags *, int);
+int CDECL lame_get_quant_comp(const lame_global_flags *);
+int CDECL lame_set_quant_comp_short(lame_global_flags *, int);
+int CDECL lame_get_quant_comp_short(const lame_global_flags *);
+
+int CDECL lame_set_experimentalX(lame_global_flags *, int); /* compatibility*/
+int CDECL lame_get_experimentalX(const lame_global_flags *);
+
+/* another experimental option.  for testing only */
+int CDECL lame_set_experimentalY(lame_global_flags *, int);
+int CDECL lame_get_experimentalY(const lame_global_flags *);
+
+/* another experimental option.  for testing only */
+int CDECL lame_set_experimentalZ(lame_global_flags *, int);
+int CDECL lame_get_experimentalZ(const lame_global_flags *);
+
+/* Naoki's psycho acoustic model.  default=0 */
+int CDECL lame_set_exp_nspsytune(lame_global_flags *, int);
+int CDECL lame_get_exp_nspsytune(const lame_global_flags *);
+
+void CDECL lame_set_msfix(lame_global_flags *, double);
+float CDECL lame_get_msfix(const lame_global_flags *);
+
+
+/********************************************************************
+ * VBR control
+ ***********************************************************************/
+/* Types of VBR.  default = vbr_off = CBR */
+int CDECL lame_set_VBR(lame_global_flags *, vbr_mode);
+vbr_mode CDECL lame_get_VBR(const lame_global_flags *);
+
+/* VBR quality level.  0=highest  9=lowest  */
+int CDECL lame_set_VBR_q(lame_global_flags *, int);
+int CDECL lame_get_VBR_q(const lame_global_flags *);
+
+/* VBR quality level.  0=highest  9=lowest, Range [0,...,10[  */
+int CDECL lame_set_VBR_quality(lame_global_flags *, float);
+float CDECL lame_get_VBR_quality(const lame_global_flags *);
+
+/* Ignored except for VBR=vbr_abr (ABR mode) */
+int CDECL lame_set_VBR_mean_bitrate_kbps(lame_global_flags *, int);
+int CDECL lame_get_VBR_mean_bitrate_kbps(const lame_global_flags *);
+
+int CDECL lame_set_VBR_min_bitrate_kbps(lame_global_flags *, int);
+int CDECL lame_get_VBR_min_bitrate_kbps(const lame_global_flags *);
+
+int CDECL lame_set_VBR_max_bitrate_kbps(lame_global_flags *, int);
+int CDECL lame_get_VBR_max_bitrate_kbps(const lame_global_flags *);
+
+/*
+  1=strictly enforce VBR_min_bitrate.  Normally it will be violated for
+  analog silence
+*/
+int CDECL lame_set_VBR_hard_min(lame_global_flags *, int);
+int CDECL lame_get_VBR_hard_min(const lame_global_flags *);
+
+/* for preset */
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+int CDECL lame_set_preset_expopts(lame_global_flags *, int);
+#endif
+
+/********************************************************************
+ * Filtering control
+ ***********************************************************************/
+/* freq in Hz to apply lowpass. Default = 0 = lame chooses.  -1 = disabled */
+int CDECL lame_set_lowpassfreq(lame_global_flags *, int);
+int CDECL lame_get_lowpassfreq(const lame_global_flags *);
+/* width of transition band, in Hz.  Default = one polyphase filter band */
+int CDECL lame_set_lowpasswidth(lame_global_flags *, int);
+int CDECL lame_get_lowpasswidth(const lame_global_flags *);
+
+/* freq in Hz to apply highpass. Default = 0 = lame chooses.  -1 = disabled */
+int CDECL lame_set_highpassfreq(lame_global_flags *, int);
+int CDECL lame_get_highpassfreq(const lame_global_flags *);
+/* width of transition band, in Hz.  Default = one polyphase filter band */
+int CDECL lame_set_highpasswidth(lame_global_flags *, int);
+int CDECL lame_get_highpasswidth(const lame_global_flags *);
+
+
+/********************************************************************
+ * psycho acoustics and other arguments which you should not change
+ * unless you know what you are doing
+ ***********************************************************************/
+
+/* only use ATH for masking */
+int CDECL lame_set_ATHonly(lame_global_flags *, int);
+int CDECL lame_get_ATHonly(const lame_global_flags *);
+
+/* only use ATH for short blocks */
+int CDECL lame_set_ATHshort(lame_global_flags *, int);
+int CDECL lame_get_ATHshort(const lame_global_flags *);
+
+/* disable ATH */
+int CDECL lame_set_noATH(lame_global_flags *, int);
+int CDECL lame_get_noATH(const lame_global_flags *);
+
+/* select ATH formula */
+int CDECL lame_set_ATHtype(lame_global_flags *, int);
+int CDECL lame_get_ATHtype(const lame_global_flags *);
+
+/* lower ATH by this many db */
+int CDECL lame_set_ATHlower(lame_global_flags *, float);
+float CDECL lame_get_ATHlower(const lame_global_flags *);
+
+/* select ATH adaptive adjustment type */
+int CDECL lame_set_athaa_type( lame_global_flags *, int);
+int CDECL lame_get_athaa_type( const lame_global_flags *);
+
+/* select the loudness approximation used by the ATH adaptive auto-leveling  */
+int CDECL lame_set_athaa_loudapprox( lame_global_flags *, int);
+int CDECL lame_get_athaa_loudapprox( const lame_global_flags *);
+
+/* adjust (in dB) the point below which adaptive ATH level adjustment occurs */
+int CDECL lame_set_athaa_sensitivity( lame_global_flags *, float);
+float CDECL lame_get_athaa_sensitivity( const lame_global_flags* );
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/* OBSOLETE: predictability limit (ISO tonality formula) */
+int CDECL lame_set_cwlimit(lame_global_flags *, int);
+int CDECL lame_get_cwlimit(const lame_global_flags *);
+#endif
+
+/*
+  allow blocktypes to differ between channels?
+  default: 0 for jstereo, 1 for stereo
+*/
+int CDECL lame_set_allow_diff_short(lame_global_flags *, int);
+int CDECL lame_get_allow_diff_short(const lame_global_flags *);
+
+/* use temporal masking effect (default = 1) */
+int CDECL lame_set_useTemporal(lame_global_flags *, int);
+int CDECL lame_get_useTemporal(const lame_global_flags *);
+
+/* use temporal masking effect (default = 1) */
+int CDECL lame_set_interChRatio(lame_global_flags *, float);
+float CDECL lame_get_interChRatio(const lame_global_flags *);
+
+/* disable short blocks */
+int CDECL lame_set_no_short_blocks(lame_global_flags *, int);
+int CDECL lame_get_no_short_blocks(const lame_global_flags *);
+
+/* force short blocks */
+int CDECL lame_set_force_short_blocks(lame_global_flags *, int);
+int CDECL lame_get_force_short_blocks(const lame_global_flags *);
+
+/* Input PCM is emphased PCM (for instance from one of the rarely
+   emphased CDs), it is STRONGLY not recommended to use this, because
+   psycho does not take it into account, and last but not least many decoders
+   ignore these bits */
+int CDECL lame_set_emphasis(lame_global_flags *, int);
+int CDECL lame_get_emphasis(const lame_global_flags *);
+
+
+
+/************************************************************************/
+/* internal variables, cannot be set...                                 */
+/* provided because they may be of use to calling application           */
+/************************************************************************/
+/* version  0=MPEG-2  1=MPEG-1  (2=MPEG-2.5)     */
+int CDECL lame_get_version(const lame_global_flags *);
+
+/* encoder delay   */
+int CDECL lame_get_encoder_delay(const lame_global_flags *);
+
+/*
+  padding appended to the input to make sure decoder can fully decode
+  all input.  Note that this value can only be calculated during the
+  call to lame_encoder_flush().  Before lame_encoder_flush() has
+  been called, the value of encoder_padding = 0.
+*/
+int CDECL lame_get_encoder_padding(const lame_global_flags *);
+
+/* size of MPEG frame */
+int CDECL lame_get_framesize(const lame_global_flags *);
+
+/* number of PCM samples buffered, but not yet encoded to mp3 data. */
+int CDECL lame_get_mf_samples_to_encode( const lame_global_flags*  gfp );
+
+/*
+  size (bytes) of mp3 data buffered, but not yet encoded.
+  this is the number of bytes which would be output by a call to
+  lame_encode_flush_nogap.  NOTE: lame_encode_flush() will return
+  more bytes than this because it will encode the reamining buffered
+  PCM samples before flushing the mp3 buffers.
+*/
+int CDECL lame_get_size_mp3buffer( const lame_global_flags*  gfp );
+
+/* number of frames encoded so far */
+int CDECL lame_get_frameNum(const lame_global_flags *);
+
+/*
+  lame's estimate of the total number of frames to be encoded
+   only valid if calling program set num_samples
+*/
+int CDECL lame_get_totalframes(const lame_global_flags *);
+
+/* RadioGain value. Multiplied by 10 and rounded to the nearest. */
+int CDECL lame_get_RadioGain(const lame_global_flags *);
+
+/* AudiophileGain value. Multipled by 10 and rounded to the nearest. */
+int CDECL lame_get_AudiophileGain(const lame_global_flags *);
+
+/* the peak sample */
+float CDECL lame_get_PeakSample(const lame_global_flags *);
+
+/* Gain change required for preventing clipping. The value is correct only if
+   peak sample searching was enabled. If negative then the waveform
+   already does not clip. The value is multiplied by 10 and rounded up. */
+int CDECL lame_get_noclipGainChange(const lame_global_flags *);
+
+/* user-specified scale factor required for preventing clipping. Value is
+   correct only if peak sample searching was enabled and no user-specified
+   scaling was performed. If negative then either the waveform already does
+   not clip or the value cannot be determined */
+float CDECL lame_get_noclipScale(const lame_global_flags *);
+
+
+
+
+
+
+
+/*
+ * REQUIRED:
+ * sets more internal configuration based on data provided above.
+ * returns -1 if something failed.
+ */
+int CDECL lame_init_params(lame_global_flags *);
+
+
+/*
+ * OPTIONAL:
+ * get the version number, in a string. of the form:
+ * "3.63 (beta)" or just "3.63".
+ */
+const char*  CDECL get_lame_version       ( void );
+const char*  CDECL get_lame_short_version ( void );
+const char*  CDECL get_lame_very_short_version ( void );
+const char*  CDECL get_psy_version        ( void );
+const char*  CDECL get_lame_url           ( void );
+const char*  CDECL get_lame_os_bitness    ( void );
+
+/*
+ * OPTIONAL:
+ * get the version numbers in numerical form.
+ */
+typedef struct {
+    /* generic LAME version */
+    int major;
+    int minor;
+    int alpha;               /* 0 if not an alpha version                  */
+    int beta;                /* 0 if not a beta version                    */
+
+    /* version of the psy model */
+    int psy_major;
+    int psy_minor;
+    int psy_alpha;           /* 0 if not an alpha version                  */
+    int psy_beta;            /* 0 if not a beta version                    */
+
+    /* compile time features */
+    const char *features;    /* Don't make assumptions about the contents! */
+} lame_version_t;
+void CDECL get_lame_version_numerical(lame_version_t *);
+
+
+/*
+ * OPTIONAL:
+ * print internal lame configuration to message handler
+ */
+void CDECL lame_print_config(const lame_global_flags*  gfp);
+
+void CDECL lame_print_internals( const lame_global_flags *gfp);
+
+
+/*
+ * input pcm data, output (maybe) mp3 frames.
+ * This routine handles all buffering, resampling and filtering for you.
+ *
+ * return code     number of bytes output in mp3buf. Can be 0
+ *                 -1:  mp3buf was too small
+ *                 -2:  malloc() problem
+ *                 -3:  lame_init_params() not called
+ *                 -4:  psycho acoustic problems
+ *
+ * The required mp3buf_size can be computed from num_samples,
+ * samplerate and encoding rate, but here is a worst case estimate:
+ *
+ * mp3buf_size in bytes = 1.25*num_samples + 7200
+ *
+ * I think a tighter bound could be:  (mt, March 2000)
+ * MPEG1:
+ *    num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512
+ * MPEG2:
+ *    num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256
+ *
+ * but test first if you use that!
+ *
+ * set mp3buf_size = 0 and LAME will not check if mp3buf_size is
+ * large enough.
+ *
+ * NOTE:
+ * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels
+ * will be averaged into the L channel before encoding only the L channel
+ * This will overwrite the data in buffer_l[] and buffer_r[].
+ *
+*/
+int CDECL lame_encode_buffer (
+        lame_global_flags*  gfp,           /* global context handle         */
+        const short int     buffer_l [],   /* PCM data for left channel     */
+        const short int     buffer_r [],   /* PCM data for right channel    */
+        const int           nsamples,      /* number of samples per channel */
+        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
+        const int           mp3buf_size ); /* number of valid octets in this
+                                              stream                        */
+
+/*
+ * as above, but input has L & R channel data interleaved.
+ * NOTE:
+ * num_samples = number of samples in the L (or R)
+ * channel, not the total number of samples in pcm[]
+ */
+int CDECL lame_encode_buffer_interleaved(
+        lame_global_flags*  gfp,           /* global context handlei        */
+        short int           pcm[],         /* PCM data for left and right
+                                              channel, interleaved          */
+        int                 num_samples,   /* number of samples per channel,
+                                              _not_ number of samples in
+                                              pcm[]                         */
+        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
+        int                 mp3buf_size ); /* number of valid octets in this
+                                              stream                        */
+
+
+/* as lame_encode_buffer, but for 'float's.
+ * !! NOTE: !! data must still be scaled to be in the same range as
+ * short int, +/- 32768
+ */
+int CDECL lame_encode_buffer_float(
+        lame_global_flags*  gfp,           /* global context handle         */
+        const float     buffer_l [],       /* PCM data for left channel     */
+        const float     buffer_r [],       /* PCM data for right channel    */
+        const int           nsamples,      /* number of samples per channel */
+        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
+        const int           mp3buf_size ); /* number of valid octets in this
+                                              stream                        */
+
+
+/* as lame_encode_buffer, but for long's
+ * !! NOTE: !! data must still be scaled to be in the same range as
+ * short int, +/- 32768
+ *
+ * This scaling was a mistake (doesn't allow one to exploit full
+ * precision of type 'long'.  Use lame_encode_buffer_long2() instead.
+ *
+ */
+int CDECL lame_encode_buffer_long(
+        lame_global_flags*  gfp,           /* global context handle         */
+        const long     buffer_l [],       /* PCM data for left channel     */
+        const long     buffer_r [],       /* PCM data for right channel    */
+        const int           nsamples,      /* number of samples per channel */
+        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
+        const int           mp3buf_size ); /* number of valid octets in this
+                                              stream                        */
+
+/* Same as lame_encode_buffer_long(), but with correct scaling.
+ * !! NOTE: !! data must still be scaled to be in the same range as
+ * type 'long'.   Data should be in the range:  +/- 2^(8*size(long)-1)
+ *
+ */
+int CDECL lame_encode_buffer_long2(
+        lame_global_flags*  gfp,           /* global context handle         */
+        const long     buffer_l [],       /* PCM data for left channel     */
+        const long     buffer_r [],       /* PCM data for right channel    */
+        const int           nsamples,      /* number of samples per channel */
+        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
+        const int           mp3buf_size ); /* number of valid octets in this
+                                              stream                        */
+
+/* as lame_encode_buffer, but for int's
+ * !! NOTE: !! input should be scaled to the maximum range of 'int'
+ * If int is 4 bytes, then the values should range from
+ * +/- 2147483648.
+ *
+ * This routine does not (and cannot, without loosing precision) use
+ * the same scaling as the rest of the lame_encode_buffer() routines.
+ *
+ */
+int CDECL lame_encode_buffer_int(
+        lame_global_flags*  gfp,           /* global context handle         */
+        const int      buffer_l [],       /* PCM data for left channel     */
+        const int      buffer_r [],       /* PCM data for right channel    */
+        const int           nsamples,      /* number of samples per channel */
+        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
+        const int           mp3buf_size ); /* number of valid octets in this
+                                              stream                        */
+
+
+
+
+
+/*
+ * REQUIRED:
+ * lame_encode_flush will flush the intenal PCM buffers, padding with
+ * 0's to make sure the final frame is complete, and then flush
+ * the internal MP3 buffers, and thus may return a
+ * final few mp3 frames.  'mp3buf' should be at least 7200 bytes long
+ * to hold all possible emitted data.
+ *
+ * will also write id3v1 tags (if any) into the bitstream
+ *
+ * return code = number of bytes output to mp3buf. Can be 0
+ */
+int CDECL lame_encode_flush(
+        lame_global_flags *  gfp,    /* global context handle                 */
+        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */
+        int                  size);  /* number of valid octets in this stream */
+
+/*
+ * OPTIONAL:
+ * lame_encode_flush_nogap will flush the internal mp3 buffers and pad
+ * the last frame with ancillary data so it is a complete mp3 frame.
+ *
+ * 'mp3buf' should be at least 7200 bytes long
+ * to hold all possible emitted data.
+ *
+ * After a call to this routine, the outputed mp3 data is complete, but
+ * you may continue to encode new PCM samples and write future mp3 data
+ * to a different file.  The two mp3 files will play back with no gaps
+ * if they are concatenated together.
+ *
+ * This routine will NOT write id3v1 tags into the bitstream.
+ *
+ * return code = number of bytes output to mp3buf. Can be 0
+ */
+int CDECL lame_encode_flush_nogap(
+        lame_global_flags *  gfp,    /* global context handle                 */
+        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */
+        int                  size);  /* number of valid octets in this stream */
+
+/*
+ * OPTIONAL:
+ * Normally, this is called by lame_init_params().  It writes id3v2 and
+ * Xing headers into the front of the bitstream, and sets frame counters
+ * and bitrate histogram data to 0.  You can also call this after
+ * lame_encode_flush_nogap().
+ */
+int CDECL lame_init_bitstream(
+        lame_global_flags *  gfp);    /* global context handle                 */
+
+
+
+/*
+ * OPTIONAL:    some simple statistics
+ * a bitrate histogram to visualize the distribution of used frame sizes
+ * a stereo mode histogram to visualize the distribution of used stereo
+ *   modes, useful in joint-stereo mode only
+ *   0: LR    left-right encoded
+ *   1: LR-I  left-right and intensity encoded (currently not supported)
+ *   2: MS    mid-side encoded
+ *   3: MS-I  mid-side and intensity encoded (currently not supported)
+ *
+ * attention: don't call them after lame_encode_finish
+ * suggested: lame_encode_flush -> lame_*_hist -> lame_close
+ */
+
+void CDECL lame_bitrate_hist(
+        const lame_global_flags * gfp,
+        int bitrate_count[14] );
+void CDECL lame_bitrate_kbps(
+        const lame_global_flags * gfp,
+        int bitrate_kbps [14] );
+void CDECL lame_stereo_mode_hist(
+        const lame_global_flags * gfp,
+        int stereo_mode_count[4] );
+
+void CDECL lame_bitrate_stereo_mode_hist (
+        const lame_global_flags * gfp,
+        int bitrate_stmode_count[14][4] );
+
+void CDECL lame_block_type_hist (
+        const lame_global_flags * gfp,
+        int btype_count[6] );
+
+void CDECL lame_bitrate_block_type_hist (
+        const lame_global_flags * gfp,
+        int bitrate_btype_count[14][6] );
+
+#if (DEPRECATED_OR_OBSOLETE_CODE_REMOVED && 0)
+#else
+/*
+ * OPTIONAL:
+ * lame_mp3_tags_fid will rewrite a Xing VBR tag to the mp3 file with file
+ * pointer fid.  These calls perform forward and backwards seeks, so make
+ * sure fid is a real file.  Make sure lame_encode_flush has been called,
+ * and all mp3 data has been written to the file before calling this
+ * function.
+ * NOTE:
+ * if VBR  tags are turned off by the user, or turned off by LAME because
+ * the output is not a regular file, this call does nothing
+ * NOTE:
+ * LAME wants to read from the file to skip an optional ID3v2 tag, so
+ * make sure you opened the file for writing and reading.
+ * NOTE:
+ * You can call lame_get_lametag_frame instead, if you want to insert
+ * the lametag yourself.
+*/
+void CDECL lame_mp3_tags_fid(lame_global_flags *, FILE* fid);
+#endif
+
+/*
+ * OPTIONAL:
+ * lame_get_lametag_frame copies the final LAME-tag into 'buffer'.
+ * The function returns the number of bytes copied into buffer, or
+ * the required buffer size, if the provided buffer is too small.
+ * Function failed, if the return value is larger than 'size'!
+ * Make sure lame_encode flush has been called before calling this function.
+ * NOTE:
+ * if VBR  tags are turned off by the user, or turned off by LAME,
+ * this call does nothing and returns 0.
+ * NOTE:
+ * LAME inserted an empty frame in the beginning of mp3 audio data,
+ * which you have to replace by the final LAME-tag frame after encoding.
+ * In case there is no ID3v2 tag, usually this frame will be the very first
+ * data in your mp3 file. If you put some other leading data into your
+ * file, you'll have to do some bookkeeping about where to write this buffer.
+ */
+size_t CDECL lame_get_lametag_frame(
+        const lame_global_flags *, unsigned char* buffer, size_t size);
+
+/*
+ * REQUIRED:
+ * final call to free all remaining buffers
+ */
+int  CDECL lame_close (lame_global_flags *);
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+#else
+/*
+ * OBSOLETE:
+ * lame_encode_finish combines lame_encode_flush() and lame_close() in
+ * one call.  However, once this call is made, the statistics routines
+ * will no longer work because the data will have been cleared, and
+ * lame_mp3_tags_fid() cannot be called to add data to the VBR header
+ */
+int CDECL lame_encode_finish(
+        lame_global_flags*  gfp,
+        unsigned char*      mp3buf,
+        int                 size );
+#endif
+
+
+
+
+
+
+/*********************************************************************
+ *
+ * decoding
+ *
+ * a simple interface to mpglib, part of mpg123, is also included if
+ * libmp3lame is compiled with HAVE_MPGLIB
+ *
+ *********************************************************************/
+
+struct hip_global_struct;
+typedef struct hip_global_struct hip_global_flags;
+typedef hip_global_flags *hip_t;
+
+
+typedef struct {
+  int header_parsed;   /* 1 if header was parsed and following data was
+                          computed                                       */
+  int stereo;          /* number of channels                             */
+  int samplerate;      /* sample rate                                    */
+  int bitrate;         /* bitrate                                        */
+  int mode;            /* mp3 frame type                                 */
+  int mode_ext;        /* mp3 frame type                                 */
+  int framesize;       /* number of samples per mp3 frame                */
+
+  /* this data is only computed if mpglib detects a Xing VBR header */
+  unsigned long nsamp; /* number of samples in mp3 file.                 */
+  int totalframes;     /* total number of frames in mp3 file             */
+
+  /* this data is not currently computed by the mpglib routines */
+  int framenum;        /* frames decoded counter                         */
+} mp3data_struct;
+
+/* required call to initialize decoder */
+hip_t CDECL hip_decode_init(void);
+
+/* cleanup call to exit decoder  */
+int CDECL hip_decode_exit(hip_t gfp);
+
+/*********************************************************************
+ * input 1 mp3 frame, output (maybe) pcm data.
+ *
+ *  nout = hip_decode(hip, mp3buf,len,pcm_l,pcm_r);
+ *
+ * input:
+ *    len          :  number of bytes of mp3 data in mp3buf
+ *    mp3buf[len]  :  mp3 data to be decoded
+ *
+ * output:
+ *    nout:  -1    : decoding error
+ *            0    : need more data before we can complete the decode
+ *           >0    : returned 'nout' samples worth of data in pcm_l,pcm_r
+ *    pcm_l[nout]  : left channel data
+ *    pcm_r[nout]  : right channel data
+ *
+ *********************************************************************/
+int CDECL hip_decode( hip_t           gfp
+                    , unsigned char * mp3buf
+                    , size_t          len
+                    , short           pcm_l[]
+                    , short           pcm_r[]
+                    );
+
+/* same as hip_decode, and also returns mp3 header data */
+int CDECL hip_decode_headers( hip_t           gfp
+                            , unsigned char*  mp3buf
+                            , size_t          len
+                            , short           pcm_l[]
+                            , short           pcm_r[]
+                            , mp3data_struct* mp3data
+                            );
+
+/* same as hip_decode, but returns at most one frame */
+int CDECL hip_decode1( hip_t          gfp
+                     , unsigned char* mp3buf
+                     , size_t         len
+                     , short          pcm_l[]
+                     , short          pcm_r[]
+                     );
+
+/* same as hip_decode1, but returns at most one frame and mp3 header data */
+int CDECL hip_decode1_headers( hip_t           gfp
+                             , unsigned char*  mp3buf
+                             , size_t          len
+                             , short           pcm_l[]
+                             , short           pcm_r[]
+                             , mp3data_struct* mp3data
+                             );
+
+/* same as hip_decode1_headers, but also returns enc_delay and enc_padding
+   from VBR Info tag, (-1 if no info tag was found) */
+int CDECL hip_decode1_headersB( hip_t gfp
+                              , unsigned char*   mp3buf
+                              , size_t           len
+                              , short            pcm_l[]
+                              , short            pcm_r[]
+                              , mp3data_struct*  mp3data
+                              , int             *enc_delay
+                              , int             *enc_padding
+                              );
+
+
+
+/* OBSOLETE:
+ * lame_decode... functions are there to keep old code working
+ * but it is strongly recommended to replace calls by hip_decode...
+ * function calls, see above.
+ */
+#if 1
+int CDECL lame_decode_init(void);
+int CDECL lame_decode(
+        unsigned char *  mp3buf,
+        int              len,
+        short            pcm_l[],
+        short            pcm_r[] );
+int CDECL lame_decode_headers(
+        unsigned char*   mp3buf,
+        int              len,
+        short            pcm_l[],
+        short            pcm_r[],
+        mp3data_struct*  mp3data );
+int CDECL lame_decode1(
+        unsigned char*  mp3buf,
+        int             len,
+        short           pcm_l[],
+        short           pcm_r[] );
+int CDECL lame_decode1_headers(
+        unsigned char*   mp3buf,
+        int              len,
+        short            pcm_l[],
+        short            pcm_r[],
+        mp3data_struct*  mp3data );
+int CDECL lame_decode1_headersB(
+        unsigned char*   mp3buf,
+        int              len,
+        short            pcm_l[],
+        short            pcm_r[],
+        mp3data_struct*  mp3data,
+        int              *enc_delay,
+        int              *enc_padding );
+int CDECL lame_decode_exit(void);
+
+#endif /* obsolete lame_decode API calls */
+
+
+/*********************************************************************
+ *
+ * id3tag stuff
+ *
+ *********************************************************************/
+
+/*
+ * id3tag.h -- Interface to write ID3 version 1 and 2 tags.
+ *
+ * Copyright (C) 2000 Don Melton.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/* utility to obtain alphabetically sorted list of genre names with numbers */
+void CDECL id3tag_genre_list(
+        void (*handler)(int, const char *, void *),
+        void*  cookie);
+
+void CDECL id3tag_init     (lame_t gfp);
+
+/* force addition of version 2 tag */
+void CDECL id3tag_add_v2   (lame_t gfp);
+
+/* add only a version 1 tag */
+void CDECL id3tag_v1_only  (lame_t gfp);
+
+/* add only a version 2 tag */
+void CDECL id3tag_v2_only  (lame_t gfp);
+
+/* pad version 1 tag with spaces instead of nulls */
+void CDECL id3tag_space_v1 (lame_t gfp);
+
+/* pad version 2 tag with extra 128 bytes */
+void CDECL id3tag_pad_v2   (lame_t gfp);
+
+/* pad version 2 tag with extra n bytes */
+void CDECL id3tag_set_pad  (lame_t gfp, size_t n);
+
+void CDECL id3tag_set_title(lame_t gfp, const char* title);
+void CDECL id3tag_set_artist(lame_t gfp, const char* artist);
+void CDECL id3tag_set_album(lame_t gfp, const char* album);
+void CDECL id3tag_set_year(lame_t gfp, const char* year);
+void CDECL id3tag_set_comment(lame_t gfp, const char* comment);
+            
+/* return -1 result if track number is out of ID3v1 range
+                    and ignored for ID3v1 */
+int CDECL id3tag_set_track(lame_t gfp, const char* track);
+
+/* return non-zero result if genre name or number is invalid
+  result 0: OK
+  result -1: genre number out of range
+  result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other'
+             but taken as-is for ID3v2 genre tag */
+int CDECL id3tag_set_genre(lame_t gfp, const char* genre);
+
+/* return non-zero result if field name is invalid */
+int CDECL id3tag_set_fieldvalue(lame_t gfp, const char* fieldvalue);
+
+/* return non-zero result if image type is invalid */
+int CDECL id3tag_set_albumart(lame_t gfp, const char* image, size_t size);
+
+/* lame_get_id3v1_tag copies ID3v1 tag into buffer.
+ * Function returns number of bytes copied into buffer, or number
+ * of bytes rquired if buffer 'size' is too small.
+ * Function fails, if returned value is larger than 'size'.
+ * NOTE:
+ * This functions does nothing, if user/LAME disabled ID3v1 tag.
+ */
+size_t CDECL lame_get_id3v1_tag(lame_t gfp, unsigned char* buffer, size_t size);
+
+/* lame_get_id3v2_tag copies ID3v2 tag into buffer.
+ * Function returns number of bytes copied into buffer, or number
+ * of bytes rquired if buffer 'size' is too small.
+ * Function fails, if returned value is larger than 'size'.
+ * NOTE:
+ * This functions does nothing, if user/LAME disabled ID3v2 tag.
+ */
+size_t CDECL lame_get_id3v2_tag(lame_t gfp, unsigned char* buffer, size_t size);
+
+/* normaly lame_init_param writes ID3v2 tags into the audio stream
+ * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param
+ * to turn off this behaviour and get ID3v2 tag with above function
+ * write it yourself into your file.
+ */
+void CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int);
+int CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp);
+
+/***********************************************************************
+*
+*  list of valid bitrates [kbps] & sample frequencies [Hz].
+*  first index: 0: MPEG-2   values  (sample frequencies 16...24 kHz)
+*               1: MPEG-1   values  (sample frequencies 32...48 kHz)
+*               2: MPEG-2.5 values  (sample frequencies  8...12 kHz)
+***********************************************************************/
+extern const int      bitrate_table    [3] [16];
+extern const int      samplerate_table [3] [ 4];
+
+
+
+/* maximum size of albumart image (128KB), which affects LAME_MAXMP3BUFFER
+   as well since lame_encode_buffer() also returns ID3v2 tag data */
+#define LAME_MAXALBUMART    (128 * 1024)
+
+/* maximum size of mp3buffer needed if you encode at most 1152 samples for
+   each call to lame_encode_buffer.  see lame_encode_buffer() below  
+   (LAME_MAXMP3BUFFER is now obsolete)  */
+#define LAME_MAXMP3BUFFER   (16384 + LAME_MAXALBUMART)
+
+
+typedef enum {
+    LAME_OKAY             =   0,
+    LAME_NOERROR          =   0,
+    LAME_GENERICERROR     =  -1,
+    LAME_NOMEM            = -10,
+    LAME_BADBITRATE       = -11,
+    LAME_BADSAMPFREQ      = -12,
+    LAME_INTERNALERROR    = -13,
+
+    FRONTEND_READERROR    = -80,
+    FRONTEND_WRITEERROR   = -81,
+    FRONTEND_FILETOOLARGE = -82
+
+} lame_errorcodes_t;
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* LAME_LAME_H */
+
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..4d4a951
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/lame.bat b/lame.bat
new file mode 100755
index 0000000..8b31774
--- /dev/null
+++ b/lame.bat
@@ -0,0 +1,41 @@
+@echo off

+rem  ---------------------------------------------

+rem  PURPOSE:

+rem  - put this Batch-Command on your Desktop, 

+rem    so you can drag and drop wave files on it

+rem    and LAME will encode them to mp3 format.

+rem  - put this Batch-Command in a place mentioned

+rem    in your PATH environment, start the DOS-BOX

+rem    and change to a directory where your wave 

+rem    files are located. the following line will

+rem    encode all your wave files to mp3

+rem     "lame.bat *.wav"

+rem  ---------------------------------------------

+rem                         C2000  Robert Hegemann

+rem  ---------------------------------------------

+rem  please set LAME and LAMEOPTS

+rem  LAME - where the executeable is

+rem  OPTS - options you like LAME to use

+

+	set LAME=lame.exe

+	set OPTS=--preset cd

+

+rem  ---------------------------------------------

+

+	set thecmd=%LAME% %OPTS%

+	lfnfor on

+:processArgs

+	if "%1"=="" goto endmark

+	for %%f in (%1) do %thecmd% "%%f"

+	if errorlevel 1 goto errormark

+	shift

+	goto processArgs

+:errormark

+	echo.

+	echo.

+	echo ERROR processing %1

+	echo. 

+:endmark

+rem

+rem	finished

+rem

diff --git a/lame.spec.in b/lame.spec.in
new file mode 100644
index 0000000..5a21562
--- /dev/null
+++ b/lame.spec.in
@@ -0,0 +1,188 @@
+%define name @PACKAGE@
+%define ver @VERSION@
+%define rel 1
+%define prefix %{_usr}
+%define docdir %{_defaultdocdir}
+
+Summary : LAME Ain't an MP3 Encoder... but it's the best.
+Summary(fr) : LAME n'est pas un encodeur MP3 ;->
+Name: %{name}
+Version: %{ver}
+Release: %{rel}
+License: LGPL
+Vendor: The LAME Project
+Packager: Yosi Markovich <yosim@bigfoot.com>
+URL: http://www.mp3dev.org
+Group: Applications/Multimedia
+Source: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-root
+Requires: ncurses >= 5.0
+BuildRequires: gcc => 3.0.1, /usr/bin/find, ncurses-devel
+%ifarch %{ix86} x86_64
+BuildRequires: nasm
+%endif
+Provides: mp3encoder
+
+%description
+LAME is an educational tool to be used for learning about MP3 encoding.  The
+goal of the LAME project is to use the open source model to improve the
+psycho acoustics, noise shaping and speed of MP3. 
+
+%description -l fr
+LAME est un outil d'enseignement pour l'apprentissage de l'encodage MP3.
+Le but du projet LAME est d'utiliser un mod�le "open source" afin
+d'am�liorer la qualit� et la vitesse du MP3. 
+
+
+
+%package devel
+Summary: Shared and static libraries for LAME.
+Group: Development/Libraries
+Requires: %{name} = %{version}
+
+%description devel
+LAME is an educational tool to be used for learning about MP3 encoding.
+This package contains both the shared and the static libraries from the
+LAME project.
+
+You will also need to install the main lame package in order to install
+these libraries.
+
+%prep
+%setup
+
+%build
+
+# Vorbis makes the build fail for now. . .
+rm -f config.cache
+ 
+%configure \
+%ifarch %{ix86} x86_64
+	--enable-nasm \
+%endif
+	--enable-decoder \
+	--without-vorbis \
+	--enable-analyzer=no \
+	--enable-brhist \
+	--disable-debug
+%{__make} %{?_smp_mflags} test CFLAGS="%{optflags}"
+
+%install
+%{__rm} -rf %{buildroot}
+%makeinstall
+
+### Some apps still expect to find <lame.h>
+%{__ln_s} -f lame/lame.h %{buildroot}%{_includedir}/lame.h
+
+
+find doc/html -name "Makefile*" | xargs rm -f
+### make install really shouldn't install these
+%{__rm} -rf %{buildroot}%{_docdir}/lame/
+
+
+%post
+/sbin/ldconfig 2>/dev/null
+
+%postun
+/sbin/ldconfig 2>/dev/null
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%files
+%defattr (-,root,root)
+%doc COPYING ChangeLog README TODO USAGE doc/html
+%doc doc/html
+%{_bindir}/lame
+%{_libdir}/libmp3lame.so.*
+%{_mandir}/man1/lame.1*
+
+%files devel
+%defattr (-, root, root)
+%doc API HACKING STYLEGUIDE
+%{_libdir}/libmp3lame.a
+%{_libdir}/libmp3lame.la
+%{_libdir}/libmp3lame.so
+%{_includedir}/*
+
+%changelog
+
+* Sun May 14 2006 Kyle VanderBeek <kylev@kylev.com>
+- Remove requirements for specific gcc versions, since modern ones "just work".
+- Remove out-dated hyper-optimizations (some of which weren't valid compiler
+  flags anymore).
+- Update to current RPM techniques and macros (inspired by freshrpms.net spec).
+
+* Sat May 11 2002 Yosi Markovich <yosim@bigfoot.com>
+- Fixes to the spec file that include:
+- Making sure the compiler is gcc version 3.0.1. Lame compiled with a version
+  greater than 3.0.1 is broken.
+- Optimization flags for i686 will use i686 for march and mcpu, and not 
+  athlon.
+- Fix the dates in this Changelog section.
+- Various small fixes merged from Matthias Saou.
+- Thanks Fred Maciel <fred-m@crl.hitachi.co.jp> for his useful comments.
+
+- 
+* Tue Jan 22 2002 Mark Taylor <mt@mp3dev.org>
+- replaced lame.spec.in with Yosi's version.  Merged some stuff from
+  the prevous lame.spec.in file, and appended changelog below.
+
+* Tue Jan 22 2002 Yosi Markovich <yosim@bigfoot.com>
+- Rewrote lame.spec.in to create a correct and nice spec file.
+  imho, this spec file is not good for anyone who wants to build
+  daily cvs snapshots. Closes bug #495975
+
+* Tue Dec 11 2001 Yosi Markovich <yosim@bigfoot.com>
+- Shamelessly stole Matthias Saou's excellent spec file to create daily
+  CVS snapshots of Lame. Other than that, nothing is new.
+
+* Tue Oct 23 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
+- Fixed the %pre and %post that should have been %post and %postun, silly me!
+- Removed -malign-double (it's evil, Yosi told me and I tested, brrr ;-)).
+- Now build with gcc3, VBR encoding gets a hell of a boost, impressive!
+  I recommend you now use "lame --r3mix", it's the best.
+- Tried to re-enable vorbis, but it's a no-go.
+
+* Thu Jul 26 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
+- Build with kgcc to have VBR working.
+
+* Wed Jul 25 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
+- Update to 3.89beta : Must be built with a non-patched version of nasm
+  to work!
+
+* Mon May  7 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
+- Rebuilt for Red Hat 7.1.
+- Disabled the vorbis support since it fails to build with it.
+- Added a big optimisation section, thanks to Yosi Markovich
+  <senna@camelot.com> for this and other pointers.
+
+* Sun Feb 11 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
+- Split the package, there is now a -devel
+
+* Thu Nov 26 2000 Matthias Saou <matthias.saou@est.une.marmotte.net>
+- Initial RPM release for RedHat 7.0 from scratch
+
+* Wed Nov 21 2000 Eric Lassauge <lassauge@mail.dotcom.fr>
+- Updated and corrected RPM to 3.89beta.
+- Added french translations
+
+* Sat Aug 04 2000 Markus Linnala �maage@cs.tut.fi�
+- Build and include docs and libs correctly
+- Build extra programs
+
+* Tue Aug 01 2000 Stuart Young �cefiar1@optushome.com.au�
+- Updated RPM to 3.85beta.
+- Modified spec file (merged George and Keitaro's specs)
+- Added reasonable info to the specs to reflect the maintainer
+- Renamed lame.spec (plain spec is bad, mmkay?).
+
+* Fri Jun 30 2000 Keitaro Yosimura �ramsy@linux.or.jp�
+- Updated RPM to 3.84alpha.
+- Better attempt at an RPM, independant of 3.83 release.
+- (This is all surmise as there was no changelog).
+
+* Thu May 30 2000 Georges Seguin �crow@planete.net� 
+- First RPM build around 3.83beta
+
+
diff --git a/lame_clients_vc6.dsw b/lame_clients_vc6.dsw
new file mode 100644
index 0000000..6f61805
--- /dev/null
+++ b/lame_clients_vc6.dsw
@@ -0,0 +1,83 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00

+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!

+

+###############################################################################

+

+Project: "ADbg"=.\ACM\ADbg\ADbg.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Project: "LAME DShow"=.\dshow\dshow.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Project: "LameMp3EncDll"=.\Dll\LameDll_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Project: "lameACM"=.\ACM\lameACM_vc6.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name ADbg

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name tinyxml

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "tinyxml"=.\ACM\tinyxml\tinyxml.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Global:

+

+Package=<5>

+{{{

+}}}

+

+Package=<3>

+{{{

+}}}

+

+###############################################################################

+

diff --git a/lame_projects_vc6.dsp b/lame_projects_vc6.dsp
new file mode 100644
index 0000000..8104dae
--- /dev/null
+++ b/lame_projects_vc6.dsp
@@ -0,0 +1,78 @@
+# Microsoft Developer Studio Project File - Name="lame_projects" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** DO NOT EDIT **

+

+# TARGTYPE "Win32 (x86) Generic Project" 0x010a

+

+CFG=lame_projects - Win32 Debug

+!MESSAGE This is not a valid makefile. To build this project using NMAKE,

+!MESSAGE use the Export Makefile command and run

+!MESSAGE 

+!MESSAGE NMAKE /f "lame_projects_vc6.mak".

+!MESSAGE 

+!MESSAGE You can specify a configuration when running NMAKE

+!MESSAGE by defining the macro CFG on the command line. For example:

+!MESSAGE 

+!MESSAGE NMAKE /f "lame_projects_vc6.mak" CFG="lame_projects - Win32 Debug"

+!MESSAGE 

+!MESSAGE Possible choices for configuration are:

+!MESSAGE 

+!MESSAGE "lame_projects - Win32 Release" (based on "Win32 (x86) Generic Project")

+!MESSAGE "lame_projects - Win32 Debug" (based on "Win32 (x86) Generic Project")

+!MESSAGE "lame_projects - Win32 Release NASM" (based on "Win32 (x86) Generic Project")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+MTL=midl.exe

+

+!IF  "$(CFG)" == "lame_projects - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "Release"

+# PROP BASE Intermediate_Dir "Release"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "Release"

+# PROP Intermediate_Dir "Release"

+# PROP Target_Dir ""

+

+!ELSEIF  "$(CFG)" == "lame_projects - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "Debug"

+# PROP Intermediate_Dir "Debug"

+# PROP Target_Dir ""

+

+!ELSEIF  "$(CFG)" == "lame_projects - Win32 Release NASM"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "lame_projects___Win32_Release_NASM"

+# PROP BASE Intermediate_Dir "lame_projects___Win32_Release_NASM"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "lame_projects___Win32_Release_NASM"

+# PROP Intermediate_Dir "lame_projects___Win32_Release_NASM"

+# PROP Target_Dir ""

+

+!ENDIF 

+

+# Begin Target

+

+# Name "lame_projects - Win32 Release"

+# Name "lame_projects - Win32 Debug"

+# Name "lame_projects - Win32 Release NASM"

+# End Target

+# End Project

diff --git a/lame_vc6.dsw b/lame_vc6.dsw
new file mode 100644
index 0000000..8db7118
--- /dev/null
+++ b/lame_vc6.dsw
@@ -0,0 +1,128 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00

+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!

+

+###############################################################################

+

+Project: "MP3x"=".\frontend\mp3x_vc6.dsp" - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name mpglib

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame DLL

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "lame"=".\frontend\lame_vc6.dsp" - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name mpglib

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame DLL

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "lame_projects"=".\lame_projects_vc6.dsp" - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name MP3x

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name libmp3lame DLL

+    End Project Dependency

+    Begin Project Dependency

+    Project_Dep_Name mpglib

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "libmp3lame"=".\libmp3lame\libmp3lame_vc6.dsp" - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name mpglib

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "libmp3lame DLL"=".\libmp3lame\libmp3lame_dll_vc6.dsp" - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Project: "mpglib"=".\mpglib\mpglib_vc6.dsp" - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+}}}

+

+###############################################################################

+

+Global:

+

+Package=<5>

+{{{

+}}}

+

+Package=<3>

+{{{

+}}}

+

+###############################################################################

+

diff --git a/lame_vc8.sln b/lame_vc8.sln
new file mode 100644
index 0000000..a282aad
--- /dev/null
+++ b/lame_vc8.sln
@@ -0,0 +1,105 @@
+

+Microsoft Visual Studio Solution File, Format Version 10.00

+# Visual Studio 2008

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp3lame_vc8", "libmp3lame\libmp3lame_vc8.vcproj", "{4B152319-0AF6-4E1B-A284-805D6483C5F1}"

+EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpglib_vc8", "mpglib\mpglib_vc8.vcproj", "{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}"

+EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lame_vc8", "frontend\lame_vc8.vcproj", "{A5BC73DF-E8BB-45D5-984E-A209170D40BB}"

+	ProjectSection(ProjectDependencies) = postProject

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4} = {0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1} = {4B152319-0AF6-4E1B-A284-805D6483C5F1}

+	EndProjectSection

+EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LameDll_vc8", "Dll\LameDll_vc8.vcproj", "{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}"

+	ProjectSection(ProjectDependencies) = postProject

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4} = {0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1} = {4B152319-0AF6-4E1B-A284-805D6483C5F1}

+	EndProjectSection

+EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp3x_vc8", "frontend\mp3x_vc8.vcproj", "{F6140F25-0460-49E5-A2EB-06CED33BF08F}"

+	ProjectSection(ProjectDependencies) = postProject

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1} = {4B152319-0AF6-4E1B-A284-805D6483C5F1}

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4} = {0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}

+	EndProjectSection

+EndProject

+Global

+	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+		Debug GTK|Win32 = Debug GTK|Win32

+		Debug GTK|x64 = Debug GTK|x64

+		Debug|Win32 = Debug|Win32

+		Debug|x64 = Debug|x64

+		Release NASM|Win32 = Release NASM|Win32

+		Release NASM|x64 = Release NASM|x64

+		Release|Win32 = Release|Win32

+		Release|x64 = Release|x64

+	EndGlobalSection

+	GlobalSection(ProjectConfigurationPlatforms) = postSolution

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug GTK|Win32.ActiveCfg = Debug GTK|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug GTK|Win32.Build.0 = Debug GTK|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug GTK|x64.ActiveCfg = Release|x64

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug|Win32.ActiveCfg = Debug|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug|Win32.Build.0 = Debug|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug|x64.ActiveCfg = Debug|x64

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Debug|x64.Build.0 = Debug|x64

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release NASM|Win32.ActiveCfg = Release NASM|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release NASM|Win32.Build.0 = Release NASM|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release NASM|x64.ActiveCfg = Release|x64

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release|Win32.ActiveCfg = Release|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release|Win32.Build.0 = Release|Win32

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release|x64.ActiveCfg = Release|x64

+		{4B152319-0AF6-4E1B-A284-805D6483C5F1}.Release|x64.Build.0 = Release|x64

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug GTK|Win32.ActiveCfg = Debug GTK|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug GTK|Win32.Build.0 = Debug GTK|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug GTK|x64.ActiveCfg = Release|x64

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug|Win32.ActiveCfg = Debug|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug|Win32.Build.0 = Debug|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug|x64.ActiveCfg = Debug|x64

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Debug|x64.Build.0 = Debug|x64

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release NASM|Win32.ActiveCfg = Release|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release NASM|Win32.Build.0 = Release|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release NASM|x64.ActiveCfg = Release|x64

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release|Win32.ActiveCfg = Release|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release|Win32.Build.0 = Release|Win32

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release|x64.ActiveCfg = Release|x64

+		{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}.Release|x64.Build.0 = Release|x64

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Debug GTK|Win32.ActiveCfg = Debug|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Debug GTK|x64.ActiveCfg = Release|x64

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Debug|Win32.ActiveCfg = Debug|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Debug|Win32.Build.0 = Debug|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Debug|x64.ActiveCfg = Debug|x64

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Debug|x64.Build.0 = Debug|x64

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release NASM|Win32.ActiveCfg = Release|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release NASM|Win32.Build.0 = Release|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release NASM|x64.ActiveCfg = Release|x64

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release|Win32.ActiveCfg = Release|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release|Win32.Build.0 = Release|Win32

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release|x64.ActiveCfg = Release|x64

+		{A5BC73DF-E8BB-45D5-984E-A209170D40BB}.Release|x64.Build.0 = Release|x64

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Debug GTK|Win32.ActiveCfg = Debug|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Debug GTK|x64.ActiveCfg = Release|x64

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Debug|Win32.ActiveCfg = Debug|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Debug|Win32.Build.0 = Debug|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Debug|x64.ActiveCfg = Debug|x64

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Debug|x64.Build.0 = Debug|x64

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release NASM|Win32.ActiveCfg = Release|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release NASM|Win32.Build.0 = Release|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release NASM|x64.ActiveCfg = Release|x64

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release|Win32.ActiveCfg = Release|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release|Win32.Build.0 = Release|Win32

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release|x64.ActiveCfg = Release|x64

+		{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}.Release|x64.Build.0 = Release|x64

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Debug GTK|Win32.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Debug GTK|Win32.Build.0 = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Debug GTK|x64.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Debug|Win32.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Debug|x64.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Release NASM|Win32.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Release NASM|x64.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Release|Win32.ActiveCfg = Debug GTK|Win32

+		{F6140F25-0460-49E5-A2EB-06CED33BF08F}.Release|x64.ActiveCfg = Debug GTK|Win32

+	EndGlobalSection

+	GlobalSection(SolutionProperties) = preSolution

+		HideSolutionNode = FALSE

+	EndGlobalSection

+EndGlobal

diff --git a/libmp3lame/.indent.pro b/libmp3lame/.indent.pro
new file mode 100644
index 0000000..2ad4b6c
--- /dev/null
+++ b/libmp3lame/.indent.pro
@@ -0,0 +1,32 @@
+// INDENT setup file:
+//	basically the GNU-style of coding
+// 
+--no-blank-lines-after-declarations
+--blank-lines-after-procedures
+--no-blank-lines-after-commas
+--break-before-boolean-operator
+--braces-on-if-line                               // after
+--brace-indent2                                   // 2 <-
+--braces-on-struct-decl-line                      //
+--comment-indentation25                           // 32
+--declaration-comment-column30                    // 1?
+--no-comment-delimiters-on-blank-lines
+--dont-cuddle-else
+--else-endif-column1
+--space-after-cast
+--declaration-indentation8                        // 2
+-ndj                                              // what does this mean?
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4                                   // 2
+--parameter-indentation6                          // 5
+--continue-at-parentheses
+--space-after-procedure-calls
+--procnames-start-lines
+--dont-star-comments
+--leave-optional-blank-lines 
+--no-space-after-function-call-names
+
+--tab-size0
+--line-length100
diff --git a/libmp3lame/Makefile.am b/libmp3lame/Makefile.am
new file mode 100644
index 0000000..1c28536
--- /dev/null
+++ b/libmp3lame/Makefile.am
@@ -0,0 +1,102 @@
+## $Id: Makefile.am,v 1.37.2.2 2010/02/26 22:24:35 robert Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+SUBDIRS = i386 vector
+
+lib_LTLIBRARIES = libmp3lame.la
+
+if HAVE_NASM
+cpu_ldadd = $(top_builddir)/libmp3lame/@CPUTYPE@/liblameasmroutines.la
+endif
+if WITH_VECTOR
+vector_ldadd = $(top_builddir)/libmp3lame/vector/liblamevectorroutines.la
+endif
+
+if LIB_WITH_DECODER
+decoder_ldadd = $(top_builddir)/mpglib/libmpgdecoder.la
+else
+decoder_ldadd =
+endif
+
+libmp3lame_la_LIBADD =	$(cpu_ldadd) $(vector_ldadd) $(decoder_ldadd) \
+			$(CONFIG_MATH_LIB)
+libmp3lame_la_LDFLAGS = -version-info @LIB_MAJOR_VERSION@:@LIB_MINOR_VERSION@ \
+			-no-undefined
+
+INCLUDES = @INCLUDES@ -I$(top_srcdir)/mpglib -I$(top_builddir)
+
+DEFS = @DEFS@ @CONFIG_DEFS@
+
+EXTRA_DIST = \
+	libmp3lame_vc6.dsp \
+	libmp3lame_dll_vc6.dsp \
+	libmp3lame_vc8.vcproj \
+	lame.rc \
+	logoe.ico
+
+libmp3lame_la_SOURCES = \
+        VbrTag.c \
+	bitstream.c \
+	encoder.c \
+	fft.c \
+	gain_analysis.c \
+        id3tag.c \
+        lame.c \
+        newmdct.c \
+	presets.c \
+	psymodel.c \
+	quantize.c \
+	quantize_pvt.c \
+	reservoir.c \
+	set_get.c \
+	tables.c \
+	takehiro.c \
+	util.c \
+	vbrquantize.c \
+	version.c \
+	mpglib_interface.c
+
+noinst_HEADERS= \
+	VbrTag.h \
+	bitstream.h \
+	encoder.h \
+	fft.h \
+	gain_analysis.h \
+	id3tag.h \
+	l3side.h \
+	lame-analysis.h \
+	lame_global_flags.h \
+	machine.h \
+	newmdct.h \
+	psymodel.h \
+	quantize.h  \
+	quantize_pvt.h \
+	reservoir.h \
+	set_get.h \
+	tables.h \
+	util.h \
+	vbrquantize.h \
+	version.h
+
+CLEANFILES = lclint.txt
+
+LCLINTFLAGS= \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+lclint.txt: ${libmp3lame_la_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${libmp3lame_la_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
diff --git a/libmp3lame/Makefile.in b/libmp3lame/Makefile.in
new file mode 100644
index 0000000..8cfa2fa
--- /dev/null
+++ b/libmp3lame/Makefile.in
@@ -0,0 +1,781 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ANSI2KNR = $(top_srcdir)/ansi2knr
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/Makefile.am.global depcomp
+subdir = libmp3lame
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+@LIB_WITH_DECODER_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/mpglib/libmpgdecoder.la
+am__DEPENDENCIES_2 =
+libmp3lame_la_DEPENDENCIES = $(cpu_ldadd) $(vector_ldadd) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_libmp3lame_la_OBJECTS = VbrTag$U.lo bitstream$U.lo encoder$U.lo \
+	fft$U.lo gain_analysis$U.lo id3tag$U.lo lame$U.lo newmdct$U.lo \
+	presets$U.lo psymodel$U.lo quantize$U.lo quantize_pvt$U.lo \
+	reservoir$U.lo set_get$U.lo tables$U.lo takehiro$U.lo \
+	util$U.lo vbrquantize$U.lo version$U.lo mpglib_interface$U.lo
+libmp3lame_la_OBJECTS = $(am_libmp3lame_la_OBJECTS)
+libmp3lame_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libmp3lame_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libmp3lame_la_SOURCES)
+DIST_SOURCES = $(libmp3lame_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+HEADERS = $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@ @CONFIG_DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@ -I$(top_srcdir)/mpglib -I$(top_builddir)
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+SUBDIRS = i386 vector
+lib_LTLIBRARIES = libmp3lame.la
+@HAVE_NASM_TRUE@cpu_ldadd = $(top_builddir)/libmp3lame/@CPUTYPE@/liblameasmroutines.la
+@WITH_VECTOR_TRUE@vector_ldadd = $(top_builddir)/libmp3lame/vector/liblamevectorroutines.la
+@LIB_WITH_DECODER_FALSE@decoder_ldadd = 
+@LIB_WITH_DECODER_TRUE@decoder_ldadd = $(top_builddir)/mpglib/libmpgdecoder.la
+libmp3lame_la_LIBADD = $(cpu_ldadd) $(vector_ldadd) $(decoder_ldadd) \
+			$(CONFIG_MATH_LIB)
+
+libmp3lame_la_LDFLAGS = -version-info @LIB_MAJOR_VERSION@:@LIB_MINOR_VERSION@ \
+			-no-undefined
+
+EXTRA_DIST = \
+	libmp3lame_vc6.dsp \
+	libmp3lame_dll_vc6.dsp \
+	libmp3lame_vc8.vcproj \
+	lame.rc \
+	logoe.ico
+
+libmp3lame_la_SOURCES = \
+        VbrTag.c \
+	bitstream.c \
+	encoder.c \
+	fft.c \
+	gain_analysis.c \
+        id3tag.c \
+        lame.c \
+        newmdct.c \
+	presets.c \
+	psymodel.c \
+	quantize.c \
+	quantize_pvt.c \
+	reservoir.c \
+	set_get.c \
+	tables.c \
+	takehiro.c \
+	util.c \
+	vbrquantize.c \
+	version.c \
+	mpglib_interface.c
+
+noinst_HEADERS = \
+	VbrTag.h \
+	bitstream.h \
+	encoder.h \
+	fft.h \
+	gain_analysis.h \
+	id3tag.h \
+	l3side.h \
+	lame-analysis.h \
+	lame_global_flags.h \
+	machine.h \
+	newmdct.h \
+	psymodel.h \
+	quantize.h  \
+	quantize_pvt.h \
+	reservoir.h \
+	set_get.h \
+	tables.h \
+	util.h \
+	vbrquantize.h \
+	version.h
+
+CLEANFILES = lclint.txt
+LCLINTFLAGS = \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  libmp3lame/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  libmp3lame/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libmp3lame.la: $(libmp3lame_la_OBJECTS) $(libmp3lame_la_DEPENDENCIES) 
+	$(libmp3lame_la_LINK) -rpath $(libdir) $(libmp3lame_la_OBJECTS) $(libmp3lame_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+$(top_srcdir)/ansi2knr:
+	cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
+
+mostlyclean-kr:
+	-test "$U" = "" || rm -f *_.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VbrTag$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitstream$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fft$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gain_analysis$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3tag$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lame$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpglib_interface$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newmdct$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/presets$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psymodel$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantize$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantize_pvt$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reservoir$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_get$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/takehiro$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbrquantize$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version$U.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+VbrTag_.c: VbrTag.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/VbrTag.c; then echo $(srcdir)/VbrTag.c; else echo VbrTag.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+bitstream_.c: bitstream.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bitstream.c; then echo $(srcdir)/bitstream.c; else echo bitstream.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+encoder_.c: encoder.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/encoder.c; then echo $(srcdir)/encoder.c; else echo encoder.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fft_.c: fft.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fft.c; then echo $(srcdir)/fft.c; else echo fft.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gain_analysis_.c: gain_analysis.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gain_analysis.c; then echo $(srcdir)/gain_analysis.c; else echo gain_analysis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+id3tag_.c: id3tag.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/id3tag.c; then echo $(srcdir)/id3tag.c; else echo id3tag.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lame_.c: lame.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lame.c; then echo $(srcdir)/lame.c; else echo lame.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mpglib_interface_.c: mpglib_interface.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mpglib_interface.c; then echo $(srcdir)/mpglib_interface.c; else echo mpglib_interface.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+newmdct_.c: newmdct.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/newmdct.c; then echo $(srcdir)/newmdct.c; else echo newmdct.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+presets_.c: presets.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/presets.c; then echo $(srcdir)/presets.c; else echo presets.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+psymodel_.c: psymodel.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/psymodel.c; then echo $(srcdir)/psymodel.c; else echo psymodel.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+quantize_.c: quantize.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quantize.c; then echo $(srcdir)/quantize.c; else echo quantize.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+quantize_pvt_.c: quantize_pvt.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quantize_pvt.c; then echo $(srcdir)/quantize_pvt.c; else echo quantize_pvt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+reservoir_.c: reservoir.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reservoir.c; then echo $(srcdir)/reservoir.c; else echo reservoir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_get_.c: set_get.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_get.c; then echo $(srcdir)/set_get.c; else echo set_get.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tables_.c: tables.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tables.c; then echo $(srcdir)/tables.c; else echo tables.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+takehiro_.c: takehiro.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/takehiro.c; then echo $(srcdir)/takehiro.c; else echo takehiro.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+util_.c: util.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/util.c; then echo $(srcdir)/util.c; else echo util.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vbrquantize_.c: vbrquantize.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vbrquantize.c; then echo $(srcdir)/vbrquantize.c; else echo vbrquantize.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+version_.c: version.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+VbrTag_.$(OBJEXT) VbrTag_.lo bitstream_.$(OBJEXT) bitstream_.lo \
+encoder_.$(OBJEXT) encoder_.lo fft_.$(OBJEXT) fft_.lo \
+gain_analysis_.$(OBJEXT) gain_analysis_.lo id3tag_.$(OBJEXT) \
+id3tag_.lo lame_.$(OBJEXT) lame_.lo mpglib_interface_.$(OBJEXT) \
+mpglib_interface_.lo newmdct_.$(OBJEXT) newmdct_.lo presets_.$(OBJEXT) \
+presets_.lo psymodel_.$(OBJEXT) psymodel_.lo quantize_.$(OBJEXT) \
+quantize_.lo quantize_pvt_.$(OBJEXT) quantize_pvt_.lo \
+reservoir_.$(OBJEXT) reservoir_.lo set_get_.$(OBJEXT) set_get_.lo \
+tables_.$(OBJEXT) tables_.lo takehiro_.$(OBJEXT) takehiro_.lo \
+util_.$(OBJEXT) util_.lo vbrquantize_.$(OBJEXT) vbrquantize_.lo \
+version_.$(OBJEXT) version_.lo : $(ANSI2KNR)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(libdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-libLTLIBRARIES
+
+
+# end global section
+
+lclint.txt: ${libmp3lame_la_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${libmp3lame_la_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libmp3lame/VbrTag.c b/libmp3lame/VbrTag.c
new file mode 100644
index 0000000..3aaf8fd
--- /dev/null
+++ b/libmp3lame/VbrTag.c
@@ -0,0 +1,1058 @@
+/*
+ *      Xing VBR tagging for LAME.
+ *
+ *      Copyright (c) 1999 A.L. Faber
+ *      Copyright (c) 2001 Jonathan Dee
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: VbrTag.c,v 1.94.2.2 2010/02/20 21:01:49 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "bitstream.h"
+#include "VbrTag.h"
+#include "lame_global_flags.h"
+
+#ifdef __sun__
+/* woraround for SunOS 4.x, it has SEEK_* defined here */
+#include <unistd.h>
+#endif
+
+
+#ifdef _DEBUG
+/*  #define DEBUG_VBRTAG */
+#endif
+
+/*
+ *    4 bytes for Header Tag
+ *    4 bytes for Header Flags
+ *  100 bytes for entry (NUMTOCENTRIES)
+ *    4 bytes for FRAME SIZE
+ *    4 bytes for STREAM_SIZE
+ *    4 bytes for VBR SCALE. a VBR quality indicator: 0=best 100=worst
+ *   20 bytes for LAME tag.  for example, "LAME3.12 (beta 6)"
+ * ___________
+ *  140 bytes
+*/
+#define VBRHEADERSIZE (NUMTOCENTRIES+4+4+4+4+4)
+
+#define LAMEHEADERSIZE (VBRHEADERSIZE + 9 + 1 + 1 + 8 + 1 + 1 + 3 + 1 + 1 + 2 + 4 + 2 + 2)
+
+/* the size of the Xing header (MPEG1 and MPEG2) in kbps */
+#define XING_BITRATE1 128
+#define XING_BITRATE2  64
+#define XING_BITRATE25 32
+
+
+
+static const char VBRTag0[] = { "Xing" };
+static const char VBRTag1[] = { "Info" };
+
+
+
+
+/* Lookup table for fast CRC computation
+ * See 'CRC_update_lookup'
+ * Uses the polynomial x^16+x^15+x^2+1 */
+
+static const unsigned int crc16_lookup[256] = {
+    0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
+    0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
+    0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
+    0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
+    0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
+    0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
+    0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
+    0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
+    0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
+    0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
+    0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
+    0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
+    0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
+    0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
+    0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
+    0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
+    0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
+    0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
+    0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
+    0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
+    0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
+    0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
+    0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
+    0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
+    0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
+    0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
+    0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
+    0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
+    0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
+    0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
+    0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
+    0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
+};
+
+
+
+
+
+/***********************************************************************
+ *  Robert Hegemann 2001-01-17
+ ***********************************************************************/
+
+static void
+addVbr(VBR_seek_info_t * v, int bitrate)
+{
+    int     i;
+
+    v->nVbrNumFrames++;
+    v->sum += bitrate;
+    v->seen++;
+
+    if (v->seen < v->want) {
+        return;
+    }
+
+    if (v->pos < v->size) {
+        v->bag[v->pos] = v->sum;
+        v->pos++;
+        v->seen = 0;
+    }
+    if (v->pos == v->size) {
+        for (i = 1; i < v->size; i += 2) {
+            v->bag[i / 2] = v->bag[i];
+        }
+        v->want *= 2;
+        v->pos /= 2;
+    }
+}
+
+static void
+Xing_seek_table(VBR_seek_info_t * v, unsigned char *t)
+{
+    int     i, indx;
+    int     seek_point;
+
+    if (v->pos <= 0)
+        return;
+
+    for (i = 1; i < NUMTOCENTRIES; ++i) {
+        float   j = i / (float) NUMTOCENTRIES, act, sum;
+        indx = (int) (floor(j * v->pos));
+        if (indx > v->pos - 1)
+            indx = v->pos - 1;
+        act = v->bag[indx];
+        sum = v->sum;
+        seek_point = (int) (256. * act / sum);
+        if (seek_point > 255)
+            seek_point = 255;
+        t[i] = seek_point;
+    }
+}
+
+#ifdef DEBUG_VBR_SEEKING_TABLE
+static void
+print_seeking(unsigned char *t)
+{
+    int     i;
+
+    printf("seeking table ");
+    for (i = 0; i < NUMTOCENTRIES; ++i) {
+        printf(" %d ", t[i]);
+    }
+    printf("\n");
+}
+#endif
+
+
+/****************************************************************************
+ * AddVbrFrame: Add VBR entry, used to fill the VBR the TOC entries
+ * Paramters:
+ *      nStreamPos: how many bytes did we write to the bitstream so far
+ *                              (in Bytes NOT Bits)
+ ****************************************************************************
+*/
+void
+AddVbrFrame(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+
+    int     kbps = bitrate_table[gfp->version][gfc->bitrate_index];
+    assert(gfc->VBR_seek_table.bag);
+    addVbr(&gfc->VBR_seek_table, kbps);
+}
+
+
+/*-------------------------------------------------------------*/
+static int
+ExtractI4(unsigned char *buf)
+{
+    int     x;
+    /* big endian extract */
+    x = buf[0];
+    x <<= 8;
+    x |= buf[1];
+    x <<= 8;
+    x |= buf[2];
+    x <<= 8;
+    x |= buf[3];
+    return x;
+}
+
+static void
+CreateI4(unsigned char *buf, int nValue)
+{
+    /* big endian create */
+    buf[0] = (nValue >> 24) & 0xff;
+    buf[1] = (nValue >> 16) & 0xff;
+    buf[2] = (nValue >> 8) & 0xff;
+    buf[3] = (nValue) & 0xff;
+}
+
+
+
+static void
+CreateI2(unsigned char *buf, int nValue)
+{
+    /* big endian create */
+    buf[0] = (nValue >> 8) & 0xff;
+    buf[1] = (nValue) & 0xff;
+}
+
+/* check for magic strings*/
+static int
+IsVbrTag(const unsigned char *buf)
+{
+    int     isTag0, isTag1;
+
+    isTag0 = ((buf[0] == VBRTag0[0]) && (buf[1] == VBRTag0[1]) && (buf[2] == VBRTag0[2])
+              && (buf[3] == VBRTag0[3]));
+    isTag1 = ((buf[0] == VBRTag1[0]) && (buf[1] == VBRTag1[1]) && (buf[2] == VBRTag1[2])
+              && (buf[3] == VBRTag1[3]));
+
+    return (isTag0 || isTag1);
+}
+
+#define SHIFT_IN_BITS_VALUE(x,n,v) ( x = (x << (n)) | ( (v) & ~(-1 << (n)) ) )
+
+static void
+setLameTagFrameHeader(lame_global_flags const *gfp, unsigned char *buffer)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    char    abyte, bbyte;
+
+    SHIFT_IN_BITS_VALUE(buffer[0], 8u, 0xffu);
+
+    SHIFT_IN_BITS_VALUE(buffer[1], 3u, 7);
+    SHIFT_IN_BITS_VALUE(buffer[1], 1u, (gfp->out_samplerate < 16000) ? 0 : 1);
+    SHIFT_IN_BITS_VALUE(buffer[1], 1u, gfp->version);
+    SHIFT_IN_BITS_VALUE(buffer[1], 2u, 4 - 3);
+    SHIFT_IN_BITS_VALUE(buffer[1], 1u, (!gfp->error_protection) ? 1 : 0);
+
+    SHIFT_IN_BITS_VALUE(buffer[2], 4u, gfc->bitrate_index);
+    SHIFT_IN_BITS_VALUE(buffer[2], 2u, gfc->samplerate_index);
+    SHIFT_IN_BITS_VALUE(buffer[2], 1u, 0);
+    SHIFT_IN_BITS_VALUE(buffer[2], 1u, gfp->extension);
+
+    SHIFT_IN_BITS_VALUE(buffer[3], 2u, gfp->mode);
+    SHIFT_IN_BITS_VALUE(buffer[3], 2u, gfc->mode_ext);
+    SHIFT_IN_BITS_VALUE(buffer[3], 1u, gfp->copyright);
+    SHIFT_IN_BITS_VALUE(buffer[3], 1u, gfp->original);
+    SHIFT_IN_BITS_VALUE(buffer[3], 2u, gfp->emphasis);
+
+    /* the default VBR header. 48 kbps layer III, no padding, no crc */
+    /* but sampling freq, mode andy copyright/copy protection taken */
+    /* from first valid frame */
+    buffer[0] = (uint8_t) 0xff;
+    abyte = (buffer[1] & (unsigned char) 0xf1);
+    {
+        int     bitrate;
+        if (1 == gfp->version) {
+            bitrate = XING_BITRATE1;
+        }
+        else {
+            if (gfp->out_samplerate < 16000)
+                bitrate = XING_BITRATE25;
+            else
+                bitrate = XING_BITRATE2;
+        }
+
+        if (gfp->VBR == vbr_off)
+            bitrate = gfp->brate;
+
+        if (gfp->free_format)
+            bbyte = 0x00;
+        else
+            bbyte = 16 * BitrateIndex(bitrate, gfp->version, gfp->out_samplerate);
+    }
+
+    /* Use as much of the info from the real frames in the
+     * Xing header:  samplerate, channels, crc, etc...
+     */
+    if (gfp->version == 1) {
+        /* MPEG1 */
+        buffer[1] = abyte | (char) 0x0a; /* was 0x0b; */
+        abyte = buffer[2] & (char) 0x0d; /* AF keep also private bit */
+        buffer[2] = (char) bbyte | abyte; /* 64kbs MPEG1 frame */
+    }
+    else {
+        /* MPEG2 */
+        buffer[1] = abyte | (char) 0x02; /* was 0x03; */
+        abyte = buffer[2] & (char) 0x0d; /* AF keep also private bit */
+        buffer[2] = (char) bbyte | abyte; /* 64kbs MPEG2 frame */
+    }
+}
+
+/*-------------------------------------------------------------*/
+/* Same as GetVbrTag below, but only checks for the Xing tag.
+   requires buf to contain only 40 bytes */
+/*-------------------------------------------------------------*/
+int
+CheckVbrTag(unsigned char *buf)
+{
+    int     h_id, h_mode;
+
+    /* get selected MPEG header data */
+    h_id = (buf[1] >> 3) & 1;
+    h_mode = (buf[3] >> 6) & 3;
+
+    /*  determine offset of header */
+    if (h_id) {
+        /* mpeg1 */
+        if (h_mode != 3)
+            buf += (32 + 4);
+        else
+            buf += (17 + 4);
+    }
+    else {
+        /* mpeg2 */
+        if (h_mode != 3)
+            buf += (17 + 4);
+        else
+            buf += (9 + 4);
+    }
+
+    return IsVbrTag(buf);
+}
+
+int
+GetVbrTag(VBRTAGDATA * pTagData, unsigned char *buf)
+{
+    int     i, head_flags;
+    int     h_bitrate, h_id, h_mode, h_sr_index;
+    int     enc_delay, enc_padding;
+
+    /* get Vbr header data */
+    pTagData->flags = 0;
+
+    /* get selected MPEG header data */
+    h_id = (buf[1] >> 3) & 1;
+    h_sr_index = (buf[2] >> 2) & 3;
+    h_mode = (buf[3] >> 6) & 3;
+    h_bitrate = ((buf[2] >> 4) & 0xf);
+    h_bitrate = bitrate_table[h_id][h_bitrate];
+
+    /* check for FFE syncword */
+    if ((buf[1] >> 4) == 0xE)
+        pTagData->samprate = samplerate_table[2][h_sr_index];
+    else
+        pTagData->samprate = samplerate_table[h_id][h_sr_index];
+    /* if( h_id == 0 ) */
+    /*  pTagData->samprate >>= 1; */
+
+
+
+    /*  determine offset of header */
+    if (h_id) {
+        /* mpeg1 */
+        if (h_mode != 3)
+            buf += (32 + 4);
+        else
+            buf += (17 + 4);
+    }
+    else {
+        /* mpeg2 */
+        if (h_mode != 3)
+            buf += (17 + 4);
+        else
+            buf += (9 + 4);
+    }
+
+    if (!IsVbrTag(buf))
+        return 0;
+
+    buf += 4;
+
+    pTagData->h_id = h_id;
+
+    head_flags = pTagData->flags = ExtractI4(buf);
+    buf += 4;           /* get flags */
+
+    if (head_flags & FRAMES_FLAG) {
+        pTagData->frames = ExtractI4(buf);
+        buf += 4;
+    }
+
+    if (head_flags & BYTES_FLAG) {
+        pTagData->bytes = ExtractI4(buf);
+        buf += 4;
+    }
+
+    if (head_flags & TOC_FLAG) {
+        if (pTagData->toc != NULL) {
+            for (i = 0; i < NUMTOCENTRIES; i++)
+                pTagData->toc[i] = buf[i];
+        }
+        buf += NUMTOCENTRIES;
+    }
+
+    pTagData->vbr_scale = -1;
+
+    if (head_flags & VBR_SCALE_FLAG) {
+        pTagData->vbr_scale = ExtractI4(buf);
+        buf += 4;
+    }
+
+    pTagData->headersize = ((h_id + 1) * 72000 * h_bitrate) / pTagData->samprate;
+
+    buf += 21;
+    enc_delay = buf[0] << 4;
+    enc_delay += buf[1] >> 4;
+    enc_padding = (buf[1] & 0x0F) << 8;
+    enc_padding += buf[2];
+    /* check for reasonable values (this may be an old Xing header, */
+    /* not a INFO tag) */
+    if (enc_delay < 0 || enc_delay > 3000)
+        enc_delay = -1;
+    if (enc_padding < 0 || enc_padding > 3000)
+        enc_padding = -1;
+
+    pTagData->enc_delay = enc_delay;
+    pTagData->enc_padding = enc_padding;
+
+#ifdef DEBUG_VBRTAG
+    fprintf(stderr, "\n\n********************* VBR TAG INFO *****************\n");
+    fprintf(stderr, "tag         :%s\n", VBRTag);
+    fprintf(stderr, "head_flags  :%d\n", head_flags);
+    fprintf(stderr, "bytes       :%d\n", pTagData->bytes);
+    fprintf(stderr, "frames      :%d\n", pTagData->frames);
+    fprintf(stderr, "VBR Scale   :%d\n", pTagData->vbr_scale);
+    fprintf(stderr, "enc_delay  = %i \n", enc_delay);
+    fprintf(stderr, "enc_padding= %i \n", enc_padding);
+    fprintf(stderr, "toc:\n");
+    if (pTagData->toc != NULL) {
+        for (i = 0; i < NUMTOCENTRIES; i++) {
+            if ((i % 10) == 0)
+                fprintf(stderr, "\n");
+            fprintf(stderr, " %3d", (int) (pTagData->toc[i]));
+        }
+    }
+    fprintf(stderr, "\n***************** END OF VBR TAG INFO ***************\n");
+#endif
+    return 1;           /* success */
+}
+
+
+/****************************************************************************
+ * InitVbrTag: Initializes the header, and write empty frame to stream
+ * Paramters:
+ *                              fpStream: pointer to output file stream
+ *                              nMode   : Channel Mode: 0=STEREO 1=JS 2=DS 3=MONO
+ ****************************************************************************
+*/
+int
+InitVbrTag(lame_global_flags * gfp)
+{
+    int     kbps_header;
+    lame_internal_flags *gfc = gfp->internal_flags;
+#define MAXFRAMESIZE 2880 /* or 0xB40, the max freeformat 640 32kHz framesize */
+
+    /*
+     * Xing VBR pretends to be a 48kbs layer III frame.  (at 44.1kHz).
+     * (at 48kHz they use 56kbs since 48kbs frame not big enough for
+     * table of contents)
+     * let's always embed Xing header inside a 64kbs layer III frame.
+     * this gives us enough room for a LAME version string too.
+     * size determined by sampling frequency (MPEG1)
+     * 32kHz:    216 bytes@48kbs    288bytes@ 64kbs
+     * 44.1kHz:  156 bytes          208bytes@64kbs     (+1 if padding = 1)
+     * 48kHz:    144 bytes          192
+     *
+     * MPEG 2 values are the same since the framesize and samplerate
+     * are each reduced by a factor of 2.
+     */
+
+
+    if (1 == gfp->version) {
+        kbps_header = XING_BITRATE1;
+    }
+    else {
+        if (gfp->out_samplerate < 16000)
+            kbps_header = XING_BITRATE25;
+        else
+            kbps_header = XING_BITRATE2;
+    }
+
+    if (gfp->VBR == vbr_off)
+        kbps_header = gfp->brate;
+
+    /** make sure LAME Header fits into Frame
+     */
+    {
+        int     total_frame_size = ((gfp->version + 1) * 72000 * kbps_header) / gfp->out_samplerate;
+        int     header_size = (gfc->sideinfo_len + LAMEHEADERSIZE);
+        gfc->VBR_seek_table.TotalFrameSize = total_frame_size;
+        if (total_frame_size < header_size || total_frame_size > MAXFRAMESIZE) {
+            /* disable tag, it wont fit */
+            gfp->bWriteVbrTag = 0;
+            return 0;
+        }
+    }
+
+    gfc->VBR_seek_table.nVbrNumFrames = 0;
+    gfc->VBR_seek_table.nBytesWritten = 0;
+    gfc->VBR_seek_table.sum = 0;
+
+    gfc->VBR_seek_table.seen = 0;
+    gfc->VBR_seek_table.want = 1;
+    gfc->VBR_seek_table.pos = 0;
+
+    if (gfc->VBR_seek_table.bag == NULL) {
+        gfc->VBR_seek_table.bag = malloc(400 * sizeof(int));
+        if (gfc->VBR_seek_table.bag != NULL) {
+            gfc->VBR_seek_table.size = 400;
+        }
+        else {
+            gfc->VBR_seek_table.size = 0;
+            ERRORF(gfc, "Error: can't allocate VbrFrames buffer\n");
+            gfp->bWriteVbrTag = 0;
+            return -1;
+        }
+    }
+
+    /* write dummy VBR tag of all 0's into bitstream */
+    {
+        uint8_t buffer[MAXFRAMESIZE];
+        size_t  i, n;
+
+        memset(buffer, 0, sizeof(buffer));
+        setLameTagFrameHeader(gfp, buffer);
+        n = gfc->VBR_seek_table.TotalFrameSize;
+        for (i = 0; i < n; ++i) {
+            add_dummy_byte(gfp, buffer[i], 1);
+        }
+    }
+    /* Success */
+    return 0;
+}
+
+
+
+/* fast CRC-16 computation - uses table crc16_lookup 8*/
+static int
+CRC_update_lookup(int value, int crc)
+{
+    int     tmp;
+    tmp = crc ^ value;
+    crc = (crc >> 8) ^ crc16_lookup[tmp & 0xff];
+    return crc;
+}
+
+void
+UpdateMusicCRC(uint16_t * crc, unsigned char *buffer, int size)
+{
+    int     i;
+    for (i = 0; i < size; ++i)
+        *crc = CRC_update_lookup(buffer[i], *crc);
+}
+
+
+
+
+
+/****************************************************************************
+ * Jonathan Dee 2001/08/31
+ *
+ * PutLameVBR: Write LAME info: mini version + info on various switches used
+ * Paramters:
+ *                              pbtStreamBuffer : pointer to output buffer
+ *                              id3v2size               : size of id3v2 tag in bytes
+ *                              crc                             : computation of crc-16 of Lame Tag so far (starting at frame sync)
+ *
+ ****************************************************************************
+*/
+static int
+PutLameVBR(lame_global_flags const *gfp, size_t nMusicLength, uint8_t * pbtStreamBuffer, uint16_t crc)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+
+    int     nBytesWritten = 0;
+    int     i;
+
+    int     enc_delay = lame_get_encoder_delay(gfp); /* encoder delay */
+    int     enc_padding = lame_get_encoder_padding(gfp); /* encoder padding  */
+
+    /*recall: gfp->VBR_q is for example set by the switch -V  */
+    /*   gfp->quality by -q, -h, -f, etc */
+
+    int     nQuality = (100 - 10 * gfp->VBR_q - gfp->quality);
+
+
+    const char *szVersion = get_lame_very_short_version();
+    uint8_t nVBR;
+    uint8_t nRevision = 0x00;
+    uint8_t nRevMethod;
+    uint8_t vbr_type_translator[] = { 1, 5, 3, 2, 4, 0, 3 }; /*numbering different in vbr_mode vs. Lame tag */
+
+    uint8_t nLowpass =
+        (((gfp->lowpassfreq / 100.0) + .5) > 255 ? 255 : (gfp->lowpassfreq / 100.0) + .5);
+
+    uint32_t nPeakSignalAmplitude = 0;
+
+    uint16_t nRadioReplayGain = 0;
+    uint16_t nAudiophileReplayGain = 0;
+
+    uint8_t nNoiseShaping = gfp->internal_flags->noise_shaping;
+    uint8_t nStereoMode = 0;
+    int     bNonOptimal = 0;
+    uint8_t nSourceFreq = 0;
+    uint8_t nMisc = 0;
+    uint16_t nMusicCRC = 0;
+
+    /*psy model type: Gpsycho or NsPsytune */
+    unsigned char bExpNPsyTune = gfp->exp_nspsytune & 1;
+    unsigned char bSafeJoint = (gfp->exp_nspsytune & 2) != 0;
+
+    unsigned char bNoGapMore = 0;
+    unsigned char bNoGapPrevious = 0;
+
+    int     nNoGapCount = gfp->internal_flags->nogap_total;
+    int     nNoGapCurr = gfp->internal_flags->nogap_current;
+
+
+    uint8_t nAthType = gfp->ATHtype; /*4 bits. */
+
+    uint8_t nFlags = 0;
+
+    /* if ABR, {store bitrate <=255} else { store "-b"} */
+    int     nABRBitrate;
+    switch (gfp->VBR) {
+    case vbr_abr:{
+            nABRBitrate = gfp->VBR_mean_bitrate_kbps;
+            break;
+        }
+    case vbr_off:{
+            nABRBitrate = gfp->brate;
+            break;
+        }
+    default:{          /*vbr modes */
+            nABRBitrate = gfp->VBR_min_bitrate_kbps;
+        }
+    }
+
+
+    /*revision and vbr method */
+    if (gfp->VBR < sizeof(vbr_type_translator))
+        nVBR = vbr_type_translator[gfp->VBR];
+    else
+        nVBR = 0x00;    /*unknown. */
+
+    nRevMethod = 0x10 * nRevision + nVBR;
+
+
+    /* ReplayGain */
+    if (gfc->findReplayGain) {
+        if (gfc->RadioGain > 0x1FE)
+            gfc->RadioGain = 0x1FE;
+        if (gfc->RadioGain < -0x1FE)
+            gfc->RadioGain = -0x1FE;
+
+        nRadioReplayGain = 0x2000; /* set name code */
+        nRadioReplayGain |= 0xC00; /* set originator code to `determined automatically' */
+
+        if (gfc->RadioGain >= 0)
+            nRadioReplayGain |= gfc->RadioGain; /* set gain adjustment */
+        else {
+            nRadioReplayGain |= 0x200; /* set the sign bit */
+            nRadioReplayGain |= -gfc->RadioGain; /* set gain adjustment */
+        }
+    }
+
+    /* peak sample */
+    if (gfc->findPeakSample)
+        nPeakSignalAmplitude = abs((int) ((((FLOAT) gfc->PeakSample) / 32767.0) * pow(2, 23) + .5));
+
+    /*nogap */
+    if (nNoGapCount != -1) {
+        if (nNoGapCurr > 0)
+            bNoGapPrevious = 1;
+
+        if (nNoGapCurr < nNoGapCount - 1)
+            bNoGapMore = 1;
+    }
+
+    /*flags */
+
+    nFlags = nAthType + (bExpNPsyTune << 4)
+        + (bSafeJoint << 5)
+        + (bNoGapMore << 6)
+        + (bNoGapPrevious << 7);
+
+
+    if (nQuality < 0)
+        nQuality = 0;
+
+    /*stereo mode field... a bit ugly. */
+
+    switch (gfp->mode) {
+    case MONO:
+        nStereoMode = 0;
+        break;
+    case STEREO:
+        nStereoMode = 1;
+        break;
+    case DUAL_CHANNEL:
+        nStereoMode = 2;
+        break;
+    case JOINT_STEREO:
+        if (gfp->force_ms)
+            nStereoMode = 4;
+        else
+            nStereoMode = 3;
+        break;
+    case NOT_SET:
+        /* FALLTHROUGH */
+    default:
+        nStereoMode = 7;
+        break;
+    }
+
+    /*Intensity stereo : nStereoMode = 6. IS is not implemented */
+
+    if (gfp->in_samplerate <= 32000)
+        nSourceFreq = 0x00;
+    else if (gfp->in_samplerate == 48000)
+        nSourceFreq = 0x02;
+    else if (gfp->in_samplerate > 48000)
+        nSourceFreq = 0x03;
+    else
+        nSourceFreq = 0x01; /*default is 44100Hz. */
+
+
+    /*Check if the user overrided the default LAME behaviour with some nasty options */
+
+    if (gfp->short_blocks == short_block_forced || gfp->short_blocks == short_block_dispensed || ((gfp->lowpassfreq == -1) && (gfp->highpassfreq == -1)) || /* "-k" */
+        (gfp->scale_left < gfp->scale_right) ||
+        (gfp->scale_left > gfp->scale_right) ||
+        (gfp->disable_reservoir && gfp->brate < 320) ||
+        gfp->noATH || gfp->ATHonly || (nAthType == 0) || gfp->in_samplerate <= 32000)
+        bNonOptimal = 1;
+
+    nMisc = nNoiseShaping + (nStereoMode << 2)
+        + (bNonOptimal << 5)
+        + (nSourceFreq << 6);
+
+
+    nMusicCRC = gfc->nMusicCRC;
+
+
+    /*Write all this information into the stream */
+    CreateI4(&pbtStreamBuffer[nBytesWritten], nQuality);
+    nBytesWritten += 4;
+
+    strncpy((char *) &pbtStreamBuffer[nBytesWritten], szVersion, 9);
+    nBytesWritten += 9;
+
+    pbtStreamBuffer[nBytesWritten] = nRevMethod;
+    nBytesWritten++;
+
+    pbtStreamBuffer[nBytesWritten] = nLowpass;
+    nBytesWritten++;
+
+    CreateI4(&pbtStreamBuffer[nBytesWritten], nPeakSignalAmplitude);
+    nBytesWritten += 4;
+
+    CreateI2(&pbtStreamBuffer[nBytesWritten], nRadioReplayGain);
+    nBytesWritten += 2;
+
+    CreateI2(&pbtStreamBuffer[nBytesWritten], nAudiophileReplayGain);
+    nBytesWritten += 2;
+
+    pbtStreamBuffer[nBytesWritten] = nFlags;
+    nBytesWritten++;
+
+    if (nABRBitrate >= 255)
+        pbtStreamBuffer[nBytesWritten] = 0xFF;
+    else
+        pbtStreamBuffer[nBytesWritten] = nABRBitrate;
+    nBytesWritten++;
+
+    pbtStreamBuffer[nBytesWritten] = enc_delay >> 4; /* works for win32, does it for unix? */
+    pbtStreamBuffer[nBytesWritten + 1] = (enc_delay << 4) + (enc_padding >> 8);
+    pbtStreamBuffer[nBytesWritten + 2] = enc_padding;
+
+    nBytesWritten += 3;
+
+    pbtStreamBuffer[nBytesWritten] = nMisc;
+    nBytesWritten++;
+
+
+    pbtStreamBuffer[nBytesWritten++] = 0; /*unused in rev0 */
+
+    CreateI2(&pbtStreamBuffer[nBytesWritten], gfp->preset);
+    nBytesWritten += 2;
+
+    CreateI4(&pbtStreamBuffer[nBytesWritten], (int) nMusicLength);
+    nBytesWritten += 4;
+
+    CreateI2(&pbtStreamBuffer[nBytesWritten], nMusicCRC);
+    nBytesWritten += 2;
+
+    /*Calculate tag CRC.... must be done here, since it includes
+     *previous information*/
+
+    for (i = 0; i < nBytesWritten; i++)
+        crc = CRC_update_lookup(pbtStreamBuffer[i], crc);
+
+    CreateI2(&pbtStreamBuffer[nBytesWritten], crc);
+    nBytesWritten += 2;
+
+    return nBytesWritten;
+}
+
+static long
+skipId3v2(FILE * fpStream)
+{
+    size_t  nbytes;
+    long    id3v2TagSize;
+    unsigned char id3v2Header[10];
+
+    /* seek to the beginning of the stream */
+    if (fseek(fpStream, 0, SEEK_SET) != 0) {
+        return -2;      /* not seekable, abort */
+    }
+    /* read 10 bytes in case there's an ID3 version 2 header here */
+    nbytes = fread(id3v2Header, 1, sizeof(id3v2Header), fpStream);
+    if (nbytes != sizeof(id3v2Header)) {
+        return -3;      /* not readable, maybe opened Write-Only */
+    }
+    /* does the stream begin with the ID3 version 2 file identifier? */
+    if (!strncmp((char *) id3v2Header, "ID3", 3)) {
+        /* the tag size (minus the 10-byte header) is encoded into four
+         * bytes where the most significant bit is clear in each byte */
+        id3v2TagSize = (((id3v2Header[6] & 0x7f) << 21)
+                        | ((id3v2Header[7] & 0x7f) << 14)
+                        | ((id3v2Header[8] & 0x7f) << 7)
+                        | (id3v2Header[9] & 0x7f))
+            + sizeof id3v2Header;
+    }
+    else {
+        /* no ID3 version 2 tag in this stream */
+        id3v2TagSize = 0;
+    }
+    return id3v2TagSize;
+}
+
+
+
+size_t
+lame_get_lametag_frame(lame_global_flags const *gfp, unsigned char *buffer, size_t size)
+{
+    lame_internal_flags *gfc;
+    int     stream_size;
+    int     nStreamIndex;
+    uint8_t btToc[NUMTOCENTRIES];
+
+    if (gfp == 0) {
+        return 0;
+    }
+    if (gfp->bWriteVbrTag == 0) {
+        return 0;
+    }
+    gfc = gfp->internal_flags;
+    if (gfc == 0) {
+        return 0;
+    }
+    if (gfc->Class_ID != LAME_ID) {
+        return 0;
+    }
+    if (gfc->VBR_seek_table.pos <= 0) {
+        return 0;
+    }
+    if (size < gfc->VBR_seek_table.TotalFrameSize) {
+        return gfc->VBR_seek_table.TotalFrameSize;
+    }
+    if (buffer == 0) {
+        return 0;
+    }
+
+    memset(buffer, 0, gfc->VBR_seek_table.TotalFrameSize);
+
+    /* 4 bytes frame header */
+
+    setLameTagFrameHeader(gfp, buffer);
+
+    /* Clear all TOC entries */
+    memset(btToc, 0, sizeof(btToc));
+
+    if (gfp->free_format) {
+        int     i;
+        for (i = 1; i < NUMTOCENTRIES; ++i)
+            btToc[i] = 255 * i / 100;
+    }
+    else {
+        Xing_seek_table(&gfc->VBR_seek_table, btToc);
+    }
+#ifdef DEBUG_VBR_SEEKING_TABLE
+    print_seeking(btToc);
+#endif
+
+    /* Start writing the tag after the zero frame */
+    nStreamIndex = gfc->sideinfo_len;
+    /* note! Xing header specifies that Xing data goes in the
+     * ancillary data with NO ERROR PROTECTION.  If error protecton
+     * in enabled, the Xing data still starts at the same offset,
+     * and now it is in sideinfo data block, and thus will not
+     * decode correctly by non-Xing tag aware players */
+    if (gfp->error_protection)
+        nStreamIndex -= 2;
+
+    /* Put Vbr tag */
+    if (gfp->VBR == vbr_off) {
+        buffer[nStreamIndex++] = VBRTag1[0];
+        buffer[nStreamIndex++] = VBRTag1[1];
+        buffer[nStreamIndex++] = VBRTag1[2];
+        buffer[nStreamIndex++] = VBRTag1[3];
+
+    }
+    else {
+        buffer[nStreamIndex++] = VBRTag0[0];
+        buffer[nStreamIndex++] = VBRTag0[1];
+        buffer[nStreamIndex++] = VBRTag0[2];
+        buffer[nStreamIndex++] = VBRTag0[3];
+    }
+
+    /* Put header flags */
+    CreateI4(&buffer[nStreamIndex], FRAMES_FLAG + BYTES_FLAG + TOC_FLAG + VBR_SCALE_FLAG);
+    nStreamIndex += 4;
+
+    /* Put Total Number of frames */
+    CreateI4(&buffer[nStreamIndex], gfc->VBR_seek_table.nVbrNumFrames);
+    nStreamIndex += 4;
+
+    /* Put total audio stream size, including Xing/LAME Header */
+    stream_size = gfc->VBR_seek_table.nBytesWritten + gfc->VBR_seek_table.TotalFrameSize;
+    CreateI4(&buffer[nStreamIndex], stream_size);
+    nStreamIndex += 4;
+
+    /* Put TOC */
+    memcpy(&buffer[nStreamIndex], btToc, sizeof(btToc));
+    nStreamIndex += sizeof(btToc);
+
+
+    if (gfp->error_protection) {
+        /* (jo) error_protection: add crc16 information to header */
+        CRC_writeheader(gfc, (char *) buffer);
+    }
+    {
+        /*work out CRC so far: initially crc = 0 */
+        uint16_t crc = 0x00;
+        int     i;
+        for (i = 0; i < nStreamIndex; i++)
+            crc = CRC_update_lookup(buffer[i], crc);
+        /*Put LAME VBR info */
+        nStreamIndex += PutLameVBR(gfp, stream_size, buffer + nStreamIndex, crc);
+    }
+
+#ifdef DEBUG_VBRTAG
+    {
+        VBRTAGDATA TestHeader;
+        GetVbrTag(&TestHeader, buffer);
+    }
+#endif
+
+    return gfc->VBR_seek_table.TotalFrameSize;
+}
+
+/***********************************************************************
+ *
+ * PutVbrTag: Write final VBR tag to the file
+ * Paramters:
+ *                              lpszFileName: filename of MP3 bit stream
+ *                              nVbrScale       : encoder quality indicator (0..100)
+ ****************************************************************************
+ */
+
+int
+PutVbrTag(lame_global_flags const *gfp, FILE * fpStream)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+
+    long    lFileSize;
+    long    id3v2TagSize;
+    size_t  nbytes;
+    uint8_t buffer[MAXFRAMESIZE];
+
+    if (gfc->VBR_seek_table.pos <= 0)
+        return -1;
+
+    /* Seek to end of file */
+    fseek(fpStream, 0, SEEK_END);
+
+    /* Get file size */
+    lFileSize = ftell(fpStream);
+
+    /* Abort if file has zero length. Yes, it can happen :) */
+    if (lFileSize == 0)
+        return -1;
+
+    /*
+     * The VBR tag may NOT be located at the beginning of the stream.
+     * If an ID3 version 2 tag was added, then it must be skipped to write
+     * the VBR tag data.
+     */
+
+    id3v2TagSize = skipId3v2(fpStream);
+
+    if (id3v2TagSize < 0) {
+        return id3v2TagSize;
+    }
+
+    /*Seek to the beginning of the stream */
+    fseek(fpStream, id3v2TagSize, SEEK_SET);
+
+    nbytes = lame_get_lametag_frame(gfp, buffer, sizeof(buffer));
+    if (nbytes > sizeof(buffer)) {
+        return -1;
+    }
+
+    if (nbytes < 1) {
+        return 0;
+    }
+
+    /* Put it all to disk again */
+    if (fwrite(buffer, nbytes, 1, fpStream) != 1) {
+        return -1;
+    }
+
+    return 0;           /* success */
+}
diff --git a/libmp3lame/VbrTag.h b/libmp3lame/VbrTag.h
new file mode 100644
index 0000000..9faa63e
--- /dev/null
+++ b/libmp3lame/VbrTag.h
@@ -0,0 +1,78 @@
+/*
+ *      Xing VBR tagging for LAME.
+ *
+ *      Copyright (c) 1999 A.L. Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_VRBTAG_H
+#define LAME_VRBTAG_H
+
+
+/* -----------------------------------------------------------
+ * A Vbr header may be present in the ancillary
+ * data field of the first frame of an mp3 bitstream
+ * The Vbr header (optionally) contains
+ *      frames      total number of audio frames in the bitstream
+ *      bytes       total number of bytes in the bitstream
+ *      toc         table of contents
+
+ * toc (table of contents) gives seek points
+ * for random access
+ * the ith entry determines the seek point for
+ * i-percent duration
+ * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
+ * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
+ */
+
+
+#define FRAMES_FLAG     0x0001
+#define BYTES_FLAG      0x0002
+#define TOC_FLAG        0x0004
+#define VBR_SCALE_FLAG  0x0008
+
+#define NUMTOCENTRIES 100
+
+#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG)
+
+
+
+/*structure to receive extracted header */
+/* toc may be NULL*/
+typedef struct {
+    int     h_id;            /* from MPEG header, 0=MPEG2, 1=MPEG1 */
+    int     samprate;        /* determined from MPEG header */
+    int     flags;           /* from Vbr header data */
+    int     frames;          /* total bit stream frames from Vbr header data */
+    int     bytes;           /* total bit stream bytes from Vbr header data */
+    int     vbr_scale;       /* encoded vbr scale from Vbr header data */
+    unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired */
+    int     headersize;      /* size of VBR header, in bytes */
+    int     enc_delay;       /* encoder delay */
+    int     enc_padding;     /* encoder paddign added at end of stream */
+} VBRTAGDATA;
+
+int     CheckVbrTag(unsigned char *buf);
+int     GetVbrTag(VBRTAGDATA * pTagData, unsigned char *buf);
+
+int     SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, float percent);
+int     InitVbrTag(lame_global_flags * gfp);
+int     PutVbrTag(lame_global_flags const* gfp, FILE * fid);
+void    AddVbrFrame(lame_global_flags * gfp);
+void    UpdateMusicCRC(uint16_t * crc, unsigned char *buffer, int size);
+
+#endif
diff --git a/libmp3lame/bitstream.c b/libmp3lame/bitstream.c
new file mode 100644
index 0000000..02da6c5
--- /dev/null
+++ b/libmp3lame/bitstream.c
@@ -0,0 +1,1066 @@
+/*
+ *      MP3 bitstream Output interface for LAME
+ *
+ *      Copyright (c) 1999-2000 Mark Taylor
+ *      Copyright (c) 1999-2002 Takehiro Tominaga
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id: bitstream.c,v 1.82.2.3 2009/01/18 15:44:27 robert Exp $
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "tables.h"
+#include "quantize_pvt.h"
+#include "lame_global_flags.h"
+#include "gain_analysis.h"
+#include "VbrTag.h"
+#include "bitstream.h"
+
+
+
+/* unsigned int is at least this large:  */
+/* we work with ints, so when doing bit manipulation, we limit
+ * ourselves to MAX_LENGTH-2 just to be on the safe side */
+#define MAX_LENGTH      32
+
+
+
+#ifdef DEBUG
+static int hogege;
+#endif
+
+
+
+
+
+/***********************************************************************
+ * compute bitsperframe and mean_bits for a layer III frame
+ **********************************************************************/
+int
+getframebits(const lame_global_flags * gfp)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     bit_rate;
+
+    /* get bitrate in kbps [?] */
+    if (gfc->bitrate_index)
+        bit_rate = bitrate_table[gfp->version][gfc->bitrate_index];
+    else
+        bit_rate = gfp->brate;
+    /*assert(bit_rate <= 550); */
+    assert(8 <= bit_rate && bit_rate <= 640);
+
+    /* main encoding routine toggles padding on and off */
+    /* one Layer3 Slot consists of 8 bits */
+    return 8 * ((gfp->version + 1) * 72000 * bit_rate / gfp->out_samplerate + gfc->padding);
+}
+
+
+
+
+static void
+putheader_bits(lame_internal_flags * gfc)
+{
+    Bit_stream_struc *bs;
+    bs = &gfc->bs;
+#ifdef DEBUG
+    hogege += gfc->sideinfo_len * 8;
+#endif
+    memcpy(&bs->buf[bs->buf_byte_idx], gfc->header[gfc->w_ptr].buf, gfc->sideinfo_len);
+    bs->buf_byte_idx += gfc->sideinfo_len;
+    bs->totbit += gfc->sideinfo_len * 8;
+    gfc->w_ptr = (gfc->w_ptr + 1) & (MAX_HEADER_BUF - 1);
+}
+
+
+
+
+/*write j bits into the bit stream */
+inline static void
+putbits2(lame_internal_flags * gfc, int val, int j)
+{
+    Bit_stream_struc *bs;
+    bs = &gfc->bs;
+
+    assert(j < MAX_LENGTH - 2);
+
+    while (j > 0) {
+        int     k;
+        if (bs->buf_bit_idx == 0) {
+            bs->buf_bit_idx = 8;
+            bs->buf_byte_idx++;
+            assert(bs->buf_byte_idx < BUFFER_SIZE);
+            assert(gfc->header[gfc->w_ptr].write_timing >= bs->totbit);
+            if (gfc->header[gfc->w_ptr].write_timing == bs->totbit) {
+                putheader_bits(gfc);
+            }
+            bs->buf[bs->buf_byte_idx] = 0;
+        }
+
+        k = Min(j, bs->buf_bit_idx);
+        j -= k;
+
+        bs->buf_bit_idx -= k;
+
+        assert(j < MAX_LENGTH); /* 32 too large on 32 bit machines */
+        assert(bs->buf_bit_idx < MAX_LENGTH);
+
+        bs->buf[bs->buf_byte_idx] |= ((val >> j) << bs->buf_bit_idx);
+        bs->totbit += k;
+    }
+}
+
+/*write j bits into the bit stream, ignoring frame headers */
+inline static void
+putbits_noheaders(lame_internal_flags * gfc, int val, int j)
+{
+    Bit_stream_struc *bs;
+    bs = &gfc->bs;
+
+    assert(j < MAX_LENGTH - 2);
+
+    while (j > 0) {
+        int     k;
+        if (bs->buf_bit_idx == 0) {
+            bs->buf_bit_idx = 8;
+            bs->buf_byte_idx++;
+            assert(bs->buf_byte_idx < BUFFER_SIZE);
+            bs->buf[bs->buf_byte_idx] = 0;
+        }
+
+        k = Min(j, bs->buf_bit_idx);
+        j -= k;
+
+        bs->buf_bit_idx -= k;
+
+        assert(j < MAX_LENGTH); /* 32 too large on 32 bit machines */
+        assert(bs->buf_bit_idx < MAX_LENGTH);
+
+        bs->buf[bs->buf_byte_idx] |= ((val >> j) << bs->buf_bit_idx);
+        bs->totbit += k;
+    }
+}
+
+
+/*
+  Some combinations of bitrate, Fs, and stereo make it impossible to stuff
+  out a frame using just main_data, due to the limited number of bits to
+  indicate main_data_length. In these situations, we put stuffing bits into
+  the ancillary data...
+*/
+
+inline static void
+drain_into_ancillary(lame_global_flags const *gfp, int remainingBits)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    assert(remainingBits >= 0);
+
+    if (remainingBits >= 8) {
+        putbits2(gfc, 0x4c, 8);
+        remainingBits -= 8;
+    }
+    if (remainingBits >= 8) {
+        putbits2(gfc, 0x41, 8);
+        remainingBits -= 8;
+    }
+    if (remainingBits >= 8) {
+        putbits2(gfc, 0x4d, 8);
+        remainingBits -= 8;
+    }
+    if (remainingBits >= 8) {
+        putbits2(gfc, 0x45, 8);
+        remainingBits -= 8;
+    }
+
+    if (remainingBits >= 32) {
+        const char *const version = get_lame_short_version();
+        if (remainingBits >= 32)
+            for (i = 0; i < (int) strlen(version) && remainingBits >= 8; ++i) {
+                remainingBits -= 8;
+                putbits2(gfc, version[i], 8);
+            }
+    }
+
+    for (; remainingBits >= 1; remainingBits -= 1) {
+        putbits2(gfc, gfc->ancillary_flag, 1);
+        gfc->ancillary_flag ^= !gfp->disable_reservoir;
+    }
+
+    assert(remainingBits == 0);
+
+}
+
+/*write N bits into the header */
+inline static void
+writeheader(lame_internal_flags * gfc, int val, int j)
+{
+    int     ptr = gfc->header[gfc->h_ptr].ptr;
+
+    while (j > 0) {
+        int const k = Min(j, 8 - (ptr & 7));
+        j -= k;
+        assert(j < MAX_LENGTH); /* >> 32  too large for 32 bit machines */
+        gfc->header[gfc->h_ptr].buf[ptr >> 3]
+            |= ((val >> j)) << (8 - (ptr & 7) - k);
+        ptr += k;
+    }
+    gfc->header[gfc->h_ptr].ptr = ptr;
+}
+
+
+static int
+CRC_update(int value, int crc)
+{
+    int     i;
+    value <<= 8;
+    for (i = 0; i < 8; i++) {
+        value <<= 1;
+        crc <<= 1;
+
+        if (((crc ^ value) & 0x10000))
+            crc ^= CRC16_POLYNOMIAL;
+    }
+    return crc;
+}
+
+
+void
+CRC_writeheader(lame_internal_flags const *gfc, char *header)
+{
+    int     crc = 0xffff;    /* (jo) init crc16 for error_protection */
+    int     i;
+
+    crc = CRC_update(((unsigned char *) header)[2], crc);
+    crc = CRC_update(((unsigned char *) header)[3], crc);
+    for (i = 6; i < gfc->sideinfo_len; i++) {
+        crc = CRC_update(((unsigned char *) header)[i], crc);
+    }
+
+    header[4] = crc >> 8;
+    header[5] = crc & 255;
+}
+
+inline static void
+encodeSideInfo2(lame_global_flags const *gfp, int bitsPerFrame)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    III_side_info_t *l3_side;
+    int     gr, ch;
+
+    l3_side = &gfc->l3_side;
+    gfc->header[gfc->h_ptr].ptr = 0;
+    memset(gfc->header[gfc->h_ptr].buf, 0, gfc->sideinfo_len);
+    if (gfp->out_samplerate < 16000)
+        writeheader(gfc, 0xffe, 12);
+    else
+        writeheader(gfc, 0xfff, 12);
+    writeheader(gfc, (gfp->version), 1);
+    writeheader(gfc, 4 - 3, 2);
+    writeheader(gfc, (!gfp->error_protection), 1);
+    writeheader(gfc, (gfc->bitrate_index), 4);
+    writeheader(gfc, (gfc->samplerate_index), 2);
+    writeheader(gfc, (gfc->padding), 1);
+    writeheader(gfc, (gfp->extension), 1);
+    writeheader(gfc, (gfp->mode), 2);
+    writeheader(gfc, (gfc->mode_ext), 2);
+    writeheader(gfc, (gfp->copyright), 1);
+    writeheader(gfc, (gfp->original), 1);
+    writeheader(gfc, (gfp->emphasis), 2);
+    if (gfp->error_protection) {
+        writeheader(gfc, 0, 16); /* dummy */
+    }
+
+    if (gfp->version == 1) {
+        /* MPEG1 */
+        assert(l3_side->main_data_begin >= 0);
+        writeheader(gfc, (l3_side->main_data_begin), 9);
+
+        if (gfc->channels_out == 2)
+            writeheader(gfc, l3_side->private_bits, 3);
+        else
+            writeheader(gfc, l3_side->private_bits, 5);
+
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            int     band;
+            for (band = 0; band < 4; band++) {
+                writeheader(gfc, l3_side->scfsi[ch][band], 1);
+            }
+        }
+
+        for (gr = 0; gr < 2; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gr_info *const gi = &l3_side->tt[gr][ch];
+                writeheader(gfc, gi->part2_3_length + gi->part2_length, 12);
+                writeheader(gfc, gi->big_values / 2, 9);
+                writeheader(gfc, gi->global_gain, 8);
+                writeheader(gfc, gi->scalefac_compress, 4);
+
+                if (gi->block_type != NORM_TYPE) {
+                    writeheader(gfc, 1, 1); /* window_switching_flag */
+                    writeheader(gfc, gi->block_type, 2);
+                    writeheader(gfc, gi->mixed_block_flag, 1);
+
+                    if (gi->table_select[0] == 14)
+                        gi->table_select[0] = 16;
+                    writeheader(gfc, gi->table_select[0], 5);
+                    if (gi->table_select[1] == 14)
+                        gi->table_select[1] = 16;
+                    writeheader(gfc, gi->table_select[1], 5);
+
+                    writeheader(gfc, gi->subblock_gain[0], 3);
+                    writeheader(gfc, gi->subblock_gain[1], 3);
+                    writeheader(gfc, gi->subblock_gain[2], 3);
+                }
+                else {
+                    writeheader(gfc, 0, 1); /* window_switching_flag */
+                    if (gi->table_select[0] == 14)
+                        gi->table_select[0] = 16;
+                    writeheader(gfc, gi->table_select[0], 5);
+                    if (gi->table_select[1] == 14)
+                        gi->table_select[1] = 16;
+                    writeheader(gfc, gi->table_select[1], 5);
+                    if (gi->table_select[2] == 14)
+                        gi->table_select[2] = 16;
+                    writeheader(gfc, gi->table_select[2], 5);
+
+                    assert(0 <= gi->region0_count && gi->region0_count < 16);
+                    assert(0 <= gi->region1_count && gi->region1_count < 8);
+                    writeheader(gfc, gi->region0_count, 4);
+                    writeheader(gfc, gi->region1_count, 3);
+                }
+                writeheader(gfc, gi->preflag, 1);
+                writeheader(gfc, gi->scalefac_scale, 1);
+                writeheader(gfc, gi->count1table_select, 1);
+            }
+        }
+    }
+    else {
+        /* MPEG2 */
+        assert(l3_side->main_data_begin >= 0);
+        writeheader(gfc, (l3_side->main_data_begin), 8);
+        writeheader(gfc, l3_side->private_bits, gfc->channels_out);
+
+        gr = 0;
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            gr_info *const gi = &l3_side->tt[gr][ch];
+            writeheader(gfc, gi->part2_3_length + gi->part2_length, 12);
+            writeheader(gfc, gi->big_values / 2, 9);
+            writeheader(gfc, gi->global_gain, 8);
+            writeheader(gfc, gi->scalefac_compress, 9);
+
+            if (gi->block_type != NORM_TYPE) {
+                writeheader(gfc, 1, 1); /* window_switching_flag */
+                writeheader(gfc, gi->block_type, 2);
+                writeheader(gfc, gi->mixed_block_flag, 1);
+
+                if (gi->table_select[0] == 14)
+                    gi->table_select[0] = 16;
+                writeheader(gfc, gi->table_select[0], 5);
+                if (gi->table_select[1] == 14)
+                    gi->table_select[1] = 16;
+                writeheader(gfc, gi->table_select[1], 5);
+
+                writeheader(gfc, gi->subblock_gain[0], 3);
+                writeheader(gfc, gi->subblock_gain[1], 3);
+                writeheader(gfc, gi->subblock_gain[2], 3);
+            }
+            else {
+                writeheader(gfc, 0, 1); /* window_switching_flag */
+                if (gi->table_select[0] == 14)
+                    gi->table_select[0] = 16;
+                writeheader(gfc, gi->table_select[0], 5);
+                if (gi->table_select[1] == 14)
+                    gi->table_select[1] = 16;
+                writeheader(gfc, gi->table_select[1], 5);
+                if (gi->table_select[2] == 14)
+                    gi->table_select[2] = 16;
+                writeheader(gfc, gi->table_select[2], 5);
+
+                assert(0 <= gi->region0_count && gi->region0_count < 16);
+                assert(0 <= gi->region1_count && gi->region1_count < 8);
+                writeheader(gfc, gi->region0_count, 4);
+                writeheader(gfc, gi->region1_count, 3);
+            }
+
+            writeheader(gfc, gi->scalefac_scale, 1);
+            writeheader(gfc, gi->count1table_select, 1);
+        }
+    }
+
+    if (gfp->error_protection) {
+        /* (jo) error_protection: add crc16 information to header */
+        CRC_writeheader(gfc, gfc->header[gfc->h_ptr].buf);
+    }
+
+    {
+        int const old = gfc->h_ptr;
+        assert(gfc->header[old].ptr == gfc->sideinfo_len * 8);
+
+        gfc->h_ptr = (old + 1) & (MAX_HEADER_BUF - 1);
+        gfc->header[gfc->h_ptr].write_timing = gfc->header[old].write_timing + bitsPerFrame;
+
+        if (gfc->h_ptr == gfc->w_ptr) {
+            /* yikes! we are out of header buffer space */
+            ERRORF(gfc, "Error: MAX_HEADER_BUF too small in bitstream.c \n");
+        }
+
+    }
+}
+
+
+inline static int
+huffman_coder_count1(lame_internal_flags * gfc, gr_info const *gi)
+{
+    /* Write count1 area */
+    struct huffcodetab const *const h = &ht[gi->count1table_select + 32];
+    int     i, bits = 0;
+#ifdef DEBUG
+    int     gegebo = gfc->bs.totbit;
+#endif
+
+    int const *ix = &gi->l3_enc[gi->big_values];
+    FLOAT const *xr = &gi->xr[gi->big_values];
+    assert(gi->count1table_select < 2);
+
+    for (i = (gi->count1 - gi->big_values) / 4; i > 0; --i) {
+        int     huffbits = 0;
+        int     p = 0, v;
+
+        v = ix[0];
+        if (v) {
+            p += 8;
+            if (xr[0] < 0)
+                huffbits++;
+            assert(v <= 1);
+        }
+
+        v = ix[1];
+        if (v) {
+            p += 4;
+            huffbits *= 2;
+            if (xr[1] < 0)
+                huffbits++;
+            assert(v <= 1);
+        }
+
+        v = ix[2];
+        if (v) {
+            p += 2;
+            huffbits *= 2;
+            if (xr[2] < 0)
+                huffbits++;
+            assert(v <= 1);
+        }
+
+        v = ix[3];
+        if (v) {
+            p++;
+            huffbits *= 2;
+            if (xr[3] < 0)
+                huffbits++;
+            assert(v <= 1);
+        }
+
+        ix += 4;
+        xr += 4;
+        putbits2(gfc, huffbits + h->table[p], h->hlen[p]);
+        bits += h->hlen[p];
+    }
+#ifdef DEBUG
+    DEBUGF(gfc, "count1: real: %ld counted:%d (bigv %d count1len %d)\n",
+           gfc->bs.totbit - gegebo, gi->count1bits, gi->big_values, gi->count1);
+#endif
+    return bits;
+}
+
+
+
+/*
+  Implements the pseudocode of page 98 of the IS
+  */
+inline static int
+Huffmancode(lame_internal_flags * const gfc, const unsigned int tableindex,
+            int start, int end, gr_info const *gi)
+{
+    struct huffcodetab const *const h = &ht[tableindex];
+    int     i, bits = 0;
+
+    assert(tableindex < 32u);
+    if (!tableindex)
+        return bits;
+
+    for (i = start; i < end; i += 2) {
+        int     cbits = 0;
+        int     xbits = 0;
+        int const linbits = h->xlen;
+        int     xlen = h->xlen;
+        int     ext = 0;
+        int     x1 = gi->l3_enc[i];
+        int     x2 = gi->l3_enc[i + 1];
+
+        if (x1 != 0) {
+            if (gi->xr[i] < 0)
+                ext++;
+            cbits--;
+        }
+
+        if (tableindex > 15) {
+            /* use ESC-words */
+            if (x1 > 14) {
+                int const linbits_x1 = x1 - 15;
+                assert(linbits_x1 <= h->linmax);
+                ext |= linbits_x1 << 1;
+                xbits = linbits;
+                x1 = 15;
+            }
+
+            if (x2 > 14) {
+                int const linbits_x2 = x2 - 15;
+                assert(linbits_x2 <= h->linmax);
+                ext <<= linbits;
+                ext |= linbits_x2;
+                xbits += linbits;
+                x2 = 15;
+            }
+            xlen = 16;
+        }
+
+        if (x2 != 0) {
+            ext <<= 1;
+            if (gi->xr[i + 1] < 0)
+                ext++;
+            cbits--;
+        }
+
+        assert((x1 | x2) < 16);
+
+        x1 = x1 * xlen + x2;
+        xbits -= cbits;
+        cbits += h->hlen[x1];
+
+        assert(cbits <= MAX_LENGTH);
+        assert(xbits <= MAX_LENGTH);
+
+        putbits2(gfc, h->table[x1], cbits);
+        putbits2(gfc, ext, xbits);
+        bits += cbits + xbits;
+    }
+    return bits;
+}
+
+/*
+  Note the discussion of huffmancodebits() on pages 28
+  and 29 of the IS, as well as the definitions of the side
+  information on pages 26 and 27.
+  */
+static int
+ShortHuffmancodebits(lame_internal_flags * gfc, gr_info const *gi)
+{
+    int     bits;
+    int     region1Start;
+
+    region1Start = 3 * gfc->scalefac_band.s[3];
+    if (region1Start > gi->big_values)
+        region1Start = gi->big_values;
+
+    /* short blocks do not have a region2 */
+    bits = Huffmancode(gfc, gi->table_select[0], 0, region1Start, gi);
+    bits += Huffmancode(gfc, gi->table_select[1], region1Start, gi->big_values, gi);
+    return bits;
+}
+
+static int
+LongHuffmancodebits(lame_internal_flags * gfc, gr_info const *gi)
+{
+    int     i, bigvalues, bits;
+    int     region1Start, region2Start;
+
+    bigvalues = gi->big_values;
+    assert(0 <= bigvalues && bigvalues <= 576);
+
+    i = gi->region0_count + 1;
+    assert(0 <= i);
+    assert((size_t) i < dimension_of(gfc->scalefac_band.l));
+    region1Start = gfc->scalefac_band.l[i];
+    i += gi->region1_count + 1;
+    assert(0 <= i);
+    assert((size_t) i < dimension_of(gfc->scalefac_band.l));
+    region2Start = gfc->scalefac_band.l[i];
+
+    if (region1Start > bigvalues)
+        region1Start = bigvalues;
+
+    if (region2Start > bigvalues)
+        region2Start = bigvalues;
+
+    bits = Huffmancode(gfc, gi->table_select[0], 0, region1Start, gi);
+    bits += Huffmancode(gfc, gi->table_select[1], region1Start, region2Start, gi);
+    bits += Huffmancode(gfc, gi->table_select[2], region2Start, bigvalues, gi);
+    return bits;
+}
+
+inline static int
+writeMainData(lame_global_flags const *const gfp)
+{
+    int     gr, ch, sfb, data_bits, tot_bits = 0;
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    III_side_info_t const *const l3_side = &gfc->l3_side;
+
+    if (gfp->version == 1) {
+        /* MPEG 1 */
+        for (gr = 0; gr < 2; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gr_info const *const gi = &l3_side->tt[gr][ch];
+                int const slen1 = slen1_tab[gi->scalefac_compress];
+                int const slen2 = slen2_tab[gi->scalefac_compress];
+                data_bits = 0;
+#ifdef DEBUG
+                hogege = gfc->bs.totbit;
+#endif
+                for (sfb = 0; sfb < gi->sfbdivide; sfb++) {
+                    if (gi->scalefac[sfb] == -1)
+                        continue; /* scfsi is used */
+                    putbits2(gfc, gi->scalefac[sfb], slen1);
+                    data_bits += slen1;
+                }
+                for (; sfb < gi->sfbmax; sfb++) {
+                    if (gi->scalefac[sfb] == -1)
+                        continue; /* scfsi is used */
+                    putbits2(gfc, gi->scalefac[sfb], slen2);
+                    data_bits += slen2;
+                }
+                assert(data_bits == gi->part2_length);
+
+                if (gi->block_type == SHORT_TYPE) {
+                    data_bits += ShortHuffmancodebits(gfc, gi);
+                }
+                else {
+                    data_bits += LongHuffmancodebits(gfc, gi);
+                }
+                data_bits += huffman_coder_count1(gfc, gi);
+#ifdef DEBUG
+                DEBUGF(gfc, "<%ld> ", gfc->bs.totbit - hogege);
+#endif
+                /* does bitcount in quantize.c agree with actual bit count? */
+                assert(data_bits == gi->part2_3_length + gi->part2_length);
+                tot_bits += data_bits;
+            }           /* for ch */
+        }               /* for gr */
+    }
+    else {
+        /* MPEG 2 */
+        gr = 0;
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            gr_info const *const gi = &l3_side->tt[gr][ch];
+            int     i, sfb_partition, scale_bits = 0;
+            assert(gi->sfb_partition_table);
+            data_bits = 0;
+#ifdef DEBUG
+            hogege = gfc->bs.totbit;
+#endif
+            sfb = 0;
+            sfb_partition = 0;
+
+            if (gi->block_type == SHORT_TYPE) {
+                for (; sfb_partition < 4; sfb_partition++) {
+                    int const sfbs = gi->sfb_partition_table[sfb_partition] / 3;
+                    int const slen = gi->slen[sfb_partition];
+                    for (i = 0; i < sfbs; i++, sfb++) {
+                        putbits2(gfc, Max(gi->scalefac[sfb * 3 + 0], 0), slen);
+                        putbits2(gfc, Max(gi->scalefac[sfb * 3 + 1], 0), slen);
+                        putbits2(gfc, Max(gi->scalefac[sfb * 3 + 2], 0), slen);
+                        scale_bits += 3 * slen;
+                    }
+                }
+                data_bits += ShortHuffmancodebits(gfc, gi);
+            }
+            else {
+                for (; sfb_partition < 4; sfb_partition++) {
+                    int const sfbs = gi->sfb_partition_table[sfb_partition];
+                    int const slen = gi->slen[sfb_partition];
+                    for (i = 0; i < sfbs; i++, sfb++) {
+                        putbits2(gfc, Max(gi->scalefac[sfb], 0), slen);
+                        scale_bits += slen;
+                    }
+                }
+                data_bits += LongHuffmancodebits(gfc, gi);
+            }
+            data_bits += huffman_coder_count1(gfc, gi);
+#ifdef DEBUG
+            DEBUGF(gfc, "<%ld> ", gfc->bs.totbit - hogege);
+#endif
+            /* does bitcount in quantize.c agree with actual bit count? */
+            assert(data_bits == gi->part2_3_length);
+            assert(scale_bits == gi->part2_length);
+            tot_bits += scale_bits + data_bits;
+        }               /* for ch */
+    }                   /* for gf */
+    return tot_bits;
+}                       /* main_data */
+
+
+
+/* compute the number of bits required to flush all mp3 frames
+   currently in the buffer.  This should be the same as the
+   reservoir size.  Only call this routine between frames - i.e.
+   only after all headers and data have been added to the buffer
+   by format_bitstream().
+
+   Also compute total_bits_output =
+       size of mp3 buffer (including frame headers which may not
+       have yet been send to the mp3 buffer) +
+       number of bits needed to flush all mp3 frames.
+
+   total_bytes_output is the size of the mp3 output buffer if
+   lame_encode_flush_nogap() was called right now.
+
+ */
+int
+compute_flushbits(const lame_global_flags * gfp, int *total_bytes_output)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     flushbits, remaining_headers;
+    int     bitsPerFrame;
+    int     last_ptr, first_ptr;
+    first_ptr = gfc->w_ptr; /* first header to add to bitstream */
+    last_ptr = gfc->h_ptr - 1; /* last header to add to bitstream */
+    if (last_ptr == -1)
+        last_ptr = MAX_HEADER_BUF - 1;
+
+    /* add this many bits to bitstream so we can flush all headers */
+    flushbits = gfc->header[last_ptr].write_timing - gfc->bs.totbit;
+    *total_bytes_output = flushbits;
+
+    if (flushbits >= 0) {
+        /* if flushbits >= 0, some headers have not yet been written */
+        /* reduce flushbits by the size of the headers */
+        remaining_headers = 1 + last_ptr - first_ptr;
+        if (last_ptr < first_ptr)
+            remaining_headers = 1 + last_ptr - first_ptr + MAX_HEADER_BUF;
+        flushbits -= remaining_headers * 8 * gfc->sideinfo_len;
+    }
+
+
+    /* finally, add some bits so that the last frame is complete
+     * these bits are not necessary to decode the last frame, but
+     * some decoders will ignore last frame if these bits are missing
+     */
+    bitsPerFrame = getframebits(gfp);
+    flushbits += bitsPerFrame;
+    *total_bytes_output += bitsPerFrame;
+    /* round up:   */
+    if (*total_bytes_output % 8)
+        *total_bytes_output = 1 + (*total_bytes_output / 8);
+    else
+        *total_bytes_output = (*total_bytes_output / 8);
+    *total_bytes_output += gfc->bs.buf_byte_idx + 1;
+
+
+    if (flushbits < 0) {
+#if 0
+        /* if flushbits < 0, this would mean that the buffer looks like:
+         * (data...)  last_header  (data...)  (extra data that should not be here...)
+         */
+        DEBUGF(gfc, "last header write_timing = %i \n", gfc->header[last_ptr].write_timing);
+        DEBUGF(gfc, "first header write_timing = %i \n", gfc->header[first_ptr].write_timing);
+        DEBUGF(gfc, "bs.totbit:                 %i \n", gfc->bs.totbit);
+        DEBUGF(gfc, "first_ptr, last_ptr        %i %i \n", first_ptr, last_ptr);
+        DEBUGF(gfc, "remaining_headers =        %i \n", remaining_headers);
+        DEBUGF(gfc, "bitsperframe:              %i \n", bitsPerFrame);
+        DEBUGF(gfc, "sidelen:                   %i \n", gfc->sideinfo_len);
+#endif
+        ERRORF(gfc, "strange error flushing buffer ... \n");
+    }
+    return flushbits;
+}
+
+
+
+void
+flush_bitstream(lame_global_flags const *gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    III_side_info_t *l3_side;
+    int     nbytes;
+    int     flushbits;
+    int     last_ptr = gfc->h_ptr - 1; /* last header to add to bitstream */
+    if (last_ptr == -1)
+        last_ptr = MAX_HEADER_BUF - 1;
+    l3_side = &gfc->l3_side;
+
+
+    if ((flushbits = compute_flushbits(gfp, &nbytes)) < 0)
+        return;
+    drain_into_ancillary(gfp, flushbits);
+
+    /* check that the 100% of the last frame has been written to bitstream */
+    assert(gfc->header[last_ptr].write_timing + getframebits(gfp)
+           == gfc->bs.totbit);
+
+    /* we have padded out all frames with ancillary data, which is the
+       same as filling the bitreservoir with ancillary data, so : */
+    gfc->ResvSize = 0;
+    l3_side->main_data_begin = 0;
+
+
+    /* save the ReplayGain value */
+    if (gfc->findReplayGain) {
+        FLOAT const RadioGain = (FLOAT) GetTitleGain(gfc->rgdata);
+        assert(NEQ(RadioGain, GAIN_NOT_ENOUGH_SAMPLES));
+        gfc->RadioGain = (int) floor(RadioGain * 10.0 + 0.5); /* round to nearest */
+    }
+
+    /* find the gain and scale change required for no clipping */
+    if (gfc->findPeakSample) {
+        gfc->noclipGainChange = (int) ceil(log10(gfc->PeakSample / 32767.0) * 20.0 * 10.0); /* round up */
+
+        if (gfc->noclipGainChange > 0) { /* clipping occurs */
+            if (EQ(gfp->scale, 1.0) || EQ(gfp->scale, 0.0))
+                gfc->noclipScale = floor((32767.0 / gfc->PeakSample) * 100.0) / 100.0; /* round down */
+            else
+                /* the user specified his own scaling factor. We could suggest
+                 * the scaling factor of (32767.0/gfp->PeakSample)*(gfp->scale)
+                 * but it's usually very inaccurate. So we'd rather not advice him
+                 * on the scaling factor. */
+                gfc->noclipScale = -1;
+        }
+        else            /* no clipping */
+            gfc->noclipScale = -1;
+    }
+}
+
+
+
+
+void
+add_dummy_byte(lame_global_flags const *const gfp, unsigned char val, unsigned int n)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+
+    while (n-- > 0) {
+        putbits_noheaders(gfc, val, 8);
+
+        for (i = 0; i < MAX_HEADER_BUF; ++i)
+            gfc->header[i].write_timing += 8;
+    }
+}
+
+
+/*
+  format_bitstream()
+
+  This is called after a frame of audio has been quantized and coded.
+  It will write the encoded audio to the bitstream. Note that
+  from a layer3 encoder's perspective the bit stream is primarily
+  a series of main_data() blocks, with header and side information
+  inserted at the proper locations to maintain framing. (See Figure A.7
+  in the IS).
+  */
+int
+format_bitstream(lame_global_flags const *gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     bits, nbytes;
+    III_side_info_t *l3_side;
+    int     bitsPerFrame;
+    l3_side = &gfc->l3_side;
+
+    bitsPerFrame = getframebits(gfp);
+    drain_into_ancillary(gfp, l3_side->resvDrain_pre);
+
+    encodeSideInfo2(gfp, bitsPerFrame);
+    bits = 8 * gfc->sideinfo_len;
+    bits += writeMainData(gfp);
+    drain_into_ancillary(gfp, l3_side->resvDrain_post);
+    bits += l3_side->resvDrain_post;
+
+    l3_side->main_data_begin += (bitsPerFrame - bits) / 8;
+
+    /* compare number of bits needed to clear all buffered mp3 frames
+     * with what we think the resvsize is: */
+    if (compute_flushbits(gfp, &nbytes) != gfc->ResvSize) {
+        ERRORF(gfc, "Internal buffer inconsistency. flushbits <> ResvSize");
+    }
+
+
+    /* compare main_data_begin for the next frame with what we
+     * think the resvsize is: */
+    if ((l3_side->main_data_begin * 8) != gfc->ResvSize) {
+        ERRORF(gfc, "bit reservoir error: \n"
+               "l3_side->main_data_begin: %i \n"
+               "Resvoir size:             %i \n"
+               "resv drain (post)         %i \n"
+               "resv drain (pre)          %i \n"
+               "header and sideinfo:      %i \n"
+               "data bits:                %i \n"
+               "total bits:               %i (remainder: %i) \n"
+               "bitsperframe:             %i \n",
+               8 * l3_side->main_data_begin,
+               gfc->ResvSize,
+               l3_side->resvDrain_post,
+               l3_side->resvDrain_pre,
+               8 * gfc->sideinfo_len,
+               bits - l3_side->resvDrain_post - 8 * gfc->sideinfo_len,
+               bits, bits % 8, bitsPerFrame);
+
+        ERRORF(gfc, "This is a fatal error.  It has several possible causes:");
+        ERRORF(gfc, "90%%  LAME compiled with buggy version of gcc using advanced optimizations");
+        ERRORF(gfc, " 9%%  Your system is overclocked");
+        ERRORF(gfc, " 1%%  bug in LAME encoding library");
+
+        gfc->ResvSize = l3_side->main_data_begin * 8;
+    };
+    assert(gfc->bs.totbit % 8 == 0);
+
+    if (gfc->bs.totbit > 1000000000) {
+        /* to avoid totbit overflow, (at 8h encoding at 128kbs) lets reset bit counter */
+        int     i;
+        for (i = 0; i < MAX_HEADER_BUF; ++i)
+            gfc->header[i].write_timing -= gfc->bs.totbit;
+        gfc->bs.totbit = 0;
+    }
+
+
+    return 0;
+}
+
+
+
+
+
+/* copy data out of the internal MP3 bit buffer into a user supplied
+   unsigned char buffer.
+
+   mp3data=0      indicates data in buffer is an id3tags and VBR tags
+   mp3data=1      data is real mp3 frame data.
+
+
+*/
+int
+copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int size, int mp3data)
+{
+    Bit_stream_struc *const bs = &gfc->bs;
+    int const minimum = bs->buf_byte_idx + 1;
+    if (minimum <= 0)
+        return 0;
+    if (size != 0 && minimum > size)
+        return -1;      /* buffer is too small */
+    memcpy(buffer, bs->buf, minimum);
+    bs->buf_byte_idx = -1;
+    bs->buf_bit_idx = 0;
+
+    if (mp3data) {
+        UpdateMusicCRC(&gfc->nMusicCRC, buffer, minimum);
+
+        /** sum number of bytes belonging to the mp3 stream
+         *  this info will be written into the Xing/LAME header for seeking
+         */
+        if (minimum > 0) {
+            gfc->VBR_seek_table.nBytesWritten += minimum;
+        }
+
+#ifdef DECODE_ON_THE_FLY
+        if (gfc->decode_on_the_fly) { /* decode the frame */
+            sample_t pcm_buf[2][1152];
+            int     mp3_in = minimum;
+            int     samples_out = -1;
+            int     i;
+
+            /* re-synthesis to pcm.  Repeat until we get a samples_out=0 */
+            while (samples_out != 0) {
+
+                samples_out = hip_decode1_unclipped(gfc->hip, buffer, mp3_in, pcm_buf[0], pcm_buf[1]);
+                /* samples_out = 0:  need more data to decode
+                 * samples_out = -1:  error.  Lets assume 0 pcm output
+                 * samples_out = number of samples output */
+
+                /* set the lenght of the mp3 input buffer to zero, so that in the
+                 * next iteration of the loop we will be querying mpglib about
+                 * buffered data */
+                mp3_in = 0;
+
+                if (samples_out == -1) {
+                    /* error decoding. Not fatal, but might screw up
+                     * the ReplayGain tag. What should we do? Ignore for now */
+                    samples_out = 0;
+                }
+                if (samples_out > 0) {
+                    /* process the PCM data */
+
+                    /* this should not be possible, and indicates we have
+                     * overflown the pcm_buf buffer */
+                    assert(samples_out <= 1152);
+
+                    if (gfc->findPeakSample) {
+                        for (i = 0; i < samples_out; i++) {
+                            if (pcm_buf[0][i] > gfc->PeakSample)
+                                gfc->PeakSample = pcm_buf[0][i];
+                            else if (-pcm_buf[0][i] > gfc->PeakSample)
+                                gfc->PeakSample = -pcm_buf[0][i];
+                        }
+                        if (gfc->channels_out > 1)
+                            for (i = 0; i < samples_out; i++) {
+                                if (pcm_buf[1][i] > gfc->PeakSample)
+                                    gfc->PeakSample = pcm_buf[1][i];
+                                else if (-pcm_buf[1][i] > gfc->PeakSample)
+                                    gfc->PeakSample = -pcm_buf[1][i];
+                            }
+                    }
+
+                    if (gfc->findReplayGain)
+                        if (AnalyzeSamples
+                            (gfc->rgdata, pcm_buf[0], pcm_buf[1], samples_out,
+                             gfc->channels_out) == GAIN_ANALYSIS_ERROR)
+                            return -6;
+
+                }       /* if (samples_out>0) */
+            }           /* while (samples_out!=0) */
+        }               /* if (gfc->decode_on_the_fly) */
+#endif
+
+    }                   /* if (mp3data) */
+    return minimum;
+}
+
+
+void
+init_bit_stream_w(lame_internal_flags * gfc)
+{
+    gfc->bs.buf = (unsigned char *) malloc(BUFFER_SIZE);
+    gfc->bs.buf_size = BUFFER_SIZE;
+
+    gfc->h_ptr = gfc->w_ptr = 0;
+    gfc->header[gfc->h_ptr].write_timing = 0;
+    gfc->bs.buf_byte_idx = -1;
+    gfc->bs.buf_bit_idx = 0;
+    gfc->bs.totbit = 0;
+}
+
+/* end of bitstream.c */
diff --git a/libmp3lame/bitstream.h b/libmp3lame/bitstream.h
new file mode 100644
index 0000000..2ac163f
--- /dev/null
+++ b/libmp3lame/bitstream.h
@@ -0,0 +1,39 @@
+/*
+ *	MP3 bitstream Output interface for LAME
+ *
+ *	Copyright (c) 1999 Takehiro TOMINAGA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_BITSTREAM_H
+#define LAME_BITSTREAM_H
+
+int     getframebits(const lame_global_flags * gfp);
+
+int     format_bitstream(lame_global_flags const *gfp);
+
+void    flush_bitstream(lame_global_flags const *gfp);
+void    add_dummy_byte(lame_global_flags const *const gfp, unsigned char val, unsigned int n);
+
+int     copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int buffer_size,
+                    int update_crc);
+void    init_bit_stream_w(lame_internal_flags * gfc);
+void    CRC_writeheader(lame_internal_flags const *gfc, char *buffer);
+int     compute_flushbits(const lame_global_flags * gfp, int *nbytes);
+
+
+#endif
diff --git a/libmp3lame/depcomp b/libmp3lame/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/libmp3lame/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/libmp3lame/encoder.c b/libmp3lame/encoder.c
new file mode 100644
index 0000000..d0549ca
--- /dev/null
+++ b/libmp3lame/encoder.c
@@ -0,0 +1,565 @@
+/*
+ *      LAME MP3 encoding engine
+ *
+ *      Copyright (c) 1999 Mark Taylor
+ *      Copyright (c) 2000-2002 Takehiro Tominaga
+ *      Copyright (c) 2000-2005 Robert Hegemann
+ *      Copyright (c) 2001 Gabriel Bouvigne
+ *      Copyright (c) 2001 John Dahlstrom
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: encoder.c,v 1.103.2.1 2008/08/05 14:16:06 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "lame_global_flags.h"
+#include "newmdct.h"
+#include "psymodel.h"
+#include "lame-analysis.h"
+#include "bitstream.h"
+#include "VbrTag.h"
+#include "quantize_pvt.h"
+
+
+
+/*
+ * auto-adjust of ATH, useful for low volume
+ * Gabriel Bouvigne 3 feb 2001
+ *
+ * modifies some values in
+ *   gfp->internal_flags->ATH
+ *   (gfc->ATH)
+ */
+static void
+adjust_ATH(lame_internal_flags const *const gfc)
+{
+    FLOAT   gr2_max, max_pow;
+
+    if (gfc->ATH->use_adjust == 0) {
+        gfc->ATH->adjust = 1.0; /* no adjustment */
+        return;
+    }
+
+    /* jd - 2001 mar 12, 27, jun 30 */
+    /* loudness based on equal loudness curve; */
+    /* use granule with maximum combined loudness */
+    max_pow = gfc->loudness_sq[0][0];
+    gr2_max = gfc->loudness_sq[1][0];
+    if (gfc->channels_out == 2) {
+        max_pow += gfc->loudness_sq[0][1];
+        gr2_max += gfc->loudness_sq[1][1];
+    }
+    else {
+        max_pow += max_pow;
+        gr2_max += gr2_max;
+    }
+    if (gfc->mode_gr == 2) {
+        max_pow = Max(max_pow, gr2_max);
+    }
+    max_pow *= 0.5;     /* max_pow approaches 1.0 for full band noise */
+
+    /* jd - 2001 mar 31, jun 30 */
+    /* user tuning of ATH adjustment region */
+    max_pow *= gfc->ATH->aa_sensitivity_p;
+
+    /*  adjust ATH depending on range of maximum value
+     */
+
+    /* jd - 2001 feb27, mar12,20, jun30, jul22 */
+    /* continuous curves based on approximation */
+    /* to GB's original values. */
+    /* For an increase in approximate loudness, */
+    /* set ATH adjust to adjust_limit immediately */
+    /* after a delay of one frame. */
+    /* For a loudness decrease, reduce ATH adjust */
+    /* towards adjust_limit gradually. */
+    /* max_pow is a loudness squared or a power. */
+    if (max_pow > 0.03125) { /* ((1 - 0.000625)/ 31.98) from curve below */
+        if (gfc->ATH->adjust >= 1.0) {
+            gfc->ATH->adjust = 1.0;
+        }
+        else {
+            /* preceding frame has lower ATH adjust; */
+            /* ascend only to the preceding adjust_limit */
+            /* in case there is leading low volume */
+            if (gfc->ATH->adjust < gfc->ATH->adjust_limit) {
+                gfc->ATH->adjust = gfc->ATH->adjust_limit;
+            }
+        }
+        gfc->ATH->adjust_limit = 1.0;
+    }
+    else {              /* adjustment curve */
+        /* about 32 dB maximum adjust (0.000625) */
+        FLOAT const adj_lim_new = 31.98 * max_pow + 0.000625;
+        if (gfc->ATH->adjust >= adj_lim_new) { /* descend gradually */
+            gfc->ATH->adjust *= adj_lim_new * 0.075 + 0.925;
+            if (gfc->ATH->adjust < adj_lim_new) { /* stop descent */
+                gfc->ATH->adjust = adj_lim_new;
+            }
+        }
+        else {          /* ascend */
+            if (gfc->ATH->adjust_limit >= adj_lim_new) {
+                gfc->ATH->adjust = adj_lim_new;
+            }
+            else {      /* preceding frame has lower ATH adjust; */
+                /* ascend only to the preceding adjust_limit */
+                if (gfc->ATH->adjust < gfc->ATH->adjust_limit) {
+                    gfc->ATH->adjust = gfc->ATH->adjust_limit;
+                }
+            }
+        }
+        gfc->ATH->adjust_limit = adj_lim_new;
+    }
+}
+
+/***********************************************************************
+ *
+ *  some simple statistics
+ *
+ *  bitrate index 0: free bitrate -> not allowed in VBR mode
+ *  : bitrates, kbps depending on MPEG version
+ *  bitrate index 15: forbidden
+ *
+ *  mode_ext:
+ *  0:  LR
+ *  1:  LR-i
+ *  2:  MS
+ *  3:  MS-i
+ *
+ ***********************************************************************/
+
+static void
+updateStats(lame_internal_flags * const gfc)
+{
+    int     gr, ch;
+    assert(0 <= gfc->bitrate_index && gfc->bitrate_index < 16);
+    assert(0 <= gfc->mode_ext && gfc->mode_ext < 4);
+
+    /* count bitrate indices */
+    gfc->bitrate_stereoMode_Hist[gfc->bitrate_index][4]++;
+    gfc->bitrate_stereoMode_Hist[15][4]++;
+
+    /* count 'em for every mode extension in case of 2 channel encoding */
+    if (gfc->channels_out == 2) {
+        gfc->bitrate_stereoMode_Hist[gfc->bitrate_index][gfc->mode_ext]++;
+        gfc->bitrate_stereoMode_Hist[15][gfc->mode_ext]++;
+    }
+    for (gr = 0; gr < gfc->mode_gr; ++gr) {
+        for (ch = 0; ch < gfc->channels_out; ++ch) {
+            int     bt = gfc->l3_side.tt[gr][ch].block_type;
+            if (gfc->l3_side.tt[gr][ch].mixed_block_flag)
+                bt = 4;
+            gfc->bitrate_blockType_Hist[gfc->bitrate_index][bt]++;
+            gfc->bitrate_blockType_Hist[gfc->bitrate_index][5]++;
+            gfc->bitrate_blockType_Hist[15][bt]++;
+            gfc->bitrate_blockType_Hist[15][5]++;
+        }
+    }
+}
+
+
+
+
+static void
+lame_encode_frame_init(lame_global_flags const *const gfp, const sample_t * inbuf[2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    int     ch, gr;
+
+    if (gfc->lame_encode_frame_init == 0) {
+        /* prime the MDCT/polyphase filterbank with a short block */
+        int     i, j;
+        sample_t primebuff0[286 + 1152 + 576];
+        sample_t primebuff1[286 + 1152 + 576];
+        gfc->lame_encode_frame_init = 1;
+        for (i = 0, j = 0; i < 286 + 576 * (1 + gfc->mode_gr); ++i) {
+            if (i < 576 * gfc->mode_gr) {
+                primebuff0[i] = 0;
+                if (gfc->channels_out == 2)
+                    primebuff1[i] = 0;
+            }
+            else {
+                primebuff0[i] = inbuf[0][j];
+                if (gfc->channels_out == 2)
+                    primebuff1[i] = inbuf[1][j];
+                ++j;
+            }
+        }
+        /* polyphase filtering / mdct */
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gfc->l3_side.tt[gr][ch].block_type = SHORT_TYPE;
+            }
+        }
+        mdct_sub48(gfc, primebuff0, primebuff1);
+
+        /* check FFT will not use a negative starting offset */
+#if 576 < FFTOFFSET
+# error FFTOFFSET greater than 576: FFT uses a negative offset
+#endif
+        /* check if we have enough data for FFT */
+        assert(gfc->mf_size >= (BLKSIZE + gfp->framesize - FFTOFFSET));
+        /* check if we have enough data for polyphase filterbank */
+        assert(gfc->mf_size >= (512 + gfp->framesize - 32));
+    }
+
+}
+
+
+
+
+
+
+
+/************************************************************************
+*
+* encodeframe()           Layer 3
+*
+* encode a single frame
+*
+************************************************************************
+lame_encode_frame()
+
+
+                       gr 0            gr 1
+inbuf:           |--------------|--------------|--------------|
+
+
+Polyphase (18 windows, each shifted 32)
+gr 0:
+window1          <----512---->
+window18                 <----512---->
+
+gr 1:
+window1                         <----512---->
+window18                                <----512---->
+
+
+
+MDCT output:  |--------------|--------------|--------------|
+
+FFT's                    <---------1024---------->
+                                         <---------1024-------->
+
+
+
+    inbuf = buffer of PCM data size=MP3 framesize
+    encoder acts on inbuf[ch][0], but output is delayed by MDCTDELAY
+    so the MDCT coefficints are from inbuf[ch][-MDCTDELAY]
+
+    psy-model FFT has a 1 granule delay, so we feed it data for the 
+    next granule.
+    FFT is centered over granule:  224+576+224
+    So FFT starts at:   576-224-MDCTDELAY
+
+    MPEG2:  FFT ends at:  BLKSIZE+576-224-MDCTDELAY      (1328)
+    MPEG1:  FFT ends at:  BLKSIZE+2*576-224-MDCTDELAY    (1904)
+
+    MPEG2:  polyphase first window:  [0..511]
+                      18th window:   [544..1055]          (1056)
+    MPEG1:            36th window:   [1120..1631]         (1632)
+            data needed:  512+framesize-32
+
+    A close look newmdct.c shows that the polyphase filterbank
+    only uses data from [0..510] for each window.  Perhaps because the window
+    used by the filterbank is zero for the last point, so Takehiro's
+    code doesn't bother to compute with it.
+
+    FFT starts at 576-224-MDCTDELAY (304)  = 576-FFTOFFSET
+
+*/
+
+typedef FLOAT chgrdata[2][2];
+
+
+int
+lame_encode_mp3_frame(       /* Output */
+                         lame_global_flags * const gfp, /* Context */
+                         sample_t const *inbuf_l, /* Input */
+                         sample_t const *inbuf_r, /* Input */
+                         unsigned char *mp3buf, /* Output */
+                         int mp3buf_size)
+{                       /* Output */
+    int     mp3count;
+    III_psy_ratio masking_LR[2][2]; /*LR masking & energy */
+    III_psy_ratio masking_MS[2][2]; /*MS masking & energy */
+    III_psy_ratio(*masking)[2][2]; /*pointer to selected maskings */
+    const sample_t *inbuf[2];
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    FLOAT   tot_ener[2][4];
+    FLOAT   ms_ener_ratio[2] = { .5, .5 };
+    chgrdata pe = { {0., 0.}, {0., 0.} }, pe_MS = { {
+    0., 0.}, {
+    0., 0.}};
+    chgrdata *pe_use;
+
+    int     ch, gr;
+
+    inbuf[0] = inbuf_l;
+    inbuf[1] = inbuf_r;
+
+    if (gfc->lame_encode_frame_init == 0) {
+        /*first run? */
+        lame_encode_frame_init(gfp, inbuf);
+
+    }
+
+
+    /********************** padding *****************************/
+    /* padding method as described in 
+     * "MPEG-Layer3 / Bitstream Syntax and Decoding"
+     * by Martin Sieler, Ralph Sperschneider
+     *
+     * note: there is no padding for the very first frame
+     *
+     * Robert Hegemann 2000-06-22
+     */
+    gfc->padding = FALSE;
+    if ((gfc->slot_lag -= gfc->frac_SpF) < 0) {
+        gfc->slot_lag += gfp->out_samplerate;
+        gfc->padding = TRUE;
+    }
+
+
+
+    /****************************************
+    *   Stage 1: psychoacoustic model       *
+    ****************************************/
+
+    if (gfc->psymodel) {
+        /* psychoacoustic model
+         * psy model has a 1 granule (576) delay that we must compensate for
+         * (mt 6/99).
+         */
+        int     ret;
+        const sample_t *bufp[2]; /* address of beginning of left & right granule */
+        int     blocktype[2];
+
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                bufp[ch] = &inbuf[ch][576 + gr * 576 - FFTOFFSET];
+            }
+            if (gfp->VBR == vbr_mtrh || gfp->VBR == vbr_mt) {
+                ret = L3psycho_anal_vbr(gfp, bufp, gr,
+                                        masking_LR, masking_MS,
+                                        pe[gr], pe_MS[gr], tot_ener[gr], blocktype);
+            }
+            else {
+                ret = L3psycho_anal_ns(gfp, bufp, gr,
+                                       masking_LR, masking_MS,
+                                       pe[gr], pe_MS[gr], tot_ener[gr], blocktype);
+            }
+            if (ret != 0)
+                return -4;
+
+            if (gfp->mode == JOINT_STEREO) {
+                ms_ener_ratio[gr] = tot_ener[gr][2] + tot_ener[gr][3];
+                if (ms_ener_ratio[gr] > 0)
+                    ms_ener_ratio[gr] = tot_ener[gr][3] / ms_ener_ratio[gr];
+            }
+
+            /* block type flags */
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gr_info *const cod_info = &gfc->l3_side.tt[gr][ch];
+                cod_info->block_type = blocktype[ch];
+                cod_info->mixed_block_flag = 0;
+            }
+        }
+    }
+    else {
+        /*no psy model */
+        memset((char *) masking_LR, 0, sizeof(masking_LR));
+        memset((char *) masking_MS, 0, sizeof(masking_MS));
+        for (gr = 0; gr < gfc->mode_gr; gr++)
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gfc->l3_side.tt[gr][ch].block_type = NORM_TYPE;
+                gfc->l3_side.tt[gr][ch].mixed_block_flag = 0;
+                pe_MS[gr][ch] = pe[gr][ch] = 700;
+            }
+    }
+
+
+
+    /* auto-adjust of ATH, useful for low volume */
+    adjust_ATH(gfc);
+
+
+    /****************************************
+    *   Stage 2: MDCT                       *
+    ****************************************/
+
+    /* polyphase filtering / mdct */
+    mdct_sub48(gfc, inbuf[0], inbuf[1]);
+
+
+    /****************************************
+    *   Stage 3: MS/LR decision             *
+    ****************************************/
+
+    /* Here will be selected MS or LR coding of the 2 stereo channels */
+    gfc->mode_ext = MPG_MD_LR_LR;
+
+    if (gfp->force_ms) {
+        gfc->mode_ext = MPG_MD_MS_LR;
+    }
+    else if (gfp->mode == JOINT_STEREO) {
+        /* ms_ratio = is scaled, for historical reasons, to look like
+           a ratio of side_channel / total.
+           0 = signal is 100% mono
+           .5 = L & R uncorrelated
+         */
+
+        /* [0] and [1] are the results for the two granules in MPEG-1,
+         * in MPEG-2 it's only a faked averaging of the same value
+         * _prev is the value of the last granule of the previous frame
+         * _next is the value of the first granule of the next frame
+         */
+
+        FLOAT   sum_pe_MS = 0;
+        FLOAT   sum_pe_LR = 0;
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                sum_pe_MS += pe_MS[gr][ch];
+                sum_pe_LR += pe[gr][ch];
+            }
+        }
+
+        /* based on PE: M/S coding would not use much more bits than L/R */
+        if (sum_pe_MS <= 1.00 * sum_pe_LR) {
+
+            gr_info const *const gi0 = &gfc->l3_side.tt[0][0];
+            gr_info const *const gi1 = &gfc->l3_side.tt[gfc->mode_gr - 1][0];
+
+            if (gi0[0].block_type == gi0[1].block_type && gi1[0].block_type == gi1[1].block_type) {
+
+                gfc->mode_ext = MPG_MD_MS_LR;
+            }
+        }
+    }
+
+    /* bit and noise allocation */
+    if (gfc->mode_ext == MPG_MD_MS_LR) {
+        masking = &masking_MS; /* use MS masking */
+        pe_use = &pe_MS;
+    }
+    else {
+        masking = &masking_LR; /* use LR masking */
+        pe_use = &pe;
+    }
+
+
+    /* copy data for MP3 frame analyzer */
+    if (gfp->analysis && gfc->pinfo != NULL) {
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gfc->pinfo->ms_ratio[gr] = gfc->ms_ratio[gr];
+                gfc->pinfo->ms_ener_ratio[gr] = ms_ener_ratio[gr];
+                gfc->pinfo->blocktype[gr][ch] = gfc->l3_side.tt[gr][ch].block_type;
+                gfc->pinfo->pe[gr][ch] = (*pe_use)[gr][ch];
+                memcpy(gfc->pinfo->xr[gr][ch], &gfc->l3_side.tt[gr][ch].xr[0], sizeof(FLOAT) * 576);
+                /* in psymodel, LR and MS data was stored in pinfo.  
+                   switch to MS data: */
+                if (gfc->mode_ext == MPG_MD_MS_LR) {
+                    gfc->pinfo->ers[gr][ch] = gfc->pinfo->ers[gr][ch + 2];
+                    memcpy(gfc->pinfo->energy[gr][ch], gfc->pinfo->energy[gr][ch + 2],
+                           sizeof(gfc->pinfo->energy[gr][ch]));
+                }
+            }
+        }
+    }
+
+
+    /****************************************
+    *   Stage 4: quantization loop          *
+    ****************************************/
+
+    if (gfp->VBR == vbr_off || gfp->VBR == vbr_abr) {
+        static FLOAT const fircoef[9] = {
+            -0.0207887 * 5, -0.0378413 * 5, -0.0432472 * 5, -0.031183 * 5,
+            7.79609e-18 * 5, 0.0467745 * 5, 0.10091 * 5, 0.151365 * 5,
+            0.187098 * 5
+        };
+
+        int     i;
+        FLOAT   f;
+
+        for (i = 0; i < 18; i++)
+            gfc->nsPsy.pefirbuf[i] = gfc->nsPsy.pefirbuf[i + 1];
+
+        f = 0.0;
+        for (gr = 0; gr < gfc->mode_gr; gr++)
+            for (ch = 0; ch < gfc->channels_out; ch++)
+                f += (*pe_use)[gr][ch];
+        gfc->nsPsy.pefirbuf[18] = f;
+
+        f = gfc->nsPsy.pefirbuf[9];
+        for (i = 0; i < 9; i++)
+            f += (gfc->nsPsy.pefirbuf[i] + gfc->nsPsy.pefirbuf[18 - i]) * fircoef[i];
+
+        f = (670 * 5 * gfc->mode_gr * gfc->channels_out) / f;
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                (*pe_use)[gr][ch] *= f;
+            }
+        }
+    }
+    gfc->iteration_loop(gfp, *pe_use, ms_ener_ratio, *masking);
+
+
+    /****************************************
+    *   Stage 5: bitstream formatting       *
+    ****************************************/
+
+
+    /*  write the frame to the bitstream  */
+    (void) format_bitstream(gfp);
+
+    /* copy mp3 bit buffer into array */
+    mp3count = copy_buffer(gfc, mp3buf, mp3buf_size, 1);
+
+
+    if (gfp->bWriteVbrTag)
+        AddVbrFrame(gfp);
+
+
+    if (gfp->analysis && gfc->pinfo != NULL) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            int     j;
+            for (j = 0; j < FFTOFFSET; j++)
+                gfc->pinfo->pcmdata[ch][j] = gfc->pinfo->pcmdata[ch][j + gfp->framesize];
+            for (j = FFTOFFSET; j < 1600; j++) {
+                gfc->pinfo->pcmdata[ch][j] = inbuf[ch][j - FFTOFFSET];
+            }
+        }
+        set_frame_pinfo(gfp, *masking);
+    }
+
+    updateStats(gfc);
+
+    return mp3count;
+}
diff --git a/libmp3lame/encoder.h b/libmp3lame/encoder.h
new file mode 100644
index 0000000..592ca66
--- /dev/null
+++ b/libmp3lame/encoder.h
@@ -0,0 +1,144 @@
+/*
+ *      encoder.h include file
+ *
+ *      Copyright (c) 2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef LAME_ENCODER_H
+#define LAME_ENCODER_H
+
+/***********************************************************************
+*
+*  encoder and decoder delays
+*
+***********************************************************************/
+
+/* 
+ * layer III enc->dec delay:  1056 (1057?)   (observed)
+ * layer  II enc->dec delay:   480  (481?)   (observed)
+ *
+ * polyphase 256-16             (dec or enc)        = 240
+ * mdct      256+32  (9*32)     (dec or enc)        = 288
+ * total:    512+16
+ *
+ * My guess is that delay of polyphase filterbank is actualy 240.5
+ * (there are technical reasons for this, see postings in mp3encoder).
+ * So total Encode+Decode delay = ENCDELAY + 528 + 1
+ */
+
+/* 
+ * ENCDELAY  The encoder delay.  
+ *
+ * Minimum allowed is MDCTDELAY (see below)
+ *  
+ * The first 96 samples will be attenuated, so using a value less than 96
+ * will result in corrupt data for the first 96-ENCDELAY samples.
+ *
+ * suggested: 576
+ * set to 1160 to sync with FhG.
+ */
+
+#define ENCDELAY      576
+
+
+
+/*
+ * make sure there is at least one complete frame after the
+ * last frame containing real data
+ *
+ * Using a value of 288 would be sufficient for a 
+ * a very sophisticated decoder that can decode granule-by-granule instead
+ * of frame by frame.  But lets not assume this, and assume the decoder  
+ * will not decode frame N unless it also has data for frame N+1
+ *
+ */
+/*#define POSTDELAY   288*/
+#define POSTDELAY   1152
+
+
+
+/* 
+ * delay of the MDCT used in mdct.c
+ * original ISO routines had a delay of 528!  
+ * Takehiro's routines: 
+ */
+
+#define MDCTDELAY     48
+#define FFTOFFSET     (224+MDCTDELAY)
+
+/*
+ * Most decoders, including the one we use, have a delay of 528 samples.  
+ */
+
+#define DECDELAY      528
+
+
+/* number of subbands */
+#define SBLIMIT       32
+
+/* parition bands bands */
+#define CBANDS        64
+
+/* number of critical bands/scale factor bands where masking is computed*/
+#define SBPSY_l       21
+#define SBPSY_s       12
+
+/* total number of scalefactor bands encoded */
+#define SBMAX_l       22
+#define SBMAX_s       13
+#define PSFB21         6
+#define PSFB12         6
+
+
+
+/* FFT sizes */
+#define BLKSIZE       1024
+#define HBLKSIZE      (BLKSIZE/2 + 1)
+#define BLKSIZE_s     256
+#define HBLKSIZE_s    (BLKSIZE_s/2 + 1)
+
+
+/* #define switch_pe        1800 */
+#define NORM_TYPE     0
+#define START_TYPE    1
+#define SHORT_TYPE    2
+#define STOP_TYPE     3
+
+/* 
+ * Mode Extention:
+ * When we are in stereo mode, there are 4 possible methods to store these
+ * two channels. The stereo modes -m? are using a subset of them.
+ *
+ *  -ms: MPG_MD_LR_LR
+ *  -mj: MPG_MD_LR_LR and MPG_MD_MS_LR
+ *  -mf: MPG_MD_MS_LR
+ *  -mi: all
+ */
+
+#define MPG_MD_LR_LR  0
+#define MPG_MD_LR_I   1
+#define MPG_MD_MS_LR  2
+#define MPG_MD_MS_I   3
+
+
+int     lame_encode_mp3_frame(lame_global_flags * const gfp,
+                              sample_t const *inbuf_l,
+                              sample_t const *inbuf_r, unsigned char *mp3buf, int mp3buf_size);
+
+#endif /* LAME_ENCODER_H */
diff --git a/libmp3lame/fft.c b/libmp3lame/fft.c
new file mode 100644
index 0000000..ec036bf
--- /dev/null
+++ b/libmp3lame/fft.c
@@ -0,0 +1,322 @@
+/*
+** FFT and FHT routines
+**  Copyright 1988, 1993; Ron Mayer
+**      Copyright (c) 1999-2000 Takehiro Tominaga
+**
+**  fht(fz,n);
+**      Does a hartley transform of "n" points in the array "fz".
+**
+** NOTE: This routine uses at least 2 patented algorithms, and may be
+**       under the restrictions of a bunch of different organizations.
+**       Although I wrote it completely myself; it is kind of a derivative
+**       of a routine I once authored and released under the GPL, so it
+**       may fall under the free software foundation's restrictions;
+**       it was worked on as a Stanford Univ project, so they claim
+**       some rights to it; it was further optimized at work here, so
+**       I think this company claims parts of it.  The patents are
+**       held by R. Bracewell (the FHT algorithm) and O. Buneman (the
+**       trig generator), both at Stanford Univ.
+**       If it were up to me, I'd say go do whatever you want with it;
+**       but it would be polite to give credit to the following people
+**       if you use this anywhere:
+**           Euler     - probable inventor of the fourier transform.
+**           Gauss     - probable inventor of the FFT.
+**           Hartley   - probable inventor of the hartley transform.
+**           Buneman   - for a really cool trig generator
+**           Mayer(me) - for authoring this particular version and
+**                       including all the optimizations in one package.
+**       Thanks,
+**       Ron Mayer; mayer@acuson.com
+** and added some optimization by
+**           Mather    - idea of using lookup table
+**           Takehiro  - some dirty hack for speed up
+*/
+
+/* $Id: fft.c,v 1.33 2008/04/12 18:18:06 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "fft.h"
+
+
+
+
+
+#define TRI_SIZE (5-1)  /* 1024 =  4**5 */
+
+/* fft.c    */
+static FLOAT window[BLKSIZE], window_s[BLKSIZE_s / 2];
+
+static const FLOAT costab[TRI_SIZE * 2] = {
+    9.238795325112867e-01, 3.826834323650898e-01,
+    9.951847266721969e-01, 9.801714032956060e-02,
+    9.996988186962042e-01, 2.454122852291229e-02,
+    9.999811752826011e-01, 6.135884649154475e-03
+};
+
+static void
+fht(FLOAT * fz, int n)
+{
+    const FLOAT *tri = costab;
+    int     k4;
+    FLOAT  *fi, *gi;
+    FLOAT const *fn;
+
+    n <<= 1;            /* to get BLKSIZE, because of 3DNow! ASM routine */
+    fn = fz + n;
+    k4 = 4;
+    do {
+        FLOAT   s1, c1;
+        int     i, k1, k2, k3, kx;
+        kx = k4 >> 1;
+        k1 = k4;
+        k2 = k4 << 1;
+        k3 = k2 + k1;
+        k4 = k2 << 1;
+        fi = fz;
+        gi = fi + kx;
+        do {
+            FLOAT   f0, f1, f2, f3;
+            f1 = fi[0] - fi[k1];
+            f0 = fi[0] + fi[k1];
+            f3 = fi[k2] - fi[k3];
+            f2 = fi[k2] + fi[k3];
+            fi[k2] = f0 - f2;
+            fi[0] = f0 + f2;
+            fi[k3] = f1 - f3;
+            fi[k1] = f1 + f3;
+            f1 = gi[0] - gi[k1];
+            f0 = gi[0] + gi[k1];
+            f3 = SQRT2 * gi[k3];
+            f2 = SQRT2 * gi[k2];
+            gi[k2] = f0 - f2;
+            gi[0] = f0 + f2;
+            gi[k3] = f1 - f3;
+            gi[k1] = f1 + f3;
+            gi += k4;
+            fi += k4;
+        } while (fi < fn);
+        c1 = tri[0];
+        s1 = tri[1];
+        for (i = 1; i < kx; i++) {
+            FLOAT   c2, s2;
+            c2 = 1 - (2 * s1) * s1;
+            s2 = (2 * s1) * c1;
+            fi = fz + i;
+            gi = fz + k1 - i;
+            do {
+                FLOAT   a, b, g0, f0, f1, g1, f2, g2, f3, g3;
+                b = s2 * fi[k1] - c2 * gi[k1];
+                a = c2 * fi[k1] + s2 * gi[k1];
+                f1 = fi[0] - a;
+                f0 = fi[0] + a;
+                g1 = gi[0] - b;
+                g0 = gi[0] + b;
+                b = s2 * fi[k3] - c2 * gi[k3];
+                a = c2 * fi[k3] + s2 * gi[k3];
+                f3 = fi[k2] - a;
+                f2 = fi[k2] + a;
+                g3 = gi[k2] - b;
+                g2 = gi[k2] + b;
+                b = s1 * f2 - c1 * g3;
+                a = c1 * f2 + s1 * g3;
+                fi[k2] = f0 - a;
+                fi[0] = f0 + a;
+                gi[k3] = g1 - b;
+                gi[k1] = g1 + b;
+                b = c1 * g2 - s1 * f3;
+                a = s1 * g2 + c1 * f3;
+                gi[k2] = g0 - a;
+                gi[0] = g0 + a;
+                fi[k3] = f1 - b;
+                fi[k1] = f1 + b;
+                gi += k4;
+                fi += k4;
+            } while (fi < fn);
+            c2 = c1;
+            c1 = c2 * tri[0] - s1 * tri[1];
+            s1 = c2 * tri[1] + s1 * tri[0];
+        }
+        tri += 2;
+    } while (k4 < n);
+}
+
+static const unsigned char rv_tbl[] = {
+    0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+    0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+    0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+    0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+    0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+    0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+    0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+    0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+    0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+    0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+    0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+    0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+    0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+    0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+    0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+    0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe
+};
+
+#define ch01(index)  (buffer[chn][index])
+
+#define ml00(f) (window[i        ] * f(i))
+#define ml10(f) (window[i + 0x200] * f(i + 0x200))
+#define ml20(f) (window[i + 0x100] * f(i + 0x100))
+#define ml30(f) (window[i + 0x300] * f(i + 0x300))
+
+#define ml01(f) (window[i + 0x001] * f(i + 0x001))
+#define ml11(f) (window[i + 0x201] * f(i + 0x201))
+#define ml21(f) (window[i + 0x101] * f(i + 0x101))
+#define ml31(f) (window[i + 0x301] * f(i + 0x301))
+
+#define ms00(f) (window_s[i       ] * f(i + k))
+#define ms10(f) (window_s[0x7f - i] * f(i + k + 0x80))
+#define ms20(f) (window_s[i + 0x40] * f(i + k + 0x40))
+#define ms30(f) (window_s[0x3f - i] * f(i + k + 0xc0))
+
+#define ms01(f) (window_s[i + 0x01] * f(i + k + 0x01))
+#define ms11(f) (window_s[0x7e - i] * f(i + k + 0x81))
+#define ms21(f) (window_s[i + 0x41] * f(i + k + 0x41))
+#define ms31(f) (window_s[0x3e - i] * f(i + k + 0xc1))
+
+
+void
+fft_short(lame_internal_flags const *const gfc,
+          FLOAT x_real[3][BLKSIZE_s], int chn, const sample_t * buffer[2])
+{
+    int     i;
+    int     j;
+    int     b;
+
+    for (b = 0; b < 3; b++) {
+        FLOAT  *x = &x_real[b][BLKSIZE_s / 2];
+        short const k = (576 / 3) * (b + 1);
+        j = BLKSIZE_s / 8 - 1;
+        do {
+            FLOAT   f0, f1, f2, f3, w;
+
+            i = rv_tbl[j << 2];
+
+            f0 = ms00(ch01);
+            w = ms10(ch01);
+            f1 = f0 - w;
+            f0 = f0 + w;
+            f2 = ms20(ch01);
+            w = ms30(ch01);
+            f3 = f2 - w;
+            f2 = f2 + w;
+
+            x -= 4;
+            x[0] = f0 + f2;
+            x[2] = f0 - f2;
+            x[1] = f1 + f3;
+            x[3] = f1 - f3;
+
+            f0 = ms01(ch01);
+            w = ms11(ch01);
+            f1 = f0 - w;
+            f0 = f0 + w;
+            f2 = ms21(ch01);
+            w = ms31(ch01);
+            f3 = f2 - w;
+            f2 = f2 + w;
+
+            x[BLKSIZE_s / 2 + 0] = f0 + f2;
+            x[BLKSIZE_s / 2 + 2] = f0 - f2;
+            x[BLKSIZE_s / 2 + 1] = f1 + f3;
+            x[BLKSIZE_s / 2 + 3] = f1 - f3;
+        } while (--j >= 0);
+
+        gfc->fft_fht(x, BLKSIZE_s / 2);
+        /* BLKSIZE_s/2 because of 3DNow! ASM routine */
+    }
+}
+
+void
+fft_long(lame_internal_flags const *const gfc,
+         FLOAT x[BLKSIZE], int chn, const sample_t * buffer[2])
+{
+    int     i;
+    int     jj = BLKSIZE / 8 - 1;
+    x += BLKSIZE / 2;
+
+    do {
+        FLOAT   f0, f1, f2, f3, w;
+
+        i = rv_tbl[jj];
+        f0 = ml00(ch01);
+        w = ml10(ch01);
+        f1 = f0 - w;
+        f0 = f0 + w;
+        f2 = ml20(ch01);
+        w = ml30(ch01);
+        f3 = f2 - w;
+        f2 = f2 + w;
+
+        x -= 4;
+        x[0] = f0 + f2;
+        x[2] = f0 - f2;
+        x[1] = f1 + f3;
+        x[3] = f1 - f3;
+
+        f0 = ml01(ch01);
+        w = ml11(ch01);
+        f1 = f0 - w;
+        f0 = f0 + w;
+        f2 = ml21(ch01);
+        w = ml31(ch01);
+        f3 = f2 - w;
+        f2 = f2 + w;
+
+        x[BLKSIZE / 2 + 0] = f0 + f2;
+        x[BLKSIZE / 2 + 2] = f0 - f2;
+        x[BLKSIZE / 2 + 1] = f1 + f3;
+        x[BLKSIZE / 2 + 3] = f1 - f3;
+    } while (--jj >= 0);
+
+    gfc->fft_fht(x, BLKSIZE / 2);
+    /* BLKSIZE/2 because of 3DNow! ASM routine */
+}
+
+#ifdef HAVE_NASM
+extern void fht_3DN(FLOAT * fz, int n);
+extern void fht_SSE(FLOAT * fz, int n);
+#endif
+
+void
+init_fft(lame_internal_flags * const gfc)
+{
+    int     i;
+
+    /* The type of window used here will make no real difference, but */
+    /* in the interest of merging nspsytune stuff - switch to blackman window */
+    for (i = 0; i < BLKSIZE; i++)
+        /* blackman window */
+        window[i] = 0.42 - 0.5 * cos(2 * PI * (i + .5) / BLKSIZE) +
+            0.08 * cos(4 * PI * (i + .5) / BLKSIZE);
+
+    for (i = 0; i < BLKSIZE_s / 2; i++)
+        window_s[i] = 0.5 * (1.0 - cos(2.0 * PI * (i + 0.5) / BLKSIZE_s));
+
+#ifdef HAVE_NASM
+    if (gfc->CPU_features.AMD_3DNow) {
+        gfc->fft_fht = fht_3DN;
+    }
+    else if (gfc->CPU_features.SSE) {
+        gfc->fft_fht = fht_SSE;
+    }
+    else
+#endif
+    {
+        gfc->fft_fht = fht;
+    }
+}
diff --git a/libmp3lame/fft.h b/libmp3lame/fft.h
new file mode 100644
index 0000000..37f8ab7
--- /dev/null
+++ b/libmp3lame/fft.h
@@ -0,0 +1,35 @@
+/*
+ *	Fast Fourier Transform include file
+ *
+ *	Copyright (c) 2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_FFT_H
+#define LAME_FFT_H
+
+void    fft_long(lame_internal_flags const *const gfc, FLOAT x_real[BLKSIZE],
+                 int chn, const sample_t * data[2]);
+
+void    fft_short(lame_internal_flags const *const gfc, FLOAT x_real[3][BLKSIZE_s],
+                  int chn, const sample_t * data[2]);
+
+void    init_fft(lame_internal_flags * const gfc);
+
+#endif
+
+/* End of fft.h */
diff --git a/libmp3lame/gain_analysis.c b/libmp3lame/gain_analysis.c
new file mode 100644
index 0000000..e3b30fe
--- /dev/null
+++ b/libmp3lame/gain_analysis.c
@@ -0,0 +1,508 @@
+/*
+ *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change
+ *  Copyright (C) 2001 David Robinson and Glen Sawyer
+ *  Improvements and optimizations added by Frank Klemm, and by Marcel Muller 
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  concept and filter values by David Robinson (David@Robinson.org)
+ *    -- blame him if you think the idea is flawed
+ *  original coding by Glen Sawyer (mp3gain@hotmail.com)
+ *    -- blame him if you think this runs too slowly, or the coding is otherwise flawed
+ *
+ *  lots of code improvements by Frank Klemm ( http://www.uni-jena.de/~pfk/mpp/ )
+ *    -- credit him for all the _good_ programming ;)
+ *
+ *
+ *  For an explanation of the concepts and the basic algorithms involved, go to:
+ *    http://www.replaygain.org/
+ */
+
+/*
+ *  Here's the deal. Call
+ *
+ *    InitGainAnalysis ( long samplefreq );
+ *
+ *  to initialize everything. Call
+ *
+ *    AnalyzeSamples ( const Float_t*  left_samples,
+ *                     const Float_t*  right_samples,
+ *                     size_t          num_samples,
+ *                     int             num_channels );
+ *
+ *  as many times as you want, with as many or as few samples as you want.
+ *  If mono, pass the sample buffer in through left_samples, leave
+ *  right_samples NULL, and make sure num_channels = 1.
+ *
+ *    GetTitleGain()
+ *
+ *  will return the recommended dB level change for all samples analyzed
+ *  SINCE THE LAST TIME you called GetTitleGain() OR InitGainAnalysis().
+ *
+ *    GetAlbumGain()
+ *
+ *  will return the recommended dB level change for all samples analyzed
+ *  since InitGainAnalysis() was called and finalized with GetTitleGain().
+ *
+ *  Pseudo-code to process an album:
+ *
+ *    Float_t       l_samples [4096];
+ *    Float_t       r_samples [4096];
+ *    size_t        num_samples;
+ *    unsigned int  num_songs;
+ *    unsigned int  i;
+ *
+ *    InitGainAnalysis ( 44100 );
+ *    for ( i = 1; i <= num_songs; i++ ) {
+ *        while ( ( num_samples = getSongSamples ( song[i], left_samples, right_samples ) ) > 0 )
+ *            AnalyzeSamples ( left_samples, right_samples, num_samples, 2 );
+ *        fprintf ("Recommended dB change for song %2d: %+6.2f dB\n", i, GetTitleGain() );
+ *    }
+ *    fprintf ("Recommended dB change for whole album: %+6.2f dB\n", GetAlbumGain() );
+ */
+
+/*
+ *  So here's the main source of potential code confusion:
+ *
+ *  The filters applied to the incoming samples are IIR filters,
+ *  meaning they rely on up to <filter order> number of previous samples
+ *  AND up to <filter order> number of previous filtered samples.
+ *
+ *  I set up the AnalyzeSamples routine to minimize memory usage and interface
+ *  complexity. The speed isn't compromised too much (I don't think), but the
+ *  internal complexity is higher than it should be for such a relatively
+ *  simple routine.
+ *
+ *  Optimization/clarity suggestions are welcome.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lame.h"
+#include "machine.h"
+#include "gain_analysis.h"
+
+/* for each filter: */
+/* [0] 48 kHz, [1] 44.1 kHz, [2] 32 kHz, [3] 24 kHz, [4] 22050 Hz, [5] 16 kHz, [6] 12 kHz, [7] is 11025 Hz, [8] 8 kHz */
+
+#ifdef WIN32
+#pragma warning ( disable : 4305 )
+#endif
+
+/*lint -save -e736 loss of precision */
+static const Float_t ABYule[9][2 * YULE_ORDER + 1] = {
+    {0.03857599435200, -3.84664617118067, -0.02160367184185, 7.81501653005538, -0.00123395316851,
+     -11.34170355132042, -0.00009291677959, 13.05504219327545, -0.01655260341619,
+     -12.28759895145294, 0.02161526843274, 9.48293806319790, -0.02074045215285, -5.87257861775999,
+     0.00594298065125, 2.75465861874613, 0.00306428023191, -0.86984376593551, 0.00012025322027,
+     0.13919314567432, 0.00288463683916},
+    {0.05418656406430, -3.47845948550071, -0.02911007808948, 6.36317777566148, -0.00848709379851,
+     -8.54751527471874, -0.00851165645469, 9.47693607801280, -0.00834990904936, -8.81498681370155,
+     0.02245293253339, 6.85401540936998, -0.02596338512915, -4.39470996079559, 0.01624864962975,
+     2.19611684890774, -0.00240879051584, -0.75104302451432, 0.00674613682247, 0.13149317958808,
+     -0.00187763777362},
+    {0.15457299681924, -2.37898834973084, -0.09331049056315, 2.84868151156327, -0.06247880153653,
+     -2.64577170229825, 0.02163541888798, 2.23697657451713, -0.05588393329856, -1.67148153367602,
+     0.04781476674921, 1.00595954808547, 0.00222312597743, -0.45953458054983, 0.03174092540049,
+     0.16378164858596, -0.01390589421898, -0.05032077717131, 0.00651420667831, 0.02347897407020,
+     -0.00881362733839},
+    {0.30296907319327, -1.61273165137247, -0.22613988682123, 1.07977492259970, -0.08587323730772,
+     -0.25656257754070, 0.03282930172664, -0.16276719120440, -0.00915702933434, -0.22638893773906,
+     -0.02364141202522, 0.39120800788284, -0.00584456039913, -0.22138138954925, 0.06276101321749,
+     0.04500235387352, -0.00000828086748, 0.02005851806501, 0.00205861885564, 0.00302439095741,
+     -0.02950134983287},
+    {0.33642304856132, -1.49858979367799, -0.25572241425570, 0.87350271418188, -0.11828570177555,
+     0.12205022308084, 0.11921148675203, -0.80774944671438, -0.07834489609479, 0.47854794562326,
+     -0.00469977914380, -0.12453458140019, -0.00589500224440, -0.04067510197014, 0.05724228140351,
+     0.08333755284107, 0.00832043980773, -0.04237348025746, -0.01635381384540, 0.02977207319925,
+     -0.01760176568150},
+    {0.44915256608450, -0.62820619233671, -0.14351757464547, 0.29661783706366, -0.22784394429749,
+     -0.37256372942400, -0.01419140100551, 0.00213767857124, 0.04078262797139, -0.42029820170918,
+     -0.12398163381748, 0.22199650564824, 0.04097565135648, 0.00613424350682, 0.10478503600251,
+     0.06747620744683, -0.01863887810927, 0.05784820375801, -0.03193428438915, 0.03222754072173,
+     0.00541907748707},
+    {0.56619470757641, -1.04800335126349, -0.75464456939302, 0.29156311971249, 0.16242137742230,
+     -0.26806001042947, 0.16744243493672, 0.00819999645858, -0.18901604199609, 0.45054734505008,
+     0.30931782841830, -0.33032403314006, -0.27562961986224, 0.06739368333110, 0.00647310677246,
+     -0.04784254229033, 0.08647503780351, 0.01639907836189, -0.03788984554840, 0.01807364323573,
+     -0.00588215443421},
+    {0.58100494960553, -0.51035327095184, -0.53174909058578, -0.31863563325245, -0.14289799034253,
+     -0.20256413484477, 0.17520704835522, 0.14728154134330, 0.02377945217615, 0.38952639978999,
+     0.15558449135573, -0.23313271880868, -0.25344790059353, -0.05246019024463, 0.01628462406333,
+     -0.02505961724053, 0.06920467763959, 0.02442357316099, -0.03721611395801, 0.01818801111503,
+     -0.00749618797172},
+    {0.53648789255105, -0.25049871956020, -0.42163034350696, -0.43193942311114, -0.00275953611929,
+     -0.03424681017675, 0.04267842219415, -0.04678328784242, -0.10214864179676, 0.26408300200955,
+     0.14590772289388, 0.15113130533216, -0.02459864859345, -0.17556493366449, -0.11202315195388,
+     -0.18823009262115, -0.04060034127000, 0.05477720428674, 0.04788665548180, 0.04704409688120,
+     -0.02217936801134}
+};
+
+static const Float_t ABButter[9][2 * BUTTER_ORDER + 1] = {
+    {0.98621192462708, -1.97223372919527, -1.97242384925416, 0.97261396931306, 0.98621192462708},
+    {0.98500175787242, -1.96977855582618, -1.97000351574484, 0.97022847566350, 0.98500175787242},
+    {0.97938932735214, -1.95835380975398, -1.95877865470428, 0.95920349965459, 0.97938932735214},
+    {0.97531843204928, -1.95002759149878, -1.95063686409857, 0.95124613669835, 0.97531843204928},
+    {0.97316523498161, -1.94561023566527, -1.94633046996323, 0.94705070426118, 0.97316523498161},
+    {0.96454515552826, -1.92783286977036, -1.92909031105652, 0.93034775234268, 0.96454515552826},
+    {0.96009142950541, -1.91858953033784, -1.92018285901082, 0.92177618768381, 0.96009142950541},
+    {0.95856916599601, -1.91542108074780, -1.91713833199203, 0.91885558323625, 0.95856916599601},
+    {0.94597685600279, -1.88903307939452, -1.89195371200558, 0.89487434461664, 0.94597685600279}
+};
+
+/*lint -restore */
+
+#ifdef WIN32
+#pragma warning ( default : 4305 )
+#endif
+
+/* When calling this procedure, make sure that ip[-order] and op[-order] point to real data! */
+
+static void
+filterYule(const Float_t * input, Float_t * output, size_t nSamples, const Float_t * const kernel)
+{
+    /*register double  y; */
+
+    while (nSamples--) {
+        *output = 1e-10 /* 1e-10 is a hack to avoid slowdown because of denormals */
+            + input[0] * kernel[0]
+            - output[-1] * kernel[1]
+            + input[-1] * kernel[2]
+            - output[-2] * kernel[3]
+            + input[-2] * kernel[4]
+            - output[-3] * kernel[5]
+            + input[-3] * kernel[6]
+            - output[-4] * kernel[7]
+            + input[-4] * kernel[8]
+            - output[-5] * kernel[9]
+            + input[-5] * kernel[10]
+            - output[-6] * kernel[11]
+            + input[-6] * kernel[12]
+            - output[-7] * kernel[13]
+            + input[-7] * kernel[14]
+            - output[-8] * kernel[15]
+            + input[-8] * kernel[16]
+            - output[-9] * kernel[17]
+            + input[-9] * kernel[18]
+            - output[-10] * kernel[19]
+            + input[-10] * kernel[20];
+        ++output;
+        ++input;
+        /* *output++ = (Float_t)y; */
+    }
+}
+
+static void
+filterButter(const Float_t * input, Float_t * output, size_t nSamples, const Float_t * const kernel)
+{                       /*register double  y; */
+
+    while (nSamples--) {
+        *output = input[0] * kernel[0]
+            - output[-1] * kernel[1]
+            + input[-1] * kernel[2]
+            - output[-2] * kernel[3]
+            + input[-2] * kernel[4];
+        ++output;
+        ++input;
+        /* *output++ = (Float_t)y; */
+    }
+}
+
+
+/* returns a INIT_GAIN_ANALYSIS_OK if successful, INIT_GAIN_ANALYSIS_ERROR if not */
+
+int
+ResetSampleFrequency(replaygain_t * rgData, long samplefreq)
+{
+    int     i;
+
+    /* zero out initial values */
+    for (i = 0; i < MAX_ORDER; i++)
+        rgData->linprebuf[i] = rgData->lstepbuf[i]
+            = rgData->loutbuf[i]
+            = rgData->rinprebuf[i]
+            = rgData->rstepbuf[i]
+            = rgData->routbuf[i] = 0.;
+
+    switch ((int) (samplefreq)) {
+    case 48000:
+        rgData->freqindex = 0;
+        break;
+    case 44100:
+        rgData->freqindex = 1;
+        break;
+    case 32000:
+        rgData->freqindex = 2;
+        break;
+    case 24000:
+        rgData->freqindex = 3;
+        break;
+    case 22050:
+        rgData->freqindex = 4;
+        break;
+    case 16000:
+        rgData->freqindex = 5;
+        break;
+    case 12000:
+        rgData->freqindex = 6;
+        break;
+    case 11025:
+        rgData->freqindex = 7;
+        break;
+    case 8000:
+        rgData->freqindex = 8;
+        break;
+    default:
+        return INIT_GAIN_ANALYSIS_ERROR;
+    }
+
+    rgData->sampleWindow =
+        (samplefreq * RMS_WINDOW_TIME_NUMERATOR + RMS_WINDOW_TIME_DENOMINATOR -
+         1) / RMS_WINDOW_TIME_DENOMINATOR;
+
+    rgData->lsum = 0.;
+    rgData->rsum = 0.;
+    rgData->totsamp = 0;
+
+    memset(rgData->A, 0, sizeof(rgData->A));
+
+    return INIT_GAIN_ANALYSIS_OK;
+}
+
+int
+InitGainAnalysis(replaygain_t * rgData, long samplefreq)
+{
+    if (ResetSampleFrequency(rgData, samplefreq) != INIT_GAIN_ANALYSIS_OK) {
+        return INIT_GAIN_ANALYSIS_ERROR;
+    }
+
+    rgData->linpre = rgData->linprebuf + MAX_ORDER;
+    rgData->rinpre = rgData->rinprebuf + MAX_ORDER;
+    rgData->lstep = rgData->lstepbuf + MAX_ORDER;
+    rgData->rstep = rgData->rstepbuf + MAX_ORDER;
+    rgData->lout = rgData->loutbuf + MAX_ORDER;
+    rgData->rout = rgData->routbuf + MAX_ORDER;
+
+    memset(rgData->B, 0, sizeof(rgData->B));
+
+    return INIT_GAIN_ANALYSIS_OK;
+}
+
+/* returns GAIN_ANALYSIS_OK if successful, GAIN_ANALYSIS_ERROR if not */
+
+static inline double
+fsqr(const double d)
+{
+    return d * d;
+}
+
+int
+AnalyzeSamples(replaygain_t * rgData, const Float_t * left_samples, const Float_t * right_samples,
+               size_t num_samples, int num_channels)
+{
+    const Float_t *curleft;
+    const Float_t *curright;
+    long    batchsamples;
+    long    cursamples;
+    long    cursamplepos;
+    int     i;
+
+    if (num_samples == 0)
+        return GAIN_ANALYSIS_OK;
+
+    cursamplepos = 0;
+    batchsamples = (long) num_samples;
+
+    switch (num_channels) {
+    case 1:
+        right_samples = left_samples;
+        break;
+    case 2:
+        break;
+    default:
+        return GAIN_ANALYSIS_ERROR;
+    }
+
+    if (num_samples < MAX_ORDER) {
+        memcpy(rgData->linprebuf + MAX_ORDER, left_samples, num_samples * sizeof(Float_t));
+        memcpy(rgData->rinprebuf + MAX_ORDER, right_samples, num_samples * sizeof(Float_t));
+    }
+    else {
+        memcpy(rgData->linprebuf + MAX_ORDER, left_samples, MAX_ORDER * sizeof(Float_t));
+        memcpy(rgData->rinprebuf + MAX_ORDER, right_samples, MAX_ORDER * sizeof(Float_t));
+    }
+
+    while (batchsamples > 0) {
+        cursamples = batchsamples > rgData->sampleWindow - rgData->totsamp ?
+            rgData->sampleWindow - rgData->totsamp : batchsamples;
+        if (cursamplepos < MAX_ORDER) {
+            curleft = rgData->linpre + cursamplepos;
+            curright = rgData->rinpre + cursamplepos;
+            if (cursamples > MAX_ORDER - cursamplepos)
+                cursamples = MAX_ORDER - cursamplepos;
+        }
+        else {
+            curleft = left_samples + cursamplepos;
+            curright = right_samples + cursamplepos;
+        }
+
+        YULE_FILTER(curleft, rgData->lstep + rgData->totsamp, cursamples,
+                    ABYule[rgData->freqindex]);
+        YULE_FILTER(curright, rgData->rstep + rgData->totsamp, cursamples,
+                    ABYule[rgData->freqindex]);
+
+        BUTTER_FILTER(rgData->lstep + rgData->totsamp, rgData->lout + rgData->totsamp, cursamples,
+                      ABButter[rgData->freqindex]);
+        BUTTER_FILTER(rgData->rstep + rgData->totsamp, rgData->rout + rgData->totsamp, cursamples,
+                      ABButter[rgData->freqindex]);
+
+        curleft = rgData->lout + rgData->totsamp; /* Get the squared values */
+        curright = rgData->rout + rgData->totsamp;
+
+        i = cursamples % 8;
+        while (i--) {
+            rgData->lsum += fsqr(*curleft++);
+            rgData->rsum += fsqr(*curright++);
+        }
+        i = cursamples / 8;
+        while (i--) {
+            rgData->lsum += fsqr(curleft[0])
+                + fsqr(curleft[1])
+                + fsqr(curleft[2])
+                + fsqr(curleft[3])
+                + fsqr(curleft[4])
+                + fsqr(curleft[5])
+                + fsqr(curleft[6])
+                + fsqr(curleft[7]);
+            curleft += 8;
+            rgData->rsum += fsqr(curright[0])
+                + fsqr(curright[1])
+                + fsqr(curright[2])
+                + fsqr(curright[3])
+                + fsqr(curright[4])
+                + fsqr(curright[5])
+                + fsqr(curright[6])
+                + fsqr(curright[7]);
+            curright += 8;
+        }
+
+        batchsamples -= cursamples;
+        cursamplepos += cursamples;
+        rgData->totsamp += cursamples;
+        if (rgData->totsamp == rgData->sampleWindow) { /* Get the Root Mean Square (RMS) for this set of samples */
+            double const val =
+                STEPS_per_dB * 10. * log10((rgData->lsum + rgData->rsum) / rgData->totsamp * 0.5 +
+                                           1.e-37);
+            size_t  ival = (val <= 0) ? 0 : (size_t) val;
+            if (ival >= sizeof(rgData->A) / sizeof(*(rgData->A)))
+                ival = sizeof(rgData->A) / sizeof(*(rgData->A)) - 1;
+            rgData->A[ival]++;
+            rgData->lsum = rgData->rsum = 0.;
+            memmove(rgData->loutbuf, rgData->loutbuf + rgData->totsamp,
+                    MAX_ORDER * sizeof(Float_t));
+            memmove(rgData->routbuf, rgData->routbuf + rgData->totsamp,
+                    MAX_ORDER * sizeof(Float_t));
+            memmove(rgData->lstepbuf, rgData->lstepbuf + rgData->totsamp,
+                    MAX_ORDER * sizeof(Float_t));
+            memmove(rgData->rstepbuf, rgData->rstepbuf + rgData->totsamp,
+                    MAX_ORDER * sizeof(Float_t));
+            rgData->totsamp = 0;
+        }
+        if (rgData->totsamp > rgData->sampleWindow) /* somehow I really screwed up: Error in programming! Contact author about totsamp > sampleWindow */
+            return GAIN_ANALYSIS_ERROR;
+    }
+    if (num_samples < MAX_ORDER) {
+        memmove(rgData->linprebuf, rgData->linprebuf + num_samples,
+                (MAX_ORDER - num_samples) * sizeof(Float_t));
+        memmove(rgData->rinprebuf, rgData->rinprebuf + num_samples,
+                (MAX_ORDER - num_samples) * sizeof(Float_t));
+        memcpy(rgData->linprebuf + MAX_ORDER - num_samples, left_samples,
+               num_samples * sizeof(Float_t));
+        memcpy(rgData->rinprebuf + MAX_ORDER - num_samples, right_samples,
+               num_samples * sizeof(Float_t));
+    }
+    else {
+        memcpy(rgData->linprebuf, left_samples + num_samples - MAX_ORDER,
+               MAX_ORDER * sizeof(Float_t));
+        memcpy(rgData->rinprebuf, right_samples + num_samples - MAX_ORDER,
+               MAX_ORDER * sizeof(Float_t));
+    }
+
+    return GAIN_ANALYSIS_OK;
+}
+
+
+static  Float_t
+analyzeResult(uint32_t const *Array, size_t len)
+{
+    uint32_t elems;
+    int32_t upper;
+    size_t  i;
+
+    elems = 0;
+    for (i = 0; i < len; i++)
+        elems += Array[i];
+    if (elems == 0)
+        return GAIN_NOT_ENOUGH_SAMPLES;
+
+    upper = (int32_t) ceil(elems * (1. - RMS_PERCENTILE));
+    for (i = len; i-- > 0;) {
+        if ((upper -= Array[i]) <= 0)
+            break;
+    }
+
+    return (Float_t) ((Float_t) PINK_REF - (Float_t) i / (Float_t) STEPS_per_dB);
+}
+
+
+Float_t
+GetTitleGain(replaygain_t * rgData)
+{
+    Float_t retval;
+    unsigned int i;
+
+    retval = analyzeResult(rgData->A, sizeof(rgData->A) / sizeof(*(rgData->A)));
+
+    for (i = 0; i < sizeof(rgData->A) / sizeof(*(rgData->A)); i++) {
+        rgData->B[i] += rgData->A[i];
+        rgData->A[i] = 0;
+    }
+
+    for (i = 0; i < MAX_ORDER; i++)
+        rgData->linprebuf[i] = rgData->lstepbuf[i]
+            = rgData->loutbuf[i]
+            = rgData->rinprebuf[i]
+            = rgData->rstepbuf[i]
+            = rgData->routbuf[i] = 0.f;
+
+    rgData->totsamp = 0;
+    rgData->lsum = rgData->rsum = 0.;
+    return retval;
+}
+
+
+Float_t
+GetAlbumGain(replaygain_t * rgData)
+{
+    return analyzeResult(rgData->B, sizeof(rgData->B) / sizeof(*(rgData->B)));
+}
+
+/* end of gain_analysis.c */
diff --git a/libmp3lame/gain_analysis.h b/libmp3lame/gain_analysis.h
new file mode 100644
index 0000000..8dbc4c8
--- /dev/null
+++ b/libmp3lame/gain_analysis.h
@@ -0,0 +1,111 @@
+/*
+ *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change
+ *  Copyright (C) 2001 David Robinson and Glen Sawyer
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  concept and filter values by David Robinson (David@Robinson.org)
+ *    -- blame him if you think the idea is flawed
+ *  coding by Glen Sawyer (mp3gain@hotmail.com) 735 W 255 N, Orem, UT 84057-4505 USA
+ *    -- blame him if you think this runs too slowly, or the coding is otherwise flawed
+ *
+ *  For an explanation of the concepts and the basic algorithms involved, go to:
+ *    http://www.replaygain.org/
+ */
+
+#ifndef GAIN_ANALYSIS_H
+#define GAIN_ANALYSIS_H
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# ifdef HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#ifdef __cplusplus
+extern  "C" {
+#endif
+
+
+    typedef sample_t Float_t; /* Type used for filtering */
+
+
+#define PINK_REF                64.82       /* 298640883795 */ /* calibration value for 89dB */
+
+
+#define YULE_ORDER         10
+#define BUTTER_ORDER        2
+#define YULE_FILTER     filterYule
+#define BUTTER_FILTER   filterButter
+#define RMS_PERCENTILE      0.95 /* percentile which is louder than the proposed level */
+#define MAX_SAMP_FREQ   48000L /* maximum allowed sample frequency [Hz] */
+#define RMS_WINDOW_TIME_NUMERATOR    1L
+#define RMS_WINDOW_TIME_DENOMINATOR 20L /* numerator / denominator = time slice size [s] */
+#define STEPS_per_dB      100. /* Table entries per dB */
+#define MAX_dB            120. /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */
+
+    enum { GAIN_NOT_ENOUGH_SAMPLES = -24601, GAIN_ANALYSIS_ERROR = 0, GAIN_ANALYSIS_OK =
+            1, INIT_GAIN_ANALYSIS_ERROR = 0, INIT_GAIN_ANALYSIS_OK = 1
+    };
+
+    enum { MAX_ORDER = (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
+            , MAX_SAMPLES_PER_WINDOW = ((MAX_SAMP_FREQ * RMS_WINDOW_TIME_NUMERATOR) / RMS_WINDOW_TIME_DENOMINATOR + 1) /* max. Samples per Time slice */
+    };
+
+    struct replaygain_data {
+        Float_t linprebuf[MAX_ORDER * 2];
+        Float_t *linpre;     /* left input samples, with pre-buffer */
+        Float_t lstepbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
+        Float_t *lstep;      /* left "first step" (i.e. post first filter) samples */
+        Float_t loutbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
+        Float_t *lout;       /* left "out" (i.e. post second filter) samples */
+        Float_t rinprebuf[MAX_ORDER * 2];
+        Float_t *rinpre;     /* right input samples ... */
+        Float_t rstepbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
+        Float_t *rstep;
+        Float_t routbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
+        Float_t *rout;
+        long    sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */
+        long    totsamp;
+        double  lsum;
+        double  rsum;
+        int     freqindex;
+        int     first;
+        uint32_t A[(size_t) (STEPS_per_dB * MAX_dB)];
+        uint32_t B[(size_t) (STEPS_per_dB * MAX_dB)];
+
+    };
+#ifndef replaygain_data_defined
+#define replaygain_data_defined
+    typedef struct replaygain_data replaygain_t;
+#endif
+
+
+
+
+    int     InitGainAnalysis(replaygain_t * rgData, long samplefreq);
+    int     AnalyzeSamples(replaygain_t * rgData, const Float_t * left_samples,
+                           const Float_t * right_samples, size_t num_samples, int num_channels);
+    int     ResetSampleFrequency(replaygain_t * rgData, long samplefreq);
+    Float_t GetTitleGain(replaygain_t * rgData);
+    Float_t GetAlbumGain(replaygain_t * rgData);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif                       /* GAIN_ANALYSIS_H */
diff --git a/libmp3lame/i386/Makefile.am b/libmp3lame/i386/Makefile.am
new file mode 100644
index 0000000..3074d57
--- /dev/null
+++ b/libmp3lame/i386/Makefile.am
@@ -0,0 +1,72 @@
+## $Id: Makefile.am,v 1.22.8.2 2010/02/26 00:55:31 robert Exp $
+
+AUTOMAKE_OPTIONS = foreign $(top_srcdir)/ansi2knr
+
+DEFS = @DEFS@ @CONFIG_DEFS@
+
+ECHO ?= echo
+
+nasm_sources = \
+	choose_table.nas \
+	cpu_feat.nas \
+	fft3dn.nas \
+	fftsse.nas
+
+if HAVE_NASM
+noinst_LTLIBRARIES = liblameasmroutines.la
+liblameasmroutines_la_SOURCES = $(nasm_sources)
+am_liblameasmroutines_la_OBJECTS = \
+	choose_table$U.lo \
+	cpu_feat$U.lo \
+	fft3dn$U.lo \
+	fftsse$U.lo
+endif
+
+noinst_HEADERS = nasm.h
+
+INCLUDES = @INCLUDES@ -I$(top_srcdir)/libmp3lame/@CPUTYPE@
+
+SUFFIXES = .nas .lo
+
+EXTRA_liblameasmroutines_la_SOURCES = $(nasm_sources)
+
+CLEANFILES = \
+	choose_table.o.lst \
+	choose_table.lo.lst \
+	cpu_feat.o.lst \
+	cpu_feat.lo.lst \
+	fft3dn.o.lst \
+	fft3dn.lo.lst \
+	fftsse.o.lst \
+	fftsse.lo.lst
+
+EXTRA_DIST = \
+	fft.nas \
+	fftfpu.nas \
+	ffttbl.nas
+
+NASM = @NASM@
+NASMFLAGS=@NASM_FORMAT@ -i $(top_srcdir)/libmp3lame/@CPUTYPE@/
+
+.nas.o: $< nasm.h
+	$(NASM) $(NASMFLAGS) $< -o $@ -l $@.lst
+
+.nas.lo: $< nasm.h
+	test -d .libs || mkdir .libs
+	$(ECHO) '# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)' >$@
+	$(ECHO) "pic_object='.libs/$*.o'" >>$@
+	$(ECHO) "non_pic_object='.libs/$*.o'" >>$@
+	$(NASM) $(NASMFLAGS) $< -o .libs/$*.o -l $@.lst
+
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+	$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
diff --git a/libmp3lame/i386/Makefile.in b/libmp3lame/i386/Makefile.in
new file mode 100644
index 0000000..fff936c
--- /dev/null
+++ b/libmp3lame/i386/Makefile.in
@@ -0,0 +1,496 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ANSI2KNR = $(top_srcdir)/ansi2knr
+subdir = libmp3lame/i386
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+liblameasmroutines_la_LIBADD =
+am__liblameasmroutines_la_SOURCES_DIST = choose_table.nas cpu_feat.nas \
+	fft3dn.nas fftsse.nas
+am__objects_1 = choose_table.lo cpu_feat.lo fft3dn.lo fftsse.lo
+liblameasmroutines_la_OBJECTS = $(am_liblameasmroutines_la_OBJECTS)
+@HAVE_NASM_TRUE@am_liblameasmroutines_la_rpath =
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+SOURCES = $(liblameasmroutines_la_SOURCES) \
+	$(EXTRA_liblameasmroutines_la_SOURCES)
+DIST_SOURCES = $(am__liblameasmroutines_la_SOURCES_DIST) \
+	$(EXTRA_liblameasmroutines_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@ @CONFIG_DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@ -I$(top_srcdir)/libmp3lame/@CPUTYPE@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign $(top_srcdir)/ansi2knr
+nasm_sources = \
+	choose_table.nas \
+	cpu_feat.nas \
+	fft3dn.nas \
+	fftsse.nas
+
+@HAVE_NASM_TRUE@noinst_LTLIBRARIES = liblameasmroutines.la
+@HAVE_NASM_TRUE@liblameasmroutines_la_SOURCES = $(nasm_sources)
+@HAVE_NASM_TRUE@am_liblameasmroutines_la_OBJECTS = \
+@HAVE_NASM_TRUE@	choose_table$U.lo \
+@HAVE_NASM_TRUE@	cpu_feat$U.lo \
+@HAVE_NASM_TRUE@	fft3dn$U.lo \
+@HAVE_NASM_TRUE@	fftsse$U.lo
+
+noinst_HEADERS = nasm.h
+SUFFIXES = .nas .lo
+EXTRA_liblameasmroutines_la_SOURCES = $(nasm_sources)
+CLEANFILES = \
+	choose_table.o.lst \
+	choose_table.lo.lst \
+	cpu_feat.o.lst \
+	cpu_feat.lo.lst \
+	fft3dn.o.lst \
+	fft3dn.lo.lst \
+	fftsse.o.lst \
+	fftsse.lo.lst
+
+EXTRA_DIST = \
+	fft.nas \
+	fftfpu.nas \
+	ffttbl.nas
+
+NASMFLAGS = @NASM_FORMAT@ -i $(top_srcdir)/libmp3lame/@CPUTYPE@/
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+	$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .nas .lo .o
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  libmp3lame/i386/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  libmp3lame/i386/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+liblameasmroutines.la: $(liblameasmroutines_la_OBJECTS) $(liblameasmroutines_la_DEPENDENCIES) 
+	$(LINK) $(am_liblameasmroutines_la_rpath) $(liblameasmroutines_la_OBJECTS) $(liblameasmroutines_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+$(top_srcdir)/ansi2knr:
+	cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
+
+mostlyclean-kr:
+	-test "$U" = "" || rm -f *_.c
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am
+
+
+.nas.o: $< nasm.h
+	$(NASM) $(NASMFLAGS) $< -o $@ -l $@.lst
+
+.nas.lo: $< nasm.h
+	test -d .libs || mkdir .libs
+	$(ECHO) '# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)' >$@
+	$(ECHO) "pic_object='.libs/$*.o'" >>$@
+	$(ECHO) "non_pic_object='.libs/$*.o'" >>$@
+	$(NASM) $(NASMFLAGS) $< -o .libs/$*.o -l $@.lst
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libmp3lame/i386/choose_table.nas b/libmp3lame/i386/choose_table.nas
new file mode 100644
index 0000000..9217c8e
--- /dev/null
+++ b/libmp3lame/i386/choose_table.nas
@@ -0,0 +1,447 @@
+; new count bit routine
+;	part of this code is origined from
+;	new GOGO-no-coda (1999, 2000)
+;	Copyright (C) 1999 shigeo
+;	modified by Keiichi SAKAI
+
+%include "nasm.h"
+
+	globaldef	choose_table_MMX
+	globaldef	MMX_masking
+
+	externdef	largetbl
+	externdef	t1l
+	externdef	table23
+	externdef	table56
+
+	segment_data
+	align	16
+D14_14_14_14	dd	0x000E000E, 0x000E000E
+D15_15_15_15	dd	0xfff0fff0, 0xfff0fff0
+mul_add		dd	0x00010010, 0x00010010
+mul_add23	dd	0x00010003, 0x00010003
+mul_add56	dd	0x00010004, 0x00010004
+tableDEF
+	dd	0x00010003,0x01,0x00050005,0x05,0x00070006,0x07,0x00090008,0x08,0x000a0008, 0x09
+	dd	0x000a0009,0x0a,0x000b000a,0x0a,0x000b000a,0x0b,0x000c000a,0x0a,0x000c000b, 0x0b
+	dd	0x000c000b,0x0c,0x000d000c,0x0c,0x000d000c,0x0d,0x000d000c,0x0d,0x000e000d, 0x0e
+	dd	0x000b000e,0x0e,0x00040005,0x04,0x00060005,0x06,0x00080007,0x08,0x00090008, 0x09
+	dd	0x000a0009,0x0a,0x000b0009,0x0a,0x000b000a,0x0b,0x000b000a,0x0b,0x000c000a, 0x0b
+	dd	0x000c000b,0x0b,0x000c000b,0x0c,0x000d000c,0x0c,0x000e000c,0x0d,0x000d000c, 0x0e
+	dd	0x000e000d,0x0e,0x000b000d,0x0e,0x00070006,0x07,0x00080007,0x08,0x00090007, 0x09
+	dd	0x000a0008,0x0a,0x000b0009,0x0b,0x000b0009,0x0b,0x000c000a,0x0c,0x000c000a, 0x0c
+	dd	0x000d000a,0x0b,0x000c000b,0x0c,0x000d000b,0x0c,0x000d000c,0x0d,0x000d000c, 0x0d
+	dd	0x000e000d,0x0e,0x000e000d,0x0f,0x000c000d,0x0f,0x00090007,0x08,0x00090008, 0x09
+	dd	0x000a0008,0x0a,0x000b0009,0x0b,0x000b0009,0x0b,0x000c000a,0x0c,0x000c000a, 0x0c
+	dd	0x000c000b,0x0c,0x000d000b,0x0c,0x000d000b,0x0d,0x000e000c,0x0d,0x000e000c, 0x0d
+	dd	0x000e000c,0x0d,0x000f000d,0x0e,0x000f000d,0x0f,0x000d000d,0x0f,0x000a0008, 0x09
+	dd	0x000a0008,0x09,0x000b0009,0x0b,0x000b0009,0x0b,0x000c000a,0x0c,0x000c000a, 0x0c
+	dd	0x000d000b,0x0d,0x000d000b,0x0d,0x000d000b,0x0c,0x000e000b,0x0d,0x000e000c, 0x0d
+	dd	0x000e000c,0x0e,0x000f000c,0x0e,0x000f000d,0x0f,0x000f000d,0x0f,0x000c000d, 0x10
+	dd	0x000a0009,0x0a,0x000a0009,0x0a,0x000b0009,0x0b,0x000b000a,0x0c,0x000c000a, 0x0c
+	dd	0x000d000a,0x0c,0x000d000b,0x0d,0x000e000b,0x0d,0x000d000b,0x0d,0x000e000b, 0x0d
+	dd	0x000e000c,0x0e,0x000f000c,0x0d,0x000f000d,0x0f,0x000f000d,0x0f,0x0010000d, 0x10
+	dd	0x000d000e,0x10,0x000b000a,0x0a,0x000b0009,0x0b,0x000b000a,0x0c,0x000c000a, 0x0c
+	dd	0x000d000a,0x0d,0x000d000b,0x0d,0x000d000b,0x0d,0x000d000b,0x0d,0x000e000b, 0x0d
+	dd	0x000e000c,0x0e,0x000e000c,0x0e,0x000e000c,0x0e,0x000f000d,0x0f,0x000f000d, 0x0f
+	dd	0x0010000e,0x10,0x000d000e,0x10,0x000b000a,0x0b,0x000b000a,0x0b,0x000c000a, 0x0c
+	dd	0x000c000b,0x0d,0x000d000b,0x0d,0x000d000b,0x0d,0x000d000b,0x0e,0x000e000c, 0x0e
+	dd	0x000e000c,0x0e,0x000f000c,0x0e,0x000f000c,0x0f,0x000f000c,0x0f,0x000f000d, 0x0f
+	dd	0x0011000d,0x10,0x0011000d,0x12,0x000d000e,0x12,0x000b000a,0x0a,0x000c000a, 0x0a
+	dd	0x000c000a,0x0b,0x000d000b,0x0c,0x000d000b,0x0c,0x000d000b,0x0d,0x000e000b, 0x0d
+	dd	0x000e000c,0x0e,0x000f000c,0x0e,0x000f000c,0x0e,0x000f000c,0x0e,0x000f000d, 0x0f
+	dd	0x0010000d,0x0f,0x0010000e,0x10,0x0010000e,0x11,0x000d000e,0x11,0x000c000a, 0x0b
+	dd	0x000c000a,0x0b,0x000c000b,0x0c,0x000d000b,0x0c,0x000d000b,0x0d,0x000e000b, 0x0d
+	dd	0x000e000c,0x0d,0x000f000c,0x0f,0x000f000c,0x0e,0x000f000d,0x0f,0x000f000d, 0x0f
+	dd	0x0010000d,0x10,0x000f000d,0x10,0x0010000e,0x10,0x000f000e,0x12,0x000e000e, 0x11
+	dd	0x000c000b,0x0b,0x000d000b,0x0c,0x000c000b,0x0c,0x000d000b,0x0d,0x000e000c, 0x0d
+	dd	0x000e000c,0x0e,0x000e000c,0x0e,0x000e000c,0x0f,0x000f000c,0x0e,0x0010000d, 0x0f
+	dd	0x0010000d,0x10,0x0010000d,0x0f,0x0011000d,0x10,0x0011000e,0x11,0x0010000f, 0x12
+	dd	0x000d000e,0x13,0x000d000b,0x0c,0x000d000b,0x0c,0x000d000b,0x0c,0x000d000b, 0x0d
+	dd	0x000e000c,0x0e,0x000e000c,0x0e,0x000f000c,0x0e,0x0010000c,0x0e,0x0010000d, 0x0f
+	dd	0x0010000d,0x0f,0x0010000d,0x0f,0x0010000d,0x10,0x0010000e,0x11,0x000f000e, 0x11
+	dd	0x0010000e,0x11,0x000e000f,0x12,0x000d000c,0x0c,0x000e000c,0x0d,0x000e000b, 0x0d
+	dd	0x000e000c,0x0e,0x000e000c,0x0e,0x000f000c,0x0f,0x000f000d,0x0e,0x000f000d, 0x0f
+	dd	0x000f000d,0x10,0x0011000d,0x10,0x0010000d,0x11,0x0010000d,0x11,0x0010000e, 0x11
+	dd	0x0010000e,0x12,0x0012000f,0x12,0x000e000f,0x12,0x000f000c,0x0d,0x000e000c, 0x0d
+	dd	0x000e000c,0x0e,0x000e000c,0x0f,0x000f000c,0x0f,0x000f000d,0x0f,0x0010000d, 0x10
+	dd	0x0010000d,0x10,0x0010000d,0x10,0x0012000e,0x10,0x0011000e,0x10,0x0011000e, 0x11
+	dd	0x0011000e,0x12,0x0013000e,0x11,0x0011000f,0x12,0x000e000f,0x12,0x000e000d, 0x0e
+	dd	0x000f000d,0x0e,0x000d000d,0x0e,0x000e000d,0x0f,0x0010000d,0x0f,0x0010000d, 0x0f
+	dd	0x000f000d,0x11,0x0010000d,0x10,0x0010000e,0x10,0x0011000e,0x13,0x0012000e, 0x11
+	dd	0x0011000e,0x11,0x0013000f,0x11,0x0011000f,0x13,0x0010000e,0x12,0x000e000f, 0x12
+	dd	0x000b000d,0x0d,0x000b000d,0x0e,0x000b000d,0x0f,0x000c000d,0x10,0x000c000d, 0x10
+	dd	0x000d000d,0x10,0x000d000d,0x11,0x000d000e,0x10,0x000e000e,0x11,0x000e000e, 0x11
+	dd	0x000e000e,0x12,0x000e000e,0x12,0x000e000f,0x15,0x000e000f,0x14,0x000e000f, 0x15
+	dd	0x000c000f,0x12
+
+tableABC
+	dd	0x00020004,0x1,0x00040004,0x4,0x00060006,0x7,0x00080008,0x9,0x00090009,0xa,0x000a000a,0xa
+	dd	0x0009000a,0xa,0x000a000a,0xb,0x00000000,0x0,0x00020003,0x1,0x00040004,0x4,0x00070006,0x7
+	dd	0x00090007,0x9,0x00090009,0x9,0x000a000a,0xa,0x00000000,0x0,0x00040004,0x4,0x00050005,0x6
+	dd	0x00060006,0x8,0x00080007,0x9,0x000a0009,0xa,0x000a0009,0xb,0x0009000a,0xa,0x000a000a,0xa
+	dd	0x00000000,0x0,0x00040004,0x4,0x00040005,0x6,0x00060006,0x8,0x000a0007,0x9,0x000a0008,0x9
+	dd	0x000a000a,0xa,0x00000000,0x0,0x00060006,0x7,0x00070006,0x8,0x00080007,0x9,0x00090008,0xa
+	dd	0x000a0009,0xb,0x000b000a,0xc,0x000a0009,0xb,0x000a000a,0xb,0x00000000,0x0,0x00070005,0x7
+	dd	0x00060006,0x7,0x00080007,0x9,0x000a0008,0xa,0x000a0009,0xa,0x000b000a,0xb,0x00000000,0x0
+	dd	0x00080007,0x8,0x00080007,0x9,0x00090008,0xa,0x000b0008,0xb,0x000a0009,0xc,0x000c000a,0xc
+	dd	0x000a000a,0xb,0x000b000a,0xc,0x00000000,0x0,0x00090007,0x8,0x000a0007,0x9,0x000a0008,0xa
+	dd	0x000b0009,0xb,0x000b0009,0xb,0x000c000a,0xb,0x00000000,0x0,0x00090008,0x9,0x000a0008,0xa
+	dd	0x000a0009,0xb,0x000b0009,0xc,0x000b000a,0xc,0x000c000a,0xc,0x000b000a,0xc,0x000c000b,0xc
+	dd	0x00000000,0x0,0x00090008,0x8,0x00090008,0x9,0x000a0009,0xa,0x000b0009,0xb,0x000c000a,0xb
+	dd	0x000c000b,0xc,0x00000000,0x0,0x00090009,0xa,0x000a0009,0xb,0x000b000a,0xc,0x000c000a,0xc
+	dd	0x000c000a,0xd,0x000d000b,0xd,0x000c000a,0xc,0x000d000b,0xd,0x00000000,0x0,0x000a0009,0x9
+	dd	0x000a0009,0xa,0x000b000a,0xb,0x000b000a,0xc,0x000d000b,0xc,0x000d000b,0xc,0x00000000,0x0
+	dd	0x00090009,0x9,0x00090009,0xa,0x00090009,0xb,0x000a000a,0xc,0x000b000a,0xc,0x000c000b,0xc
+	dd	0x000c000b,0xd,0x000c000c,0xd,0x00000000,0x0,0x00000000,0x0,0x00000000,0x0,0x00000000,0x0
+	dd	0x00000000,0x0,0x00000000,0x0,0x00000000,0x0,0x00000000,0x0,0x0009000a,0xa,0x0009000a,0xa
+	dd	0x000a000a,0xb,0x000b000b,0xc,0x000c000b,0xc,0x000c000b,0xd,0x000c000b,0xd,0x000c000c,0xd
+	dd	0x00000000,0x0,0x00000000,0x0,0x00000000,0x0,0x00000000,0x0,0x00000000,0x0,0x00000000,0x0
+	dd	0x0,0x00000000, 0x0,0x00000000
+
+linbits32
+	dd	0x00040004,0x10001,0x00040004,0x20002,0x00040004,0x30003,0x00040004,0x40004
+	dd	0x00050005,0x60006,0x00060006,0x60006,0x00070007,0x80008,0x00080008,0x80008
+	dd	0x00090009,0xa000a,0x000b000b,0xa000a,0x000b000b,0xd000d,0x000d000d,0xd000d
+	dd	0x000d000d,0xd000d
+
+
+choose_table_H
+	dw	0x1810, 0x1811, 0x1812, 0x1813, 0x1914, 0x1a14, 0x1b15, 0x1c15
+	dw	0x1d16, 0x1e16, 0x1e17, 0x1f17, 0x1f17
+
+choose_jump_table_L:
+	dd	table_MMX.L_case_0    - choose_table_MMX
+	dd	table_MMX.L_case_1    - choose_table_MMX
+	dd	table_MMX.L_case_2    - choose_table_MMX
+	dd	table_MMX.L_case_3    - choose_table_MMX
+	dd	table_MMX.L_case_45   - choose_table_MMX
+	dd	table_MMX.L_case_45   - choose_table_MMX
+	dd	table_MMX.L_case_67   - choose_table_MMX
+	dd	table_MMX.L_case_67   - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+	dd	table_MMX.L_case_8_15 - choose_table_MMX
+
+	segment_code
+;
+; use MMX
+;
+
+PIC_OFFSETTABLE
+
+	align	16
+; int choose_table(int *ix, int *end, int *s)
+choose_table_MMX:
+	push	ebp
+	call	get_pc.bp
+	add	ebp, PIC_BASE()
+
+	mov	ecx,[esp+8]	;ecx = begin
+	mov	edx,[esp+12]	;edx = end
+	sub	ecx,edx		;ecx = begin-end(should be minus)
+	test	ecx,8
+ 	pxor	mm0,mm0		;mm0=[0:0]
+	movq	mm1,[edx+ecx]
+	jz	.lp
+
+	add	ecx,8
+	jz	.exit
+
+	align	4
+.lp:
+	movq	mm4,[edx+ecx]
+	movq	mm5,[edx+ecx+8]
+	add	ecx,16
+	psubusw	mm4,mm0	; $BK\Ev$O(B dword $B$G$J$$$H$$$1$J$$$N$@$,(B
+	psubusw	mm5,mm1	; $B$=$s$J%3%^%s%I$O$J$$(B :-p
+	paddw	mm0,mm4 ; $B$,(B, $B$3$3$G07$&CM$NHO0O$O(B 8191+15 $B0J2<$J$N$GLdBj$J$$(B
+	paddw	mm1,mm5
+	jnz	.lp
+.exit:
+	psubusw	mm1,mm0	; $B$3$l$bK\Ev$O(B dword $B$G$J$$$H$$$1$J$$(B
+	paddw	mm0,mm1
+
+	movq	mm4,mm0
+	punpckhdq	mm4,mm4
+	psubusw	mm4,mm0	; $B$3$l$bK\Ev$O(B dword $B$G$J$$$H$$$1$J$$(B
+	paddw	mm0,mm4
+	movd	eax,mm0
+
+	cmp	eax,15
+	ja	.with_ESC
+	lea	ecx,[PIC_EBP_REL(choose_table_MMX)]
+	add	ecx,[PIC_EBP_REL(choose_jump_table_L+eax*4)]
+	jmp 	ecx
+
+.with_ESC1:
+	emms
+	mov	ecx, [esp+16]	; *s
+	mov	[ecx], eax
+	or	eax,-1
+	pop	ebp
+	ret
+
+.with_ESC:
+	cmp	eax, 8191+15
+	ja	.with_ESC1
+
+	sub	eax,15
+	push	ebx
+	push	esi
+	bsr	eax, eax
+%assign _P 4*2
+	movq    mm5, [PIC_EBP_REL(D15_15_15_15)]
+	movq	mm6, [PIC_EBP_REL(D14_14_14_14)]
+	movq	mm3, [PIC_EBP_REL(mul_add)]
+
+	mov	ecx, [esp+_P+8]		; = ix
+;	mov	edx, [esp+_P+12]	; = end
+	sub	ecx, edx
+
+	xor	esi, esi	; sum = 0
+	test    ecx, 8
+	pxor	mm7, mm7	; linbits_sum, 14$B$r1[$($?$b$N$N?t(B
+	jz	.H_dual_lp1
+
+	movq	mm0, [edx+ecx]
+	add	ecx,8
+	packssdw	mm0,mm7
+	movq	mm2, mm0
+	paddusw	mm0, mm5	; mm0 = min(ix, 15)+0xfff0
+	pcmpgtw	mm2, mm6	; 14$B$h$jBg$-$$$+!)(B
+	psubw	mm7, mm2	; 14$B$h$jBg$-$$$H$-(B linbits_sum++;
+	pmaddwd	mm0, mm3	; {0, 0, y, x}*{1, 16, 1, 16}
+	movd	ebx, mm0
+	mov	esi, [PIC_EBP_REL(largetbl+ebx*4+(16*16+16)*4)]
+
+	jz	.H_dual_exit
+
+	align   4
+.H_dual_lp1:
+	movq	mm0, [edx+ecx]
+	movq	mm1, [edx+ecx+8]
+	packssdw	mm0,mm1
+	movq	mm2, mm0
+	paddusw	mm0, mm5	; mm0 = min(ix, 15)+0xfff0
+	pcmpgtw	mm2, mm6	; 14$B$h$jBg$-$$$+!)(B
+	pmaddwd	mm0, mm3	; {y, x, y, x}*{1, 16, 1, 16}
+	movd	ebx, mm0
+	punpckhdq	mm0,mm0
+	add	esi, [PIC_EBP_REL(largetbl+ebx*4+(16*16+16)*4)]
+	movd	ebx, mm0
+	add	esi, [PIC_EBP_REL(largetbl+ebx*4+(16*16+16)*4)]
+	add	ecx, 16
+	psubw	mm7, mm2	; 14$B$h$jBg$-$$$H$-(B linbits_sum++;
+	jnz	.H_dual_lp1
+
+.H_dual_exit:
+	pmov	mm1,mm7
+	punpckhdq	mm7,mm7
+	paddd	mm7,mm1
+	punpckldq	mm7,mm7
+
+	pmaddwd	mm7, [PIC_EBP_REL(linbits32+eax*8)]	; linbits
+	mov	ax, [PIC_EBP_REL(choose_table_H+eax*2)]
+
+	movd	ecx, mm7
+	punpckhdq	mm7,mm7
+	movd	edx,mm7
+	emms
+	shl	edx, 16
+	add	ecx, edx
+
+	add	ecx, esi
+
+	pop	esi
+	pop	ebx
+
+	mov	edx, ecx
+	and	ecx, 0xffff	; ecx = sum2
+	shr	edx, 16	; edx = sum
+
+	cmp	edx, ecx
+	jle	.chooseE_s1
+	mov	edx, ecx
+	shr	eax, 8
+.chooseE_s1:
+	mov	ecx, [esp+16] ; *s
+	and	eax, 0xff
+	add	[ecx], edx
+	pop	ebp
+	ret
+
+table_MMX.L_case_0:
+	emms
+	pop	ebp
+	ret
+
+table_MMX.L_case_1:
+	emms
+	mov	eax, [esp+16] ; *s
+	mov	ecx, [esp+8] ; *ix
+	sub	ecx, edx
+	push	ebx
+.lp:
+	mov	ebx, [edx+ecx]
+	add	ebx, ebx
+	add	ebx, [edx+ecx+4]
+	movzx	ebx, byte [PIC_EBP_REL(ebx+t1l)]
+	add	[eax], ebx
+	add	ecx, 8
+	jnz	.lp
+	pop	ebx
+	mov	eax, 1
+	pop	ebp
+	ret
+
+table_MMX.L_case_45:
+	push	dword 7
+	lea	ecx, [PIC_EBP_REL(tableABC+9*8)]
+	jmp	from3
+
+table_MMX.L_case_67:
+	push	dword 10
+	lea	ecx, [PIC_EBP_REL(tableABC)]
+	jmp	from3
+
+table_MMX.L_case_8_15:
+	push	dword 13
+	lea	ecx, [PIC_EBP_REL(tableDEF)]
+from3:
+	mov	eax,[esp+12]	;eax = *begin
+;	mov	edx,[esp+16]	;edx = *end
+
+	push	ebx
+	sub	eax, edx
+
+	movq	mm5,[PIC_EBP_REL(mul_add)]
+	pxor	mm2,mm2	;mm2 = sum
+
+	test	eax, 8
+	jz	.choose3_lp1
+; odd length
+	movq	mm0,[edx+eax]	;mm0 = ix[0] | ix[1]
+	add	eax,8
+	packssdw	mm0,mm2
+
+	pmaddwd	mm0,mm5
+	movd	ebx,mm0
+
+	movq	mm2,  [ecx+ebx*8]
+
+	jz	.choose3_exit
+
+	align	4
+.choose3_lp1
+	movq	mm0,[edx+eax]
+	movq	mm1,[edx+eax+8]
+	add	eax,16
+	packssdw	mm0,mm1 ;mm0 = ix[0]|ix[1]|ix[2]|ix[3]
+	pmaddwd	mm0,mm5
+	movd	ebx,mm0
+	punpckhdq	mm0,mm0
+	paddd	mm2, [ecx+ebx*8]
+	movd	ebx,mm0
+	paddd	mm2, [ecx+ebx*8]
+	jnz	.choose3_lp1
+.choose3_exit
+;	xor	eax,eax
+	movd	ebx, mm2
+	punpckhdq	mm2,mm2
+	mov	ecx, ebx
+	and	ecx, 0xffff	; ecx = sum2
+	shr	ebx, 16	; ebx = sum1
+	movd	edx, mm2	; edx = sum
+
+	cmp	edx, ebx
+	jle	.choose3_s1
+	mov	edx, ebx
+	inc	eax
+.choose3_s1:
+	emms
+	pop	ebx
+	cmp	edx, ecx
+	jle	.choose3_s2
+	mov	edx, ecx
+	mov	eax, 2
+.choose3_s2:
+	pop	ecx
+	add	eax, ecx
+	mov	ecx, [esp+16] ; *s
+	add	[ecx], edx
+	pop	ebp
+	ret
+
+table_MMX.L_case_2:
+	push	dword 2
+	lea	ecx,[PIC_EBP_REL(table23)]
+	pmov	mm5,[PIC_EBP_REL(mul_add23)]
+	jmp	from2
+table_MMX.L_case_3:
+	push	dword 5
+	lea	ecx,[PIC_EBP_REL(table56)]
+	pmov	mm5,[PIC_EBP_REL(mul_add56)]
+from2:
+	mov	eax,[esp+12]	;eax = *begin
+;	mov	edx,[esp+16]	;edx = *end
+	push	ebx
+	push	edi
+
+	sub	eax, edx
+	xor	edi, edi
+	test	eax, 8
+	jz	.choose2_lp1
+; odd length
+	movq	mm0,[edx+eax]	;mm0 = ix[0] | ix[1]
+	pxor	mm2,mm2		;mm2 = sum
+	packssdw	mm0,mm2
+
+	pmaddwd	mm0,mm5
+	movd	ebx,mm0
+
+	mov	edi,  [ecx+ebx*4]
+
+	add	eax,8
+	jz	.choose2_exit
+
+	align	4
+.choose2_lp1
+	movq	mm0,[edx+eax]
+	movq	mm1,[edx+eax+8]
+	packssdw	mm0,mm1 ;mm0 = ix[0]|ix[1]|ix[2]|ix[3]
+	pmaddwd	mm0,mm5
+	movd	ebx,mm0
+	punpckhdq	mm0,mm0
+	add	edi, [ecx+ebx*4]
+	movd	ebx, mm0
+	add	edi, [ecx+ebx*4]
+	add	eax,16
+	jnc	.choose2_lp1
+.choose2_exit
+	mov	ecx, edi
+	pop	edi
+	pop	ebx
+	pop	eax ; table num.
+	emms
+
+	mov	edx, ecx
+	and	ecx, 0xffff	; ecx = sum2
+	shr	edx, 16	; edx = sum1
+
+	cmp	edx, ecx
+	jle	.choose2_s1
+	mov	edx, ecx
+	inc	eax
+.choose2_s1:
+	mov	ecx, [esp+16] ; *s
+	add	[ecx], edx
+	pop	ebp
+	ret
+
+	end
diff --git a/libmp3lame/i386/cpu_feat.nas b/libmp3lame/i386/cpu_feat.nas
new file mode 100644
index 0000000..b5b09c1
--- /dev/null
+++ b/libmp3lame/i386/cpu_feat.nas
@@ -0,0 +1,107 @@
+;
+;
+; 	assembler routines to detect CPU-features
+;
+;	MMX / 3DNow! / SSE / SSE2
+;
+;	for the LAME project
+;	Frank Klemm, Robert Hegemann 2000-10-12
+;
+
+%include "nasm.h"
+
+	globaldef	has_MMX_nasm
+	globaldef	has_3DNow_nasm
+	globaldef	has_SSE_nasm
+	globaldef	has_SSE2_nasm
+
+        segment_code
+
+testCPUID:
+	pushfd	                        
+	pop	eax
+	mov	ecx,eax
+	xor	eax,0x200000
+	push	eax
+	popfd
+	pushfd
+	pop	eax
+	cmp	eax,ecx
+	ret
+
+;---------------------------------------
+;	int  has_MMX_nasm (void)
+;---------------------------------------
+
+has_MMX_nasm:
+        pushad
+	call	testCPUID
+	jz	return0		; no CPUID command, so no MMX
+
+	mov	eax,0x1
+	CPUID
+	test	edx,0x800000
+	jz	return0		; no MMX support
+	jmp	return1		; MMX support
+        
+;---------------------------------------
+;	int  has_SSE_nasm (void)
+;---------------------------------------
+
+has_SSE_nasm:
+        pushad
+	call	testCPUID
+	jz	return0		; no CPUID command, so no SSE
+        
+	mov	eax,0x1
+	CPUID
+	test	edx,0x02000000
+	jz	return0		; no SSE support
+	jmp	return1		; SSE support
+        
+;---------------------------------------
+;	int  has_SSE2_nasm (void)
+;---------------------------------------
+
+has_SSE2_nasm:
+        pushad
+	call	testCPUID
+	jz	return0		; no CPUID command, so no SSE2
+        
+	mov	eax,0x1
+	CPUID
+	test	edx,0x04000000
+	jz	return0		; no SSE2 support
+	jmp	return1		; SSE2 support
+        
+;---------------------------------------
+;	int  has_3DNow_nasm (void)
+;---------------------------------------
+
+has_3DNow_nasm:
+        pushad
+	call	testCPUID
+	jz	return0		; no CPUID command, so no 3DNow!
+
+	mov	eax,0x80000000
+	CPUID
+	cmp	eax,0x80000000
+	jbe	return0		; no extended MSR(1), so no 3DNow!
+
+	mov	eax,0x80000001
+	CPUID
+	test	edx,0x80000000
+	jz	return0		; no 3DNow! support
+				; 3DNow! support
+return1:
+	popad
+	xor	eax,eax
+	inc	eax
+	ret
+
+return0:
+	popad
+	xor	eax,eax
+	ret
+        
+        end
diff --git a/libmp3lame/i386/fft.nas b/libmp3lame/i386/fft.nas
new file mode 100644
index 0000000..7928b33
--- /dev/null
+++ b/libmp3lame/i386/fft.nas
@@ -0,0 +1,267 @@
+
+;	for new GOGO-no-coda (1999/09)
+;	Copyright (C) 1999 shigeo
+;	special thanks to Keiichi SAKAI, URURI
+%include "nasm.h"
+
+	globaldef fht_3DN
+	globaldef fht
+	externdef costab_fft
+	externdef sintab_fft
+	externdef gray_index
+
+	segment_data
+	align 16
+D_MSB1_0	dd	0         ,0x80000000
+D_SQRT2	dd	1.414213562,1.414213562
+t_s0	dd	0	;[ t_c:t_s]
+t_c0	dd	0
+t_c1	dd	0	;[-t_s:t_c]
+t_s1	dd	0
+D_s1c1	dd	0, 0
+D_Mc1s1	dd	0, 0
+D_s2c2	dd	0, 0
+D_Mc2s2	dd	0, 0
+D_0_1	dd	1.0, 0.0
+S_05	DD	0.5
+S_00005	DD	0.0005
+fht		dd	0	;´Ø¿ô¥Ý¥¤¥ó¥¿
+
+	segment_code
+
+;************************************************************************
+
+;	by shigeo
+;	99/08/16
+;	23000clk ¿É¤«¤Ã¤¿¡Á
+;	18500clk bit reversal from gogo1 by URURI
+
+;void fht(float *fz, int n);
+	align 16
+fht_3DN:
+	push	ebx
+	push	esi
+	push	edi
+	push	ebp
+%assign _P 4*4
+	;¤Þ¤ººÇ½é¤Î¥ë¡¼¥×... ¤Ïfht()¤Î³°¤Ø°Üư
+
+	mov	esi,[esp+_P+4]	;esi=fz
+	mov	ecx,[esp+_P+8]	;ecx=n
+
+	;¥á¥¤¥ó¥ë¡¼¥×
+	movq	mm7,[D_MSB1_0]	;mm7=[1<<31:0]
+
+%assign LOCAL_STACK	16
+	sub	esp,LOCAL_STACK
+%assign _P (_P+LOCAL_STACK)
+	xor	eax,eax
+	mov	[esp],eax	;k=0
+%define k dword [esp]
+%define kx	dword [esp+4]
+%define fn dword [esp+8]
+
+.lp30:	;k=0; do{
+	mov	ecx,k
+	add	ecx,2
+	mov	k,ecx
+	mov	eax,1
+	shl	eax,cl		;eax=k1 = 1<<k
+	lea	ebx,[eax+eax]	;ebx=k2 = k1*2
+	lea	ecx,[eax+eax*2]	;ecx=k3 = k2 + k1 = k1*3
+	lea	edx,[ebx+ebx]	;edx=k4 = k1*4
+	mov	esi,eax
+	shr	esi,1		;esi=kx=k1>>1
+	mov	kx,esi		;Êݸ(¸å¤Ç»È¤¦)
+	mov	edi,[esp+_P+4]	;edi=fi=fz
+	lea	ebp,[edi+esi*4]	;ebp=gi=fz+kx
+	mov	esi,[esp+_P+8]	;esi=n
+	lea	esi,[edi+esi*4]	;esi=fn=fz+n
+	movq	mm6,[D_SQRT2]	;mm6=[¢å2:¢å2]
+
+.lp31:	;fn=fz+n; do{ FLOAT g0,f0,f1,...
+	movd	mm0,[edi]	;mm0=[0:fi[ 0]]
+	movd	mm1,[edi+eax*4]	;mm1=[0:fi[k1]]
+	punpckldq	mm0,mm0	;mm0=[fi_0 :fi_0 ]
+	punpckldq	mm1,mm1	;mm1=[fi_k1:fi_k1]
+	movd	mm2,[edi+ebx*4]
+	movd	mm3,[edi+ecx*4]
+	punpckldq	mm2,mm2	;mm2=[fi_k2:fi_k2]
+	punpckldq	mm3,mm3	;mm3=[fi_k3:fi_k3]
+	pxor	mm1,mm7		;mm1=[-fi_k1:fi_k1]
+	pxor	mm3,mm7		;mm3=[-fi_k3:fi_k3]
+	pfadd	mm0,mm1		;mm0=[f1:f0]=[fi_0 -fi_k1 : fi_0 +fi_k1]
+	pfadd	mm2,mm3		;mm2=[f3:f2]=[fi_k2-fi_k3 : fi_k2+fi_k3]
+	movq	mm3,mm0		;mm3=[f1:f0]
+	pfadd	mm0,mm2		;mm0=[f1+f3:f0+f2]
+	movd	[edi],mm0	;fi[0]=f0+f2
+	psrlq	mm0,32		;mm0=[0:f1+f3]
+	pfsub	mm3,mm2		;mm3=[f1-f3:f0-f2]
+	movd	[edi+eax*4],mm0	;fi[k1]=f1+f3
+	movd	[edi+ebx*4],mm3	;fi[k2]=f0-f2
+	psrlq	mm3,32		;mm3=[0:f1-f3]
+	movd	[edi+ecx*4],mm3	;fi[k3]=f1-f3
+
+	movd	mm0,[ebp]	;mm0=[0:gi_0]
+	movd	mm1,[ebp+eax*4]	;mm1=[0:gi_k1]
+	punpckldq	mm0,mm0	;mm0=[gi_0 :gi_0 ]
+	punpckldq	mm1,mm1	;mm1=[gi_k1:gi_k1]
+	movd	mm2,[ebp+ebx*4]	;mm2=[0:gi_k2]
+	pxor	mm1,mm7		;mm1=[-gi_k1:gi_k1]
+	punpckldq	mm2,[ebp+ecx*4]	;mm2=[gi_k3:gi_k2]
+	pfadd	mm0,mm1		;mm0=[g1:g0]=[gi_0 -gi_k1:gi_0 +gi_k1]
+	pfmul	mm2,mm6		;mm2=[g3:g2]=sqrt2 * [gi_k3:gi_k2]
+	movq	mm1,mm0		;mm1=[g1:g0]
+	pfadd	mm0,mm2		;mm0=[g1+g3:g0+g2]
+	movd	[ebp],mm0	;gi[0]=g0+g2
+	psrlq	mm0,32		;mm0=[0:g1+g3]
+	pfsub	mm1,mm2		;mm1=[g1-g3:g0-g2]
+	movd	[ebp+eax*4],mm0	;gi[k1]=g1+g3
+	movd	[ebp+ebx*4],mm1	;gi[k2]=g0-g2
+	psrlq	mm1,32		;mm1=[0:g1-g3]
+	movd	[ebp+ecx*4],mm1	;gi[k3]=g1-g3
+	lea	edi,[edi+edx*4]	;fi += k4
+	lea	ebp,[ebp+edx*4]	;gi += k4
+	cmp	edi,esi
+	jc	near .lp31	;}while(fi<fn);
+
+;	¤³¤³¤Þ¤Ç¤Ï¿ʬO.K.
+
+	mov	fn,esi		;fn=fz+n
+	;¼¡¤ÎÃͤϰú¤­Â³¤­»È¤¦
+	;eax=k1,ebx=k2,ecx=k3,edx=k4
+
+	mov	edi,k
+	lea	ebp,[costab_fft+edi*4]
+	mov	ebp,[ebp]	;ebp=t_c
+	mov	[t_c0],ebp
+	mov	[t_c1],ebp	;t_c
+	lea	ebp,[sintab_fft+edi*4]
+	mov	ebp,[ebp]	;ebx=t_s
+	mov	[t_s0],ebp
+	xor	ebp,0x80000000
+	mov	[t_s1],ebp	;-t_s
+
+	movq	mm1,[D_0_1]	;mm1=[0:1]
+	movq	[D_s1c1],mm1	;mm1=[s1:c1]
+	mov	esi,1		;esi=i=1
+
+.lp32:	;	for(i=1;i<kx;i++){
+	movq	mm0,[D_s1c1]	;mm1=[s1:t]=[s1:c1]
+	movq	mm2,mm0
+	pfmul	mm0,[t_c1]	;mm0=[-s1*t_s: t*t_c]
+	pfmul	mm2,[t_s0]	;mm2=[ s1*t_c: t*t_s]
+	pfacc	mm0,mm2		;mm0=[s1:c1]=[ s1*t_c+t*t_s:-s1*t_s+t*t_c]
+	movq	mm2,mm0		;mm2=[s1:c1]
+	movq	[D_s1c1],mm0	;Êݸ
+	movq	mm6,mm2
+	punpckldq	mm5,mm6
+	punpckhdq	mm6,mm5	;mm6=[ c1:s1]
+	pxor	mm6,mm7		;mm6=[-c1:s1]
+	movq	[D_Mc1s1],mm6	;Êݸ
+	pfmul	mm2,mm2		;mm2=[s1*s1:c1*c1]
+	movq	mm3,mm0		;mm3=[s1:c1]
+	pxor	mm2,mm7		;mm2=[-s1*s1:c1*c1]
+	psrlq	mm3,32		;mm3=[ 0:s1]
+	pfacc	mm2,mm2		;mm2=[c2:c2]=[c1*c1-s1*s1:<]
+	pfmul	mm0,mm3		;mm0=[ 0:c1*s1]
+	pfadd	mm0,mm0		;mm0=[0:s2]=[ 0:2*c1*s1]
+	punpckldq	mm2,mm0	;mm2=[s2:c2]
+	movq	[D_s2c2],mm2	;Êݸ
+
+	punpckldq	mm0,mm2
+	punpckhdq	mm2,mm0	;mm2=[c2:s2]
+	pxor	mm2,mm7		;mm2=[-c2:s2]
+	movq	[D_Mc2s2],mm2	;Êݸ
+
+	mov	edi,[esp+_P+4]	;edi=fz
+	lea	edi,[edi+esi*4]	;edi=fz+i
+
+	mov	ebp,[esp+_P+4]	;ebp=fz
+	neg	esi		;esi=-i
+	lea	ebp,[ebp+eax*4]	;ebp=fz+k1
+	lea	ebp,[ebp+esi*4]	;ebp=gi=fz+k1-i
+	neg	esi		;esi=i
+
+.lp33:	;	do{ FLOAT a,b,g0,f0,f1,g1,f2,g2,f3,g3;
+
+	movd	mm0,[edi+eax*4]	;mm0=[0:fi_k1]
+	punpckldq	mm0,[ebp+eax*4]	;mm0=[gi_k1:fi_k1]
+	movq	mm1,mm0
+	pfmul	mm0,[D_s2c2]	;mm0=[ s2*gi_k1:c2*fi_k1]
+	pfmul	mm1,[D_Mc2s2]	;mm1=[-c2*gi_k1:s2*fi_k1]
+	pfacc	mm0,mm1		;mm0=[b:a]
+	movd	mm4,[edi]	;mm4=[0:fi_0]
+	movq	mm3,mm0		;mm3=[b:a]
+	punpckldq	mm4,[ebp]	;mm4=[gi_0:fi_0]
+	pfadd	mm3,mm4		;mm3=[g0:f0]=[gi_0+b:fi_0+a]
+	pfsub	mm4,mm0		;mm4=[g1:f1]=[gi_0-b:fi_0-a]
+
+	movd	mm0,[edi+ecx*4]	;mm0=[0:fi_k3]
+	punpckldq	mm0,[ebp+ecx*4]	;mm0=[gi_k3:fi_k3]
+	movq	mm1,mm0
+	pfmul	mm0,[D_s2c2]	;mm0=[ s2*gi_k3:c2*fi_k3]
+	pfmul	mm1,[D_Mc2s2]	;mm1=[-c2*gi_k3:s2*fi_k3]
+	pfacc	mm0,mm1		;mm0=[b:a]
+	movd	mm5,[edi+ebx*4]	;mm5=[0:fi_k2]
+	movq	mm6,mm0		;mm6=[b:a]
+	punpckldq	mm5,[ebp+ebx*4]	;mm5=[gi_k2:fi_k2]
+	pfadd	mm6,mm5		;mm6=[g2:f2]=[gi_k2+b:fi_k2+a]
+	pfsub	mm5,mm0		;mm5=[g3:f3]=[gi_k2-b:fi_k2-a]
+
+	punpckldq	mm1,mm6	;mm1=[f2:*]
+	movq	mm0,[D_s1c1]	;mm0=[s1:c1]
+	punpckhdq	mm1,mm5	;mm1=[g3:f2]
+	pfmul	mm0,mm1		;mm0=[ s1*g3:c1*f2]
+	movq	mm2,[D_Mc1s1]	;mm2=[-c1:s1]
+	pfmul	mm2,mm1		;mm2=[-c1*g3:s1*f2]
+	pfacc	mm0,mm2		;mm0=[b:a]
+
+	punpckldq	mm1,mm3	;mm1=[f0:*]
+	punpckhdq	mm1,mm4	;mm1=[g1:f0]
+	movq	mm2,mm0		;mm2=[b:a]
+	pfadd	mm0,mm1		;mm0=[g1+b:f0+a]
+	pfsubr	mm2,mm1		;mm2=[g1-b:f0-a]
+	movd	[edi],mm0	;fi[0]=f0+a
+	psrlq	mm0,32		;mm0=[0:g1+b]
+	movd	[edi+ebx*4],mm2	;fi[k2]=f0-a
+	psrlq	mm2,32		;mm2=[0:g1-b]
+	movd	[ebp+eax*4],mm0	;gi[k1]=g1+b
+	movd	[ebp+ecx*4],mm2	;gi[k3]=g1-b
+	psrlq	mm6,32		;mm6=[0:g2]
+	movq	mm0,[D_s1c1]	;mm0=[s1:c1]
+	punpckldq	mm5,mm6	;mm5=[g2:f3]
+	pfmul	mm0,mm5		;mm0=[g2* s1:f3*c1]
+	pfmul	mm5,[D_Mc1s1]	;mm5=[g2*-c1:f3*s1]
+	pfacc	mm0,mm5		;mm0=[-b:a]
+	psrlq	mm3,32		;mm3=[0:g0]
+	movq	mm1,mm0		;mm1=[-b:a]
+	punpckldq	mm3,mm4	;mm3=[f1:g0]
+	pfadd	mm0,mm3		;mm0=[f1-b:g0+a]
+	pfsubr	mm1,mm3		;mm1=[f1+b:g0-a]
+	movd	[ebp],mm0	;gi[0]=g0+a
+	psrlq	mm0,32		;mm0=[0:f1-b]
+	movd	[ebp+ebx*4],mm1	;gi[k2]=g0-a
+	psrlq	mm1,32		;mm1=[0:f1+b]
+	movd	[edi+ecx*4],mm0	;fi[k3]=f1-b
+	movd	[edi+eax*4],mm1	;fi[k1]=f1+b
+
+	lea	edi,[edi+edx*4]	;fi += k4
+	lea	ebp,[ebp+edx*4]	;gi += k4
+	cmp	edi,fn
+	jc	near .lp33	;}while(fi<fn)
+	inc	esi
+	cmp	esi,kx
+	jnz	near .lp32	;}
+	cmp	edx,[esp+_P+8]
+	jnz	near .lp30	;}while(k4<n)
+
+
+.exit:
+	add	esp,LOCAL_STACK
+	femms
+	pop	ebp
+	pop	edi
+	pop	esi
+	pop	ebx
+	ret
diff --git a/libmp3lame/i386/fft3dn.nas b/libmp3lame/i386/fft3dn.nas
new file mode 100644
index 0000000..71db7db
--- /dev/null
+++ b/libmp3lame/i386/fft3dn.nas
@@ -0,0 +1,488 @@
+; from a new GOGO-no-coda (1999/09)
+;	Copyright (C) 1999 shigeo
+;	special thanks to Keiichi SAKAI, URURI
+; hacked and back-ported to LAME
+;	 by Takehiro TOMINAGA Nov 2000
+
+%include "nasm.h"
+
+	globaldef fht_3DN
+
+	segment_data
+	align	16
+costab	dd	0x80000000, 0
+	dd	1.414213562,1.414213562
+	dd	9.238795283293805e-01, 9.238795283293805e-01
+	dd	3.826834424611044e-01, 3.826834424611044e-01
+	dd	9.951847264044178e-01, 9.951847264044178e-01
+	dd	9.801714304836734e-02, 9.801714304836734e-02
+	dd	9.996988186794428e-01, 9.996988186794428e-01
+	dd	2.454122920569705e-02, 2.454122920569705e-02
+	dd	9.999811752815535e-01, 9.999811752815535e-01
+	dd	6.135884819898878e-03, 6.135884819898878e-03
+D_1_0_0_0	dd	0.0		, 1.0
+
+	segment_code
+
+PIC_OFFSETTABLE
+
+
+;void fht_3DN(float *fz, int nn);
+
+proc	fht_3DN
+
+	pushd	ebp, ebx, esi, edi
+
+	sub	esp, 20
+
+	call	get_pc.bp
+	add	ebp, PIC_BASE()
+
+	mov	r0, [esp+40]		;fi
+	mov	r1, [esp+44]		;r1 = nn
+	lea	r3, [PIC_EBP_REL(costab)]		;tri = costab
+	lea	r4, [r0+r1*8]		;r4 = fn = &fz[n]
+	mov	[esp+16], r4
+	mov	r4, 8			;kx = k1/2
+
+	pmov	mm7, [r3]
+
+	loopalign 16
+.do1
+	lea	r3, [r3+16]	;tri += 2;
+	pmov	mm6, [PIC_EBP_REL(costab+8)]
+	lea	r2, [r4+r4*2]		;k3*fsize/2
+	mov	r5, 4		;i = 1*fsize
+
+	loopalign 16
+.do2:
+	lea	r1, [r0+r4]		;gi = fi + kx
+	;f
+	pmov	mm0, [r0]	;fi0
+	pmov	mm1, [r0+r4*2]	;fi1
+	pmov	mm2, [r0+r2*2]	;fi3
+	pmov	mm3, [r0+r4*4]	;fi2
+
+	pupldq	mm0, mm0	;fi0 | fi0
+	pupldq	mm1, mm1	;fi1 | fi1
+	pupldq	mm2, mm2	;fi2 | fi2
+	pupldq	mm3, mm3	;fi3 | fi3
+
+	pxor	mm1, mm7	;fi1 | -fi1
+	pxor	mm3, mm7	;fi3 | -fi3
+
+	pfsub	mm0, mm1	;f1 | f0
+	pfsub	mm2, mm3	;f3 | f2
+
+	pmov	mm4, mm0
+	pfadd	mm0, mm2	;f1+f3|f0+f2 = fi1 | fi0
+	pfsub	mm4, mm2	;f1-f3|f0-f2 = fi3 | fi2
+
+	pmovd	[r0], mm0	;fi[0]
+	puphdq	mm0, mm0
+	pmovd	[r0+r4*4], mm4	;fi[k2]
+	puphdq	mm4, mm4
+
+	pmovd	[r0+r4*2], mm4	;fi[k1]
+	pmovd	[r0+r2*2], mm0	;fi[k3]
+	lea	r0, [r0+r4*8]
+
+	;g
+	pmov	mm0, [r1]	;gi0
+	pmov	mm1, [r1+r4*2]	;gi1
+	pmov	mm2, [r1+r4*4]	;gi2
+	pmov	mm3, [r1+r2*2]	;gi3
+
+	pupldq	mm1, mm1
+	pupldq	mm0, mm0	;gi0 | gi0
+	pupldq	mm2, mm3	;gi3 | gi2
+
+	pxor	mm1, mm7	;gi1 | -gi1
+
+	pfsub	mm0, mm1	;gi0-gi1|gi0+gi1 = g1 | g0
+	pfmul	mm2, mm6	;gi3*SQRT2|gi2*SQRT2 = g3 | g2
+
+	pmov	mm4, mm0
+	pfadd	mm0, mm2	;g1+g3|g0+g2 = gi1 | gi0
+	pfsub	mm4, mm2	;g1-g3|g0-g2 = gi3 | gi2
+
+	pmovd	[r1], mm0	;gi[0]
+	puphdq	mm0, mm0
+	pmovd	[r1+r4*4], mm4	;gi[k2]
+	puphdq	mm4, mm4
+
+	cmp	r0, [esp + 16]
+	pmovd	[r1+r4*2], mm0	;gi[k1]
+	pmovd	[r1+r2*2], mm4	;gi[k3]
+
+	jb near .do2
+
+	pmov	mm6, [r3+r5]	; this is not aligned address!!
+
+	loopalign 16
+.for:
+;
+; mm6 = c1 | s1
+; mm7 = 0x800000000 | 0
+;
+	pmov	mm1, mm6
+	mov	r0, [esp+40]	; fz
+	puphdq	mm1, mm1	; c1 | c1
+	lea	r1, [r0+r4*2]
+	pfadd	mm1, mm1	; c1+c1 | c1+c1
+	pfmul	mm1, mm6	; 2*c1*c1 | 2*c1*s1
+	pfsub	mm1, [PIC_EBP_REL(D_1_0_0_0)] ; 2*c1*c1-1.0 | 2*c1*s1 = -c2 | s2
+
+	pmov	mm0, mm1
+	pxor	mm7, mm6	; c1 | -s1
+
+	pupldq	mm2, mm0
+	pupldq	mm3, mm6	; ** | c1
+	puphdq	mm0, mm2	; s2 | c2
+	puphdq	mm6, mm3	;-s1 | c1
+
+	pxor	mm0, [PIC_EBP_REL(costab)]	; c2 | -s2
+
+; mm0 =  s2| c2
+; mm1 = -c2| s2
+; mm6 =  c1| s1
+; mm7 =  s1|-c1 (we use the opposite sign. from GOGO here)
+
+	pmov	[esp], mm0
+	pmov	[esp+8], mm1
+
+	sub	r1, r5		;r1 = gi
+	add	r0, r5		;r0 = fi
+
+	loopalign 16
+.do3:
+	pmov	mm2, [r0+r4*2] ; fi[k1]
+	pmov	mm4, [r1+r4*2] ; gi[k1]
+	pmov	mm3, [r0+r2*2] ; fi[k3]
+	pmov	mm5, [r1+r2*2] ; gi[k3]
+
+	pupldq	mm2, mm2	; fi1 | fi1
+	pupldq	mm4, mm4	; gi1 | gi1
+	pupldq	mm3, mm3	; fi3 | fi3
+	pupldq	mm5, mm5	; gi3 | gi3
+
+	pfmul	mm2, mm0	; s2 * fi1 | c2 * fi1
+	pfmul	mm4, mm1	;-c2 * gi1 | s2 * gi1
+	pfmul	mm3, mm0	; s2 * fi3 | c2 * fi3
+	pfmul	mm5, mm1	;-c2 * gi3 | s2 * gi3
+
+	pfadd	mm2, mm4		;b | a
+	pfadd	mm3, mm5		;d | c
+
+	pmov	mm0, [r0]
+	pmov	mm4, [r1]
+	pmov	mm1, [r0+r4*4]
+	pmov	mm5, [r1+r4*4]
+
+	pupldq	mm0, mm4		;gi0 | fi0
+	pupldq	mm1, mm5		;gi2 | fi2
+
+	pmov	mm4, mm2
+	pmov	mm5, mm3
+
+	pfadd	mm2, mm0		;g0 | f0
+	pfadd	mm3, mm1		;g2 | f2
+
+	pfsub	mm0, mm4		;g1 | f1
+	pfsub	mm1, mm5		;g3 | f3
+
+	pmov	mm4, mm3
+	pmov	mm5, mm1
+
+	pupldq	mm4, mm4		;f2 | f2
+	puphdq	mm5, mm5		;g3 | g3
+	puphdq	mm3, mm3		;g2 | g2
+	pupldq	mm1, mm1		;f3 | f3
+
+	pfmul	mm4, mm6		;f2 * c1 | f2 * s1
+	pfmul	mm5, mm7		;g3 * s1 | g3 *-c1
+	pfmul	mm3, mm6		;g2 * c1 | g2 * s1
+	pfmul	mm1, mm7		;f3 * s1 | f3 *-c1
+
+	pfadd	mm4, mm5		;a | b
+	pfsub	mm3, mm1		;d | c
+
+	pmov	mm5, mm2
+	pmov	mm1, mm0
+
+	pupldq	mm2, mm2		;f0 | f0
+	pupldq	mm0, mm0		;f1 | f1
+
+	puphdq	mm1, mm2		;f0 | g1
+	puphdq	mm5, mm0		;f1 | g0
+
+	pmov	mm2, mm4
+	pmov	mm0, mm3
+
+	pfadd	mm4, mm1		;fi0 | gi1
+	pfadd	mm3, mm5		;fi1 | gi0
+	pfsub	mm1, mm2		;fi2 | gi3
+	pfsub	mm5, mm0		;fi3 | gi2
+
+	pmovd	[r1+r4*2], mm4	;gi[k1]
+	puphdq	mm4, mm4
+	pmovd	[r1], mm3		;gi[0]
+	puphdq	mm3, mm3
+	pmovd	[r1+r2*2], mm1	;gi[k3]
+	puphdq	mm1, mm1
+	pmovd	[r1+r4*4], mm5	;gi[k2]
+	puphdq	mm5, mm5
+
+	pmovd	[r0], mm4	;fi[0]
+	pmovd	[r0+r4*2], mm3	;fi[k1]
+	pmovd	[r0+r4*4], mm1	;fi[k2]
+	pmovd	[r0+r2*2], mm5	;fi[k3]
+
+	lea	r0, [r0+r4*8]
+	lea	r1, [r1+r4*8]
+	cmp	r0, [esp + 16]
+	pmov	mm0, [esp]
+	pmov	mm1, [esp+8]
+
+	jb near	.do3
+
+	add	r5, 4
+; mm6 =  c1| s1
+; mm7 =  s1|-c1 (we use the opposite sign. from GOGO here)
+	pfmul	mm6, [r3]	; c1*a | s1*a
+	pfmul	mm7, [r3+8]	; s1*b |-c1*b
+	cmp	r5, r4
+
+	pfsub	mm6, mm7	; c1*a-s1*b | s1*a+c1*b
+	pupldq	mm7,mm6
+	puphdq	mm6,mm7
+	pmov	mm7, [PIC_EBP_REL(costab)]
+	jb near	.for
+
+	mov	r0, [esp+40]	;fi
+	cmp	r4, [esp+40+4]
+	lea	r4, [r4*4]	;kx *= 4
+
+	jb near	.do1
+.exitttt
+	femms
+	add	esp,20
+	popd	ebp, ebx, esi, edi
+endproc
+
+
+;void fht_E3DN(float *fz, int nn);
+
+proc	fht_E3DN
+
+	pushd	ebp, ebx, esi, edi
+
+	sub	esp, 20
+
+	call	get_pc.bp
+	add	ebp, PIC_BASE()
+
+	mov	r0, [esp+40]		;fi
+	mov	r1, [esp+44]		;r1 = nn
+	lea	r3, [PIC_EBP_REL(costab)]		;tri = costab
+	lea	r4, [r0+r1*8]		;r4 = fn = &fz[n]
+	mov	[esp+16], r4
+	mov	r4, 8			;kx = k1/2
+
+	pmov	mm7, [r3]
+
+	loopalign 16
+.do1
+	lea	r3, [r3+16]	;tri += 2;
+	pmov	mm6, [PIC_EBP_REL(costab+8)]
+	lea	r2, [r4+r4*2]		;k3*fsize/2
+	mov	r5, 4		;i = 1*fsize
+
+	loopalign 16
+.do2:
+	lea	r1, [r0+r4]		;gi = fi + kx
+;f
+	pmov	mm0, [r0]	; X  | fi0
+	pmov	mm1, [r0+r4*4]	; X  | fi2
+	pupldq	mm0, [r0+r4*2]	;fi1 | fi0
+	pupldq	mm1, [r0+r2*2]	;fi3 | fi2
+	pfpnacc	mm0, mm0	;fi0+fi1 | fi0-fi1 = f0|f1
+	pfpnacc	mm1, mm1	;fi2+fi3 | fi2-fi3 = f2|f3
+
+	pmov	mm2, mm0
+	pfadd	mm0, mm1	;f0+f2|f1+f3 = fi0 | fi1
+	pfsub	mm2, mm1	;f0-f2|f1-f3 = fi2 | fi3
+
+	pmovd	[r0+r4*2], mm0	;fi[k1]
+	pmovd	[r0+r2*2], mm2	;fi[k3]
+
+	puphdq	mm0, mm0
+	puphdq	mm2, mm2
+	pmovd	[r0], mm0	;fi[0]
+	pmovd	[r0+r4*4], mm2	;fi[k2]
+
+	lea	r0, [r0+r4*8]
+;g
+	pmov	mm3, [r1]	;    gi0
+	pmov	mm4, [r1+r2*2]	;    gi3
+	pupldq	mm3, [r1+r4*2]	;gi1|gi0
+	pupldq	mm4, [r1+r4*4]	;gi2|gi3
+
+	pfpnacc	mm3, mm3	;gi0+gi1  |gi0-gi1   = f0|f1
+	pfmul	mm4, mm6	;gi2*SQRT2|gi3*SQRT2 = f2|f3
+
+	pmov	mm5, mm3
+	pfadd	mm3, mm4	;f0+f2|f1+f3
+	pfsub	mm5, mm4	;f0-f2|f1-f3
+
+	cmp	r0, [esp + 16]
+	pmovd	[r1+r4*2], mm3	;gi[k1]
+	pmovd	[r1+r2*2], mm5	;gi[k3]
+	puphdq	mm3, mm3
+	puphdq	mm5, mm5
+	pmovd	[r1], mm3	;gi[0]
+	pmovd	[r1+r4*4], mm5	;gi[k2]
+
+	jb near .do2
+
+	pmov	mm6, [r3+r5]	; this is not aligned address!!
+
+	loopalign 16
+.for:
+;
+; mm6 = c1 | s1
+; mm7 = 0x800000000 | 0
+;
+	pmov	mm5, mm6
+	mov	r0, [esp+40]	; fz
+	puphdq	mm5, mm5	; c1 | c1
+	lea	r1, [r0+r4*2]
+	pfadd	mm5, mm5	; c1+c1 | c1+c1
+	pfmul	mm5, mm6	; 2*c1*c1 | 2*c1*s1
+	pfsub	mm5, [PIC_EBP_REL(D_1_0_0_0)] ; 2*c1*c1-1.0 | 2*c1*s1 = -c2 | s2
+
+	pswapd	mm4, mm5	; s2 |-c2
+	pxor	mm4, mm7	; s2 | c2
+	pxor	mm7, mm6	; c1 |-s1
+	pswapd	mm6, mm6	; s1 | c1
+
+; mm4 =  s2| c2
+; mm5 = -c2| s2
+; mm6 =  c1| s1
+; mm7 =  s1|-c1 (we use the opposite sign. from GOGO here)
+
+	pmov	[esp], mm4
+	pmov	[esp+8], mm5
+
+	sub	r1, r5		;r1 = gi
+	add	r0, r5		;r0 = fi
+
+	loopalign 16
+.do3:
+	pmov	mm0, [r0+r2*2] ; fi[k1]
+	pmov	mm2, [r1+r2*2] ; gi[k1]
+	pmov	mm1, [r0+r4*2] ; fi[k3]
+	pmov	mm3, [r1+r4*2] ; gi[k3]
+
+	pupldq	mm0, mm0
+	pupldq	mm2, mm2
+	pupldq	mm1, mm1
+	pupldq	mm3, mm3
+
+	pfmul	mm0, mm4
+	pfmul	mm2, mm5
+	pfmul	mm1, mm4
+	pfmul	mm3, mm5
+
+	pfadd	mm0, mm2		;d | c
+	pfadd	mm1, mm3		;b | a
+
+	pmov	mm2, [r0+r4*4]		;fi2
+	pupldq	mm3, [r1+r4*4]		;gi2 | -
+	pmov	mm4, [r0]		;fi0
+	pupldq	mm5, [r1]		;gi0 | -
+
+	pupldq	mm2, mm0		;c | fi2
+	puphdq	mm3, mm0		;d | gi2
+	pupldq	mm4, mm1		;a | fi0
+	puphdq	mm5, mm1		;b | gi0
+
+	pfpnacc	mm2, mm2		;f2 | f3
+	pfpnacc	mm3, mm3		;g2 | g3
+	pfpnacc	mm4, mm4		;f0 | f1
+	pfpnacc	mm5, mm5		;g0 | g1
+
+	pmov	mm0, mm2
+	pmov	mm1, mm3
+	pupldq	mm2, mm2		;f3 | f3
+	pupldq	mm3, mm3		;g3 | g3
+	puphdq	mm0, mm0		;f2 | f2
+	puphdq	mm1, mm1		;g2 | g2
+
+	pswapd	mm4, mm4		;f1 | f0
+	pswapd	mm5, mm5		;g1 | g0
+
+	pfmul	mm0, mm7		;f2 * s1 | f2 *-c1
+	pfmul	mm3, mm6		;g3 * c1 | g3 * s1
+	pfmul	mm1, mm6		;g2 * c1 | g2 * s1
+	pfmul	mm2, mm7		;f3 * s1 | f3 *-c1
+
+	pfsub	mm0, mm3		; b |-a
+	pfsub	mm1, mm2		; d | c
+
+	pmov	mm2, mm5
+	pmov	mm3, mm4
+	pupldq	mm4, mm0		;-a | f0
+	pupldq	mm5, mm1		; c | g0
+	puphdq	mm2, mm0		; b | g1
+	puphdq	mm3, mm1		; d | f1
+
+	pfpnacc	mm4, mm4		;fi2 | fi0
+	pfpnacc	mm5, mm5		;gi0 | gi2
+	pfpnacc	mm2, mm2		;gi1 | gi3
+	pfpnacc	mm3, mm3		;fi1 | fi3
+
+	pmovd	[r0], mm4		;fi[0]
+	pmovd	[r1+r4*4], mm5		;gi[k2]
+	pmovd	[r1+r2*2], mm2		;gi[k3]
+	pmovd	[r0+r2*2], mm3		;fi[k3]
+
+	puphdq	mm4, mm4
+	puphdq	mm5, mm5
+	puphdq	mm2, mm2
+	puphdq	mm3, mm3
+	pmovd	[r0+r4*4], mm4		;fi[k2]
+	pmovd	[r1], mm5		;gi[0]
+	pmovd	[r1+r4*2], mm2		;gi[k1]
+	pmovd	[r0+r4*2], mm3		;fi[k1]
+
+	lea	r0, [r0+r4*8]
+	lea	r1, [r1+r4*8]
+	cmp	r0, [esp + 16]
+	pmov	mm4, [esp]
+	pmov	mm5, [esp+8]
+
+	jb near	.do3
+
+	add	r5, 4
+; mm6 =  c1| s1
+; mm7 =  s1|-c1 (we use the opposite sign. from GOGO here)
+	pfmul	mm6, [r3]	; c1*a | s1*a
+	pfmul	mm7, [r3+8]	; s1*b |-c1*b
+	cmp	r5, r4
+
+	pfsub	mm6, mm7	; c1*a-s1*b | s1*a+c1*b
+	pswapd	mm6, mm6 ; ???	; s1*a+c1*b | c1*a-s1*b
+	pmov	mm7, [PIC_EBP_REL(costab)]
+	jb near	.for
+
+	mov	r0, [esp+40]	;fi
+	cmp	r4, [esp+40+4]
+	lea	r4, [r4*4]	;kx *= 4
+
+	jb near	.do1
+.exitttt
+	femms
+	add	esp,20
+	popd	ebp, ebx, esi, edi
+endproc
diff --git a/libmp3lame/i386/fftfpu.nas b/libmp3lame/i386/fftfpu.nas
new file mode 100644
index 0000000..2ae89bd
--- /dev/null
+++ b/libmp3lame/i386/fftfpu.nas
@@ -0,0 +1,619 @@
+; back port from GOGO-no coda 2.24b by Takehiro TOMINAGA
+
+; GOGO-no-coda
+;	Copyright (C) 1999 shigeo
+;	special thanks to URURI
+
+%include "nasm.h"
+
+	externdef costab_fft
+	externdef sintab_fft
+
+	segment_data
+	align 32
+D_1_41421	dd	1.41421356
+D_1_0	dd	1.0
+D_0_5	dd	0.5
+D_0_25	dd	0.25
+D_0_0005	dd	0.0005
+D_0_0	dd	0.0
+
+	segment_code
+
+;void fht(float *fz, int n);
+proc	fht_FPU
+
+%$fz	arg	4
+%$n	arg	4
+
+%$k	local	4
+
+%$f0	local	4
+%$f1	local	4
+%$f2	local	4
+%$f3	local	4
+
+%$g0	local	4
+%$g1	local	4
+%$g2	local	4
+%$g3	local	4
+
+%$s1	local	4
+%$c1	local	4
+%$s2	local	4
+%$c2	local	4
+
+%$t_s	local	4
+%$t_c	local	4
+	alloc
+
+	pushd	ebp, ebx, esi, edi
+
+fht_FPU_1st_part:
+
+fht_FPU_2nd_part:
+
+fht_FPU_3rd_part:
+
+.do_init:
+	mov	r3, 16		;k1*fsize = 4*fsize = k4
+	mov	r4, 8		;kx = k1/2
+	mov	r2, 48		;k3*fsize
+	mov	dword [sp(%$k)], 2	;k = 2
+	mov	r0, [sp(%$fz)]	;fi
+	lea	r1, [r0+8]		;gi = fi + kx
+
+.do:
+.do2:
+	;f
+	fld	dword [r0]
+	fsub	dword [r0+r3]
+
+	fld	dword [r0]
+	fadd	dword [r0+r3]
+
+	fld	dword [r0+r3*2]
+	fsub	dword [r0+r2]
+
+	fld	dword [r0+r3*2]
+	fadd	dword [r0+r2]		;f2 f3 f0 f1
+
+	fld	st2			;f0 f2 f3 f0 f1
+	fadd	st0, st1
+	fstp	dword [r0]		;fi[0]
+
+	fld	st3			;f1 f2 f3 f0 f1
+	fadd	st0, st2
+	fstp	dword [r0+r3]		;fi[k1]
+
+	fsubr	st0, st2		;f0-f2 f3 f0 f1
+	fstp	dword [r0+r3*2]		;fi[k2]
+
+	fsubr	st0, st2		;f1-f3 f0 f1
+	fstp	dword [r0+r2]		;fi[k3]
+	fcompp
+
+	;g
+	fld	dword [r1]
+	fsub	dword [r1+r3]
+
+	fld	dword [r1]
+	fadd	dword [r1+r3]
+
+	fld	dword [D_1_41421]
+	fmul	dword [r1+r2]
+
+	fld	dword [D_1_41421]
+	fmul	dword [r1+r3*2]		;g2 g3 g0 g1
+
+	fld	st2			;g0 g2 g3 g0 g1
+	fadd	st0, st1
+	fstp	dword [r1]		;gi[0]
+
+	fld	st3			;g1 g2 g3 g0 g1
+	fadd	st0, st2
+	fstp	dword [r1+r3]		;gi[k1]
+
+	fsubr	st0, st2		;g0-g2 g3 g0 g1
+	fstp	dword [r1+r3*2]		;gi[k2]
+
+	fsubr	st0, st2		;g1-g3 g0 g1
+	fstp	dword [r1+r2]		;gi[k3]
+	fcompp
+
+	lea	r0, [r0+r3*4]
+	lea	r1, [r1+r3*4]
+	cmp	r0, r6
+	jb	.do2
+
+
+	mov	r0, [sp(%$k)]
+	fld	dword [costab_fft +r0*4]
+	fstp	dword [sp(%$t_c)]
+	fld	dword [sintab_fft +r0*4]
+	fstp	dword [sp(%$t_s)]
+	fld	dword [D_1_0]
+	fstp	dword [sp(%$c1)]
+	fld	dword [D_0_0]
+	fstp	dword [sp(%$s1)]
+
+.for_init:
+	mov	r5, 4		;i = 1*fsize
+
+.for:
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$t_c)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$t_s)]
+	fsubp	st1, st0		;c1
+
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$t_s)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$t_c)]
+	faddp	st1, st0		;s1 c1
+	
+	fld	st1
+	fmul	st0, st0		;c1c1 s1 c1
+	fld	st1
+	fmul	st0, st0		;s1s1 c1c1 s1 c1
+	fsubp	st1, st0		;c2 s1 c1
+	fstp	dword [sp(%$c2)]	;s1 c1
+
+	fld	st1			;c1 s1 c1
+	fmul	st0, st1		;c1s1 s1 c1
+	fadd	st0, st0		;s2 s1 c1
+	fstp	dword [sp(%$s2)]	;s1 c1
+
+	fstp	dword [sp(%$s1)]	;c1
+	fstp	dword [sp(%$c1)]	;
+	
+	mov	r0, [sp(%$fz)]
+	add	r0, r5		;r0 = fi
+	mov	r1, [sp(%$fz)]
+	add	r1, r3
+	sub	r1, r5		;r1 = gi
+
+.do3:
+	fld	dword [sp(%$s2)]
+	fmul	dword [r0+r3]
+	fld	dword [sp(%$c2)]
+	fmul	dword [r1+r3]
+	fsubp	st1, st0		;b = s2*fi[k1] - c2*gi[k1]
+
+	fld	dword [sp(%$c2)]
+	fmul	dword [r0+r3]
+	fld	dword [sp(%$s2)]
+	fmul	dword [r1+r3]
+	faddp	st1, st0		;a = c2*fi[k1] + s2*gi[k1]  b
+
+	fld	dword [r0]
+	fsub	st0, st1		;f1 a b
+	fstp	dword [sp(%$f1)]	;a b
+
+	fadd	dword [r0]		;f0 b
+	fstp	dword [sp(%$f0)]	;b
+
+	fld	dword [r1]
+	fsub	st0, st1		;g1 b
+	fstp	dword [sp(%$g1)]	;b
+
+	fadd	dword [r1]		;g0
+	fstp	dword [sp(%$g0)]	;
+
+
+	fld	dword [sp(%$s2)]
+	fmul	dword [r0+r2]
+	fld	dword [sp(%$c2)]
+	fmul	dword [r1+r2]
+	fsubp	st1, st0		;b = s2*fi[k3] - c2*gi[k3]
+
+	fld	dword [sp(%$c2)]
+	fmul	dword [r0+r2]
+	fld	dword [sp(%$s2)]
+	fmul	dword [r1+r2]
+	faddp	st1, st0		;a = c2*fi[k3] + s2*gi[k3]  b
+
+	fld	dword [r0+r3*2]
+	fsub	st0, st1		;f3 a b
+	fstp	dword [sp(%$f3)]	;a b
+
+	fadd	dword [r0+r3*2]	;f2 b
+	fstp	dword [sp(%$f2)]	;b
+
+	fld	dword [r1+r3*2]
+	fsub	st0, st1		;g3 b
+	fstp	dword [sp(%$g3)]	;b
+
+	fadd	dword [r1+r3*2]	;g2
+	fstp	dword [sp(%$g2)]	;
+
+
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$f2)]
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$g3)]
+	fsubp	st1, st0		;b = s1*f2 - c1*g3
+	
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$f2)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$g3)]
+	faddp	st1, st0		;a = c1*f2 + s1*g3  b
+
+	fld	dword [sp(%$f0)]
+	fsub	st0, st1		;fi[k2] a b
+	fstp	dword [r0+r3*2]
+
+	fadd	dword [sp(%$f0)]	;fi[0] b
+	fstp	dword [r0]
+
+	fld	dword [sp(%$g1)]
+	fsub	st0, st1		;gi[k3] b
+	fstp	dword [r1+r2]
+
+	fadd	dword [sp(%$g1)]	;gi[k1]
+	fstp	dword [r1+r3]
+
+
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$g2)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$f3)]
+	fsubp	st1, st0		;b = c1*g2 - s1*f3
+	
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$g2)]
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$f3)]
+	faddp	st1, st0		;a = s1*g2 + c1*f3  b
+
+	fld	dword [sp(%$g0)]
+	fsub	st0, st1		;gi[k2] a b
+	fstp	dword [r1+r3*2]
+
+	fadd	dword [sp(%$g0)]	;gi[0] b
+	fstp	dword [r1]
+
+	fld	dword [sp(%$f1)]
+	fsub	st0, st1		;fi[k3] b
+	fstp	dword [r0+r2]
+
+	fadd	dword [sp(%$f1)]	;fi[k1]
+	fstp	dword [r0+r3]
+
+
+	lea	r0, [r0+r3*4]
+	lea	r1, [r1+r3*4]
+	cmp	r0, r6
+	jb near	.do3
+
+	add	r5, 4
+	cmp	r5, r4
+	jb near	.for
+
+	cmp	r3, [sp(%$n)]
+	jae	.exit
+
+	add	dword [sp(%$k)], 2	;k  += 2;
+	lea	r3, [r3*4]		;k1 *= 4
+	lea	r2, [r2*4]		;k3 *= 4
+	lea	r4, [r4*4]		;kx *= 4
+	mov	r0, [sp(%$fz)]	;fi
+	lea	r1, [r0+r4]		;gi = fi + kx
+	jmp	.do
+
+.exit:
+	popd	ebp, ebx, esi, edi
+endproc
+
+;*************************************************************
+
+;void fht_FPU_FXCH(float *fz, int n);
+proc	fht_FPU_FXCH
+
+%$fz	arg	4
+%$n	arg	4
+
+%$k	local	4
+
+%$f0	local	4
+%$f1	local	4
+%$f2	local	4
+%$f3	local	4
+
+%$g0	local	4
+%$g1	local	4
+%$g2	local	4
+%$g3	local	4
+
+%$s1	local	4
+%$c1	local	4
+%$s2	local	4
+%$c2	local	4
+
+%$t_s	local	4
+%$t_c	local	4
+	alloc
+
+	pushd	ebp, ebx, esi, edi
+
+fht_FPU_FXCH_1st_part:
+
+fht_FPU_FXCH_2nd_part:
+
+fht_FPU_FXCH_3rd_part:
+
+.do_init:
+	mov	r3, 16		;k1*fsize = 4*fsize = k4
+	mov	r4, 8		;kx = k1/2
+	mov	r2, 48		;k3*fsize
+	mov	dword [sp(%$k)], 2	;k = 2
+	mov	r0, [sp(%$fz)]	;fi
+	lea	r1, [r0+8]		;gi = fi + kx
+
+.do:
+.do2:
+	;f
+	fld	dword [r0]
+	fsub	dword [r0+r3]
+	fld	dword [r0]
+	fadd	dword [r0+r3]
+
+	fld	dword [r0+r3*2]
+	fsub	dword [r0+r2]
+	fld	dword [r0+r3*2]
+	fadd	dword [r0+r2]		;f2 f3 f0 f1
+
+	fld	st3
+	fld	st3
+	fxch	st5
+	fadd	st0, st3
+	fxch	st4
+	fadd	st0, st2
+	fxch	st3
+	fsubp	st1, st0
+	fxch	st1
+	fsubp	st4, st0
+	fxch	st2
+
+	fstp	dword [r0+r3]		;fi[k1]
+	fstp	dword [r0]		;fi[0]
+	fstp	dword [r0+r2]		;fi[k3]
+	fstp	dword [r0+r3*2]		;fi[k2]
+
+	;g
+	fld	dword [r1]
+	fsub	dword [r1+r3]
+	fld	dword [r1]
+	fadd	dword [r1+r3]
+
+	fld	dword [D_1_41421]
+	fmul	dword [r1+r2]
+	fld	dword [D_1_41421]
+	fmul	dword [r1+r3*2]		;g2 g3 g0 g1
+
+	fld	st3
+	fld	st3
+	fxch	st5
+	fadd	st0, st3
+	fxch	st4
+	fadd	st0, st2
+	fxch	st3
+	fsubp	st1, st0
+	fxch	st1
+	fsubp	st4, st0
+	fxch	st2
+
+	fstp	dword [r1+r3]		;gi[k1]
+	fstp	dword [r1]		;gi[0]
+	fstp	dword [r1+r2]		;gi[k3]
+	fstp	dword [r1+r3*2]		;gi[k2]
+
+	lea	r0, [r0+r3*4]
+	lea	r1, [r1+r3*4]
+	cmp	r0, r6
+	jb	.do2
+
+
+	mov	r0, [sp(%$k)]
+	fld	dword [costab_fft +r0*4]
+	fld	dword [sintab_fft +r0*4]
+	fld	dword [D_1_0]
+	fld	dword [D_0_0]
+	fxch	st3
+	fstp	dword [sp(%$t_c)]
+	fxch	st1
+	fstp	dword [sp(%$t_s)]
+	fstp	dword [sp(%$c1)]
+	fstp	dword [sp(%$s1)]
+
+.for_init:
+	mov	r5, 4		;i = 1*fsize
+
+.for:
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$t_c)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$t_s)]
+
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$t_s)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$t_c)]
+	fxch	st2
+	fsubp	st3, st0		;c1
+	faddp	st1, st0		;s1 c1
+	
+	fld	st1
+	fxch	st2
+	fmul	st0, st0		;c1c1 s1 c1
+	fld	st1
+	fxch	st2
+	fmul	st0, st0		;s1s1 c1c1 s1 c1
+
+	fxch	st3
+	fst	dword [sp(%$c1)]	;c1
+	fxch	st2
+	fst	dword [sp(%$s1)]	;s1 c1c1 c1 s1s1
+
+	fmulp	st2, st0
+	fsubrp	st2, st0
+	fadd	st0, st0		;s2 c2
+	fxch	st1
+	fstp	dword [sp(%$c2)]
+	fstp	dword [sp(%$s2)]
+
+	mov	r0, [sp(%$fz)]
+	mov	r1, [sp(%$fz)]
+	add	r0, r5		;r0 = fi
+	add	r1, r3
+	sub	r1, r5		;r1 = gi
+
+.do3:
+	fld	dword [sp(%$s2)]
+	fmul	dword [r0+r3]
+	fld	dword [sp(%$c2)]
+	fmul	dword [r1+r3]
+
+	fld	dword [sp(%$c2)]
+	fmul	dword [r0+r3]
+	fld	dword [sp(%$s2)]
+	fmul	dword [r1+r3]
+	fxch	st2
+	fsubp	st3, st0		;b = s2*fi[k1] - c2*gi[k1]
+	faddp	st1, st0		;a = c2*fi[k1] + s2*gi[k1]  b
+
+	fld	dword [r1]
+	fsub	st0, st2		;g1 a b
+	fxch	st2
+	fadd	dword [r1]		;g0 a g1
+
+	fld	dword [r0]
+	fsub	st0, st2		;f1 g0 a g1
+	fxch	st2
+	fadd	dword [r0]		;f0 g0 f1 g1
+
+	fxch	st3
+	fstp	dword [sp(%$g1)]
+	fstp	dword [sp(%$g0)]
+	fstp	dword [sp(%$f1)]
+	fstp	dword [sp(%$f0)]
+
+
+	fld	dword [sp(%$s2)]
+	fmul	dword [r0+r2]
+	fld	dword [sp(%$c2)]
+	fmul	dword [r1+r2]
+
+	fld	dword [sp(%$c2)]
+	fmul	dword [r0+r2]
+	fld	dword [sp(%$s2)]
+	fmul	dword [r1+r2]
+	fxch	st2
+	fsubp	st3, st0		;b = s2*fi[k3] - c2*gi[k3]
+	faddp	st1, st0		;a = c2*fi[k3] + s2*gi[k3]  b
+
+
+	fld	dword [r1+r3*2]
+	fsub	st0, st2		;g3 a b
+	fxch	st2
+	fadd	dword [r1+r3*2]	;g2 a g3
+
+	fld	dword [r0+r3*2]
+	fsub	st0, st2		;f3 g2 a g3
+	fxch	st2
+	fadd	dword [r0+r3*2]	;f2 g2 f3 g3
+
+	fxch	st3
+	fstp	dword [sp(%$g3)]
+	fstp	dword [sp(%$g2)]
+	fstp	dword [sp(%$f3)]
+	fstp	dword [sp(%$f2)]
+
+
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$f2)]
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$g3)]
+	
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$f2)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$g3)]
+	fxch	st2
+	fsubp	st3, st0		;b = s1*f2 - c1*g3
+	faddp	st1, st0		;a = c1*f2 + s1*g3  b
+
+	fld	dword [sp(%$g1)]
+	fsub	st0, st2		;gi[k3] a b
+	fxch	st2
+	fadd	dword [sp(%$g1)]	;gi[k1] a gi[k3]
+
+	fld	dword [sp(%$f0)]
+	fsub	st0, st2		;fi[k2] gi[k1] a gi[k3]
+	fxch	st2
+	fadd	dword [sp(%$f0)]	;fi[0] gi[k1] fi[k2] gi[k3]
+
+	fxch	st3
+	fstp	dword [r1+r2]
+	fstp	dword [r1+r3]
+	fstp	dword [r0+r3*2]
+	fstp	dword [r0]
+
+
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$g2)]
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$f3)]
+	
+	fld	dword [sp(%$s1)]
+	fmul	dword [sp(%$g2)]
+	fld	dword [sp(%$c1)]
+	fmul	dword [sp(%$f3)]
+	fxch	st2
+	fsubp	st3, st0		;b = c1*g2 - s1*f3
+	faddp	st1, st0		;a = s1*g2 + c1*f3  b
+
+	fld	dword [sp(%$f1)]
+	fsub	st0, st2		;fi[k3] a b
+	fxch	st2
+	fadd	dword [sp(%$f1)]	;fi[k1] a fi[k3]
+
+	fld	dword [sp(%$g0)]
+	fsub	st0, st2		;gi[k2] fi[k1] a fi[k3]
+	fxch	st2
+	fadd	dword [sp(%$g0)]	;gi[0] fi[k1] gi[k2] fi[k3]
+
+	fxch	st3
+	fstp	dword [r0+r2]
+	fstp	dword [r0+r3]
+	fstp	dword [r1+r3*2]
+	fstp	dword [r1]
+
+
+	lea	r0, [r0+r3*4]
+	lea	r1, [r1+r3*4]
+	cmp	r0, r6
+	jb near	.do3
+
+	add	r5, 4
+	cmp	r5, r4
+	jb near	.for
+
+	cmp	r3, [sp(%$n)]
+	jae	.exit
+
+	add	dword [sp(%$k)], 2	;k  += 2;
+	lea	r3, [r3*4]		;k1 *= 4
+	lea	r2, [r2*4]		;k3 *= 4
+	lea	r4, [r4*4]		;kx *= 4
+	mov	r0, [sp(%$fz)]	;fi
+	lea	r1, [r0+r4]		;gi = fi + kx
+	jmp	.do
+
+.exit:
+	popd	ebp, ebx, esi, edi
+endproc
+
+	end
diff --git a/libmp3lame/i386/fftsse.nas b/libmp3lame/i386/fftsse.nas
new file mode 100644
index 0000000..616fcc2
--- /dev/null
+++ b/libmp3lame/i386/fftsse.nas
@@ -0,0 +1,422 @@
+; back port from GOGO-no coda 2.24b by Takehiro TOMINAGA
+
+; GOGO-no-coda
+;	Copyright (C) 1999 shigeo
+;	special thanks to Keiichi SAKAI
+ 
+%include "nasm.h"
+
+	globaldef fht_SSE
+
+	segment_data
+	align 16
+Q_MMPP	dd	0x0,0x0,0x80000000,0x80000000
+Q_MPMP	dd	0x0,0x80000000,0x0,0x80000000
+D_1100	dd 0.0, 0.0, 1.0, 1.0
+costab_fft:
+	dd 9.238795325112867e-01
+	dd 3.826834323650898e-01
+	dd 9.951847266721969e-01
+	dd 9.801714032956060e-02
+	dd 9.996988186962042e-01
+	dd 2.454122852291229e-02
+	dd 9.999811752836011e-01
+	dd 6.135884649154475e-03
+S_SQRT2	dd	1.414213562
+
+	segment_code
+
+PIC_OFFSETTABLE
+
+;------------------------------------------------------------------------
+;	by K. SAKAI
+;	99/08/18	PIII 23k[clk]
+;	99/08/19	Ì¿Îá½ç½øÆþ¤ì´¹¤¨ PIII 22k[clk]
+;	99/08/20	bit reversal ¤òµì¸á¸å¤«¤é°Ü¿¢¤·¤¿ PIII 17k[clk]
+;	99/08/23	°ìÉô unroll PIII 14k[clk]
+;	99/11/12	clean up
+;
+;void fht_SSE(float *fz, int n);
+	align 16
+fht_SSE:
+	push	ebx
+	push	esi
+	push	edi
+	push	ebp
+
+%assign _P 4*5
+
+	;2¤ÄÌܤΥ롼¥×
+	mov	eax,[esp+_P+0]	;eax=fz
+	mov	ebp,[esp+_P+4]	;=n
+	shl	ebp,3
+	add	ebp,eax		; fn  = fz + n, ¤³¤Î´Ø¿ô½ªÎ»¤Þ¤ÇÉÔÊÑ
+	push	ebp
+
+	call	get_pc.bp
+	add	ebp, PIC_BASE()
+
+	lea	ecx,[PIC_EBP_REL(costab_fft)]
+	xor	eax,eax
+	mov	al,8		; =k1=1*(sizeof float)	// 4, 16, 64, 256,...
+.lp2:				; do{
+	mov	esi,[esp+_P+4]	; esi=fi=fz
+	lea	edx,[eax+eax*2]
+	mov	ebx, esi
+
+; ¤¿¤«¤À¤«2ÊÂÎó¤·¤«´üÂԤǤ­¤Ê¤¤Éôʬ¤ÏFPU¤Î¤Û¤¦¤¬Â®¤¤¡£
+	loopalign	16
+.lp20:				; do{
+;                       f0     = fi[0 ] + fi[k1];
+;                       f2     = fi[k2] + fi[k3];
+;                       f1     = fi[0 ] - fi[k1];
+;                       f3     = fi[k2] - fi[k3];
+;                       fi[0 ] = f0     + f2;
+;                       fi[k1] = f1     + f3;
+;                       fi[k2] = f0     - f2;
+;                       fi[k3] = f1     - f3;
+	lea	edi,[ebx+eax]	; edi=gi=fi+ki/2
+	fld	dword [ebx]
+	fadd	dword [ebx+eax*2]
+	fld	dword [ebx+eax*4]
+	fadd	dword [ebx+edx*2]
+
+	fld	dword [ebx]
+	fsub	dword [ebx+eax*2]
+	fld	dword [ebx+eax*4]
+	fsub	dword [ebx+edx*2]
+
+	fld	st1
+	fadd	st0,st1
+	fstp	dword [ebx+eax*2]
+	fsubp	st1,st0
+	fstp	dword [ebx+edx*2]
+
+	fld	st1
+	fadd	st0,st1
+	fstp	dword [ebx]
+	fsubp	st1,st0
+	fstp	dword [ebx+eax*4]
+
+	lea	ebx,[ebx + eax*8]	; = fi += (k1 * 4);
+;                       g0     = gi[0 ] + gi[k1];
+;                       g2     = SQRT2  * gi[k2];
+;                       g1     = gi[0 ] - gi[k1];
+;                       g3     = SQRT2  * gi[k3];
+;                       gi[0 ] = g0     + g2;
+;                       gi[k2] = g0     - g2;
+;                       gi[k1] = g1     + g3;
+;                       gi[k3] = g1     - g3;
+	fld	dword [edi]
+	fadd	dword [edi+eax*2]
+	fld	dword [PIC_EBP_REL(S_SQRT2)]
+	fmul	dword [edi+eax*4]
+
+	fld	dword [edi]
+	fsub	dword [edi+eax*2]
+	fld	dword [PIC_EBP_REL(S_SQRT2)]
+	fmul	dword [edi+edx*2]
+
+	fld	st1
+	fadd	st0,st1
+	fstp	dword [edi+eax*2]
+	fsubp	st1,st0
+	fstp	dword [edi+edx*2]
+
+	fld	st1
+	fadd	st0,st1
+	fstp	dword [edi]
+	fsubp	st1,st0
+	fstp	dword [edi+eax*4]
+
+	cmp	ebx,[esp]
+	jl	near .lp20		; while (fi<fn);
+
+
+;               i = 1; //for (i=1;i<kx;i++){
+;                       c1 = 1.0*t_c - 0.0*t_s;
+;                       s1 = 0.0*t_c + 1.0*t_s;
+	movlps	xmm6,[ecx] ; = { --,  --,  s1, c1}
+	movaps	xmm7,xmm6
+
+	shufps	xmm6,xmm6,R4(0,1,1,0)	; = {+c1, +s1, +s1, +c1} -> ɬÍ×
+;                       c2 = c1*c1 - s1*s1 = 1 - (2*s1)*s1;
+;                       s2 = c1*s1 + s1*c1 = 2*s1*c1;
+	shufps	xmm7,xmm7,R4(1,0,0,1)
+	movss	xmm5,xmm7		; = { --,  --,  --, s1}
+	xorps	xmm7,[PIC_EBP_REL(Q_MMPP)]	; = {-s1, -c1, +c1, +s1} -> ɬÍ×
+
+	addss	xmm5,xmm5		; = (--, --,  --, 2*s1)
+	add	esi,4		; esi = fi = fz + i
+	shufps	xmm5,xmm5,R4(0,0,0,0)	; = (2*s1, 2*s1, 2*s1, 2*s1)
+	mulps	xmm5,xmm6		; = (2*s1*c1, 2*s1*s1, 2*s1*s1, 2*s1*c1)
+	subps	xmm5,[PIC_EBP_REL(D_1100)]		; = (--, 2*s1*s1-1, --, 2*s1*c1) = {-- -c2 -- s2}
+	movaps	xmm4,xmm5
+	shufps	xmm5,xmm5,R4(2,0,2,0)	; = {-c2, s2, -c2, s2} -> ɬÍ×
+
+	xorps	xmm4,[PIC_EBP_REL(Q_MMPP)]		; = {--, c2, --, s2}
+	shufps	xmm4,xmm4,R4(0,2,0,2)	; = {s2, c2, s2, c2} -> ɬÍ×
+
+	loopalign	16
+.lp21:				; do{
+;                               a       = c2*fi[k1] + s2*gi[k1];
+;                               b       = s2*fi[k1] - c2*gi[k1];
+;                               c       = c2*fi[k3] + s2*gi[k3];
+;                               d       = s2*fi[k3] - c2*gi[k3];
+;                               f0      = fi[0 ]        + a;
+;                               g0      = gi[0 ]        + b;
+;                               f2      = fi[k1 * 2]    + c;
+;                               g2      = gi[k1 * 2]    + d;
+;                               f1      = fi[0 ]        - a;
+;                               g1      = gi[0 ]        - b;
+;                               f3      = fi[k1 * 2]    - c;
+;                               g3      = gi[k1 * 2]    - d;
+	lea	edi,[esi + eax*2 - 8]	; edi = gi = fz +k1-i
+
+	movss	xmm0,[esi + eax*2]	; = fi[k1]
+	movss	xmm2,[esi + edx*2]	; = fi[k3]
+	shufps	xmm0,xmm2,0x00	; = {fi[k3], fi[k3], fi[k1], fi[k1]}
+	movss	xmm1,[edi + eax*2]	; = fi[k1]
+	movss	xmm3,[edi + edx*2]	; = fi[k3]
+	shufps	xmm1,xmm3,0x00	; = {gi[k3], gi[k3], gi[k1], gi[k1]}
+	movss	xmm2,[esi]		; = fi[0]
+	mulps	xmm0,xmm4		; *= {+s2, +c2, +s2, +c2}
+	movss	xmm3,[esi + eax*4]	; = fi[k2]
+	unpcklps	xmm2,xmm3	; = {--, --, fi[k2], fi[0]}
+	mulps	xmm1,xmm5		; *= {-c2, +s2, -c2, +s2}
+	movss	xmm3,[edi + eax*4]	; = gi[k2]
+	addps	xmm0,xmm1		; = {d, c, b, a}
+	movss	xmm1,[edi]		; = gi[0]
+	unpcklps	xmm1,xmm3	; = {--,  --, gi[k2], gi[0]}
+	unpcklps	xmm2,xmm1	; = {gi[k2], fi[k2], gi[0], fi[0]}
+	movaps	xmm1,xmm2
+	addps	xmm1,xmm0	; = {g2, f2, g0, f0}
+	subps	xmm2,xmm0	; = {g3, f3, g1, f1}
+
+;                               a       = c1*f2     + s1*g3;
+;                               c       = s1*g2     + c1*f3;
+;                               b       = s1*f2     - c1*g3;
+;                               d       = c1*g2     - s1*f3;
+;                               fi[0 ]  = f0        + a;
+;                               gi[0 ]  = g0        + c;
+;                               gi[k1]  = g1        + b;
+;                               fi[k1]  = f1        + d;
+;                               fi[k1 * 2]  = f0    - a;
+;                               gi[k1 * 2]  = g0    - c;
+;                               gi[k3]      = g1    - b;
+;                               fi[k3]      = f1    - d;
+	movaps	xmm3,xmm1
+	movhlps	xmm1,xmm1	; = {g2, f2, g2, f2}
+	shufps	xmm3,xmm2,0x14	; = {f1, g1, g0, f0}
+	mulps	xmm1,xmm6	; *= {+c1, +s1, +s1, +c1}
+	shufps	xmm2,xmm2,0xBB	; = {f3, g3, f3, g3}
+	mulps	xmm2,xmm7	; *= {-s1, -c1, +c1, +s1}
+	addps	xmm1,xmm2	; = {d, b, c, a}
+	movaps	xmm2,xmm3
+	addps	xmm3,xmm1	; = {fi[k1], gi[k1], gi[0], fi[0]}
+	subps	xmm2,xmm1	; = {fi[k3], gi[k3], gi[k1*2], fi[k1*2]}
+	movhlps	xmm0,xmm3
+	movss	[esi],xmm3
+	shufps	xmm3,xmm3,0x55
+	movss	[edi+eax*2],xmm0
+	shufps	xmm0,xmm0,0x55
+	movss	[edi],xmm3
+	movss	[esi+eax*2],xmm0
+	movhlps	xmm0,xmm2
+	movss	[esi+eax*4],xmm2
+	shufps	xmm2,xmm2,0x55
+	movss	[edi+edx*2],xmm0
+	shufps	xmm0,xmm0,0x55
+	movss	[edi+eax*4],xmm2
+	movss	[esi+edx*2],xmm0
+	lea	esi,[esi + eax*8] ; fi += (k1 * 4);
+	cmp	esi,[esp]
+	jl	near .lp21		; while (fi<fn);
+
+
+; unrollÁ°¤Îdo loop¤Ï43+4Ì¿Îá
+
+; ºÇÆâ¼þ¤Ç¤Ï¤Ê¤¤for¥ë¡¼¥×¤Îi=2¤«¤éÀè¤òunrolling¤·¤¿
+; kx=   2,   8,  32,  128
+; k4=  16,  64, 256, 1024
+;       0, 6/2,30/2,126/2
+
+	xor	ebx,ebx
+	mov	bl, 4*2		; = i = 4
+	cmp	ebx,eax		; i < k1
+	jnl	near .F22
+;               for (i=2;i<kx;i+=2){
+	loopalign	16
+.lp22:
+; at here, xmm6 is {c3, s3, s3, c3}
+;                       c1 = c3*t_c - s3*t_s;
+;                       s1 = c3*t_s + s3*t_c;
+	movlps	xmm0,[ecx]
+	shufps	xmm0,xmm0,R4(1,1,0,0)	; = {t_s, t_s, t_c, t_c}
+	mulps	xmm6,xmm0	; = {c3*ts, s3*ts, s3*tc, c3*tc}
+	movhlps	xmm4,xmm6	; = {--,    --,    c3*ts, s3*ts}
+	xorps	xmm4,[PIC_EBP_REL(Q_MPMP)]	; = {--,    --,   -c3*ts, s3*ts}
+	subps	xmm6,xmm4	; = {-,-, c3*ts+s3*tc, c3*tc-s3*ts}={-,-,s1,c1}
+
+;                       c3 = c1*t_c - s1*t_s;
+;                       s3 = s1*t_c + c1*t_s;
+	shufps	xmm6,xmm6,0x14	; = {c1, s1, s1, c1}
+	mulps	xmm0,xmm6	; = {ts*c1 ts*s1 tc*s1 tc*c1}
+	movhlps	xmm3,xmm0
+	xorps	xmm3,[PIC_EBP_REL(Q_MPMP)]
+	subps	xmm0,xmm3	; = {--, --, s3, c3}
+
+; {s2 s4 c4 c2} = {2*s1*c1 2*s3*c3 1-2*s3*s3 1-2*s1*s1}
+	unpcklps	xmm6,xmm0	; xmm6 = {s3, s1, c3, c1}
+	movaps	xmm7, xmm6
+	shufps	xmm6,xmm6,R4(2,3,1,0)	; xmm6 = {s1, s3, c3, c1}
+	addps	xmm7, xmm7		; {s3*2, s1*2,   --,   --}
+	mov	edi,[esp+_P+4]		; = fz
+	shufps	xmm7, xmm7, R4(2,3,3,2)	; {s1*2, s3*2, s3*2, s1*2}
+	sub	edi,ebx			; edi = fz - i/2
+	mulps	xmm7, xmm6		; {s1*s1*2, s3*s3*2, s3*c3*2, s1*c1*2}
+	lea	esi,[edi + ebx*2]	; esi = fi = fz +i/2
+	subps	xmm7, [PIC_EBP_REL(D_1100)]		; {-c2, -c4, s4, s2}
+	lea	edi,[edi + eax*2-4]	; edi = gi = fz +k1-i/2
+
+;                       fi = fz +i;
+;                       gi = fz +k1-i;
+;                       do{
+.lp220:
+; unroll¸å¤Îdo loop¤Ï51+4Ì¿Îá
+;                               a       = c2*fi[k1  ] + s2*gi[k1  ];
+;                               e       = c4*fi[k1+1] + s4*gi[k1-1];
+;                               f       = s4*fi[k1+1] - c4*gi[k1-1];
+;                               b       = s2*fi[k1  ] - c2*gi[k1  ];
+;                               c       = c2*fi[k3  ] + s2*gi[k3  ];
+;                               g       = c4*fi[k3+1] + s4*gi[k3-1];
+;                               h       = s4*fi[k3+1] - c4*gi[k3-1];
+;                               d       = s2*fi[k3  ] - c2*gi[k3  ];
+
+	movaps	xmm4,xmm7	; = {-c2 -c4  s4  s2}
+	xorps	xmm4,[PIC_EBP_REL(Q_MMPP)]	; = { c2  c4  s4  s2}
+	shufps	xmm4,xmm4,0x1B	; = { s2  s4  c4  c2}
+	movlps	xmm0,[esi+eax*2]
+	movlps	xmm1,[edi+eax*2]
+	movlps	xmm2,[esi+edx*2]
+	movlps	xmm3,[edi+edx*2]
+	shufps	xmm0,xmm0,0x14
+	shufps	xmm1,xmm1,0x41
+	shufps	xmm2,xmm2,0x14
+	shufps	xmm3,xmm3,0x41
+	mulps	xmm0,xmm4
+	mulps	xmm1,xmm7
+	mulps	xmm2,xmm4
+	mulps	xmm3,xmm7
+	addps	xmm0,xmm1	; xmm0 = {b, f, e, a}
+	addps	xmm2,xmm3	; xmm2 = {d, h, g, c}
+;17
+
+;                               f0      = fi[0   ]    + a;
+;                               f4      = fi[0 +1]    + e;
+;                               g4      = gi[0 -1]    + f;
+;                               g0      = gi[0   ]    + b;
+;                               f1      = fi[0   ]    - a;
+;                               f5      = fi[0 +1]    - e;
+;                               g5      = gi[0 -1]    - f;
+;                               g1      = gi[0   ]    - b;
+;                               f2      = fi[k2  ]    + c;
+;                               f6      = fi[k2+1]    + g;
+;                               g6      = gi[k2-1]    + h;
+;                               g2      = gi[k2  ]    + d;
+;                               f3      = fi[k2  ]    - c;
+;                               f7      = fi[k2+1]    - g;
+;                               g7      = gi[k2-1]    - h;
+;                               g3      = gi[k2  ]    - d;
+	movlps	xmm1,[esi      ]
+	movhps	xmm1,[edi      ]
+	movaps	xmm4,xmm1
+	subps	xmm1,xmm0	; xmm1 = {g1, g5, f5, f1}
+	movlps	xmm3,[esi+eax*4]
+	movhps	xmm3,[edi+eax*4]
+	movaps	xmm5,xmm3
+	subps	xmm3,xmm2	; xmm3 = {g3, g7, f7, f3}
+	addps	xmm0,xmm4	; xmm0 = {g0, g4, f4, f0}
+	addps	xmm2,xmm5	; xmm2 = {g2, g6, f6, f2}
+;10
+
+;                               a       = c1*f2     + s1*g3;	½ç*½ç + µÕ*µÕ
+;                               e       = c3*f6     + s3*g7;
+;                               g       = s3*g6     + c3*f7;
+;                               c       = s1*g2     + c1*f3;
+;                               d       = c1*g2     - s1*f3;	½ç*µÕ - µÕ*½ç
+;                               h       = c3*g6     - s3*f7;
+;                               f       = s3*f6     - c3*g7;
+;                               b       = s1*f2     - c1*g3;
+
+	movaps	xmm5,xmm6	; xmm6 = {s1, s3, c3, c1}
+	shufps	xmm5,xmm5,0x1B	; = {c1, c3, s3, s1}
+	movaps	xmm4,xmm2
+	mulps	xmm4,xmm6
+	shufps	xmm2,xmm2,0x1B	; xmm2 = {f2, f6, g6, g2}
+	mulps	xmm2,xmm6
+	mulps	xmm5,xmm3
+	mulps	xmm3,xmm6
+	shufps	xmm3,xmm3,0x1B
+	addps	xmm4,xmm3	; = {c, g, e, a}
+	subps	xmm2,xmm5	; = {b, f, h, d}
+;10
+
+;                               fi[0   ]  = f0        + a;
+;                               fi[0 +1]  = f4        + e;
+;                               gi[0 -1]  = g4        + g;
+;                               gi[0   ]  = g0        + c;
+;                               fi[k2  ]  = f0        - a;
+;                               fi[k2+1]  = f4        - e;
+;                               gi[k2-1]  = g4        - g;
+;                               gi[k2  ]  = g0        - c;
+;                               fi[k1  ]  = f1        + d;
+;                               fi[k1+1]  = f5        + h;
+;                               gi[k1-1]  = g5        + f;
+;                               gi[k1  ]  = g1        + b;
+;                               fi[k3  ]  = f1        - d;
+;                               fi[k3+1]  = f5        - h;
+;                               gi[k3-1]  = g5        - f;
+;                               gi[k3  ]  = g1        - b;
+	movaps	xmm3,xmm0
+	subps	xmm0,xmm4
+	movlps	[esi+eax*4],xmm0
+	movhps	[edi+eax*4],xmm0
+	addps	xmm4,xmm3
+	movlps	[esi      ],xmm4
+	movhps	[edi      ],xmm4
+
+	movaps	xmm5,xmm1
+	subps	xmm1,xmm2
+	movlps	[esi+edx*2],xmm1
+	movhps	[edi+edx*2],xmm1
+	addps	xmm2,xmm5
+	movlps	[esi+eax*2],xmm2
+	movhps	[edi+eax*2],xmm2
+; 14
+;                               gi     += k4;
+;                               fi     += k4;
+	lea	edi,[edi + eax*8] ; gi += (k1 * 4);
+	lea	esi,[esi + eax*8] ; fi += (k1 * 4);
+	cmp	esi,[esp]
+	jl	near .lp220		; while (fi<fn);
+;                       } while (fi<fn);
+
+	add	ebx,byte 2*4	; i+= 4
+	cmp	ebx,eax		; i < k1
+	shufps	xmm6,xmm6,R4(1,2,2,1)	; (--,s3,c3,--) => {c3, s3, s3, c3}
+	jl	near .lp22
+;               }
+.F22:
+	shl	eax,2
+	add	ecx, byte 8
+	cmp	eax,[esp+_P+8]	; while ((k1 * 4)<n);
+	jle	near .lp2
+	pop	ebp
+	pop	ebp
+	pop	edi
+	pop	esi
+	pop	ebx
+	ret
+
+	end
diff --git a/libmp3lame/i386/ffttbl.nas b/libmp3lame/i386/ffttbl.nas
new file mode 100644
index 0000000..14dd9ae
--- /dev/null
+++ b/libmp3lame/i386/ffttbl.nas
@@ -0,0 +1,78 @@
+
+;	for new GOGO-no-coda (1999/09)
+;	Copyright (C) 1999 shigeo
+;	special thanks to URURI, Keiichi SAKAI
+
+
+;	fft sin,cos,gray¥Æ¡¼¥Ö¥ë
+;	99/08/21
+;	99/09/01(¤¦¤ë¤ê)¡¡¥Ó¥Ã¥Èȿž¥Æ¡¼¥Ö¥ëºï½ü
+;	99/09/14 ¥°¥ì¥¤¥³¡¼¥É¥¤¥ó¥Ç¥Ã¥¯¥¹É½¥°¥í¡¼¥Ð¥ë²½
+
+%include "nasm.h"
+
+	globaldef	costab_fft
+	globaldef	sintab_fft
+	globaldef	gray_index
+
+	segment_data
+	align 16
+
+costab_fft:
+	dd 0.000000000000
+	dd 0.707106781187
+	dd 0.923879532511
+	dd 0.980785280403
+	dd 0.995184726672
+	dd 0.998795456205
+	dd 0.999698818696
+	dd 0.999924701839
+	dd 0.999981175283
+	dd 0.999995293810
+	dd 0.999998823452
+	dd 0.999999705863
+	dd 0.999999926466
+	dd 0.999999981616
+	dd 0.999999995404
+	dd 0.999999998851
+
+sintab_fft:
+	dd 1.000000000000
+	dd 0.707106781187
+	dd 0.382683432365
+	dd 0.195090322016
+	dd 0.098017140330
+	dd 0.049067674327
+	dd 0.024541228523
+	dd 0.012271538286
+	dd 0.006135884649
+	dd 0.003067956763
+	dd 0.001533980186
+	dd 0.000766990319
+	dd 0.000383495188
+	dd 0.000191747597
+	dd 0.000095873799
+	dd 0.000047936900
+
+		align 16
+gray_index:
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 7
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 8
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 7
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 9
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 7
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 8
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 7
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6
+		db	2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 10
+
+	segment_code
+
+	end
diff --git a/libmp3lame/i386/nasm.h b/libmp3lame/i386/nasm.h
new file mode 100644
index 0000000..43d3a8d
--- /dev/null
+++ b/libmp3lame/i386/nasm.h
@@ -0,0 +1,266 @@
+
+;	Copyright (C) 1999 URURI
+
+;	nasm�ѥޥ���
+;	1999/08/21 ���
+;	1999/10/10 ���Ĥ��ɲ�
+;	1999/10/27 aout�б�
+;	1999/11/07 pushf, popf ��NASM�ΥХ��б�
+;	1999/12/02 for BCC ( Thanks to Miquel )
+
+; for Windows Visual C++        -> define WIN32
+;             Borland or cygwin ->        WIN32 and COFF
+; for FreeBSD 2.x               ->        AOUT
+; for TownsOS                   ->        __tos__
+; otherwise                     ->   none
+
+;̾����դ���
+
+BITS 32
+
+%ifdef YASM
+	%define segment_code segment .text align=16 use32
+	%define segment_data segment .data align=16 use32
+	%define segment_bss  segment .bss align=16 use32
+%elifdef WIN32
+	%define segment_code segment .text align=16 class=CODE use32
+	%define segment_data segment .data align=16 class=DATA use32
+%ifdef __BORLANDC__
+	%define segment_bss  segment .data align=16 class=DATA use32
+%else
+	%define segment_bss  segment .bss align=16 class=DATA use32
+%endif
+%elifdef AOUT
+	%define _NAMING
+	%define segment_code segment .text
+	%define segment_data segment .data
+	%define segment_bss  segment .bss
+%else
+%ifidn __OUTPUT_FORMAT__,elf
+	section .note.GNU-stack progbits noalloc noexec nowrite align=1
+%endif
+	%define segment_code segment .text align=16 class=CODE use32
+	%define segment_data segment .data align=16 class=DATA use32
+	%define segment_bss  segment .bss align=16 class=DATA use32
+%endif
+
+%ifdef WIN32
+	%define _NAMING
+%endif
+
+%ifdef __tos__
+group CGROUP text
+group DGROUP data
+%endif
+
+;ñ�����ư��������
+
+%idefine float dword
+%idefine fsize 4
+%idefine fsizen(a) (fsize*(a))
+
+;��ɷ��
+
+%idefine wsize 2
+%idefine wsizen(a) (wsize*(a))
+%idefine dwsize 4
+%idefine dwsizen(a) (dwsize*(a))
+
+;REG
+
+%define r0 eax
+%define r1 ebx
+%define r2 ecx
+%define r3 edx
+%define r4 esi
+%define r5 edi
+%define r6 ebp
+%define r7 esp
+
+;MMX,3DNow!,SSE
+
+%define pmov	movq
+%define pmovd	movd
+
+%define pupldq	punpckldq
+%define puphdq	punpckhdq
+%define puplwd	punpcklwd
+%define puphwd	punpckhwd
+
+%define xm0 xmm0
+%define xm1 xmm1
+%define xm2 xmm2
+%define xm3 xmm3
+%define xm4 xmm4
+%define xm5 xmm5
+%define xm6 xmm6
+%define xm7 xmm7
+
+;�����åե��Ѥ�4�ʥޥ���
+
+%define R4(a,b,c,d) (a*64+b*16+c*4+d)
+
+;C�饤���ʴʰץޥ���
+
+%imacro globaldef 1
+	%ifdef _NAMING
+		%define %1 _%1
+	%endif
+	global %1
+%endmacro
+
+%imacro externdef 1
+	%ifdef _NAMING
+		%define %1 _%1
+	%endif
+	extern %1
+%endmacro
+
+%imacro proc 1
+	%push	proc
+	%ifdef _NAMING
+		global _%1
+	%else
+		global %1
+	%endif
+
+	align 32
+%1:
+_%1:
+
+	%assign %$STACK 0
+	%assign %$STACKN 0
+	%assign %$ARG 4
+%endmacro
+
+%imacro endproc 0
+	%ifnctx proc
+		%error expected 'proc' before 'endproc'.
+	%else
+		%if %$STACK > 0
+			add esp, %$STACK
+		%endif
+
+		%if %$STACK <> (-%$STACKN)
+			%error STACKLEVEL mismatch check 'local', 'alloc', 'pushd', 'popd'
+		%endif
+
+		ret
+		%pop
+	%endif
+%endmacro
+
+%idefine sp(a) esp+%$STACK+a
+
+%imacro arg 1
+	%00	equ %$ARG
+	%assign %$ARG %$ARG+%1
+%endmacro
+
+%imacro local 1
+	%assign %$STACKN %$STACKN-%1
+	%00 equ %$STACKN
+%endmacro
+
+%imacro alloc 0
+	sub esp, (-%$STACKN)-%$STACK
+	%assign %$STACK (-%$STACKN)
+%endmacro
+
+%imacro pushd 1-*
+	%rep %0
+		push %1
+		%assign %$STACK %$STACK+4
+	%rotate 1
+	%endrep
+%endmacro
+
+%imacro popd 1-*
+	%rep %0
+	%rotate -1
+		pop %1
+		%assign %$STACK %$STACK-4
+	%endrep
+%endmacro
+
+; bug of NASM-0.98
+%define pushf db 0x66, 0x9C
+%define popf  db 0x66, 0x9D
+
+%define	ge16(n)		((((n) / 16)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge15(n)		((((n) / 15)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge14(n)		((((n) / 14)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge13(n)		((((n) / 13)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge12(n)		((((n) / 12)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge11(n)		((((n) / 11)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge10(n)		((((n) / 10)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge9(n)		((((n) /  9)*0xFFFFFFFF) & 0xFFFFFFFF)
+%define	ge8(n)		(ge9(n) | ((((n) /  8)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge7(n)		(ge9(n) | ((((n) /  7)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge6(n)		(ge9(n) | ((((n) /  6)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge5(n)		(ge9(n) | ((((n) /  5)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge4(n)		(ge5(n) | ((((n) /  4)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge3(n)		(ge5(n) | ((((n) /  3)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge2(n)		(ge3(n) | ((((n) /  2)*0xFFFFFFFF) & 0xFFFFFFFF))
+%define	ge1(n)		(ge2(n) | ((((n) /  1)*0xFFFFFFFF) & 0xFFFFFFFF))
+
+; macro to align for begining of loop
+; %1   does not align if it LE bytes to next alignment 
+;      4..16 
+;      default is 12
+
+%imacro	loopalignK6	0-1 12 
+%%here:
+	times (($$-%%here) & 15 & ge1(($$-%%here) & 15) & ~ge4(($$-%%here) & 15)) nop
+	times (1                & ge4(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) jmp short %%skip
+	times (((($$-%%here) & 15)-2) & ge4(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) nop
+%%skip:
+%endmacro
+
+%imacro	loopalignK7	0-1 12 
+%%here:
+	times (1 & ge1(($$-%%here) & 15)  & ~ge2(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) nop
+	times (1 & ge2(($$-%%here) & 15)  & ~ge3(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Bh,0C0h
+	times (1 & ge3(($$-%%here) & 15)  & ~ge4(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Dh,004h,020h
+	times (1 & ge4(($$-%%here) & 15)  & ~ge5(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Dh,044h,020h,000h
+	times (1 & ge5(($$-%%here) & 15)  & ~ge6(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Dh,044h,020h,000h,090h
+	times (1 & ge6(($$-%%here) & 15)  & ~ge7(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Dh,080h,0,0,0,0
+	times (1 & ge7(($$-%%here) & 15)  & ~ge8(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Dh,004h,005h,0,0,0,0
+	times (1 & ge8(($$-%%here) & 15)  & ~ge9(($$-%%here) & 15)  & ~ge%1(($$-%%here) & 15)) DB 08Dh,004h,005h,0,0,0,0,90h
+	times (1 & ge9(($$-%%here) & 15)  & ~ge10(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,007h,90h,90h,90h,90h,90h,90h,90h
+	times (1 & ge10(($$-%%here) & 15) & ~ge11(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,008h,90h,90h,90h,90h,90h,90h,90h,90h
+	times (1 & ge11(($$-%%here) & 15) & ~ge12(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,009h,90h,90h,90h,90h,90h,90h,90h,90h,90h
+	times (1 & ge12(($$-%%here) & 15) & ~ge13(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Ah,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
+	times (1 & ge13(($$-%%here) & 15) & ~ge14(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Bh,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
+	times (1 & ge14(($$-%%here) & 15) & ~ge15(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Ch,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
+	times (1 & ge15(($$-%%here) & 15) & ~ge16(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Dh,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
+%%skip:
+%endmacro
+
+%imacro	loopalign	0-1 12 
+	loopalignK7 %1
+%endmacro
+%define PACK(x,y,z,w)	(x*64+y*16+z*4+w)
+
+%ifidn __OUTPUT_FORMAT__,elf
+
+%idefine PIC_BASE(A) _GLOBAL_OFFSET_TABLE_ + $$ - $ wrt ..gotpc
+%idefine PIC_EBP_REL(A) ebp + A wrt ..gotoff
+%macro PIC_OFFSETTABLE 0
+extern  _GLOBAL_OFFSET_TABLE_
+get_pc.bp:
+	mov ebp, [esp]
+	retn
+%endmacro
+
+%else
+
+%define PIC_BASE(A) (0)
+%define PIC_EBP_REL(A) (A)
+%macro PIC_OFFSETTABLE 0
+get_pc.bp:
+	mov ebp, [esp]
+	retn
+%endmacro
+
+%endif
diff --git a/libmp3lame/i386/scalar.nas b/libmp3lame/i386/scalar.nas
new file mode 100644
index 0000000..6d69f42
--- /dev/null
+++ b/libmp3lame/i386/scalar.nas
@@ -0,0 +1,1022 @@
+;
+;    (C) Frank Klemm 1995,99,2000
+;    Dedicated to the LAME project
+;
+;
+        %include "nasm.h"
+
+        segment_code
+        
+; float_t  scalar04_float32_i387 ( 
+;         const float32_t* const  p, 
+;         const float32_t* const  q );
+
+proc    scalar04_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+endproc
+
+
+proc    scalar08_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+        fld     dword [eax + 16]
+        fmul    dword [edx + 16]
+        faddp   st1,st0    
+        fld     dword [eax + 20]
+        fmul    dword [edx + 20]
+        faddp   st1,st0    
+        fld     dword [eax + 24]
+        fmul    dword [edx + 24]
+        faddp   st1,st0    
+        fld     dword [eax + 28]
+        fmul    dword [edx + 28]
+        faddp   st1,st0    
+endproc
+
+
+proc    scalar12_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+        fld     dword [eax + 16]
+        fmul    dword [edx + 16]
+        faddp   st1,st0    
+        fld     dword [eax + 20]
+        fmul    dword [edx + 20]
+        faddp   st1,st0    
+        fld     dword [eax + 24]
+        fmul    dword [edx + 24]
+        faddp   st1,st0    
+        fld     dword [eax + 28]
+        fmul    dword [edx + 28]
+        faddp   st1,st0    
+        fld     dword [eax + 32]
+        fmul    dword [edx + 32]
+        faddp   st1,st0    
+        fld     dword [eax + 36]
+        fmul    dword [edx + 36]
+        faddp   st1,st0    
+        fld     dword [eax + 40]
+        fmul    dword [edx + 40]
+        faddp   st1,st0    
+        fld     dword [eax + 44]
+        fmul    dword [edx + 44]
+        faddp   st1,st0    
+endproc
+
+
+proc    scalar16_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+        fld     dword [eax + 16]
+        fmul    dword [edx + 16]
+        faddp   st1,st0    
+        fld     dword [eax + 20]
+        fmul    dword [edx + 20]
+        faddp   st1,st0    
+        fld     dword [eax + 24]
+        fmul    dword [edx + 24]
+        faddp   st1,st0    
+        fld     dword [eax + 28]
+        fmul    dword [edx + 28]
+        faddp   st1,st0    
+        fld     dword [eax + 32]
+        fmul    dword [edx + 32]
+        faddp   st1,st0    
+        fld     dword [eax + 36]
+        fmul    dword [edx + 36]
+        faddp   st1,st0    
+        fld     dword [eax + 40]
+        fmul    dword [edx + 40]
+        faddp   st1,st0    
+        fld     dword [eax + 44]
+        fmul    dword [edx + 44]
+        faddp   st1,st0    
+        fld     dword [eax + 48]
+        fmul    dword [edx + 48]
+        faddp   st1,st0    
+        fld     dword [eax + 52]
+        fmul    dword [edx + 52]
+        faddp   st1,st0    
+        fld     dword [eax + 56]
+        fmul    dword [edx + 56]
+        faddp   st1,st0    
+        fld     dword [eax + 60]
+        fmul    dword [edx + 60]
+        faddp   st1,st0    
+endproc
+
+
+proc    scalar20_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+        fld     dword [eax + 16]
+        fmul    dword [edx + 16]
+        faddp   st1,st0    
+        fld     dword [eax + 20]
+        fmul    dword [edx + 20]
+        faddp   st1,st0    
+        fld     dword [eax + 24]
+        fmul    dword [edx + 24]
+        faddp   st1,st0    
+        fld     dword [eax + 28]
+        fmul    dword [edx + 28]
+        faddp   st1,st0    
+        fld     dword [eax + 32]
+        fmul    dword [edx + 32]
+        faddp   st1,st0    
+        fld     dword [eax + 36]
+        fmul    dword [edx + 36]
+        faddp   st1,st0    
+        fld     dword [eax + 40]
+        fmul    dword [edx + 40]
+        faddp   st1,st0    
+        fld     dword [eax + 44]
+        fmul    dword [edx + 44]
+        faddp   st1,st0    
+        fld     dword [eax + 48]
+        fmul    dword [edx + 48]
+        faddp   st1,st0    
+        fld     dword [eax + 52]
+        fmul    dword [edx + 52]
+        faddp   st1,st0    
+        fld     dword [eax + 56]
+        fmul    dword [edx + 56]
+        faddp   st1,st0    
+        fld     dword [eax + 60]
+        fmul    dword [edx + 60]
+        faddp   st1,st0    
+        fld     dword [eax + 64]
+        fmul    dword [edx + 64]
+        faddp   st1,st0    
+        fld     dword [eax + 68]
+        fmul    dword [edx + 68]
+        faddp   st1,st0    
+        fld     dword [eax + 72]
+        fmul    dword [edx + 72]
+        faddp   st1,st0    
+        fld     dword [eax + 76]
+        fmul    dword [edx + 76]
+        faddp   st1,st0    
+endproc
+
+
+proc    scalar24_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+        fld     dword [eax + 16]
+        fmul    dword [edx + 16]
+        faddp   st1,st0    
+        fld     dword [eax + 20]
+        fmul    dword [edx + 20]
+        faddp   st1,st0    
+        fld     dword [eax + 24]
+        fmul    dword [edx + 24]
+        faddp   st1,st0    
+        fld     dword [eax + 28]
+        fmul    dword [edx + 28]
+        faddp   st1,st0    
+        fld     dword [eax + 32]
+        fmul    dword [edx + 32]
+        faddp   st1,st0    
+        fld     dword [eax + 36]
+        fmul    dword [edx + 36]
+        faddp   st1,st0    
+        fld     dword [eax + 40]
+        fmul    dword [edx + 40]
+        faddp   st1,st0    
+        fld     dword [eax + 44]
+        fmul    dword [edx + 44]
+        faddp   st1,st0    
+        fld     dword [eax + 48]
+        fmul    dword [edx + 48]
+        faddp   st1,st0    
+        fld     dword [eax + 52]
+        fmul    dword [edx + 52]
+        faddp   st1,st0    
+        fld     dword [eax + 56]
+        fmul    dword [edx + 56]
+        faddp   st1,st0    
+        fld     dword [eax + 60]
+        fmul    dword [edx + 60]
+        faddp   st1,st0    
+        fld     dword [eax + 64]
+        fmul    dword [edx + 64]
+        faddp   st1,st0    
+        fld     dword [eax + 68]
+        fmul    dword [edx + 68]
+        faddp   st1,st0    
+        fld     dword [eax + 72]
+        fmul    dword [edx + 72]
+        faddp   st1,st0    
+        fld     dword [eax + 76]
+        fmul    dword [edx + 76]
+        faddp   st1,st0    
+        fld     dword [eax + 80]
+        fmul    dword [edx + 80]
+        faddp   st1,st0    
+        fld     dword [eax + 84]
+        fmul    dword [edx + 84]
+        faddp   st1,st0    
+        fld     dword [eax + 88]
+        fmul    dword [edx + 88]
+        faddp   st1,st0    
+        fld     dword [eax + 92]
+        fmul    dword [edx + 92]
+        faddp   st1,st0    
+endproc
+
+
+proc    scalar32_float32_i387
+%$p     arg     4
+%$q     arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0    
+        fld     dword [eax + 16]
+        fmul    dword [edx + 16]
+        faddp   st1,st0    
+        fld     dword [eax + 20]
+        fmul    dword [edx + 20]
+        faddp   st1,st0    
+        fld     dword [eax + 24]
+        fmul    dword [edx + 24]
+        faddp   st1,st0    
+        fld     dword [eax + 28]
+        fmul    dword [edx + 28]
+        faddp   st1,st0    
+        fld     dword [eax + 32]
+        fmul    dword [edx + 32]
+        faddp   st1,st0    
+        fld     dword [eax + 36]
+        fmul    dword [edx + 36]
+        faddp   st1,st0    
+        fld     dword [eax + 40]
+        fmul    dword [edx + 40]
+        faddp   st1,st0    
+        fld     dword [eax + 44]
+        fmul    dword [edx + 44]
+        faddp   st1,st0    
+        fld     dword [eax + 48]
+        fmul    dword [edx + 48]
+        faddp   st1,st0    
+        fld     dword [eax + 52]
+        fmul    dword [edx + 52]
+        faddp   st1,st0    
+        fld     dword [eax + 56]
+        fmul    dword [edx + 56]
+        faddp   st1,st0    
+        fld     dword [eax + 60]
+        fmul    dword [edx + 60]
+        faddp   st1,st0    
+        fld     dword [eax + 64]
+        fmul    dword [edx + 64]
+        faddp   st1,st0    
+        fld     dword [eax + 68]
+        fmul    dword [edx + 68]
+        faddp   st1,st0    
+        fld     dword [eax + 72]
+        fmul    dword [edx + 72]
+        faddp   st1,st0    
+        fld     dword [eax + 76]
+        fmul    dword [edx + 76]
+        faddp   st1,st0    
+        fld     dword [eax + 80]
+        fmul    dword [edx + 80]
+        faddp   st1,st0    
+        fld     dword [eax + 84]
+        fmul    dword [edx + 84]
+        faddp   st1,st0    
+        fld     dword [eax + 88]
+        fmul    dword [edx + 88]
+        faddp   st1,st0    
+        fld     dword [eax + 92]
+        fmul    dword [edx + 92]
+        faddp   st1,st0    
+        fld     dword [eax + 96]
+        fmul    dword [edx + 96]
+        faddp   st1,st0    
+        fld     dword [eax +100]
+        fmul    dword [edx +100]
+        faddp   st1,st0    
+        fld     dword [eax +104]
+        fmul    dword [edx +104]
+        faddp   st1,st0    
+        fld     dword [eax +108]
+        fmul    dword [edx +108]
+        faddp   st1,st0    
+        fld     dword [eax +112]
+        fmul    dword [edx +112]
+        faddp   st1,st0    
+        fld     dword [eax +116]
+        fmul    dword [edx +116]
+        faddp   st1,st0    
+        fld     dword [eax +120]
+        fmul    dword [edx +120]
+        faddp   st1,st0    
+        fld     dword [eax +124]
+        fmul    dword [edx +124]
+        faddp   st1,st0    
+endproc
+
+
+; float_t  scalar4n_float32_i387 ( 
+;         const float32_t* const  p, 
+;         const float32_t* const  q,
+;         const size_t            len );
+
+proc    scalar4n_float32_i387
+%$p     arg     4
+%$q     arg     4
+%$len   arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        mov     ecx,[sp(%$len)]
+        fld     dword [eax]
+        fmul    dword [edx]
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0
+        dec     ecx
+        jz      .ret1
+        add     eax,byte 16
+        add     edx,byte 16
+.lbl1
+        fld     dword [eax]
+        fmul    dword [edx]
+        faddp   st1,st0
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0
+        add     eax,byte 16
+        add     edx,byte 16
+        dec     ecx
+        jnz     .lbl1
+.ret1   
+endproc
+
+
+; float_t  scalar1n_float32_i387 ( 
+;         const float32_t* const  p, 
+;         const float32_t* const  q,
+;         const size_t            len );
+
+proc    scalar1n_float32_i387
+%$p     arg     4
+%$q     arg     4
+%$len   arg     4
+;;;     alloc
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        mov     ecx,[sp(%$len)]
+        fld0
+        shr     ecx,1
+        jnc     .lbl2
+        fld     dword [eax]
+        fmul    dword [edx]
+        faddp   st1,st0
+        add     eax,byte 4
+        add     edx,byte 4
+.lbl2
+        shr     ecx,1
+        jnc     .lbl3
+        fld     dword [eax]
+        fmul    dword [edx]
+        faddp   st1,st0
+        fld     dword [eax + 4]
+        fmul    dword [edx + 4]
+        faddp   st1,st0
+        add     eax,byte 8
+        add     edx,byte 8
+        and     ecx,ecx
+.lbl3
+        jz      .ret2
+.lbl4
+        fld     dword [eax]
+        fmul    dword [edx]
+        faddp   st1,st0
+        fld     dword [eax +  4]
+        fmul    dword [edx +  4]
+        faddp   st1,st0
+        fld     dword [eax +  8]
+        fmul    dword [edx +  8]
+        faddp   st1,st0
+        fld     dword [eax + 12]
+        fmul    dword [edx + 12]
+        faddp   st1,st0
+        add     eax,byte 16
+        add     edx,byte 16
+        dec     ecx
+        jnz     .lbl4
+.ret2
+endproc
+
+
+proc    scalar04_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar08_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pmov    mm2,qword [eax+16]
+        pmov    mm3,qword [eax+24]
+        pfmul   mm2,qword [edx+16]
+        pfmul   mm3,qword [edx+24]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar12_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pmov    mm2,qword [eax+16]
+        pmov    mm3,qword [eax+24]
+        pfmul   mm2,qword [edx+16]
+        pfmul   mm3,qword [edx+24]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+32]
+        pmov    mm3,qword [eax+40]
+        pfmul   mm2,qword [edx+32]
+        pfmul   mm3,qword [edx+40]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar16_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pmov    mm2,qword [eax+16]
+        pmov    mm3,qword [eax+24]
+        pfmul   mm2,qword [edx+16]
+        pfmul   mm3,qword [edx+24]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+32]
+        pmov    mm3,qword [eax+40]
+        pfmul   mm2,qword [edx+32]
+        pfmul   mm3,qword [edx+40]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+48]
+        pmov    mm3,qword [eax+56]
+        pfmul   mm2,qword [edx+48]
+        pfmul   mm3,qword [edx+56]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar20_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pmov    mm2,qword [eax+16]
+        pmov    mm3,qword [eax+24]
+        pfmul   mm2,qword [edx+16]
+        pfmul   mm3,qword [edx+24]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+32]
+        pmov    mm3,qword [eax+40]
+        pfmul   mm2,qword [edx+32]
+        pfmul   mm3,qword [edx+40]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+48]
+        pmov    mm3,qword [eax+56]
+        pfmul   mm2,qword [edx+48]
+        pfmul   mm3,qword [edx+56]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+64]
+        pmov    mm3,qword [eax+72]
+        pfmul   mm2,qword [edx+64]
+        pfmul   mm3,qword [edx+72]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar24_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pmov    mm2,qword [eax+16]
+        pmov    mm3,qword [eax+24]
+        pfmul   mm2,qword [edx+16]
+        pfmul   mm3,qword [edx+24]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+32]
+        pmov    mm3,qword [eax+40]
+        pfmul   mm2,qword [edx+32]
+        pfmul   mm3,qword [edx+40]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+48]
+        pmov    mm3,qword [eax+56]
+        pfmul   mm2,qword [edx+48]
+        pfmul   mm3,qword [edx+56]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+64]
+        pmov    mm3,qword [eax+72]
+        pfmul   mm2,qword [edx+64]
+        pfmul   mm3,qword [edx+72]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+80]
+        pmov    mm3,qword [eax+88]
+        pfmul   mm2,qword [edx+80]
+        pfmul   mm3,qword [edx+88]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+proc    scalar32_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+
+        pmov    mm2,qword [eax+16]
+        pmov    mm3,qword [eax+24]
+        pfmul   mm2,qword [edx+16]
+        pfmul   mm3,qword [edx+24]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+32]
+        pmov    mm3,qword [eax+40]
+        pfmul   mm2,qword [edx+32]
+        pfmul   mm3,qword [edx+40]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+48]
+        pmov    mm3,qword [eax+56]
+        pfmul   mm2,qword [edx+48]
+        pfmul   mm3,qword [edx+56]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+64]
+        pmov    mm3,qword [eax+72]
+        pfmul   mm2,qword [edx+64]
+        pfmul   mm3,qword [edx+72]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+80]
+        pmov    mm3,qword [eax+88]
+        pfmul   mm2,qword [edx+80]
+        pfmul   mm3,qword [edx+88]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+96]
+        pmov    mm3,qword [eax+104]
+        pfmul   mm2,qword [edx+96]
+        pfmul   mm3,qword [edx+104]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pmov    mm2,qword [eax+112]
+        pmov    mm3,qword [eax+120]
+        pfmul   mm2,qword [edx+112]
+        pfmul   mm3,qword [edx+120]
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+
+        pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar4n_float32_3DNow
+%$p     arg     4
+%$q     arg     4
+%$len   arg     4
+
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+        mov     ecx,[sp(%$len)]
+
+        pmov    mm0,qword [eax]
+        pmov    mm1,qword [eax+8]
+        pfmul   mm0,qword [edx]
+        pfmul   mm1,qword [edx+8]
+        dec     ecx
+        jz      .ret4
+        
+        add     eax,byte 16
+        add     edx,byte 16
+.lbl4:  
+        pmov    mm2,qword [eax]
+        pmov    mm3,qword [eax+8]
+        pfmul   mm2,qword [edx]
+        pfmul   mm3,qword [edx+8]
+        add     eax,byte 16
+        add     edx,byte 16
+        pfadd   mm0,mm2
+        pfadd   mm1,mm3
+        dec     ecx
+        jnz     .lbl4
+
+.ret4:  pfadd   mm0,mm1
+        pmov    qword [sp(%$p)],mm0
+        femms
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar1n_float32_3DNow
+        jmp     scalar24_float32_i387
+endproc
+
+
+proc    scalar04_float32_SIMD
+        jmp     scalar04_float32_i387
+endproc
+
+
+proc    scalar08_float32_SIMD
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        movups  xmm0, [eax]
+        movups  xmm1, [eax+16]
+        mulps   xmm0, [edx]
+        mulps   xmm1, [edx+16]
+
+        addps   xmm0,xmm1
+        sub     esp,16
+        movups  [esp],xmm0
+        fld     dword [esp+ 0]
+        fadd    dword [esp+ 4]
+        fadd    dword [esp+ 8]
+        fadd    dword [esp+12]
+        add     esp,16
+endproc
+
+
+proc    scalar12_float32_SIMD
+        jmp     scalar12_float32_i387
+endproc
+
+
+proc    scalar16_float32_SIMD
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        movups  xmm0, [eax]
+        movups  xmm1, [eax+16]
+        mulps   xmm0, [edx]
+        mulps   xmm1, [edx+16]
+
+        movups  xmm2, [eax+32]
+        movups  xmm3, [eax+48]
+        mulps   xmm2, [edx+32]
+        mulps   xmm3, [edx+48]
+        addps   xmm0,xmm2
+        addps   xmm1,xmm3
+
+        addps   xmm0,xmm1
+        sub     esp,16
+        movups  [esp],xmm0
+        fld     dword [esp+ 0]
+        fadd    dword [esp+ 4]
+        fadd    dword [esp+ 8]
+        fadd    dword [esp+12]
+        add     esp,16
+endproc
+
+
+proc    scalar20_float32_SIMD
+        jmp     scalar20_float32_i387
+endproc
+
+
+proc    scalar24_float32_SIMD
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        movups  xmm0, [eax]
+        movups  xmm1, [eax+16]
+        mulps   xmm0, [edx]
+        mulps   xmm1, [edx+16]
+
+        movups  xmm2, [eax+32]
+        movups  xmm3, [eax+48]
+        mulps   xmm2, [edx+32]
+        mulps   xmm3, [edx+48]
+        addps   xmm0,xmm2
+        addps   xmm1,xmm3
+
+        movups  xmm2, [eax+64]
+        movups  xmm3, [eax+80]
+        mulps   xmm2, [edx+64]
+        mulps   xmm3, [edx+80]
+        addps   xmm0,xmm2
+        addps   xmm1,xmm3
+
+        addps   xmm0,xmm1
+        sub     esp,16
+        movups  [esp],xmm0
+        fld     dword [esp+ 0]
+        fadd    dword [esp+ 4]
+        fadd    dword [esp+ 8]
+        fadd    dword [esp+12]
+        add     esp,16
+endproc
+
+
+proc    scalar32_float32_SIMD
+%$p     arg     4
+%$q     arg     4
+        mov     eax,[sp(%$p)]
+        mov     edx,[sp(%$q)]
+
+        movups  xmm0, [eax]
+        movups  xmm1, [eax+16]
+        mulps   xmm0, [edx]
+        mulps   xmm1, [edx+16]
+
+        movups  xmm2, [eax+32]
+        movups  xmm3, [eax+48]
+        mulps   xmm2, [edx+32]
+        mulps   xmm3, [edx+48]
+        addps   xmm0,xmm2
+        addps   xmm1,xmm3
+
+        movups  xmm2, [eax+64]
+        movups  xmm3, [eax+80]
+        mulps   xmm2, [edx+64]
+        mulps   xmm3, [edx+80]
+        addps   xmm0,xmm2
+        addps   xmm1,xmm3
+
+        movups  xmm2, [eax+96]
+        movups  xmm3, [eax+112]
+        mulps   xmm2, [edx+96]
+        mulps   xmm3, [edx+112]
+        addps   xmm0,xmm2
+        addps   xmm1,xmm3
+
+        addps   xmm0,xmm1
+
+        ;sub     esp,16
+        ;movups  [esp],xmm0
+        ;fld     dword [esp+ 0]
+        ;fadd    dword [esp+ 4]
+        ;fadd    dword [esp+ 8]
+        ;fadd    dword [esp+12]
+        ;add     esp,16
+         
+         movhlps xmm1,xmm0
+         addps   xmm0,xmm1
+         movlps  [sp(%$p)],xmm0
+        fld     dword [sp(%$p)]
+        fadd    dword [sp(%$p)+4]
+endproc
+
+
+proc    scalar4n_float32_SIMD
+        jmp     scalar4n_float32_i387
+endproc
+
+
+proc    scalar1n_float32_SIMD
+        jmp     scalar1n_float32_i387
+endproc
+
+; end of scalar.nas
diff --git a/libmp3lame/id3tag.c b/libmp3lame/id3tag.c
new file mode 100644
index 0000000..1d37340
--- /dev/null
+++ b/libmp3lame/id3tag.c
@@ -0,0 +1,1437 @@
+/*
+ * id3tag.c -- Write ID3 version 1 and 2 tags.
+ *
+ * Copyright (C) 2000 Don Melton.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * HISTORY: This source file is part of LAME (see http://www.mp3dev.org)
+ * and was originally adapted by Conrad Sanderson <c.sanderson@me.gu.edu.au>
+ * from mp3info by Ricardo Cerqueira <rmc@rccn.net> to write only ID3 version 1
+ * tags.  Don Melton <don@blivet.com> COMPLETELY rewrote it to support version
+ * 2 tags and be more conformant to other standards while remaining flexible.
+ *
+ * NOTE: See http://id3.org/ for more information about ID3 tag formats.
+ */
+
+/* $Id: id3tag.c,v 1.53.2.5 2010/02/19 00:44:37 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
+# include <ctype.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "id3tag.h"
+#include "lame_global_flags.h"
+#include "util.h"
+#include "bitstream.h"
+
+
+static const char *const genre_names[] = {
+    /*
+     * NOTE: The spelling of these genre names is identical to those found in
+     * Winamp and mp3info.
+     */
+    "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
+    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
+    "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
+    "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop",
+    "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental",
+    "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "Alternative Rock",
+    "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop",
+    "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial",
+    "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy",
+    "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle",
+    "Native US", "Cabaret", "New Wave", "Psychedelic", "Rave",
+    "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz",
+    "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk",
+    "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin",
+    "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock",
+    "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock",
+    "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech",
+    "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass",
+    "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba",
+    "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
+    "Punk Rock", "Drum Solo", "A Cappella", "Euro-House", "Dance Hall",
+    "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie",
+    "BritPop", "Negerpunk", "Polsk Punk", "Beat", "Christian Gangsta",
+    "Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian",
+    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
+    "SynthPop"
+};
+
+#define GENRE_NAME_COUNT \
+    ((int)(sizeof genre_names / sizeof (const char *const)))
+
+static const int genre_alpha_map[] = {
+    123, 34, 74, 73, 99, 20, 40, 26, 145, 90, 116, 41, 135, 85, 96, 138, 89, 0,
+    107, 132, 65, 88, 104, 102, 97, 136, 61, 141, 32, 1, 112, 128, 57, 140, 2,
+    139, 58, 3, 125, 50, 22, 4, 55, 127, 122, 120, 98, 52, 48, 54, 124, 25, 84,
+    80, 115, 81, 119, 5, 30, 36, 59, 126, 38, 49, 91, 6, 129, 79, 137, 7, 35,
+    100, 131, 19, 33, 46, 47, 8, 29, 146, 63, 86, 71, 45, 142, 9, 77, 82, 64,
+    133, 10, 66, 39, 11, 103, 12, 75, 134, 13, 53, 62, 109, 117, 23, 108, 92,
+    67, 93, 43, 121, 15, 68, 14, 16, 76, 87, 118, 17, 78, 143, 114, 110, 69, 21,
+    111, 95, 105, 42, 37, 24, 56, 44, 101, 83, 94, 106, 147, 113, 18, 51, 130,
+    144, 60, 70, 31, 72, 27, 28
+};
+
+#define GENRE_ALPHA_COUNT ((int)(sizeof genre_alpha_map / sizeof (int)))
+
+#define GENRE_INDEX_OTHER 12
+
+
+#define FRAME_ID(a, b, c, d) \
+    ( ((unsigned long)(a) << 24) \
+    | ((unsigned long)(b) << 16) \
+    | ((unsigned long)(c) <<  8) \
+    | ((unsigned long)(d) <<  0) )
+
+typedef enum UsualStringIDs { ID_TITLE = FRAME_ID('T', 'I', 'T', '2')
+        , ID_ARTIST = FRAME_ID('T', 'P', 'E', '1')
+        , ID_ALBUM = FRAME_ID('T', 'A', 'L', 'B')
+        , ID_GENRE = FRAME_ID('T', 'C', 'O', 'N')
+        , ID_ENCODER = FRAME_ID('T', 'S', 'S', 'E')
+        , ID_PLAYLENGTH = FRAME_ID('T', 'L', 'E', 'N')
+        , ID_COMMENT = FRAME_ID('C', 'O', 'M', 'M') /* full text string */
+} UsualStringIDs;
+
+typedef enum NumericStringIDs { ID_DATE = FRAME_ID('T', 'D', 'A', 'T') /* "ddMM" */
+        , ID_TIME = FRAME_ID('T', 'I', 'M', 'E') /* "hhmm" */
+        , ID_TPOS = FRAME_ID('T', 'P', 'O', 'S') /* '0'-'9' and '/' allowed */
+        , ID_TRACK = FRAME_ID('T', 'R', 'C', 'K') /* '0'-'9' and '/' allowed */
+        , ID_YEAR = FRAME_ID('T', 'Y', 'E', 'R') /* "yyyy" */
+} NumericStringIDs;
+
+typedef enum MiscIDs { ID_TXXX = FRAME_ID('T', 'X', 'X', 'X')
+        , ID_WXXX = FRAME_ID('W', 'X', 'X', 'X')
+        , ID_SYLT = FRAME_ID('S', 'Y', 'L', 'T')
+        , ID_APIC = FRAME_ID('A', 'P', 'I', 'C')
+        , ID_GEOB = FRAME_ID('G', 'E', 'O', 'B')
+        , ID_PCNT = FRAME_ID('P', 'C', 'N', 'T')
+        , ID_AENC = FRAME_ID('A', 'E', 'N', 'C')
+        , ID_LINK = FRAME_ID('L', 'I', 'N', 'K')
+        , ID_ENCR = FRAME_ID('E', 'N', 'C', 'R')
+        , ID_GRID = FRAME_ID('G', 'R', 'I', 'D')
+        , ID_PRIV = FRAME_ID('P', 'R', 'I', 'V')
+        , ID_VSLT = FRAME_ID('V', 'S', 'L', 'T') /* full text string */
+} MiscIDs;
+
+
+
+
+
+static int
+id3v2_add_ucs2(lame_global_flags * gfp, int frame_id, char const *lang,
+                       unsigned short const *desc, unsigned short const *text);
+static int
+id3v2_add_latin1(lame_global_flags * gfp, int frame_id, char const *lang, char const *desc,
+                         char const *text);
+
+static void
+copyV1ToV2(lame_global_flags * gfp, int frame_id, char const *s)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    int     flags = gfc->tag_spec.flags;
+    id3v2_add_latin1(gfp, frame_id, 0, 0, s);
+    gfc->tag_spec.flags = flags;
+}
+
+
+static void
+id3v2AddLameVersion(lame_global_flags * gfp)
+{
+    char    buffer[1024];
+    const char *b = get_lame_os_bitness();
+    const char *v = get_lame_version();
+    const char *u = get_lame_url();
+    const size_t lenb = strlen(b);
+
+    if (lenb > 0) {
+        sprintf(buffer, "LAME %s version %s (%s)", b, v, u);
+    }
+    else {
+        sprintf(buffer, "LAME version %s (%s)", v, u);
+    }
+    copyV1ToV2(gfp, ID_ENCODER, buffer);
+}
+
+static void
+id3v2AddAudioDuration(lame_global_flags * gfp)
+{
+    if (gfp->num_samples != MAX_U_32_NUM) {
+        char    buffer[1024];
+        double const max_ulong = MAX_U_32_NUM;
+        double  ms = gfp->num_samples;
+        unsigned long playlength_ms;
+
+        ms *= 1000;
+        ms /= gfp->in_samplerate;
+        if (ms > max_ulong) {
+            playlength_ms = max_ulong;
+        }
+        else if (ms < 0) {
+            playlength_ms = 0;
+        }
+        else {
+            playlength_ms = ms;
+        }
+        snprintf(buffer, sizeof(buffer), "%lu", playlength_ms);
+        copyV1ToV2(gfp, ID_PLAYLENGTH, buffer);
+    }
+}
+
+void
+id3tag_genre_list(void (*handler) (int, const char *, void *), void *cookie)
+{
+    if (handler) {
+        int     i;
+        for (i = 0; i < GENRE_NAME_COUNT; ++i) {
+            if (i < GENRE_ALPHA_COUNT) {
+                int     j = genre_alpha_map[i];
+                handler(j, genre_names[j], cookie);
+            }
+        }
+    }
+}
+
+#define GENRE_NUM_UNKNOWN 255
+
+void
+id3tag_init(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    free_id3tag(gfc);
+    memset(&gfc->tag_spec, 0, sizeof gfc->tag_spec);
+    gfc->tag_spec.genre_id3v1 = GENRE_NUM_UNKNOWN;
+    gfc->tag_spec.padding_size = 128;
+    id3v2AddLameVersion(gfp);
+}
+
+
+
+void
+id3tag_add_v2(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->tag_spec.flags &= ~V1_ONLY_FLAG;
+    gfc->tag_spec.flags |= ADD_V2_FLAG;
+}
+
+void
+id3tag_v1_only(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->tag_spec.flags &= ~(ADD_V2_FLAG | V2_ONLY_FLAG);
+    gfc->tag_spec.flags |= V1_ONLY_FLAG;
+}
+
+void
+id3tag_v2_only(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->tag_spec.flags &= ~V1_ONLY_FLAG;
+    gfc->tag_spec.flags |= V2_ONLY_FLAG;
+}
+
+void
+id3tag_space_v1(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->tag_spec.flags &= ~V2_ONLY_FLAG;
+    gfc->tag_spec.flags |= SPACE_V1_FLAG;
+}
+
+void
+id3tag_pad_v2(lame_global_flags * gfp)
+{
+    id3tag_set_pad(gfp, 128);
+}
+
+void
+id3tag_set_pad(lame_global_flags * gfp, size_t n)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->tag_spec.flags &= ~V1_ONLY_FLAG;
+    gfc->tag_spec.flags |= PAD_V2_FLAG;
+    gfc->tag_spec.flags |= ADD_V2_FLAG;
+    gfc->tag_spec.padding_size = n;
+}
+
+
+static  size_t
+local_strdup(char **dst, const char *src)
+{
+    if (dst == 0) {
+        return 0;
+    }
+    free(*dst);
+    *dst = 0;
+    if (src != 0) {
+        size_t  n;
+        for (n = 0; src[n] != 0; ++n) { /* calc src string length */
+        }
+        if (n > 0) {    /* string length without zero termination */
+            assert(sizeof(*src) == sizeof(**dst));
+            *dst = malloc((n + 1) * sizeof(**dst));
+            if (*dst != 0) {
+                memcpy(*dst, src, n * sizeof(**dst));
+                (*dst)[n] = 0;
+                return n;
+            }
+        }
+    }
+    return 0;
+}
+
+static  size_t
+local_ucs2_strdup(unsigned short **dst, unsigned short const *src)
+{
+    if (dst == 0) {
+        return 0;
+    }
+    free(*dst);         /* free old string pointer */
+    *dst = 0;
+    if (src != 0) {
+        size_t  n;
+        for (n = 0; src[n] != 0; ++n) { /* calc src string length */
+        }
+        if (n > 0) {    /* string length without zero termination */
+            assert(sizeof(*src) >= 2);
+            assert(sizeof(*src) == sizeof(**dst));
+            *dst = malloc((n + 1) * sizeof(**dst));
+            if (*dst != 0) {
+                memcpy(*dst, src, n * sizeof(**dst));
+                (*dst)[n] = 0;
+                return n;
+            }
+        }
+    }
+    return 0;
+}
+
+#if 0
+static  size_t
+local_ucs2_strlen(unsigned short const *s)
+{
+    size_t  n = 0;
+    if (s != 0) {
+        while (*s++) {
+            ++n;
+        }
+    }
+    return n;
+}
+#endif
+
+/*
+Some existing options for ID3 tag can be specified by --tv option
+as follows.
+--tt <value>, --tv TIT2=value
+--ta <value>, --tv TPE1=value
+--tl <value>, --tv TALB=value
+--ty <value>, --tv TYER=value
+--tn <value>, --tv TRCK=value
+--tg <value>, --tv TCON=value
+(although some are not exactly same)*/
+
+int
+id3tag_set_albumart(lame_global_flags * gfp, const char *image, size_t size)
+{
+    int     mimetype = 0;
+    unsigned char const *data = (unsigned char const *) image;
+    lame_internal_flags *gfc = gfp->internal_flags;
+
+    /* make sure the image size is no larger than the maximum value */
+    if (LAME_MAXALBUMART < size) {
+        return -1;
+    }
+    /* determine MIME type from the actual image data */
+    if (2 < size && data[0] == 0xFF && data[1] == 0xD8) {
+        mimetype = MIMETYPE_JPEG;
+    }
+    else if (4 < size && data[0] == 0x89 && strncmp((const char *) &data[1], "PNG", 3) == 0) {
+        mimetype = MIMETYPE_PNG;
+    }
+    else if (4 < size && strncmp((const char *) data, "GIF8", 4) == 0) {
+        mimetype = MIMETYPE_GIF;
+    }
+    else {
+        return -1;
+    }
+    if (gfc->tag_spec.albumart != 0) {
+        free(gfc->tag_spec.albumart);
+        gfc->tag_spec.albumart = 0;
+        gfc->tag_spec.albumart_size = 0;
+        gfc->tag_spec.albumart_mimetype = MIMETYPE_NONE;
+    }
+    if (size < 1) {
+        return 0;
+    }
+    gfc->tag_spec.albumart = malloc(size);
+    if (gfc->tag_spec.albumart != 0) {
+        memcpy(gfc->tag_spec.albumart, image, size);
+        gfc->tag_spec.albumart_size = size;
+        gfc->tag_spec.albumart_mimetype = mimetype;
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+        id3tag_add_v2(gfp);
+    }
+    return 0;
+}
+
+static unsigned char *
+set_4_byte_value(unsigned char *bytes, uint32_t value)
+{
+    int     i;
+    for (i = 3; i >= 0; --i) {
+        bytes[i] = value & 0xffUL;
+        value >>= 8;
+    }
+    return bytes + 4;
+}
+
+static int
+toID3v2TagId(char const *s)
+{
+    int     i, x = 0;
+    if (s == 0) {
+        return 0;
+    }
+    for (i = 0; i < 4 && s[i] != 0; ++i) {
+        char const c = s[i];
+        unsigned int const u = 0x0ff & c;
+        x <<= 8;
+        x |= u;
+        if (c < 'A' || 'Z' < c) {
+            if (c < '0' || '9' < c) {
+                return 0;
+            }
+        }
+    }
+    return x;
+}
+
+static int
+isNumericString(int frame_id)
+{
+    switch (frame_id) {
+    case ID_DATE:
+    case ID_TIME:
+    case ID_TPOS:
+    case ID_TRACK:
+    case ID_YEAR:
+        return 1;
+    }
+    return 0;
+}
+
+static int
+isMultiFrame(int frame_id)
+{
+    switch (frame_id) {
+    case ID_TXXX:
+    case ID_WXXX:
+    case ID_COMMENT:
+    case ID_SYLT:
+    case ID_APIC:
+    case ID_GEOB:
+    case ID_PCNT:
+    case ID_AENC:
+    case ID_LINK:
+    case ID_ENCR:
+    case ID_GRID:
+    case ID_PRIV:
+        return 1;
+    }
+    return 0;
+}
+
+#if 0
+static int
+isFullTextString(int frame_id)
+{
+    switch (frame_id) {
+    case ID_VSLT:
+    case ID_COMMENT:
+        return 1;
+    }
+    return 0;
+}
+#endif
+
+static int
+hasUcs2ByteOrderMarker(unsigned short bom)
+{
+    if (bom == 0xFFFEu || bom == 0xFEFFu) {
+        return 1;
+    }
+    return 0;
+}
+
+static FrameDataNode *
+findNode(id3tag_spec const *tag, int frame_id, FrameDataNode * last)
+{
+    FrameDataNode *node = last ? last->nxt : tag->v2_head;
+    while (node != 0) {
+        if (node->fid == frame_id) {
+            return node;
+        }
+        node = node->nxt;
+    }
+    return 0;
+}
+
+static void
+appendNode(id3tag_spec * tag, FrameDataNode * node)
+{
+    if (tag->v2_tail == 0 || tag->v2_head == 0) {
+        tag->v2_head = node;
+        tag->v2_tail = node;
+    }
+    else {
+        tag->v2_tail->nxt = node;
+        tag->v2_tail = node;
+    }
+}
+
+static void
+setLang(char *dst, char const *src)
+{
+    int     i;
+    if (src == 0 || src[0] == 0) {
+        dst[0] = 'X';
+        dst[1] = 'X';
+        dst[2] = 'X';
+    }
+    else {
+        for (i = 0; i < 3 && src && *src; ++i) {
+            dst[i] = src[i];
+        }
+        for (; i < 3; ++i) {
+            dst[i] = ' ';
+        }
+    }
+}
+
+static int
+isSameLang(char const *l1, char const *l2)
+{
+    char    d[3];
+    int     i;
+    setLang(d, l2);
+    for (i = 0; i < 3; ++i) {
+        char    a = tolower(l1[i]);
+        char    b = tolower(d[i]);
+        if (a < ' ')
+            a = ' ';
+        if (b < ' ')
+            b = ' ';
+        if (a != b) {
+            return 0;
+        }
+    }
+    return 1;
+}
+
+static int
+isSameDescriptor(FrameDataNode * node, char const *dsc)
+{
+    size_t  i;
+    if (node->dsc.enc == 1 && node->dsc.dim > 0) {
+        return 0;
+    }
+    for (i = 0; i < node->dsc.dim; ++i) {
+        if (!dsc || node->dsc.ptr.l[i] != dsc[i]) {
+            return 0;
+        }
+    }
+    return 1;
+}
+
+static int
+isSameDescriptorUcs2(FrameDataNode const *node, unsigned short const *dsc)
+{
+    size_t  i;
+    if (node->dsc.enc != 1 && node->dsc.dim > 0) {
+        return 0;
+    }
+    for (i = 0; i < node->dsc.dim; ++i) {
+        if (!dsc || node->dsc.ptr.u[i] != dsc[i]) {
+            return 0;
+        }
+    }
+    return 1;
+}
+
+static int
+id3v2_add_ucs2(lame_global_flags * gfp, int frame_id, char const *lang, unsigned short const *desc,
+               unsigned short const *text)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (gfc != 0) {
+        FrameDataNode *node = 0;
+        node = findNode(&gfc->tag_spec, frame_id, 0);
+        if (isMultiFrame(frame_id)) {
+            while (node) {
+                if (isSameLang(node->lng, lang)) {
+                    if (isSameDescriptorUcs2(node, desc)) {
+                        break;
+                    }
+                }
+                node = findNode(&gfc->tag_spec, frame_id, node);
+            }
+        }
+        if (node == 0) {
+            node = calloc(1, sizeof(FrameDataNode));
+            if (node == 0) {
+                return -254; /* memory problem */
+            }
+            appendNode(&gfc->tag_spec, node);
+        }
+        node->fid = frame_id;
+        setLang(node->lng, lang);
+        node->dsc.dim = local_ucs2_strdup(&node->dsc.ptr.u, desc);
+        node->dsc.enc = 1;
+        node->txt.dim = local_ucs2_strdup(&node->txt.ptr.u, text);
+        node->txt.enc = 1;
+        gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG);
+    }
+    return 0;
+}
+
+static int
+id3v2_add_latin1(lame_global_flags * gfp, int frame_id, char const *lang, char const *desc,
+                 char const *text)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (gfc != 0) {
+        FrameDataNode *node = 0;
+        node = findNode(&gfc->tag_spec, frame_id, 0);
+        if (isMultiFrame(frame_id)) {
+            while (node) {
+                if (isSameLang(node->lng, lang)) {
+                    if (isSameDescriptor(node, desc)) {
+                        break;
+                    }
+                }
+                node = findNode(&gfc->tag_spec, frame_id, node);
+            }
+        }
+        if (node == 0) {
+            node = calloc(1, sizeof(FrameDataNode));
+            if (node == 0) {
+                return -254; /* memory problem */
+            }
+            appendNode(&gfc->tag_spec, node);
+        }
+        node->fid = frame_id;
+        setLang(node->lng, lang);
+        node->dsc.dim = local_strdup(&node->dsc.ptr.l, desc);
+        node->dsc.enc = 0;
+        node->txt.dim = local_strdup(&node->txt.ptr.l, text);
+        node->txt.enc = 0;
+        gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG);
+    }
+    return 0;
+}
+
+
+int
+id3tag_set_textinfo_ucs2(lame_global_flags * gfp, char const *id, unsigned short const *text)
+{
+    int const t_mask = FRAME_ID('T', 0, 0, 0);
+    int const frame_id = toID3v2TagId(id);
+    if (frame_id == 0) {
+        return -1;
+    }
+    if ((frame_id & t_mask) == t_mask) {
+        if (isNumericString(frame_id)) {
+            return -2;  /* must be Latin-1 encoded */
+        }
+        if (text == 0) {
+            return 0;
+        }
+        if (!hasUcs2ByteOrderMarker(text[0])) {
+            return -3;  /* BOM missing */
+        }
+        if (gfp != 0) {
+            return id3v2_add_ucs2(gfp, frame_id, 0, 0, text);
+        }
+    }
+    return -255;        /* not supported by now */
+}
+
+int
+id3tag_set_textinfo_latin1(lame_global_flags * gfp, char const *id, char const *text)
+{
+    int const t_mask = FRAME_ID('T', 0, 0, 0);
+    int const frame_id = toID3v2TagId(id);
+    if (frame_id == 0) {
+        return -1;
+    }
+    if ((frame_id & t_mask) == t_mask) {
+        if (text == 0) {
+            return 0;
+        }
+        if (gfp != 0) {
+            return id3v2_add_latin1(gfp, frame_id, 0, 0, text);
+        }
+    }
+    return -255;        /* not supported by now */
+}
+
+
+int
+id3tag_set_comment_latin1(lame_global_flags * gfp, char const *lang, char const *desc,
+                          char const *text)
+{
+    if (gfp != 0) {
+        return id3v2_add_latin1(gfp, ID_COMMENT, lang, desc, text);
+    }
+    return -255;
+}
+
+
+int
+id3tag_set_comment_ucs2(lame_global_flags * gfp, char const *lang, unsigned short const *desc,
+                        unsigned short const *text)
+{
+    if (gfp != 0) {
+        return id3v2_add_ucs2(gfp, ID_COMMENT, lang, desc, text);
+    }
+    return -255;
+}
+
+
+void
+id3tag_set_title(lame_global_flags * gfp, const char *title)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (title && *title) {
+        local_strdup(&gfc->tag_spec.title, title);
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+        copyV1ToV2(gfp, ID_TITLE, title);
+    }
+}
+
+void
+id3tag_set_artist(lame_global_flags * gfp, const char *artist)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (artist && *artist) {
+        local_strdup(&gfc->tag_spec.artist, artist);
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+        copyV1ToV2(gfp, ID_ARTIST, artist);
+    }
+}
+
+void
+id3tag_set_album(lame_global_flags * gfp, const char *album)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (album && *album) {
+        local_strdup(&gfc->tag_spec.album, album);
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+        copyV1ToV2(gfp, ID_ALBUM, album);
+    }
+}
+
+void
+id3tag_set_year(lame_global_flags * gfp, const char *year)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (year && *year) {
+        int     num = atoi(year);
+        if (num < 0) {
+            num = 0;
+        }
+        /* limit a year to 4 digits so it fits in a version 1 tag */
+        if (num > 9999) {
+            num = 9999;
+        }
+        if (num) {
+            gfc->tag_spec.year = num;
+            gfc->tag_spec.flags |= CHANGED_FLAG;
+        }
+        copyV1ToV2(gfp, ID_YEAR, year);
+    }
+}
+
+void
+id3tag_set_comment(lame_global_flags * gfp, const char *comment)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (comment && *comment) {
+        local_strdup(&gfc->tag_spec.comment, comment);
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+        {
+            int const flags = gfc->tag_spec.flags;
+            id3v2_add_latin1(gfp, ID_COMMENT, "XXX", "", comment);
+            gfc->tag_spec.flags = flags;
+        }
+    }
+}
+
+int
+id3tag_set_track(lame_global_flags * gfp, const char *track)
+{
+    char const *trackcount;
+    lame_internal_flags *gfc = gfp->internal_flags;
+    int     ret = 0;
+
+    if (track && *track) {
+        int     num = atoi(track);
+        /* check for valid ID3v1 track number range */
+        if (num < 1 || num > 255) {
+            num = 0;
+            ret = -1;   /* track number out of ID3v1 range, ignored for ID3v1 */
+            gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG);
+        }
+        if (num) {
+            gfc->tag_spec.track_id3v1 = num;
+            gfc->tag_spec.flags |= CHANGED_FLAG;
+        }
+        /* Look for the total track count after a "/", same restrictions */
+        trackcount = strchr(track, '/');
+        if (trackcount && *trackcount) {
+            gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG);
+        }
+        copyV1ToV2(gfp, ID_TRACK, track);
+    }
+    return ret;
+}
+
+/* would use real "strcasecmp" but it isn't portable */
+static int
+local_strcasecmp(const char *s1, const char *s2)
+{
+    unsigned char c1;
+    unsigned char c2;
+    do {
+        c1 = tolower(*s1);
+        c2 = tolower(*s2);
+        if (!c1) {
+            break;
+        }
+        ++s1;
+        ++s2;
+    } while (c1 == c2);
+    return c1 - c2;
+}
+
+
+static 
+const char* nextUpperAlpha(const char* p, char x)
+{
+    char c;
+    for(c = toupper(*p); *p != 0; c = toupper(*++p)) {
+        if ('A' <= c && c <= 'Z') {
+            if (c != x) {
+                return p;
+            }
+        }
+    }
+    return p;
+}
+
+
+static int
+sloppyCompared(const char* p, const char* q)
+{
+    char cp, cq;
+    p = nextUpperAlpha(p, 0);
+    q = nextUpperAlpha(q, 0);
+    cp = toupper(*p);
+    cq = toupper(*q);
+    while (cp == cq) {
+        if (cp == 0) {
+            return 1;
+        }
+        if (p[1] == '.') { /* some abbrevation */
+            while (*q && *q++ != ' ') {
+            }
+        }
+        p = nextUpperAlpha(p, cp);
+        q = nextUpperAlpha(q, cq);
+        cp = toupper(*p);
+        cq = toupper(*q);
+    }
+    return 0;
+}
+
+
+static int 
+sloppySearchGenre(const char *genre)
+{
+    int i;
+    for (i = 0; i < GENRE_NAME_COUNT; ++i) {
+        if (sloppyCompared(genre, genre_names[i])) {
+            return i;
+        }
+    }
+    return GENRE_NAME_COUNT;
+}
+
+
+static int
+searchGenre(const char* genre)
+{
+    int i;
+    for (i = 0; i < GENRE_NAME_COUNT; ++i) {
+        if (!local_strcasecmp(genre, genre_names[i])) {
+            return i;
+        }
+    }
+    return GENRE_NAME_COUNT;
+}
+
+
+int
+id3tag_set_genre(lame_global_flags * gfp, const char *genre)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    int     ret = 0;
+    if (genre && *genre) {
+        char   *str;
+        int     num = strtol(genre, &str, 10);
+        /* is the input a string or a valid number? */
+        if (*str) {
+            num = searchGenre(genre);
+            if (num == GENRE_NAME_COUNT) {
+                num = sloppySearchGenre(genre);
+            }
+            if (num == GENRE_NAME_COUNT) {
+                num = GENRE_INDEX_OTHER;
+                ret = -2;
+            }
+            else {
+                genre = genre_names[num];
+            }
+        }
+        else {
+            if ((num < 0) || (num >= GENRE_NAME_COUNT)) {
+                return -1;
+            }
+            genre = genre_names[num];
+        }
+        gfc->tag_spec.genre_id3v1 = num;
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+        if (ret) {
+            gfc->tag_spec.flags |= ADD_V2_FLAG;
+        }
+        copyV1ToV2(gfp, ID_GENRE, genre);
+    }
+    return ret;
+}
+
+
+static unsigned char *
+set_frame_custom(unsigned char *frame, const char *fieldvalue)
+{
+    if (fieldvalue && *fieldvalue) {
+        const char *value = fieldvalue + 5;
+        size_t  length = strlen(value);
+        *frame++ = *fieldvalue++;
+        *frame++ = *fieldvalue++;
+        *frame++ = *fieldvalue++;
+        *frame++ = *fieldvalue++;
+        frame = set_4_byte_value(frame, (unsigned long) (strlen(value) + 1));
+        /* clear 2-byte header flags */
+        *frame++ = 0;
+        *frame++ = 0;
+        /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */
+        *frame++ = 0;
+        while (length--) {
+            *frame++ = *value++;
+        }
+    }
+    return frame;
+}
+
+static  size_t
+sizeOfNode(FrameDataNode const *node)
+{
+    size_t  n = 0;
+    if (node) {
+        n = 10;         /* header size */
+        n += 1;         /* text encoding flag */
+        switch (node->txt.enc) {
+        default:
+        case 0:
+            n += node->txt.dim;
+            break;
+        case 1:
+            n += node->txt.dim * 2;
+            break;
+        }
+    }
+    return n;
+}
+
+static  size_t
+sizeOfCommentNode(FrameDataNode const *node)
+{
+    size_t  n = 0;
+    if (node) {
+        n = 10;         /* header size */
+        n += 1;         /* text encoding flag */
+        n += 3;         /* language */
+        switch (node->dsc.enc) {
+        default:
+        case 0:
+            n += 1 + node->dsc.dim;
+            break;
+        case 1:
+            n += 2 + node->dsc.dim * 2;
+            break;
+        }
+        switch (node->txt.enc) {
+        default:
+        case 0:
+            n += node->txt.dim;
+            break;
+        case 1:
+            n += node->txt.dim * 2;
+            break;
+        }
+    }
+    return n;
+}
+
+static unsigned char *
+writeChars(unsigned char *frame, char const *str, size_t n)
+{
+    while (n--) {
+        *frame++ = *str++;
+    }
+    return frame;
+}
+
+static unsigned char *
+writeUcs2s(unsigned char *frame, unsigned short *str, size_t n)
+{
+    while (n--) {
+        *frame++ = 0xff & (*str >> 8);
+        *frame++ = 0xff & (*str++);
+    }
+    return frame;
+}
+
+static unsigned char *
+set_frame_comment(unsigned char *frame, FrameDataNode const *node)
+{
+    size_t const n = sizeOfCommentNode(node);
+    if (n > 10) {
+        frame = set_4_byte_value(frame, ID_COMMENT);
+        frame = set_4_byte_value(frame, (uint32_t) (n - 10));
+        /* clear 2-byte header flags */
+        *frame++ = 0;
+        *frame++ = 0;
+        /* encoding descriptor byte */
+        *frame++ = node->txt.enc == 1 ? 1 : 0;
+        /* 3 bytes language */
+        *frame++ = node->lng[0];
+        *frame++ = node->lng[1];
+        *frame++ = node->lng[2];
+        /* descriptor with zero byte(s) separator */
+        if (node->dsc.enc != 1) {
+            frame = writeChars(frame, node->dsc.ptr.l, node->dsc.dim);
+            *frame++ = 0;
+        }
+        else {
+            frame = writeUcs2s(frame, node->dsc.ptr.u, node->dsc.dim);
+            *frame++ = 0;
+            *frame++ = 0;
+        }
+        /* comment full text */
+        if (node->txt.enc != 1) {
+            frame = writeChars(frame, node->txt.ptr.l, node->txt.dim);
+        }
+        else {
+            frame = writeUcs2s(frame, node->txt.ptr.u, node->txt.dim);
+        }
+    }
+    return frame;
+}
+
+static unsigned char *
+set_frame_custom2(unsigned char *frame, FrameDataNode const *node)
+{
+    size_t const n = sizeOfNode(node);
+    if (n > 10) {
+        frame = set_4_byte_value(frame, node->fid);
+        frame = set_4_byte_value(frame, (unsigned long) (n - 10));
+        /* clear 2-byte header flags */
+        *frame++ = 0;
+        *frame++ = 0;
+        /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */
+        *frame++ = node->txt.enc == 1 ? 1 : 0;
+        if (node->txt.enc != 1) {
+            frame = writeChars(frame, node->txt.ptr.l, node->txt.dim);
+        }
+        else {
+            frame = writeUcs2s(frame, node->txt.ptr.u, node->txt.dim);
+        }
+    }
+    return frame;
+}
+
+static unsigned char *
+set_frame_apic(unsigned char *frame, const char *mimetype, const unsigned char *data, size_t size)
+{
+    /* ID3v2.3 standard APIC frame:
+     *     <Header for 'Attached picture', ID: "APIC">
+     *     Text encoding    $xx
+     *     MIME type        <text string> $00
+     *     Picture type     $xx
+     *     Description      <text string according to encoding> $00 (00)
+     *     Picture data     <binary data>
+     */
+    if (mimetype && data && size) {
+        frame = set_4_byte_value(frame, FRAME_ID('A', 'P', 'I', 'C'));
+        frame = set_4_byte_value(frame, (unsigned long) (4 + strlen(mimetype) + size));
+        /* clear 2-byte header flags */
+        *frame++ = 0;
+        *frame++ = 0;
+        /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */
+        *frame++ = 0;
+        /* copy mime_type */
+        while (*mimetype) {
+            *frame++ = *mimetype++;
+        }
+        *frame++ = 0;
+        /* set picture type to 0 */
+        *frame++ = 0;
+        /* empty description field */
+        *frame++ = 0;
+        /* copy the image data */
+        while (size--) {
+            *frame++ = *data++;
+        }
+    }
+    return frame;
+}
+
+int
+id3tag_set_fieldvalue(lame_global_flags * gfp, const char *fieldvalue)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if (fieldvalue && *fieldvalue) {
+        int const frame_id = toID3v2TagId(fieldvalue);
+        char  **p = NULL;
+        if (strlen(fieldvalue) < 5 || fieldvalue[4] != '=') {
+            return -1;
+        }
+        if (frame_id != 0) {
+            if (id3tag_set_textinfo_latin1(gfp, fieldvalue, &fieldvalue[5])) {
+                p = (char **) realloc(gfc->tag_spec.values,
+                                      sizeof(char *) * (gfc->tag_spec.num_values + 1));
+                if (!p) {
+                    return -1;
+                }
+                gfc->tag_spec.values = (char **) p;
+                gfc->tag_spec.values[gfc->tag_spec.num_values++] = strdup(fieldvalue);
+            }
+        }
+        gfc->tag_spec.flags |= CHANGED_FLAG;
+    }
+    id3tag_add_v2(gfp);
+    return 0;
+}
+
+size_t
+lame_get_id3v2_tag(lame_global_flags * gfp, unsigned char *buffer, size_t size)
+{
+    lame_internal_flags *gfc;
+    if (gfp == 0) {
+        return 0;
+    }
+    gfc = gfp->internal_flags;
+    if (gfc == 0) {
+        return 0;
+    }
+    if (gfc->tag_spec.flags & V1_ONLY_FLAG) {
+        return 0;
+    }
+    {
+        /* calculate length of four fields which may not fit in verion 1 tag */
+        size_t  title_length = gfc->tag_spec.title ? strlen(gfc->tag_spec.title) : 0;
+        size_t  artist_length = gfc->tag_spec.artist ? strlen(gfc->tag_spec.artist) : 0;
+        size_t  album_length = gfc->tag_spec.album ? strlen(gfc->tag_spec.album) : 0;
+        size_t  comment_length = gfc->tag_spec.comment ? strlen(gfc->tag_spec.comment) : 0;
+        /* write tag if explicitly requested or if fields overflow */
+        if ((gfc->tag_spec.flags & (ADD_V2_FLAG | V2_ONLY_FLAG))
+            || (title_length > 30)
+            || (artist_length > 30) || (album_length > 30)
+            || (comment_length > 30)
+            || (gfc->tag_spec.track_id3v1 && (comment_length > 28))) {
+            size_t  tag_size;
+            unsigned char *p;
+            size_t  adjusted_tag_size;
+            unsigned int i;
+            const char *albumart_mime = NULL;
+            static const char *mime_jpeg = "image/jpeg";
+            static const char *mime_png = "image/png";
+            static const char *mime_gif = "image/gif";
+
+            id3v2AddAudioDuration(gfp);
+
+            /* calulate size of tag starting with 10-byte tag header */
+            tag_size = 10;
+            for (i = 0; i < gfc->tag_spec.num_values; ++i) {
+                tag_size += 6 + strlen(gfc->tag_spec.values[i]);
+            }
+            if (gfc->tag_spec.albumart && gfc->tag_spec.albumart_size) {
+                switch (gfc->tag_spec.albumart_mimetype) {
+                case MIMETYPE_JPEG:
+                    albumart_mime = mime_jpeg;
+                    break;
+                case MIMETYPE_PNG:
+                    albumart_mime = mime_png;
+                    break;
+                case MIMETYPE_GIF:
+                    albumart_mime = mime_gif;
+                    break;
+                }
+                if (albumart_mime) {
+                    tag_size += 10 + 4 + strlen(albumart_mime) + gfc->tag_spec.albumart_size;
+                }
+            }
+            {
+                id3tag_spec *tag = &gfc->tag_spec;
+                if (tag->v2_head != 0) {
+                    FrameDataNode *node;
+                    for (node = tag->v2_head; node != 0; node = node->nxt) {
+                        switch (node->fid) {
+                        case ID_COMMENT:
+                            tag_size += sizeOfCommentNode(node);
+                            break;
+
+                        default:
+                            tag_size += sizeOfNode(node);
+                            break;
+                        }
+                    }
+                }
+            }
+            if (gfc->tag_spec.flags & PAD_V2_FLAG) {
+                /* add some bytes of padding */
+                tag_size += gfc->tag_spec.padding_size;
+            }
+            if (size < tag_size) {
+                return tag_size;
+            }
+            if (buffer == 0) {
+                return 0;
+            }
+            p = buffer;
+            /* set tag header starting with file identifier */
+            *p++ = 'I';
+            *p++ = 'D';
+            *p++ = '3';
+            /* set version number word */
+            *p++ = 3;
+            *p++ = 0;
+            /* clear flags byte */
+            *p++ = 0;
+            /* calculate and set tag size = total size - header size */
+            adjusted_tag_size = tag_size - 10;
+            /* encode adjusted size into four bytes where most significant 
+             * bit is clear in each byte, for 28-bit total */
+            *p++ = (unsigned char) ((adjusted_tag_size >> 21) & 0x7fu);
+            *p++ = (unsigned char) ((adjusted_tag_size >> 14) & 0x7fu);
+            *p++ = (unsigned char) ((adjusted_tag_size >> 7) & 0x7fu);
+            *p++ = (unsigned char) (adjusted_tag_size & 0x7fu);
+
+            /*
+             * NOTE: The remainder of the tag (frames and padding, if any)
+             * are not "unsynchronized" to prevent false MPEG audio headers
+             * from appearing in the bitstream.  Why?  Well, most players
+             * and utilities know how to skip the ID3 version 2 tag by now
+             * even if they don't read its contents, and it's actually
+             * very unlikely that such a false "sync" pattern would occur
+             * in just the simple text frames added here.
+             */
+
+            /* set each frame in tag */
+            {
+                id3tag_spec *tag = &gfc->tag_spec;
+                if (tag->v2_head != 0) {
+                    FrameDataNode *node;
+                    for (node = tag->v2_head; node != 0; node = node->nxt) {
+                        switch (node->fid) {
+                        case ID_COMMENT:
+                            p = set_frame_comment(p, node);
+                            break;
+
+                        default:
+                            p = set_frame_custom2(p, node);
+                            break;
+                        }
+                    }
+                }
+            }
+            for (i = 0; i < gfc->tag_spec.num_values; ++i) {
+                p = set_frame_custom(p, gfc->tag_spec.values[i]);
+            }
+            if (albumart_mime) {
+                p = set_frame_apic(p, albumart_mime, gfc->tag_spec.albumart,
+                                   gfc->tag_spec.albumart_size);
+            }
+            /* clear any padding bytes */
+            memset(p, 0, tag_size - (p - buffer));
+            return tag_size;
+        }
+    }
+    return 0;
+}
+
+int
+id3tag_write_v2(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    if ((gfc->tag_spec.flags & CHANGED_FLAG)
+        && !(gfc->tag_spec.flags & V1_ONLY_FLAG)) {
+        unsigned char *tag = 0;
+        size_t  tag_size, n;
+
+        n = lame_get_id3v2_tag(gfp, 0, 0);
+        tag = malloc(n);
+        if (tag == 0) {
+            return -1;
+        }
+        tag_size = lame_get_id3v2_tag(gfp, tag, n);
+        if (tag_size > n) {
+            free(tag);
+            return -1;
+        }
+        else {
+            size_t  i;
+            /* write tag directly into bitstream at current position */
+            for (i = 0; i < tag_size; ++i) {
+                add_dummy_byte(gfp, tag[i], 1);
+            }
+        }
+        free(tag);
+        return (int) tag_size; /* ok, tag should not exceed 2GB */
+    }
+    return 0;
+}
+
+static unsigned char *
+set_text_field(unsigned char *field, const char *text, size_t size, int pad)
+{
+    while (size--) {
+        if (text && *text) {
+            *field++ = *text++;
+        }
+        else {
+            *field++ = pad;
+        }
+    }
+    return field;
+}
+
+size_t
+lame_get_id3v1_tag(lame_global_flags * gfp, unsigned char *buffer, size_t size)
+{
+    size_t const tag_size = 128;
+    lame_internal_flags *gfc;
+
+    if (gfp == 0) {
+        return 0;
+    }
+    if (size < tag_size) {
+        return tag_size;
+    }
+    gfc = gfp->internal_flags;
+    if (gfc == 0) {
+        return 0;
+    }
+    if (buffer == 0) {
+        return 0;
+    }
+    if ((gfc->tag_spec.flags & CHANGED_FLAG)
+        && !(gfc->tag_spec.flags & V2_ONLY_FLAG)) {
+        unsigned char *p = buffer;
+        int     pad = (gfc->tag_spec.flags & SPACE_V1_FLAG) ? ' ' : 0;
+        char    year[5];
+
+        /* set tag identifier */
+        *p++ = 'T';
+        *p++ = 'A';
+        *p++ = 'G';
+        /* set each field in tag */
+        p = set_text_field(p, gfc->tag_spec.title, 30, pad);
+        p = set_text_field(p, gfc->tag_spec.artist, 30, pad);
+        p = set_text_field(p, gfc->tag_spec.album, 30, pad);
+        snprintf(year, sizeof(year), "%d", gfc->tag_spec.year);
+        p = set_text_field(p, gfc->tag_spec.year ? year : NULL, 4, pad);
+        /* limit comment field to 28 bytes if a track is specified */
+        p = set_text_field(p, gfc->tag_spec.comment, gfc->tag_spec.track_id3v1 ? 28 : 30, pad);
+        if (gfc->tag_spec.track_id3v1) {
+            /* clear the next byte to indicate a version 1.1 tag */
+            *p++ = 0;
+            *p++ = gfc->tag_spec.track_id3v1;
+        }
+        *p++ = gfc->tag_spec.genre_id3v1;
+        return tag_size;
+    }
+    return 0;
+}
+
+int
+id3tag_write_v1(lame_global_flags * gfp)
+{
+    size_t  i, n, m;
+    unsigned char tag[128];
+
+    m = sizeof(tag);
+    n = lame_get_id3v1_tag(gfp, tag, m);
+    if (n > m) {
+        return 0;
+    }
+    /* write tag directly into bitstream at current position */
+    for (i = 0; i < n; ++i) {
+        add_dummy_byte(gfp, tag[i], 1);
+    }
+    return (int) n;     /* ok, tag has fixed size of 128 bytes, well below 2GB */
+}
diff --git a/libmp3lame/id3tag.h b/libmp3lame/id3tag.h
new file mode 100644
index 0000000..15dbbad
--- /dev/null
+++ b/libmp3lame/id3tag.h
@@ -0,0 +1,91 @@
+
+#ifndef LAME_ID3_H
+#define LAME_ID3_H
+
+
+#define CHANGED_FLAG    (1U << 0)
+#define ADD_V2_FLAG     (1U << 1)
+#define V1_ONLY_FLAG    (1U << 2)
+#define V2_ONLY_FLAG    (1U << 3)
+#define SPACE_V1_FLAG   (1U << 4)
+#define PAD_V2_FLAG     (1U << 5)
+
+enum {
+    MIMETYPE_NONE = 0,
+    MIMETYPE_JPEG,
+    MIMETYPE_PNG,
+    MIMETYPE_GIF,
+};
+
+typedef struct FrameDataNode
+{
+    struct FrameDataNode* nxt;
+    int     fid;                /* Frame Identifier                 */
+    char    lng[4];             /* 3-character language descriptor  */
+    struct {
+        union {
+            char*           l;  /* ptr to Latin-1 chars             */
+            unsigned short* u;  /* ptr to UCS-2 text                */
+            unsigned char*  b;  /* ptr to raw bytes                 */
+        }       ptr;
+        size_t  dim;
+        int     enc;            /* 0:Latin-1, 1:UCS-2, 2:RAW        */
+    } dsc, txt;
+} FrameDataNode;
+
+
+typedef struct id3tag_spec {
+    /* private data members */
+    unsigned int flags;
+    int     year;
+    char   *title;
+    char   *artist;
+    char   *album;
+    char   *comment;
+    int     track_id3v1;
+    int     genre_id3v1;
+    unsigned char *albumart;
+    unsigned int albumart_size;
+    unsigned int padding_size;
+    int     albumart_mimetype;
+    char  **values;
+    unsigned int num_values;
+    FrameDataNode* v2_head, *v2_tail;
+} id3tag_spec;
+
+
+/* write tag into stream at current position */
+extern int id3tag_write_v2(lame_global_flags * gfp);
+extern int id3tag_write_v1(lame_global_flags * gfp);
+/*
+ * NOTE: A version 2 tag will NOT be added unless one of the text fields won't
+ * fit in a version 1 tag (e.g. the title string is longer than 30 characters),
+ * or the "id3tag_add_v2" or "id3tag_v2_only" functions are used.
+ */
+/* experimental */
+int CDECL id3tag_set_textinfo_latin1(
+        lame_global_flags* gfp,
+        char const*        id,
+        char const*        text );
+
+/* experimental */
+int CDECL id3tag_set_textinfo_ucs2(
+        lame_global_flags*    gfp, 
+        char const*           id,
+        unsigned short const* text );
+
+/* experimental */
+int CDECL id3tag_set_comment_latin1(
+        lame_global_flags* gfp,
+        char const*        lang,
+        char const*        desc,
+        char const*        text );
+
+/* experimental */
+int CDECL id3tag_set_comment_ucs2(
+        lame_global_flags*    gfp, 
+        char const*           lang,
+        unsigned short const* desc,
+        unsigned short const* text );
+
+#endif
diff --git a/libmp3lame/l3side.h b/libmp3lame/l3side.h
new file mode 100644
index 0000000..22adbc2
--- /dev/null
+++ b/libmp3lame/l3side.h
@@ -0,0 +1,94 @@
+/*
+ *	Layer 3 side include file
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_L3SIDE_H
+#define LAME_L3SIDE_H
+
+/* max scalefactor band, max(SBMAX_l, SBMAX_s*3, (SBMAX_s-3)*3+8) */
+#define SFBMAX (SBMAX_s*3)
+
+/* Layer III side information. */
+typedef struct {
+    int     l[1 + SBMAX_l];
+    int     s[1 + SBMAX_s];
+    int     psfb21[1 + PSFB21];
+    int     psfb12[1 + PSFB12];
+} scalefac_struct;
+
+
+typedef struct {
+    FLOAT   l[SBMAX_l];
+    FLOAT   s[SBMAX_s][3];
+} III_psy_xmin;
+
+typedef struct {
+    III_psy_xmin thm;
+    III_psy_xmin en;
+} III_psy_ratio;
+
+typedef struct {
+    FLOAT   xr[576];
+    int     l3_enc[576];
+    int     scalefac[SFBMAX];
+    FLOAT   xrpow_max;
+
+    int     part2_3_length;
+    int     big_values;
+    int     count1;
+    int     global_gain;
+    int     scalefac_compress;
+    int     block_type;
+    int     mixed_block_flag;
+    int     table_select[3];
+    int     subblock_gain[3 + 1];
+    int     region0_count;
+    int     region1_count;
+    int     preflag;
+    int     scalefac_scale;
+    int     count1table_select;
+
+    int     part2_length;
+    int     sfb_lmax;
+    int     sfb_smin;
+    int     psy_lmax;
+    int     sfbmax;
+    int     psymax;
+    int     sfbdivide;
+    int     width[SFBMAX];
+    int     window[SFBMAX];
+    int     count1bits;
+    /* added for LSF */
+    const int *sfb_partition_table;
+    int     slen[4];
+
+    int     max_nonzero_coeff;
+} gr_info;
+
+typedef struct {
+    gr_info tt[2][2];
+    int     main_data_begin;
+    int     private_bits;
+    int     resvDrain_pre;
+    int     resvDrain_post;
+    int     scfsi[2][4];
+} III_side_info_t;
+
+#endif
diff --git a/libmp3lame/lame-analysis.h b/libmp3lame/lame-analysis.h
new file mode 100644
index 0000000..9593cb0
--- /dev/null
+++ b/libmp3lame/lame-analysis.h
@@ -0,0 +1,96 @@
+/*
+ *      GTK plotting routines source file
+ *
+ *      Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_GTKANAL_H
+#define LAME_GTKANAL_H
+
+
+#define READ_AHEAD 40   /* number of frames to read ahead */
+#define MAXMPGLAG READ_AHEAD /* if the mpg123 lag becomes bigger than this
+                                we have to stop */
+#define NUMBACK 6       /* number of frames we can back up */
+#define NUMPINFO (NUMBACK+READ_AHEAD+1)
+
+
+
+struct plotting_data {
+    int     frameNum;        /* current frame number */
+    int     frameNum123;
+    int     num_samples;     /* number of pcm samples read for this frame */
+    double  frametime;       /* starting time of frame, in seconds */
+    double  pcmdata[2][1600];
+    double  pcmdata2[2][1152 + 1152 - DECDELAY];
+    double  xr[2][2][576];
+    double  mpg123xr[2][2][576];
+    double  ms_ratio[2];
+    double  ms_ener_ratio[2];
+
+    /* L,R, M and S values */
+    double  energy_save[4][BLKSIZE]; /* psymodel is one ahead */
+    double  energy[2][4][BLKSIZE];
+    double  pe[2][4];
+    double  thr[2][4][SBMAX_l];
+    double  en[2][4][SBMAX_l];
+    double  thr_s[2][4][3 * SBMAX_s];
+    double  en_s[2][4][3 * SBMAX_s];
+    double  ers_save[4];     /* psymodel is one ahead */
+    double  ers[2][4];
+
+    double  sfb[2][2][SBMAX_l];
+    double  sfb_s[2][2][3 * SBMAX_s];
+    double  LAMEsfb[2][2][SBMAX_l];
+    double  LAMEsfb_s[2][2][3 * SBMAX_s];
+
+    int     LAMEqss[2][2];
+    int     qss[2][2];
+    int     big_values[2][2];
+    int     sub_gain[2][2][3];
+
+    double  xfsf[2][2][SBMAX_l];
+    double  xfsf_s[2][2][3 * SBMAX_s];
+
+    int     over[2][2];
+    double  tot_noise[2][2];
+    double  max_noise[2][2];
+    double  over_noise[2][2];
+    int     over_SSD[2][2];
+    int     blocktype[2][2];
+    int     scalefac_scale[2][2];
+    int     preflag[2][2];
+    int     mpg123blocktype[2][2];
+    int     mixed[2][2];
+    int     mainbits[2][2];
+    int     sfbits[2][2];
+    int     LAMEmainbits[2][2];
+    int     LAMEsfbits[2][2];
+    int     framesize, stereo, js, ms_stereo, i_stereo, emph, bitrate, sampfreq, maindata;
+    int     crc, padding;
+    int     scfsi[2], mean_bits, resvsize;
+    int     totbits;
+};
+#ifndef plotting_data_defined
+#define plotting_data_defined
+typedef struct plotting_data plotting_data;
+#endif
+
+extern plotting_data *pinfo;
+
+#endif
diff --git a/libmp3lame/lame.c b/libmp3lame/lame.c
new file mode 100644
index 0000000..82ba31c
--- /dev/null
+++ b/libmp3lame/lame.c
@@ -0,0 +1,2459 @@
+/* -*- mode: C; mode: fold -*- */
+/*
+ *      LAME MP3 encoding engine
+ *
+ *      Copyright (c) 1999-2000 Mark Taylor
+ *      Copyright (c) 2000-2005 Takehiro Tominaga
+ *      Copyright (c) 2000-2005 Robert Hegemann
+ *      Copyright (c) 2000-2005 Gabriel Bouvigne
+ *      Copyright (c) 2000-2004 Alexander Leidinger
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: lame.c,v 1.323.2.8 2010/02/20 21:08:55 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+
+#include "encoder.h"
+#include "util.h"
+#include "lame_global_flags.h"
+#include "gain_analysis.h"
+#include "bitstream.h"
+#include "quantize_pvt.h"
+#include "set_get.h"
+#include "quantize.h"
+#include "psymodel.h"
+#include "version.h"
+#include "VbrTag.h"
+
+
+#if defined(__FreeBSD__) && !defined(__alpha__)
+#include <floatingpoint.h>
+#endif
+#ifdef __riscos__
+#include "asmstuff.h"
+#endif
+
+#ifdef __sun__
+/* woraround for SunOS 4.x, it has SEEK_* defined here */
+#include <unistd.h>
+#endif
+
+
+#define LAME_DEFAULT_QUALITY 3
+
+static  FLOAT
+filter_coef(FLOAT x)
+{
+    if (x > 1.0)
+        return 0.0;
+    if (x <= 0.0)
+        return 1.0;
+
+    return cos(PI / 2 * x);
+}
+
+static void
+lame_init_params_ppflt(lame_global_flags const *gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    /***************************************************************/
+    /* compute info needed for polyphase filter (filter type==0, default) */
+    /***************************************************************/
+
+    int     band, maxband, minband;
+    FLOAT   freq;
+    int     lowpass_band = 32;
+    int     highpass_band = -1;
+
+    if (gfc->lowpass1 > 0) {
+        minband = 999;
+        for (band = 0; band <= 31; band++) {
+            freq = band / 31.0;
+            /* this band and above will be zeroed: */
+            if (freq >= gfc->lowpass2) {
+                lowpass_band = Min(lowpass_band, band);
+            }
+            if (gfc->lowpass1 < freq && freq < gfc->lowpass2) {
+                minband = Min(minband, band);
+            }
+        }
+
+        /* compute the *actual* transition band implemented by
+         * the polyphase filter */
+        if (minband == 999) {
+            gfc->lowpass1 = (lowpass_band - .75) / 31.0;
+        }
+        else {
+            gfc->lowpass1 = (minband - .75) / 31.0;
+        }
+        gfc->lowpass2 = lowpass_band / 31.0;
+    }
+
+    /* make sure highpass filter is within 90% of what the effective
+     * highpass frequency will be */
+    if (gfc->highpass2 > 0) {
+        if (gfc->highpass2 < .9 * (.75 / 31.0)) {
+            gfc->highpass1 = 0;
+            gfc->highpass2 = 0;
+            MSGF(gfc, "Warning: highpass filter disabled.  " "highpass frequency too small\n");
+        }
+    }
+
+    if (gfc->highpass2 > 0) {
+        maxband = -1;
+        for (band = 0; band <= 31; band++) {
+            freq = band / 31.0;
+            /* this band and below will be zereod */
+            if (freq <= gfc->highpass1) {
+                highpass_band = Max(highpass_band, band);
+            }
+            if (gfc->highpass1 < freq && freq < gfc->highpass2) {
+                maxband = Max(maxband, band);
+            }
+        }
+        /* compute the *actual* transition band implemented by
+         * the polyphase filter */
+        gfc->highpass1 = highpass_band / 31.0;
+        if (maxband == -1) {
+            gfc->highpass2 = (highpass_band + .75) / 31.0;
+        }
+        else {
+            gfc->highpass2 = (maxband + .75) / 31.0;
+        }
+    }
+
+    for (band = 0; band < 32; band++) {
+        double fc1, fc2;
+        freq = band / 31.0;
+        if (gfc->highpass2 > gfc->highpass1) {
+            fc1 = filter_coef((gfc->highpass2 - freq) / (gfc->highpass2 - gfc->highpass1 + 1e-20));
+        }
+        else {
+            fc1 = 1.0;
+        }
+        if (gfc->lowpass2 > gfc->lowpass1) {
+            fc2 = filter_coef((freq - gfc->lowpass1)  / (gfc->lowpass2 - gfc->lowpass1 + 1e-20));
+        }
+        else {
+            fc2 = 1.0;
+        }
+        gfc->amp_filter[band] = fc1 * fc2;
+    }
+}
+
+
+static void
+optimum_bandwidth(double *const lowerlimit, double *const upperlimit, const unsigned bitrate)
+{
+/*
+ *  Input:
+ *      bitrate     total bitrate in kbps
+ *
+ *   Output:
+ *      lowerlimit: best lowpass frequency limit for input filter in Hz
+ *      upperlimit: best highpass frequency limit for input filter in Hz
+ */
+    int     table_index;
+
+    typedef struct {
+        int     bitrate;     /* only indicative value */
+        int     lowpass;
+    } band_pass_t;
+
+    const band_pass_t freq_map[] = {
+        {8, 2000},
+        {16, 3700},
+        {24, 3900},
+        {32, 5500},
+        {40, 7000},
+        {48, 7500},
+        {56, 10000},
+        {64, 11000},
+        {80, 13500},
+        {96, 15100},
+        {112, 15600},
+        {128, 17000},
+        {160, 17500},
+        {192, 18600},
+        {224, 19400},
+        {256, 19700},
+        {320, 20500}
+    };
+
+
+    table_index = nearestBitrateFullIndex(bitrate);
+
+    *lowerlimit = freq_map[table_index].lowpass;
+
+
+/*
+ *  Now we try to choose a good high pass filtering frequency.
+ *  This value is currently not used.
+ *    For fu < 16 kHz:  sqrt(fu*fl) = 560 Hz
+ *    For fu = 18 kHz:  no high pass filtering
+ *  This gives:
+ *
+ *   2 kHz => 160 Hz
+ *   3 kHz => 107 Hz
+ *   4 kHz =>  80 Hz
+ *   8 kHz =>  40 Hz
+ *  16 kHz =>  20 Hz
+ *  17 kHz =>  10 Hz
+ *  18 kHz =>   0 Hz
+ *
+ *  These are ad hoc values and these can be optimized if a high pass is available.
+ */
+/*    if (f_low <= 16000)
+        f_high = 16000. * 20. / f_low;
+    else if (f_low <= 18000)
+        f_high = 180. - 0.01 * f_low;
+    else
+        f_high = 0.;*/
+
+    /*
+     *  When we sometimes have a good highpass filter, we can add the highpass
+     *  frequency to the lowpass frequency
+     */
+
+    /*if (upperlimit != NULL)
+     *upperlimit = f_high;*/
+    (void) upperlimit;
+}
+
+
+static int
+optimum_samplefreq(int lowpassfreq, int input_samplefreq)
+{
+/*
+ * Rules:
+ *  - if possible, sfb21 should NOT be used
+ *
+ */
+    int     suggested_samplefreq = 44100;
+
+    if (input_samplefreq >= 48000)
+        suggested_samplefreq = 48000;
+    else if (input_samplefreq >= 44100)
+        suggested_samplefreq = 44100;
+    else if (input_samplefreq >= 32000)
+        suggested_samplefreq = 32000;
+    else if (input_samplefreq >= 24000)
+        suggested_samplefreq = 24000;
+    else if (input_samplefreq >= 22050)
+        suggested_samplefreq = 22050;
+    else if (input_samplefreq >= 16000)
+        suggested_samplefreq = 16000;
+    else if (input_samplefreq >= 12000)
+        suggested_samplefreq = 12000;
+    else if (input_samplefreq >= 11025)
+        suggested_samplefreq = 11025;
+    else if (input_samplefreq >= 8000)
+        suggested_samplefreq = 8000;
+
+    if (lowpassfreq == -1)
+        return suggested_samplefreq;
+
+    if (lowpassfreq <= 15960)
+        suggested_samplefreq = 44100;
+    if (lowpassfreq <= 15250)
+        suggested_samplefreq = 32000;
+    if (lowpassfreq <= 11220)
+        suggested_samplefreq = 24000;
+    if (lowpassfreq <= 9970)
+        suggested_samplefreq = 22050;
+    if (lowpassfreq <= 7230)
+        suggested_samplefreq = 16000;
+    if (lowpassfreq <= 5420)
+        suggested_samplefreq = 12000;
+    if (lowpassfreq <= 4510)
+        suggested_samplefreq = 11025;
+    if (lowpassfreq <= 3970)
+        suggested_samplefreq = 8000;
+
+    if (input_samplefreq < suggested_samplefreq) {
+        /* choose a valid MPEG sample frequency above the input sample frequency
+           to avoid SFB21/12 bitrate bloat
+           rh 061115
+         */
+        if (input_samplefreq > 44100) {
+            return 48000;
+        }
+        if (input_samplefreq > 32000) {
+            return 44100;
+        }
+        if (input_samplefreq > 24000) {
+            return 32000;
+        }
+        if (input_samplefreq > 22050) {
+            return 24000;
+        }
+        if (input_samplefreq > 16000) {
+            return 22050;
+        }
+        if (input_samplefreq > 12000) {
+            return 16000;
+        }
+        if (input_samplefreq > 11025) {
+            return 12000;
+        }
+        if (input_samplefreq > 8000) {
+            return 11025;
+        }
+        return 8000;
+    }
+    return suggested_samplefreq;
+}
+
+
+
+
+
+/* set internal feature flags.  USER should not access these since
+ * some combinations will produce strange results */
+static void
+lame_init_qval(lame_global_flags * gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    switch (gfp->quality) {
+    default:
+    case 9:            /* no psymodel, no noise shaping */
+        gfc->psymodel = 0;
+        gfc->noise_shaping = 0;
+        gfc->noise_shaping_amp = 0;
+        gfc->noise_shaping_stop = 0;
+        gfc->use_best_huffman = 0;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 8:
+        gfp->quality = 7;
+        /*lint --fallthrough */
+    case 7:            /* use psymodel (for short block and m/s switching), but no noise shapping */
+        gfc->psymodel = 1;
+        gfc->noise_shaping = 0;
+        gfc->noise_shaping_amp = 0;
+        gfc->noise_shaping_stop = 0;
+        gfc->use_best_huffman = 0;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 6:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        gfc->noise_shaping_amp = 0;
+        gfc->noise_shaping_stop = 0;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 0;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 5:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        gfc->noise_shaping_amp = 0;
+        gfc->noise_shaping_stop = 0;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 0;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 4:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        gfc->noise_shaping_amp = 0;
+        gfc->noise_shaping_stop = 0;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 1;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 3:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        gfc->noise_shaping_amp = 1;
+        gfc->noise_shaping_stop = 1;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 1;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 2:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        if (gfc->substep_shaping == 0)
+            gfc->substep_shaping = 2;
+        gfc->noise_shaping_amp = 1;
+        gfc->noise_shaping_stop = 1;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 1; /* inner loop */
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 1:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        if (gfc->substep_shaping == 0)
+            gfc->substep_shaping = 2;
+        gfc->noise_shaping_amp = 2;
+        gfc->noise_shaping_stop = 1;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 1;
+        gfc->full_outer_loop = 0;
+        break;
+
+    case 0:
+        gfc->psymodel = 1;
+        if (gfc->noise_shaping == 0)
+            gfc->noise_shaping = 1;
+        if (gfc->substep_shaping == 0)
+            gfc->substep_shaping = 2;
+        gfc->noise_shaping_amp = 2;
+        gfc->noise_shaping_stop = 1;
+        if (gfc->subblock_gain == -1)
+            gfc->subblock_gain = 1;
+        gfc->use_best_huffman = 1; /*type 2 disabled because of it slowness,
+                                      in favor of full outer loop search */
+        gfc->full_outer_loop = 0; /* full outer loop search disabled because
+                                     of audible distortions it may generate
+                                     rh 060629 */
+        break;
+    }
+
+}
+
+
+
+static double
+linear_int(double a, double b, double m)
+{
+    return a + m * (b - a);
+}
+
+
+
+/********************************************************************
+ *   initialize internal params based on data in gf
+ *   (globalflags struct filled in by calling program)
+ *
+ *  OUTLINE:
+ *
+ * We first have some complex code to determine bitrate,
+ * output samplerate and mode.  It is complicated by the fact
+ * that we allow the user to set some or all of these parameters,
+ * and need to determine best possible values for the rest of them:
+ *
+ *  1. set some CPU related flags
+ *  2. check if we are mono->mono, stereo->mono or stereo->stereo
+ *  3.  compute bitrate and output samplerate:
+ *          user may have set compression ratio
+ *          user may have set a bitrate
+ *          user may have set a output samplerate
+ *  4. set some options which depend on output samplerate
+ *  5. compute the actual compression ratio
+ *  6. set mode based on compression ratio
+ *
+ *  The remaining code is much simpler - it just sets options
+ *  based on the mode & compression ratio:
+ *
+ *   set allow_diff_short based on mode
+ *   select lowpass filter based on compression ratio & mode
+ *   set the bitrate index, and min/max bitrates for VBR modes
+ *   disable VBR tag if it is not appropriate
+ *   initialize the bitstream
+ *   initialize scalefac_band data
+ *   set sideinfo_len (based on channels, CRC, out_samplerate)
+ *   write an id3v2 tag into the bitstream
+ *   write VBR tag into the bitstream
+ *   set mpeg1/2 flag
+ *   estimate the number of frames (based on a lot of data)
+ *
+ *   now we set more flags:
+ *   nspsytune:
+ *      see code
+ *   VBR modes
+ *      see code
+ *   CBR/ABR
+ *      see code
+ *
+ *  Finally, we set the algorithm flags based on the gfp->quality value
+ *  lame_init_qval(gfp);
+ *
+ ********************************************************************/
+int
+lame_init_params(lame_global_flags * gfp)
+{
+
+    int     i;
+    int     j;
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    gfc->Class_ID = 0;
+
+    /* report functions */
+    gfc->report.msgf = gfp->report.msgf;
+    gfc->report.debugf = gfp->report.debugf;
+    gfc->report.errorf = gfp->report.errorf;
+
+    if (gfp->asm_optimizations.amd3dnow)
+        gfc->CPU_features.AMD_3DNow = has_3DNow();
+    else
+        gfc->CPU_features.AMD_3DNow = 0;
+
+    if (gfp->asm_optimizations.mmx)
+        gfc->CPU_features.MMX = has_MMX();
+    else
+        gfc->CPU_features.MMX = 0;
+
+    if (gfp->asm_optimizations.sse) {
+        gfc->CPU_features.SSE = has_SSE();
+        gfc->CPU_features.SSE2 = has_SSE2();
+    }
+    else {
+        gfc->CPU_features.SSE = 0;
+        gfc->CPU_features.SSE2 = 0;
+    }
+
+
+    if (NULL == gfc->ATH)
+        gfc->ATH = calloc(1, sizeof(ATH_t));
+
+    if (NULL == gfc->ATH)
+        return -2;      /* maybe error codes should be enumerated in lame.h ?? */
+
+    if (NULL == gfc->PSY)
+        gfc->PSY = calloc(1, sizeof(PSY_t));
+    if (NULL == gfc->PSY) {
+        freegfc(gfc);
+        gfp->internal_flags = NULL;
+        return -2;
+    }
+
+    if (NULL == gfc->rgdata)
+        gfc->rgdata = calloc(1, sizeof(replaygain_t));
+    if (NULL == gfc->rgdata) {
+        freegfc(gfc);
+        gfp->internal_flags = NULL;
+        return -2;
+    }
+
+    gfc->channels_in = gfp->num_channels;
+    if (gfc->channels_in == 1)
+        gfp->mode = MONO;
+    gfc->channels_out = (gfp->mode == MONO) ? 1 : 2;
+    gfc->mode_ext = MPG_MD_MS_LR;
+    if (gfp->mode == MONO)
+        gfp->force_ms = 0; /* don't allow forced mid/side stereo for mono output */
+
+    if (gfp->VBR == vbr_off && gfp->VBR_mean_bitrate_kbps != 128 && gfp->brate == 0)
+        gfp->brate = gfp->VBR_mean_bitrate_kbps;
+
+    switch (gfp->VBR) {
+    case vbr_off:
+    case vbr_mtrh:
+    case vbr_mt:
+        /* these modes can handle free format condition */
+        break;
+    default:
+        gfp->free_format = 0; /* mode can't be mixed with free format */
+        break;
+    }
+
+    if (gfp->VBR == vbr_off && gfp->brate == 0) {
+        /* no bitrate or compression ratio specified, use 11.025 */
+        if (EQ(gfp->compression_ratio, 0))
+            gfp->compression_ratio = 11.025; /* rate to compress a CD down to exactly 128000 bps */
+    }
+
+    /* find bitrate if user specify a compression ratio */
+    if (gfp->VBR == vbr_off && gfp->compression_ratio > 0) {
+
+        if (gfp->out_samplerate == 0)
+            gfp->out_samplerate = map2MP3Frequency((int) (0.97 * gfp->in_samplerate)); /* round up with a margin of 3% */
+
+        /* choose a bitrate for the output samplerate which achieves
+         * specified compression ratio
+         */
+        gfp->brate = gfp->out_samplerate * 16 * gfc->channels_out / (1.e3 * gfp->compression_ratio);
+
+        /* we need the version for the bitrate table look up */
+        gfc->samplerate_index = SmpFrqIndex(gfp->out_samplerate, &gfp->version);
+
+        if (!gfp->free_format) /* for non Free Format find the nearest allowed bitrate */
+            gfp->brate = FindNearestBitrate(gfp->brate, gfp->version, gfp->out_samplerate);
+    }
+    if (gfp->out_samplerate) {
+        if (gfp->out_samplerate < 16000) {
+            gfp->VBR_mean_bitrate_kbps = Max(gfp->VBR_mean_bitrate_kbps, 8);
+            gfp->VBR_mean_bitrate_kbps = Min(gfp->VBR_mean_bitrate_kbps, 64);
+        }
+        else if (gfp->out_samplerate < 32000) {
+            gfp->VBR_mean_bitrate_kbps = Max(gfp->VBR_mean_bitrate_kbps, 8);
+            gfp->VBR_mean_bitrate_kbps = Min(gfp->VBR_mean_bitrate_kbps, 160);
+        }
+        else {
+            gfp->VBR_mean_bitrate_kbps = Max(gfp->VBR_mean_bitrate_kbps, 32);
+            gfp->VBR_mean_bitrate_kbps = Min(gfp->VBR_mean_bitrate_kbps, 320);
+        }
+    }
+
+  /****************************************************************/
+    /* if a filter has not been enabled, see if we should add one: */
+  /****************************************************************/
+    if (gfp->lowpassfreq == 0) {
+        double  lowpass = 16000;
+        double  highpass;
+
+        switch (gfp->VBR) {
+        case vbr_off:{
+                optimum_bandwidth(&lowpass, &highpass, gfp->brate);
+                break;
+            }
+        case vbr_abr:{
+                optimum_bandwidth(&lowpass, &highpass, gfp->VBR_mean_bitrate_kbps);
+                break;
+            }
+        case vbr_rh:{
+                int const x[11] = {
+                    19500, 19000, 18600, 18000, 17500, 16000, 15600, 14900, 12500, 10000, 3950
+                };
+                if (0 <= gfp->VBR_q && gfp->VBR_q <= 9) {
+                    double  a = x[gfp->VBR_q], b = x[gfp->VBR_q + 1], m = gfp->VBR_q_frac;
+                    lowpass = linear_int(a, b, m);
+                }
+                else {
+                    lowpass = 19500;
+                }
+                break;
+            }
+        default:{
+                int const x[11] = {
+                    19500, 19000, 18500, 18000, 17500, 16500, 15500, 14500, 12500, 9500, 3950
+                };
+                if (0 <= gfp->VBR_q && gfp->VBR_q <= 9) {
+                    double  a = x[gfp->VBR_q], b = x[gfp->VBR_q + 1], m = gfp->VBR_q_frac;
+                    lowpass = linear_int(a, b, m);
+                }
+                else {
+                    lowpass = 19500;
+                }
+            }
+        }
+
+        if (gfp->mode == MONO && (gfp->VBR == vbr_off || gfp->VBR == vbr_abr))
+            lowpass *= 1.5;
+
+        gfp->lowpassfreq = lowpass;
+    }
+
+    if (gfp->out_samplerate == 0) {
+        if (2 * gfp->lowpassfreq > gfp->in_samplerate) {
+            gfp->lowpassfreq = gfp->in_samplerate / 2;
+        }
+        gfp->out_samplerate = optimum_samplefreq((int) gfp->lowpassfreq, gfp->in_samplerate);
+    }
+
+    gfp->lowpassfreq = Min(20500, gfp->lowpassfreq);
+    gfp->lowpassfreq = Min(gfp->out_samplerate / 2, gfp->lowpassfreq);
+
+    if (gfp->VBR == vbr_off) {
+        gfp->compression_ratio = gfp->out_samplerate * 16 * gfc->channels_out / (1.e3 * gfp->brate);
+    }
+    if (gfp->VBR == vbr_abr) {
+        gfp->compression_ratio =
+            gfp->out_samplerate * 16 * gfc->channels_out / (1.e3 * gfp->VBR_mean_bitrate_kbps);
+    }
+
+    /* do not compute ReplayGain values and do not find the peak sample
+       if we can't store them */
+    if (!gfp->bWriteVbrTag) {
+        gfp->findReplayGain = 0;
+        gfp->decode_on_the_fly = 0;
+        gfc->findPeakSample = 0;
+    }
+    gfc->findReplayGain = gfp->findReplayGain;
+    gfc->decode_on_the_fly = gfp->decode_on_the_fly;
+
+    if (gfc->decode_on_the_fly)
+        gfc->findPeakSample = 1;
+
+    if (gfc->findReplayGain) {
+        if (InitGainAnalysis(gfc->rgdata, gfp->out_samplerate) == INIT_GAIN_ANALYSIS_ERROR) {
+            freegfc(gfc);
+            gfp->internal_flags = NULL;
+            return -6;
+        }
+    }
+
+#ifdef DECODE_ON_THE_FLY
+    if (gfc->decode_on_the_fly && !gfp->decode_only) {
+        if (gfc->hip) {
+            hip_decode_exit(gfc->hip);
+        }
+        gfc->hip = hip_decode_init();
+    }
+#endif
+
+    gfc->mode_gr = gfp->out_samplerate <= 24000 ? 1 : 2; /* Number of granules per frame */
+    gfp->framesize = 576 * gfc->mode_gr;
+    gfp->encoder_delay = ENCDELAY;
+
+    gfc->resample_ratio = (double) gfp->in_samplerate / gfp->out_samplerate;
+
+    /*
+     *  sample freq       bitrate     compression ratio
+     *     [kHz]      [kbps/channel]   for 16 bit input
+     *     44.1            56               12.6
+     *     44.1            64               11.025
+     *     44.1            80                8.82
+     *     22.05           24               14.7
+     *     22.05           32               11.025
+     *     22.05           40                8.82
+     *     16              16               16.0
+     *     16              24               10.667
+     *
+     */
+    /*
+     *  For VBR, take a guess at the compression_ratio.
+     *  For example:
+     *
+     *    VBR_q    compression     like
+     *     -        4.4         320 kbps/44 kHz
+     *   0...1      5.5         256 kbps/44 kHz
+     *     2        7.3         192 kbps/44 kHz
+     *     4        8.8         160 kbps/44 kHz
+     *     6       11           128 kbps/44 kHz
+     *     9       14.7          96 kbps
+     *
+     *  for lower bitrates, downsample with --resample
+     */
+
+    switch (gfp->VBR) {
+    case vbr_mt:
+    case vbr_rh:
+    case vbr_mtrh:
+        {
+            /*numbers are a bit strange, but they determine the lowpass value */
+            FLOAT const cmp[] = { 5.7, 6.5, 7.3, 8.2, 10, 11.9, 13, 14, 15, 16.5 };
+            gfp->compression_ratio = cmp[gfp->VBR_q];
+        }
+        break;
+    case vbr_abr:
+        gfp->compression_ratio =
+            gfp->out_samplerate * 16 * gfc->channels_out / (1.e3 * gfp->VBR_mean_bitrate_kbps);
+        break;
+    default:
+        gfp->compression_ratio = gfp->out_samplerate * 16 * gfc->channels_out / (1.e3 * gfp->brate);
+        break;
+    }
+
+
+    /* mode = -1 (not set by user) or
+     * mode = MONO (because of only 1 input channel).
+     * If mode has not been set, then select J-STEREO
+     */
+    if (gfp->mode == NOT_SET) {
+        gfp->mode = JOINT_STEREO;
+    }
+
+
+    /* apply user driven high pass filter */
+    if (gfp->highpassfreq > 0) {
+        gfc->highpass1 = 2. * gfp->highpassfreq;
+
+        if (gfp->highpasswidth >= 0)
+            gfc->highpass2 = 2. * (gfp->highpassfreq + gfp->highpasswidth);
+        else            /* 0% above on default */
+            gfc->highpass2 = (1 + 0.00) * 2. * gfp->highpassfreq;
+
+        gfc->highpass1 /= gfp->out_samplerate;
+        gfc->highpass2 /= gfp->out_samplerate;
+    }
+    else {
+        gfc->highpass1 = 0;
+        gfc->highpass2 = 0;
+    }
+    /* apply user driven low pass filter */
+    if (gfp->lowpassfreq > 0) {
+        gfc->lowpass2 = 2. * gfp->lowpassfreq;
+        if (gfp->lowpasswidth >= 0) {
+            gfc->lowpass1 = 2. * (gfp->lowpassfreq - gfp->lowpasswidth);
+            if (gfc->lowpass1 < 0) /* has to be >= 0 */
+                gfc->lowpass1 = 0;
+        }
+        else {          /* 0% below on default */
+            gfc->lowpass1 = (1 - 0.00) * 2. * gfp->lowpassfreq;
+        }
+        gfc->lowpass1 /= gfp->out_samplerate;
+        gfc->lowpass2 /= gfp->out_samplerate;
+    }
+    else {
+        gfc->lowpass1 = 0;
+        gfc->lowpass2 = 0;
+    }
+
+
+
+
+  /**********************************************************************/
+    /* compute info needed for polyphase filter (filter type==0, default) */
+  /**********************************************************************/
+    lame_init_params_ppflt(gfp);
+
+
+  /*******************************************************
+   * samplerate and bitrate index
+   *******************************************************/
+    gfc->samplerate_index = SmpFrqIndex(gfp->out_samplerate, &gfp->version);
+    if (gfc->samplerate_index < 0) {
+        freegfc(gfc);
+        gfp->internal_flags = NULL;
+        return -1;
+    }
+
+    if (gfp->VBR == vbr_off) {
+        if (gfp->free_format) {
+            gfc->bitrate_index = 0;
+        }
+        else {
+            gfp->brate = FindNearestBitrate(gfp->brate, gfp->version, gfp->out_samplerate);
+            gfc->bitrate_index = BitrateIndex(gfp->brate, gfp->version, gfp->out_samplerate);
+            if (gfc->bitrate_index <= 0) {
+                freegfc(gfc);
+                gfp->internal_flags = NULL;
+                return -1;
+            }
+        }
+    }
+    else {
+        gfc->bitrate_index = 1;
+    }
+
+    /* for CBR, we will write an "info" tag. */
+    /*    if ((gfp->VBR == vbr_off))  */
+    /*  gfp->bWriteVbrTag = 0; */
+
+    if (gfp->analysis)
+        gfp->bWriteVbrTag = 0;
+
+    /* some file options not allowed if output is: not specified or stdout */
+    if (gfc->pinfo != NULL)
+        gfp->bWriteVbrTag = 0; /* disable Xing VBR tag */
+
+    init_bit_stream_w(gfc);
+
+    j = gfc->samplerate_index + (3 * gfp->version) + 6 * (gfp->out_samplerate < 16000);
+    for (i = 0; i < SBMAX_l + 1; i++)
+        gfc->scalefac_band.l[i] = sfBandIndex[j].l[i];
+
+    for (i = 0; i < PSFB21 + 1; i++) {
+        int const size = (gfc->scalefac_band.l[22] - gfc->scalefac_band.l[21]) / PSFB21;
+        int const start = gfc->scalefac_band.l[21] + i * size;
+        gfc->scalefac_band.psfb21[i] = start;
+    }
+    gfc->scalefac_band.psfb21[PSFB21] = 576;
+
+    for (i = 0; i < SBMAX_s + 1; i++)
+        gfc->scalefac_band.s[i] = sfBandIndex[j].s[i];
+
+    for (i = 0; i < PSFB12 + 1; i++) {
+        int const size = (gfc->scalefac_band.s[13] - gfc->scalefac_band.s[12]) / PSFB12;
+        int const start = gfc->scalefac_band.s[12] + i * size;
+        gfc->scalefac_band.psfb12[i] = start;
+    }
+    gfc->scalefac_band.psfb12[PSFB12] = 192;
+
+    /* determine the mean bitrate for main data */
+    if (gfp->version == 1) /* MPEG 1 */
+        gfc->sideinfo_len = (gfc->channels_out == 1) ? 4 + 17 : 4 + 32;
+    else                /* MPEG 2 */
+        gfc->sideinfo_len = (gfc->channels_out == 1) ? 4 + 9 : 4 + 17;
+
+    if (gfp->error_protection)
+        gfc->sideinfo_len += 2;
+
+    (void) lame_init_bitstream(gfp);
+
+    gfc->Class_ID = LAME_ID;
+
+    /*if (gfp->exp_nspsytune & 1) */  {
+        int     k;
+
+        for (k = 0; k < 19; k++)
+            gfc->nsPsy.pefirbuf[k] = 700 * gfc->mode_gr * gfc->channels_out;
+
+        if (gfp->ATHtype == -1)
+            gfp->ATHtype = 4;
+    }
+
+    assert(gfp->VBR_q <= 9);
+    assert(gfp->VBR_q >= 0);
+
+    switch (gfp->VBR) {
+
+    case vbr_mt:
+        gfp->VBR = vbr_mtrh;
+        /*lint --fallthrough */
+    case vbr_mtrh:{
+            if (gfp->useTemporal < 0) {
+                gfp->useTemporal = 0; /* off by default for this VBR mode */
+            }
+
+            (void) apply_preset(gfp, 500 - (gfp->VBR_q * 10), 0);
+            /*  The newer VBR code supports only a limited
+               subset of quality levels:
+               9-5=5 are the same, uses x^3/4 quantization
+               4-0=0 are the same  5 plus best huffman divide code
+             */
+            if (gfp->quality < 0)
+                gfp->quality = LAME_DEFAULT_QUALITY;
+            if (gfp->quality < 5)
+                gfp->quality = 0;
+            if (gfp->quality > 5)
+                gfp->quality = 5;
+
+            gfc->PSY->mask_adjust = gfp->maskingadjust;
+            gfc->PSY->mask_adjust_short = gfp->maskingadjust_short;
+
+            /*  sfb21 extra only with MPEG-1 at higher sampling rates
+             */
+            if (gfp->experimentalY)
+                gfc->sfb21_extra = 0;
+            else
+                gfc->sfb21_extra = (gfp->out_samplerate > 44000);
+
+            gfc->iteration_loop = VBR_new_iteration_loop;
+            break;
+
+        }
+    case vbr_rh:{
+
+            (void) apply_preset(gfp, 500 - (gfp->VBR_q * 10), 0);
+
+            gfc->PSY->mask_adjust = gfp->maskingadjust;
+            gfc->PSY->mask_adjust_short = gfp->maskingadjust_short;
+
+            /*  sfb21 extra only with MPEG-1 at higher sampling rates
+             */
+            if (gfp->experimentalY)
+                gfc->sfb21_extra = 0;
+            else
+                gfc->sfb21_extra = (gfp->out_samplerate > 44000);
+
+            /*  VBR needs at least the output of GPSYCHO,
+             *  so we have to garantee that by setting a minimum
+             *  quality level, actually level 6 does it.
+             *  down to level 6
+             */
+            if (gfp->quality > 6)
+                gfp->quality = 6;
+
+
+            if (gfp->quality < 0)
+                gfp->quality = LAME_DEFAULT_QUALITY;
+
+            gfc->iteration_loop = VBR_old_iteration_loop;
+            break;
+        }
+
+    default:           /* cbr/abr */  {
+            vbr_mode vbrmode;
+
+            /*  no sfb21 extra with CBR code
+             */
+            gfc->sfb21_extra = 0;
+
+            if (gfp->quality < 0)
+                gfp->quality = LAME_DEFAULT_QUALITY;
+
+
+            vbrmode = lame_get_VBR(gfp);
+            if (vbrmode == vbr_off)
+                (void) lame_set_VBR_mean_bitrate_kbps(gfp, gfp->brate);
+            /* second, set parameters depending on bitrate */
+            (void) apply_preset(gfp, gfp->VBR_mean_bitrate_kbps, 0);
+            (void) lame_set_VBR(gfp, vbrmode);
+
+            gfc->PSY->mask_adjust = gfp->maskingadjust;
+            gfc->PSY->mask_adjust_short = gfp->maskingadjust_short;
+
+            if (vbrmode == vbr_off) {
+                gfc->iteration_loop = CBR_iteration_loop;
+            }
+            else {
+                gfc->iteration_loop = ABR_iteration_loop;
+            }
+            break;
+        }
+    }
+
+    /*initialize default values common for all modes */
+
+
+    if (lame_get_VBR(gfp) != vbr_off) { /* choose a min/max bitrate for VBR */
+        /* if the user didn't specify VBR_max_bitrate: */
+        gfc->VBR_min_bitrate = 1; /* default: allow   8 kbps (MPEG-2) or  32 kbps (MPEG-1) */
+        gfc->VBR_max_bitrate = 14; /* default: allow 160 kbps (MPEG-2) or 320 kbps (MPEG-1) */
+        if (gfp->out_samplerate < 16000)
+            gfc->VBR_max_bitrate = 8; /* default: allow 64 kbps (MPEG-2.5) */
+        if (gfp->VBR_min_bitrate_kbps) {
+            gfp->VBR_min_bitrate_kbps =
+                FindNearestBitrate(gfp->VBR_min_bitrate_kbps, gfp->version, gfp->out_samplerate);
+            gfc->VBR_min_bitrate =
+                BitrateIndex(gfp->VBR_min_bitrate_kbps, gfp->version, gfp->out_samplerate);
+            if (gfc->VBR_min_bitrate < 0)
+                return -1;
+        }
+        if (gfp->VBR_max_bitrate_kbps) {
+            gfp->VBR_max_bitrate_kbps =
+                FindNearestBitrate(gfp->VBR_max_bitrate_kbps, gfp->version, gfp->out_samplerate);
+            gfc->VBR_max_bitrate =
+                BitrateIndex(gfp->VBR_max_bitrate_kbps, gfp->version, gfp->out_samplerate);
+            if (gfc->VBR_max_bitrate < 0)
+                return -1;
+        }
+        gfp->VBR_min_bitrate_kbps = bitrate_table[gfp->version][gfc->VBR_min_bitrate];
+        gfp->VBR_max_bitrate_kbps = bitrate_table[gfp->version][gfc->VBR_max_bitrate];
+        gfp->VBR_mean_bitrate_kbps =
+            Min(bitrate_table[gfp->version][gfc->VBR_max_bitrate], gfp->VBR_mean_bitrate_kbps);
+        gfp->VBR_mean_bitrate_kbps =
+            Max(bitrate_table[gfp->version][gfc->VBR_min_bitrate], gfp->VBR_mean_bitrate_kbps);
+    }
+
+
+    /*  just another daily changing developer switch  */
+    if (gfp->tune) {
+        gfc->PSY->mask_adjust += gfp->tune_value_a;
+        gfc->PSY->mask_adjust_short += gfp->tune_value_a;
+    }
+
+    /* initialize internal qval settings */
+    lame_init_qval(gfp);
+
+
+    /*  automatic ATH adjustment on
+     */
+    if (gfp->athaa_type < 0)
+        gfc->ATH->use_adjust = 3;
+    else
+        gfc->ATH->use_adjust = gfp->athaa_type;
+
+
+    /* initialize internal adaptive ATH settings  -jd */
+    gfc->ATH->aa_sensitivity_p = pow(10.0, gfp->athaa_sensitivity / -10.0);
+
+
+    if (gfp->short_blocks == short_block_not_set) {
+        gfp->short_blocks = short_block_allowed;
+    }
+
+    /*Note Jan/2003: Many hardware decoders cannot handle short blocks in regular
+       stereo mode unless they are coupled (same type in both channels)
+       it is a rare event (1 frame per min. or so) that LAME would use
+       uncoupled short blocks, so lets turn them off until we decide
+       how to handle this.  No other encoders allow uncoupled short blocks,
+       even though it is in the standard.  */
+    /* rh 20040217: coupling makes no sense for mono and dual-mono streams
+     */
+    if (gfp->short_blocks == short_block_allowed
+        && (gfp->mode == JOINT_STEREO || gfp->mode == STEREO)) {
+        gfp->short_blocks = short_block_coupled;
+    }
+
+
+    if (lame_get_quant_comp(gfp) < 0)
+        (void) lame_set_quant_comp(gfp, 1);
+    if (lame_get_quant_comp_short(gfp) < 0)
+        (void) lame_set_quant_comp_short(gfp, 0);
+
+    if (lame_get_msfix(gfp) < 0)
+        lame_set_msfix(gfp, 0);
+
+    /* select psychoacoustic model */
+    (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 1);
+
+    if (lame_get_short_threshold_lrm(gfp) < 0)
+        (void) lame_set_short_threshold_lrm(gfp, NSATTACKTHRE);
+    if (lame_get_short_threshold_s(gfp) < 0)
+        (void) lame_set_short_threshold_s(gfp, NSATTACKTHRE_S);
+
+    if (gfp->scale < 0)
+        gfp->scale = 1;
+
+    if (gfp->ATHtype < 0)
+        gfp->ATHtype = 4;
+
+    if (gfp->ATHcurve < 0)
+        gfp->ATHcurve = 4;
+
+    if (gfp->athaa_loudapprox < 0)
+        gfp->athaa_loudapprox = 2;
+
+    if (gfp->interChRatio < 0)
+        gfp->interChRatio = 0;
+
+    if (gfp->useTemporal < 0)
+        gfp->useTemporal = 1; /* on by default */
+
+
+
+    /* padding method as described in
+     * "MPEG-Layer3 / Bitstream Syntax and Decoding"
+     * by Martin Sieler, Ralph Sperschneider
+     *
+     * note: there is no padding for the very first frame
+     *
+     * Robert Hegemann 2000-06-22
+     */
+    gfc->slot_lag = gfc->frac_SpF = 0;
+    if (gfp->VBR == vbr_off)
+        gfc->slot_lag = gfc->frac_SpF
+            = ((gfp->version + 1) * 72000L * gfp->brate) % gfp->out_samplerate;
+
+    iteration_init(gfp);
+    (void) psymodel_init(gfp);
+
+    return 0;
+}
+
+/*
+ *  print_config
+ *
+ *  Prints some selected information about the coding parameters via
+ *  the macro command MSGF(), which is currently mapped to lame_errorf
+ *  (reports via a error function?), which is a printf-like function
+ *  for <stderr>.
+ */
+
+void
+lame_print_config(const lame_global_flags * gfp)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    double const out_samplerate = gfp->out_samplerate;
+    double const in_samplerate = gfp->out_samplerate * gfc->resample_ratio;
+
+    MSGF(gfc, "LAME %s %s (%s)\n", get_lame_version(), get_lame_os_bitness(), get_lame_url());
+
+#if (LAME_ALPHA_VERSION)
+    MSGF(gfc, "warning: alpha versions should be used for testing only\n");
+#endif
+    if (gfc->CPU_features.MMX
+        || gfc->CPU_features.AMD_3DNow || gfc->CPU_features.SSE || gfc->CPU_features.SSE2) {
+        int     fft_asm_used = 0;
+#ifdef HAVE_NASM
+        if (gfc->CPU_features.AMD_3DNow) {
+            fft_asm_used = 1;
+        }
+        else if (gfc->CPU_features.SSE) {
+            fft_asm_used = 2;
+        }
+        else
+#endif
+        {
+            fft_asm_used = 0;
+        }
+        MSGF(gfc, "CPU features: ");
+
+        if (gfc->CPU_features.MMX) {
+#ifdef MMX_choose_table
+            MSGF(gfc, "MMX (ASM used)");
+#else
+            MSGF(gfc, "MMX");
+#endif
+        }
+        if (gfc->CPU_features.AMD_3DNow) {
+            if (fft_asm_used == 1) {
+                MSGF(gfc, ", 3DNow! (ASM used)");
+            }
+            else {
+                MSGF(gfc, ", 3DNow!");
+            }
+        }
+        if (gfc->CPU_features.SSE) {
+#if defined(HAVE_XMMINTRIN_H)
+            MSGF(gfc, ", SSE (ASM used)");
+#else
+            if (fft_asm_used == 2) {
+                MSGF(gfc, ", SSE (ASM used)");
+            }
+            else {
+                MSGF(gfc, ", SSE");
+            }
+#endif
+        }
+        if (gfc->CPU_features.SSE2) {
+            MSGF(gfc, ", SSE2");
+        }
+        MSGF(gfc, "\n");
+    }
+
+    if (gfp->num_channels == 2 && gfc->channels_out == 1 /* mono */ ) {
+        MSGF(gfc, "Autoconverting from stereo to mono. Setting encoding to mono mode.\n");
+    }
+
+    if (NEQ(gfc->resample_ratio, 1.)) {
+        MSGF(gfc, "Resampling:  input %g kHz  output %g kHz\n",
+             1.e-3 * in_samplerate, 1.e-3 * out_samplerate);
+    }
+
+    if (gfc->highpass2 > 0.)
+        MSGF(gfc,
+             "Using polyphase highpass filter, transition band: %5.0f Hz - %5.0f Hz\n",
+             0.5 * gfc->highpass1 * out_samplerate, 0.5 * gfc->highpass2 * out_samplerate);
+    if (0. < gfc->lowpass1 || 0. < gfc->lowpass2) {
+        MSGF(gfc,
+             "Using polyphase lowpass filter, transition band: %5.0f Hz - %5.0f Hz\n",
+             0.5 * gfc->lowpass1 * out_samplerate, 0.5 * gfc->lowpass2 * out_samplerate);
+    }
+    else {
+        MSGF(gfc, "polyphase lowpass filter disabled\n");
+    }
+
+    if (gfp->free_format) {
+        MSGF(gfc, "Warning: many decoders cannot handle free format bitstreams\n");
+        if (gfp->brate > 320) {
+            MSGF(gfc,
+                 "Warning: many decoders cannot handle free format bitrates >320 kbps (see documentation)\n");
+        }
+    }
+}
+
+
+/**     rh:
+ *      some pretty printing is very welcome at this point!
+ *      so, if someone is willing to do so, please do it!
+ *      add more, if you see more...
+ */
+void
+lame_print_internals(const lame_global_flags * gfp)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    const char *pc = "";
+
+    /*  compiler/processor optimizations, operational, etc.
+     */
+    MSGF(gfc, "\nmisc:\n\n");
+
+    MSGF(gfc, "\tscaling: %g\n", gfp->scale);
+    MSGF(gfc, "\tch0 (left) scaling: %g\n", gfp->scale_left);
+    MSGF(gfc, "\tch1 (right) scaling: %g\n", gfp->scale_right);
+    switch (gfc->use_best_huffman) {
+    default:
+        pc = "normal";
+        break;
+    case 1:
+        pc = "best (outside loop)";
+        break;
+    case 2:
+        pc = "best (inside loop, slow)";
+        break;
+    }
+    MSGF(gfc, "\thuffman search: %s\n", pc);
+    MSGF(gfc, "\texperimental Y=%d\n", gfp->experimentalY);
+    MSGF(gfc, "\t...\n");
+
+    /*  everything controlling the stream format
+     */
+    MSGF(gfc, "\nstream format:\n\n");
+    switch (gfp->version) {
+    case 0:
+        pc = "2.5";
+        break;
+    case 1:
+        pc = "1";
+        break;
+    case 2:
+        pc = "2";
+        break;
+    default:
+        pc = "?";
+        break;
+    }
+    MSGF(gfc, "\tMPEG-%s Layer 3\n", pc);
+    switch (gfp->mode) {
+    case JOINT_STEREO:
+        pc = "joint stereo";
+        break;
+    case STEREO:
+        pc = "stereo";
+        break;
+    case DUAL_CHANNEL:
+        pc = "dual channel";
+        break;
+    case MONO:
+        pc = "mono";
+        break;
+    case NOT_SET:
+        pc = "not set (error)";
+        break;
+    default:
+        pc = "unknown (error)";
+        break;
+    }
+    MSGF(gfc, "\t%d channel - %s\n", gfc->channels_out, pc);
+
+    switch (gfp->VBR) {
+    case vbr_off:
+        pc = "off";
+        break;
+    default:
+        pc = "all";
+        break;
+    }
+    MSGF(gfc, "\tpadding: %s\n", pc);
+
+    if (vbr_default == gfp->VBR)
+        pc = "(default)";
+    else if (gfp->free_format)
+        pc = "(free format)";
+    else
+        pc = "";
+    switch (gfp->VBR) {
+    case vbr_off:
+        MSGF(gfc, "\tconstant bitrate - CBR %s\n", pc);
+        break;
+    case vbr_abr:
+        MSGF(gfc, "\tvariable bitrate - ABR %s\n", pc);
+        break;
+    case vbr_rh:
+        MSGF(gfc, "\tvariable bitrate - VBR rh %s\n", pc);
+        break;
+    case vbr_mt:
+        MSGF(gfc, "\tvariable bitrate - VBR mt %s\n", pc);
+        break;
+    case vbr_mtrh:
+        MSGF(gfc, "\tvariable bitrate - VBR mtrh %s\n", pc);
+        break;
+    default:
+        MSGF(gfc, "\t ?? oops, some new one ?? \n");
+        break;
+    }
+    if (gfp->bWriteVbrTag)
+        MSGF(gfc, "\tusing LAME Tag\n");
+    MSGF(gfc, "\t...\n");
+
+    /*  everything controlling psychoacoustic settings, like ATH, etc.
+     */
+    MSGF(gfc, "\npsychoacoustic:\n\n");
+
+    switch (gfp->short_blocks) {
+    default:
+    case short_block_not_set:
+        pc = "?";
+        break;
+    case short_block_allowed:
+        pc = "allowed";
+        break;
+    case short_block_coupled:
+        pc = "channel coupled";
+        break;
+    case short_block_dispensed:
+        pc = "dispensed";
+        break;
+    case short_block_forced:
+        pc = "forced";
+        break;
+    }
+    MSGF(gfc, "\tusing short blocks: %s\n", pc);
+    MSGF(gfc, "\tsubblock gain: %d\n", gfc->subblock_gain);
+    MSGF(gfc, "\tadjust masking: %g dB\n", gfc->PSY->mask_adjust);
+    MSGF(gfc, "\tadjust masking short: %g dB\n", gfc->PSY->mask_adjust_short);
+    MSGF(gfc, "\tquantization comparison: %d\n", gfp->quant_comp);
+    MSGF(gfc, "\t ^ comparison short blocks: %d\n", gfp->quant_comp_short);
+    MSGF(gfc, "\tnoise shaping: %d\n", gfc->noise_shaping);
+    MSGF(gfc, "\t ^ amplification: %d\n", gfc->noise_shaping_amp);
+    MSGF(gfc, "\t ^ stopping: %d\n", gfc->noise_shaping_stop);
+
+    pc = "using";
+    if (gfp->ATHshort)
+        pc = "the only masking for short blocks";
+    if (gfp->ATHonly)
+        pc = "the only masking";
+    if (gfp->noATH)
+        pc = "not used";
+    MSGF(gfc, "\tATH: %s\n", pc);
+    MSGF(gfc, "\t ^ type: %d\n", gfp->ATHtype);
+    MSGF(gfc, "\t ^ shape: %g%s\n", gfp->ATHcurve, " (only for type 4)");
+    MSGF(gfc, "\t ^ level adjustement: %g\n", gfp->ATHlower);
+    MSGF(gfc, "\t ^ adjust type: %d\n", gfc->ATH->use_adjust);
+    MSGF(gfc, "\t ^ adjust sensitivity power: %f\n", gfc->ATH->aa_sensitivity_p);
+    MSGF(gfc, "\t ^ adapt threshold type: %d\n", gfp->athaa_loudapprox);
+
+    MSGF(gfc, "\texperimental psy tunings by Naoki Shibata\n");
+    MSGF(gfc, "\t   adjust masking bass=%g dB, alto=%g dB, treble=%g dB, sfb21=%g dB\n",
+         10 * log10(gfc->nsPsy.longfact[0]),
+         10 * log10(gfc->nsPsy.longfact[7]),
+         10 * log10(gfc->nsPsy.longfact[14]), 10 * log10(gfc->nsPsy.longfact[21]));
+
+    pc = gfp->useTemporal ? "yes" : "no";
+    MSGF(gfc, "\tusing temporal masking effect: %s\n", pc);
+    MSGF(gfc, "\tinterchannel masking ratio: %g\n", gfp->interChRatio);
+    MSGF(gfc, "\t...\n");
+
+    /*  that's all ?
+     */
+    MSGF(gfc, "\n");
+    return;
+}
+
+
+
+/* routine to feed exactly one frame (gfp->framesize) worth of data to the
+encoding engine.  All buffering, resampling, etc, handled by calling
+program.
+*/
+static int
+lame_encode_frame(lame_global_flags * gfp,
+                  sample_t inbuf_l[], sample_t inbuf_r[], unsigned char *mp3buf, int mp3buf_size)
+{
+    int     ret;
+    ret = lame_encode_mp3_frame(gfp, inbuf_l, inbuf_r, mp3buf, mp3buf_size);
+    gfp->frameNum++;
+    return ret;
+}
+
+static int
+update_inbuffer_size(lame_internal_flags * gfc, const int nsamples)
+{
+    if (gfc->in_buffer_0 == 0 || gfc->in_buffer_nsamples < nsamples) {
+        if (gfc->in_buffer_0) {
+            free(gfc->in_buffer_0);
+        }
+        if (gfc->in_buffer_1) {
+            free(gfc->in_buffer_1);
+        }
+        gfc->in_buffer_0 = calloc(sizeof(sample_t), nsamples);
+        gfc->in_buffer_1 = calloc(sizeof(sample_t), nsamples);
+        gfc->in_buffer_nsamples = nsamples;
+    }
+    if (gfc->in_buffer_0 == NULL || gfc->in_buffer_1 == NULL) {
+        if (gfc->in_buffer_0) {
+            free(gfc->in_buffer_0);
+        }
+        if (gfc->in_buffer_1) {
+            free(gfc->in_buffer_1);
+        }
+        gfc->in_buffer_0 = 0;
+        gfc->in_buffer_1 = 0;
+        gfc->in_buffer_nsamples = 0;
+        ERRORF(gfc, "Error: can't allocate in_buffer buffer\n");
+        return -2;
+    }
+    return 0;
+}
+
+
+static int
+calcNeeded(lame_global_flags* gfp)
+{
+    int mf_needed;
+    /* some sanity checks */
+#if ENCDELAY < MDCTDELAY
+# error ENCDELAY is less than MDCTDELAY, see encoder.h
+#endif
+#if FFTOFFSET > BLKSIZE
+# error FFTOFFSET is greater than BLKSIZE, see encoder.h
+#endif
+
+    mf_needed = BLKSIZE + gfp->framesize - FFTOFFSET; /* amount needed for FFT */
+    /*mf_needed = Max(mf_needed, 286 + 576 * (1 + gfc->mode_gr)); */
+    mf_needed = Max(mf_needed, 512 + gfp->framesize - 32);
+
+    assert(MFSIZE >= mf_needed);
+    
+    return mf_needed;
+}
+
+/*
+ * THE MAIN LAME ENCODING INTERFACE
+ * mt 3/00
+ *
+ * input pcm data, output (maybe) mp3 frames.
+ * This routine handles all buffering, resampling and filtering for you.
+ * The required mp3buffer_size can be computed from num_samples,
+ * samplerate and encoding rate, but here is a worst case estimate:
+ *
+ * mp3buffer_size in bytes = 1.25*num_samples + 7200
+ *
+ * return code = number of bytes output in mp3buffer.  can be 0
+ *
+ * NOTE: this routine uses LAME's internal PCM data representation,
+ * 'sample_t'.  It should not be used by any application.
+ * applications should use lame_encode_buffer(),
+ *                         lame_encode_buffer_float()
+ *                         lame_encode_buffer_int()
+ * etc... depending on what type of data they are working with.
+*/
+static int
+lame_encode_buffer_sample_t(lame_global_flags * gfp,
+                            sample_t buffer_l[],
+                            sample_t buffer_r[],
+                            int nsamples, unsigned char *mp3buf, const int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     mp3size = 0, ret, i, ch, mf_needed;
+    int     mp3out;
+    sample_t *mfbuf[2];
+    sample_t *in_buffer[2];
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    if (nsamples == 0)
+        return 0;
+
+    /* copy out any tags that may have been written into bitstream */
+    mp3out = copy_buffer(gfc, mp3buf, mp3buf_size, 0);
+    if (mp3out < 0)
+        return mp3out;  /* not enough buffer space */
+    mp3buf += mp3out;
+    mp3size += mp3out;
+
+
+    in_buffer[0] = buffer_l;
+    in_buffer[1] = buffer_r;
+
+
+    /* Apply user defined re-scaling */
+
+    /* user selected scaling of the samples */
+    if (NEQ(gfp->scale, 0) && NEQ(gfp->scale, 1.0)) {
+        for (i = 0; i < nsamples; ++i) {
+            in_buffer[0][i] *= gfp->scale;
+            if (gfc->channels_out == 2)
+                in_buffer[1][i] *= gfp->scale;
+        }
+    }
+
+    /* user selected scaling of the channel 0 (left) samples */
+    if (NEQ(gfp->scale_left, 0) && NEQ(gfp->scale_left, 1.0)) {
+        for (i = 0; i < nsamples; ++i) {
+            in_buffer[0][i] *= gfp->scale_left;
+        }
+    }
+
+    /* user selected scaling of the channel 1 (right) samples */
+    if (NEQ(gfp->scale_right, 0) && NEQ(gfp->scale_right, 1.0)) {
+        for (i = 0; i < nsamples; ++i) {
+            in_buffer[1][i] *= gfp->scale_right;
+        }
+    }
+
+    /* Downsample to Mono if 2 channels in and 1 channel out */
+    if (gfp->num_channels == 2 && gfc->channels_out == 1) {
+        for (i = 0; i < nsamples; ++i) {
+            in_buffer[0][i] = 0.5 * ((FLOAT) in_buffer[0][i] + in_buffer[1][i]);
+            in_buffer[1][i] = 0.0;
+        }
+    }
+
+    mf_needed = calcNeeded(gfp);
+
+    mfbuf[0] = gfc->mfbuf[0];
+    mfbuf[1] = gfc->mfbuf[1];
+
+    while (nsamples > 0) {
+        sample_t const *in_buffer_ptr[2];
+        int     n_in = 0;    /* number of input samples processed with fill_buffer */
+        int     n_out = 0;   /* number of samples output with fill_buffer */
+        /* n_in <> n_out if we are resampling */
+
+        in_buffer_ptr[0] = in_buffer[0];
+        in_buffer_ptr[1] = in_buffer[1];
+        /* copy in new samples into mfbuf, with resampling */
+        fill_buffer(gfp, mfbuf, &in_buffer_ptr[0], nsamples, &n_in, &n_out);
+
+        /* compute ReplayGain of resampled input if requested */
+        if (gfc->findReplayGain && !gfc->decode_on_the_fly)
+            if (AnalyzeSamples
+                (gfc->rgdata, &mfbuf[0][gfc->mf_size], &mfbuf[1][gfc->mf_size], n_out,
+                 gfc->channels_out) == GAIN_ANALYSIS_ERROR)
+                return -6;
+
+
+
+        /* update in_buffer counters */
+        nsamples -= n_in;
+        in_buffer[0] += n_in;
+        if (gfc->channels_out == 2)
+            in_buffer[1] += n_in;
+
+        /* update mfbuf[] counters */
+        gfc->mf_size += n_out;
+        assert(gfc->mf_size <= MFSIZE);
+
+        /* lame_encode_flush may have set gfc->mf_sample_to_encode to 0
+         * so we have to reinitialize it here when that happened.
+         */
+        if (gfc->mf_samples_to_encode < 1) {
+            gfc->mf_samples_to_encode = ENCDELAY + POSTDELAY;
+        }
+        gfc->mf_samples_to_encode += n_out;
+
+
+        if (gfc->mf_size >= mf_needed) {
+            /* encode the frame.  */
+            /* mp3buf              = pointer to current location in buffer */
+            /* mp3buf_size         = size of original mp3 output buffer */
+            /*                     = 0 if we should not worry about the */
+            /*                       buffer size because calling program is  */
+            /*                       to lazy to compute it */
+            /* mp3size             = size of data written to buffer so far */
+            /* mp3buf_size-mp3size = amount of space avalable  */
+
+            int     buf_size = mp3buf_size - mp3size;
+            if (mp3buf_size == 0)
+                buf_size = 0;
+
+            ret = lame_encode_frame(gfp, mfbuf[0], mfbuf[1], mp3buf, buf_size);
+
+            if (ret < 0)
+                return ret;
+            mp3buf += ret;
+            mp3size += ret;
+
+            /* shift out old samples */
+            gfc->mf_size -= gfp->framesize;
+            gfc->mf_samples_to_encode -= gfp->framesize;
+            for (ch = 0; ch < gfc->channels_out; ch++)
+                for (i = 0; i < gfc->mf_size; i++)
+                    mfbuf[ch][i] = mfbuf[ch][i + gfp->framesize];
+        }
+    }
+    assert(nsamples == 0);
+
+    return mp3size;
+}
+
+
+int
+lame_encode_buffer(lame_global_flags * gfp,
+                   const short int buffer_l[],
+                   const short int buffer_r[],
+                   const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    sample_t *in_buffer[2];
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    if (nsamples == 0)
+        return 0;
+
+    if (update_inbuffer_size(gfc, nsamples) != 0) {
+        return -2;
+    }
+
+    in_buffer[0] = gfc->in_buffer_0;
+    in_buffer[1] = gfc->in_buffer_1;
+
+    /* make a copy of input buffer, changing type to sample_t */
+    for (i = 0; i < nsamples; i++) {
+        in_buffer[0][i] = buffer_l[i];
+        if (gfc->channels_in > 1)
+            in_buffer[1][i] = buffer_r[i];
+    }
+
+    return lame_encode_buffer_sample_t(gfp, in_buffer[0], in_buffer[1],
+                                       nsamples, mp3buf, mp3buf_size);
+}
+
+
+int
+lame_encode_buffer_float(lame_global_flags * gfp,
+                         const float buffer_l[],
+                         const float buffer_r[],
+                         const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    sample_t *in_buffer[2];
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    if (nsamples == 0)
+        return 0;
+
+    if (update_inbuffer_size(gfc, nsamples) != 0) {
+        return -2;
+    }
+
+    in_buffer[0] = gfc->in_buffer_0;
+    in_buffer[1] = gfc->in_buffer_1;
+
+    /* make a copy of input buffer, changing type to sample_t */
+    for (i = 0; i < nsamples; i++) {
+        in_buffer[0][i] = buffer_l[i];
+        if (gfc->channels_in > 1)
+            in_buffer[1][i] = buffer_r[i];
+    }
+
+    return lame_encode_buffer_sample_t(gfp, in_buffer[0], in_buffer[1],
+                                       nsamples, mp3buf, mp3buf_size);
+}
+
+
+int
+lame_encode_buffer_int(lame_global_flags * gfp,
+                       const int buffer_l[],
+                       const int buffer_r[],
+                       const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    sample_t *in_buffer[2];
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    if (nsamples == 0)
+        return 0;
+
+    if (update_inbuffer_size(gfc, nsamples) != 0) {
+        return -2;
+    }
+
+    in_buffer[0] = gfc->in_buffer_0;
+    in_buffer[1] = gfc->in_buffer_1;
+
+    /* make a copy of input buffer, changing type to sample_t */
+    for (i = 0; i < nsamples; i++) {
+        /* internal code expects +/- 32768.0 */
+        in_buffer[0][i] = buffer_l[i] * (1.0 / (1L << (8 * sizeof(int) - 16)));
+        if (gfc->channels_in > 1)
+            in_buffer[1][i] = buffer_r[i] * (1.0 / (1L << (8 * sizeof(int) - 16)));
+    }
+
+    return lame_encode_buffer_sample_t(gfp, in_buffer[0], in_buffer[1],
+                                       nsamples, mp3buf, mp3buf_size);
+}
+
+
+
+
+int
+lame_encode_buffer_long2(lame_global_flags * gfp,
+                         const long buffer_l[],
+                         const long buffer_r[],
+                         const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    sample_t *in_buffer[2];
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    if (nsamples == 0)
+        return 0;
+
+    if (update_inbuffer_size(gfc, nsamples) != 0) {
+        return -2;
+    }
+
+    in_buffer[0] = gfc->in_buffer_0;
+    in_buffer[1] = gfc->in_buffer_1;
+
+    /* make a copy of input buffer, changing type to sample_t */
+    for (i = 0; i < nsamples; i++) {
+        /* internal code expects +/- 32768.0 */
+        in_buffer[0][i] = buffer_l[i] * (1.0 / (1L << (8 * sizeof(long) - 16)));
+        if (gfc->channels_in > 1)
+            in_buffer[1][i] = buffer_r[i] * (1.0 / (1L << (8 * sizeof(long) - 16)));
+    }
+
+    return lame_encode_buffer_sample_t(gfp, in_buffer[0], in_buffer[1],
+                                       nsamples, mp3buf, mp3buf_size);
+
+}
+
+
+
+int
+lame_encode_buffer_long(lame_global_flags * gfp,
+                        const long buffer_l[],
+                        const long buffer_r[],
+                        const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    sample_t *in_buffer[2];
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    if (nsamples == 0)
+        return 0;
+
+    if (update_inbuffer_size(gfc, nsamples) != 0) {
+        return -2;
+    }
+
+    in_buffer[0] = gfc->in_buffer_0;
+    in_buffer[1] = gfc->in_buffer_1;
+
+    /* make a copy of input buffer, changing type to sample_t */
+    for (i = 0; i < nsamples; i++) {
+        in_buffer[0][i] = buffer_l[i];
+        if (gfc->channels_in > 1)
+            in_buffer[1][i] = buffer_r[i];
+    }
+
+    return lame_encode_buffer_sample_t(gfp, in_buffer[0], in_buffer[1],
+                                       nsamples, mp3buf, mp3buf_size);
+}
+
+
+
+
+
+
+
+
+
+
+
+int
+lame_encode_buffer_interleaved(lame_global_flags * gfp,
+                               short int buffer[],
+                               int nsamples, unsigned char *mp3buf, int mp3buf_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i;
+    sample_t *in_buffer[2];
+
+    if (update_inbuffer_size(gfc, nsamples) != 0) {
+        return -2;
+    }
+
+    in_buffer[0] = gfc->in_buffer_0;
+    in_buffer[1] = gfc->in_buffer_1;
+
+    for (i = 0; i < nsamples; i++) {
+        in_buffer[0][i] = buffer[2 * i];
+        in_buffer[1][i] = buffer[2 * i + 1];
+    }
+    return lame_encode_buffer_sample_t(gfp, in_buffer[0], in_buffer[1], nsamples, mp3buf,
+                                       mp3buf_size);
+}
+
+#if 0
+static int
+lame_encode(lame_global_flags * const gfp,
+            const short int in_buffer[2][1152], unsigned char *const mp3buf, const int size)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+
+    if (gfc->Class_ID != LAME_ID)
+        return -3;
+
+    return lame_encode_buffer(gfp, in_buffer[0], in_buffer[1], gfp->framesize, mp3buf, size);
+}
+#endif
+
+/*****************************************************************
+ Flush mp3 buffer, pad with ancillary data so last frame is complete.
+ Reset reservoir size to 0
+ but keep all PCM samples and MDCT data in memory
+ This option is used to break a large file into several mp3 files
+ that when concatenated together will decode with no gaps
+ Because we set the reservoir=0, they will also decode seperately
+ with no errors.
+*********************************************************************/
+int
+lame_encode_flush_nogap(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    flush_bitstream(gfp);
+    return copy_buffer(gfc, mp3buffer, mp3buffer_size, 1);
+}
+
+
+/* called by lame_init_params.  You can also call this after flush_nogap
+   if you want to write new id3v2 and Xing VBR tags into the bitstream */
+int
+lame_init_bitstream(lame_global_flags * gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    gfp->frameNum = 0;
+
+    if (gfp->write_id3tag_automatic) {
+        (void) id3tag_write_v2(gfp);
+    }
+    /* initialize histogram data optionally used by frontend */
+    memset(gfc->bitrate_stereoMode_Hist, 0, sizeof(gfc->bitrate_stereoMode_Hist));
+    memset(gfc->bitrate_blockType_Hist, 0, sizeof(gfc->bitrate_blockType_Hist));
+
+    gfc->PeakSample = 0.0;
+
+    /* Write initial VBR Header to bitstream and init VBR data */
+    if (gfp->bWriteVbrTag)
+        (void) InitVbrTag(gfp);
+
+
+    return 0;
+}
+
+
+/*****************************************************************/
+/* flush internal PCM sample buffers, then mp3 buffers           */
+/* then write id3 v1 tags into bitstream.                        */
+/*****************************************************************/
+
+int
+lame_encode_flush(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    short int buffer[2][1152];
+    int     imp3 = 0, mp3count, mp3buffer_size_remaining;
+
+    /* we always add POSTDELAY=288 padding to make sure granule with real
+     * data can be complety decoded (because of 50% overlap with next granule */
+    int     end_padding;
+    int     frames_left;
+    int     samples_to_encode = gfc->mf_samples_to_encode - POSTDELAY;
+    int     mf_needed = calcNeeded(gfp);
+
+    /* Was flush already called? */
+    if (gfc->mf_samples_to_encode < 1) {
+        return 0;
+    }
+    memset(buffer, 0, sizeof(buffer));
+    mp3count = 0;
+
+    if (gfp->in_samplerate != gfp->out_samplerate) {
+        /* delay due to resampling; needs to be fixed, if resampling code gets changed */
+        samples_to_encode += 16.*gfp->out_samplerate/gfp->in_samplerate;
+    }
+    end_padding = gfp->framesize - (samples_to_encode % gfp->framesize);
+    if (end_padding < 576)
+        end_padding += gfp->framesize;
+    gfp->encoder_padding = end_padding;
+
+    frames_left = (samples_to_encode + end_padding) / gfp->framesize;
+
+    /* send in a frame of 0 padding until all internal sample buffers are flushed */
+    while (frames_left > 0 && imp3 >= 0) {
+        int bunch = mf_needed-gfc->mf_size;
+        int frame_num = gfp->frameNum;
+        
+        bunch *= gfp->in_samplerate;
+        bunch /= gfp->out_samplerate;
+        if (bunch > 1152) bunch = 1152;
+        if (bunch < 1) bunch = 1;
+
+        mp3buffer_size_remaining = mp3buffer_size - mp3count;
+
+        /* if user specifed buffer size = 0, dont check size */
+        if (mp3buffer_size == 0)
+            mp3buffer_size_remaining = 0;
+
+        imp3 = lame_encode_buffer(gfp, buffer[0], buffer[1], bunch,
+                                  mp3buffer, mp3buffer_size_remaining);
+        
+        mp3buffer += imp3;
+        mp3count += imp3;
+        frames_left -= (frame_num != gfp->frameNum) ? 1 : 0;
+    }
+    /* Set gfc->mf_samples_to_encode to 0, so we may detect
+     * and break loops calling it more than once in a row.
+     */
+    gfc->mf_samples_to_encode = 0;
+
+    if (imp3 < 0) {
+        /* some type of fatal error */
+        return imp3;
+    }
+
+    mp3buffer_size_remaining = mp3buffer_size - mp3count;
+    /* if user specifed buffer size = 0, dont check size */
+    if (mp3buffer_size == 0)
+        mp3buffer_size_remaining = 0;
+
+    /* mp3 related stuff.  bit buffer might still contain some mp3 data */
+    flush_bitstream(gfp);
+    imp3 = copy_buffer(gfc, mp3buffer, mp3buffer_size_remaining, 1);
+    if (imp3 < 0) {
+        /* some type of fatal error */
+        return imp3;
+    }
+    mp3buffer += imp3;
+    mp3count += imp3;
+    mp3buffer_size_remaining = mp3buffer_size - mp3count;
+    /* if user specifed buffer size = 0, dont check size */
+    if (mp3buffer_size == 0)
+        mp3buffer_size_remaining = 0;
+
+    if (gfp->write_id3tag_automatic) {
+        /* write a id3 tag to the bitstream */
+        (void) id3tag_write_v1(gfp);
+
+        imp3 = copy_buffer(gfc, mp3buffer, mp3buffer_size_remaining, 0);
+
+        if (imp3 < 0) {
+            return imp3;
+        }
+        mp3count += imp3;
+    }
+#if 0
+    {
+        int const ed = gfp->encoder_delay;
+        int const ep = gfp->encoder_padding;
+        int const ns = (gfp->frameNum*gfp->framesize) - (ed + ep); 
+        double duration = ns;
+        duration /= gfp->out_samplerate;
+        MSGF(gfc, "frames=%d\n", gfp->frameNum);
+        MSGF(gfc, "framesize=%d\n", gfp->framesize);
+        MSGF(gfc, "encoder delay=%d\n", ed);
+        MSGF(gfc, "encoder padding=%d\n", ep);
+        MSGF(gfc, "sample count=%d (%g)\n", ns, gfp->in_samplerate*duration);
+        MSGF(gfc, "duration=%g sec\n", duration);
+        MSGF(gfc, "mf_size=%d\n",gfc->mf_size);
+        MSGF(gfc, "mf_samples_to_encode=%d\n",gfc->mf_samples_to_encode);
+    }
+#endif
+    return mp3count;
+}
+
+/***********************************************************************
+ *
+ *      lame_close ()
+ *
+ *  frees internal buffers
+ *
+ ***********************************************************************/
+
+int
+lame_close(lame_global_flags * gfp)
+{
+    int ret = 0;
+    if (gfp && gfp->class_id == LAME_ID) {
+        lame_internal_flags *const gfc = gfp->internal_flags;
+        gfp->class_id = 0;
+        if (NULL == gfc || gfc->Class_ID != LAME_ID) {
+            ret = -3;
+        }
+        if (NULL != gfc) {
+            gfc->Class_ID = 0;
+            /* this routine will free all malloc'd data in gfc, and then free gfc: */
+            freegfc(gfc);
+            gfp->internal_flags = NULL;
+        }
+        if (gfp->lame_allocated_gfp) {
+            gfp->lame_allocated_gfp = 0;
+            free(gfp);
+        }
+    }
+    return ret;
+}
+
+/*****************************************************************/
+/* flush internal mp3 buffers, and free internal buffers         */
+/*****************************************************************/
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+/* OBSOLETE */
+int CDECL
+lame_encode_finish(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size);
+#else
+#endif
+
+int
+lame_encode_finish(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size)
+{
+    int const ret = lame_encode_flush(gfp, mp3buffer, mp3buffer_size);
+
+    (void) lame_close(gfp);
+
+    return ret;
+}
+
+/*****************************************************************/
+/* write VBR Xing header, and ID3 version 1 tag, if asked for    */
+/*****************************************************************/
+void    lame_mp3_tags_fid(lame_global_flags * gfp, FILE * fpStream);
+
+void
+lame_mp3_tags_fid(lame_global_flags * gfp, FILE * fpStream)
+{
+    if (gfp->bWriteVbrTag) {
+        /* Write Xing header again */
+        if (fpStream && !fseek(fpStream, 0, SEEK_SET)) {
+            lame_internal_flags *gfc = gfp->internal_flags;
+            int     rc = PutVbrTag(gfp, fpStream);
+            switch (rc) {
+            default:
+                /* OK */
+                break;
+
+            case -1:
+                ERRORF(gfc, "Error: could not update LAME tag.\n");
+                break;
+
+            case -2:
+                ERRORF(gfc, "Error: could not update LAME tag, file not seekable.\n");
+                break;
+
+            case -3:
+                ERRORF(gfc, "Error: could not update LAME tag, file not readable.\n");
+                break;
+            }
+        }
+    }
+}
+
+
+
+/* initialize mp3 encoder */
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+static
+#else
+#endif
+int
+lame_init_old(lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc;
+    
+    disable_FPE();      /* disable floating point exceptions */
+
+    memset(gfp, 0, sizeof(lame_global_flags));
+
+    gfp->class_id = LAME_ID;
+
+    if (NULL == (gfc = gfp->internal_flags = calloc(1, sizeof(lame_internal_flags))))
+        return -1;
+
+    /* Global flags.  set defaults here for non-zero values */
+    /* see lame.h for description */
+    /* set integer values to -1 to mean that LAME will compute the
+     * best value, UNLESS the calling program as set it
+     * (and the value is no longer -1)
+     */
+
+
+    gfp->mode = NOT_SET;
+    gfp->original = 1;
+    gfp->in_samplerate = 44100;
+    gfp->num_channels = 2;
+    gfp->num_samples = MAX_U_32_NUM;
+
+    gfp->bWriteVbrTag = 1;
+    gfp->quality = -1;
+    gfp->short_blocks = short_block_not_set;
+    gfc->subblock_gain = -1;
+
+    gfp->lowpassfreq = 0;
+    gfp->highpassfreq = 0;
+    gfp->lowpasswidth = -1;
+    gfp->highpasswidth = -1;
+
+    gfp->VBR = vbr_off;
+    gfp->VBR_q = 4;
+    gfp->ATHcurve = -1;
+    gfp->VBR_mean_bitrate_kbps = 128;
+    gfp->VBR_min_bitrate_kbps = 0;
+    gfp->VBR_max_bitrate_kbps = 0;
+    gfp->VBR_hard_min = 0;
+    gfc->VBR_min_bitrate = 1; /* not  0 ????? */
+    gfc->VBR_max_bitrate = 13; /* not 14 ????? */
+
+    gfp->quant_comp = -1;
+    gfp->quant_comp_short = -1;
+
+    gfp->msfix = -1;
+
+    gfc->resample_ratio = 1;
+
+    gfc->OldValue[0] = 180;
+    gfc->OldValue[1] = 180;
+    gfc->CurrentStep[0] = 4;
+    gfc->CurrentStep[1] = 4;
+    gfc->masking_lower = 1;
+    gfc->nsPsy.attackthre = -1;
+    gfc->nsPsy.attackthre_s = -1;
+
+    gfp->scale = -1;
+
+    gfp->athaa_type = -1;
+    gfp->ATHtype = -1;  /* default = -1 = set in lame_init_params */
+    gfp->athaa_loudapprox = -1; /* 1 = flat loudness approx. (total energy) */
+    /* 2 = equal loudness curve */
+    gfp->athaa_sensitivity = 0.0; /* no offset */
+    gfp->useTemporal = -1;
+    gfp->interChRatio = -1;
+
+    /* The reason for
+     *       int mf_samples_to_encode = ENCDELAY + POSTDELAY;
+     * ENCDELAY = internal encoder delay.  And then we have to add POSTDELAY=288
+     * because of the 50% MDCT overlap.  A 576 MDCT granule decodes to
+     * 1152 samples.  To synthesize the 576 samples centered under this granule
+     * we need the previous granule for the first 288 samples (no problem), and
+     * the next granule for the next 288 samples (not possible if this is last
+     * granule).  So we need to pad with 288 samples to make sure we can
+     * encode the 576 samples we are interested in.
+     */
+    gfc->mf_samples_to_encode = ENCDELAY + POSTDELAY;
+    gfp->encoder_padding = 0;
+    gfc->mf_size = ENCDELAY - MDCTDELAY; /* we pad input with this many 0's */
+
+    gfp->findReplayGain = 0;
+    gfp->decode_on_the_fly = 0;
+
+    gfc->decode_on_the_fly = 0;
+    gfc->findReplayGain = 0;
+    gfc->findPeakSample = 0;
+
+    gfc->RadioGain = 0;
+    gfc->AudiophileGain = 0;
+    gfc->noclipGainChange = 0;
+    gfc->noclipScale = -1.0;
+
+    gfp->asm_optimizations.mmx = 1;
+    gfp->asm_optimizations.amd3dnow = 1;
+    gfp->asm_optimizations.sse = 1;
+
+    gfp->preset = 0;
+
+    gfp->write_id3tag_automatic = 1;
+    return 0;
+}
+
+
+lame_global_flags *
+lame_init(void)
+{
+    lame_global_flags *gfp;
+    int     ret;
+
+    init_log_table();
+
+    gfp = calloc(1, sizeof(lame_global_flags));
+    if (gfp == NULL)
+        return NULL;
+
+    ret = lame_init_old(gfp);
+    if (ret != 0) {
+        free(gfp);
+        return NULL;
+    }
+
+    gfp->lame_allocated_gfp = 1;
+    return gfp;
+}
+
+
+/***********************************************************************
+ *
+ *  some simple statistics
+ *
+ *  Robert Hegemann 2000-10-11
+ *
+ ***********************************************************************/
+
+/*  histogram of used bitrate indexes:
+ *  One has to weight them to calculate the average bitrate in kbps
+ *
+ *  bitrate indices:
+ *  there are 14 possible bitrate indices, 0 has the special meaning
+ *  "free format" which is not possible to mix with VBR and 15 is forbidden
+ *  anyway.
+ *
+ *  stereo modes:
+ *  0: LR   number of left-right encoded frames
+ *  1: LR-I number of left-right and intensity encoded frames
+ *  2: MS   number of mid-side encoded frames
+ *  3: MS-I number of mid-side and intensity encoded frames
+ *
+ *  4: number of encoded frames
+ *
+ */
+
+void
+lame_bitrate_kbps(const lame_global_flags * gfp, int bitrate_kbps[14])
+{
+    const lame_internal_flags *gfc;
+    int     i;
+
+    if (NULL == bitrate_kbps)
+        return;
+    if (NULL == gfp)
+        return;
+    gfc = gfp->internal_flags;
+    if (NULL == gfc)
+        return;
+
+    if (gfp->free_format) {
+        for (i = 0; i < 14; i++)
+            bitrate_kbps[i] = -1;
+        bitrate_kbps[0] = gfp->brate;
+    }
+    else {
+        for (i = 0; i < 14; i++)
+            bitrate_kbps[i] = bitrate_table[gfp->version][i + 1];
+    }
+}
+
+
+void
+lame_bitrate_hist(const lame_global_flags * gfp, int bitrate_count[14])
+{
+    const lame_internal_flags *gfc;
+    int     i;
+
+    if (NULL == bitrate_count)
+        return;
+    if (NULL == gfp)
+        return;
+    gfc = gfp->internal_flags;
+    if (NULL == gfc)
+        return;
+
+    if (gfp->free_format) {
+        for (i = 0; i < 14; i++)
+            bitrate_count[i] = 0;
+        bitrate_count[0] = gfc->bitrate_stereoMode_Hist[0][4];
+    }
+    else {
+        for (i = 0; i < 14; i++)
+            bitrate_count[i] = gfc->bitrate_stereoMode_Hist[i + 1][4];
+    }
+}
+
+
+void
+lame_stereo_mode_hist(const lame_global_flags * gfp, int stmode_count[4])
+{
+    const lame_internal_flags *gfc;
+    int     i;
+
+    if (NULL == stmode_count)
+        return;
+    if (NULL == gfp)
+        return;
+    gfc = gfp->internal_flags;
+    if (NULL == gfc)
+        return;
+
+    for (i = 0; i < 4; i++) {
+        stmode_count[i] = gfc->bitrate_stereoMode_Hist[15][i];
+    }
+}
+
+
+
+void
+lame_bitrate_stereo_mode_hist(const lame_global_flags * gfp, int bitrate_stmode_count[14][4])
+{
+    const lame_internal_flags *gfc;
+    int     i;
+    int     j;
+
+    if (NULL == bitrate_stmode_count)
+        return;
+    if (NULL == gfp)
+        return;
+    gfc = gfp->internal_flags;
+    if (NULL == gfc)
+        return;
+
+    if (gfp->free_format) {
+        for (j = 0; j < 14; j++)
+            for (i = 0; i < 4; i++)
+                bitrate_stmode_count[j][i] = 0;
+        for (i = 0; i < 4; i++)
+            bitrate_stmode_count[0][i] = gfc->bitrate_stereoMode_Hist[0][i];
+    }
+    else {
+        for (j = 0; j < 14; j++)
+            for (i = 0; i < 4; i++)
+                bitrate_stmode_count[j][i] = gfc->bitrate_stereoMode_Hist[j + 1][i];
+    }
+}
+
+
+void
+lame_block_type_hist(const lame_global_flags * gfp, int btype_count[6])
+{
+    const lame_internal_flags *gfc;
+    int     i;
+
+    if (NULL == btype_count)
+        return;
+    if (NULL == gfp)
+        return;
+    gfc = gfp->internal_flags;
+    if (NULL == gfc)
+        return;
+
+    for (i = 0; i < 6; ++i) {
+        btype_count[i] = gfc->bitrate_blockType_Hist[15][i];
+    }
+}
+
+
+
+void
+lame_bitrate_block_type_hist(const lame_global_flags * gfp, int bitrate_btype_count[14][6])
+{
+    const lame_internal_flags *gfc;
+    int     i, j;
+
+    if (NULL == bitrate_btype_count)
+        return;
+    if (NULL == gfp)
+        return;
+    gfc = gfp->internal_flags;
+    if (NULL == gfc)
+        return;
+
+    if (gfp->free_format) {
+        for (j = 0; j < 14; ++j)
+            for (i = 0; i < 6; ++i)
+                bitrate_btype_count[j][i] = 0;
+        for (i = 0; i < 6; ++i)
+            bitrate_btype_count[0][i] = gfc->bitrate_blockType_Hist[0][i];
+    }
+    else {
+        for (j = 0; j < 14; ++j)
+            for (i = 0; i < 6; ++i)
+                bitrate_btype_count[j][i] = gfc->bitrate_blockType_Hist[j + 1][i];
+    }
+}
+
+
+/* end of lame.c */
diff --git a/libmp3lame/lame.rc b/libmp3lame/lame.rc
new file mode 100644
index 0000000..8bbba05
--- /dev/null
+++ b/libmp3lame/lame.rc
@@ -0,0 +1,44 @@
+#include <winver.h>
+#include "version.h"
+
+#ifdef _DLL
+#else
+IDI_ICON1		ICON		DISCARDABLE	"logoe.ico"
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+	FILEVERSION LAME_MAJOR_VERSION,LAME_MINOR_VERSION,LAME_TYPE_VERSION,LAME_PATCH_VERSION
+	PRODUCTVERSION LAME_MAJOR_VERSION,LAME_MINOR_VERSION,LAME_TYPE_VERSION,LAME_PATCH_VERSION
+	FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+	FILEFLAGS VS_FF_DEBUG
+#else
+	FILEFLAGS 0x0L
+#endif
+	FILEOS VOS__WINDOWS32
+#ifdef _DLL
+	FILETYPE VFT_DLL
+#else
+	FILETYPE VFT_APP
+#endif
+	FILESUBTYPE 0x0L
+	BEGIN
+		BLOCK "StringFileInfo"
+		BEGIN
+			BLOCK "040904B0"
+			BEGIN
+				VALUE "CompanyName", LAME_URL "\0"
+				VALUE "FileDescription", "MP3 Encoder.\0"
+				VALUE "FileVersion", LAME_VERSION_STRING "\0"
+				VALUE "LegalCopyright", "Copyright (C) 1999-2010 The L.A.M.E. Team\0"
+#ifdef _DLL
+				VALUE "OriginalFilename", STR(_DLL) "\0"
+#else
+				VALUE "OriginalFilename", STR(_APP) "\0"
+#endif
+				VALUE "ProductName", "L.A.M.E.\0"
+			END
+		END
+	END
+/* End of Version info */
+
diff --git a/libmp3lame/lame_global_flags.h b/libmp3lame/lame_global_flags.h
new file mode 100644
index 0000000..03bcfc7
--- /dev/null
+++ b/libmp3lame/lame_global_flags.h
@@ -0,0 +1,175 @@
+#ifndef LAME_GLOBAL_FLAGS_H
+#define LAME_GLOBAL_FLAGS_H
+
+#ifndef lame_internal_flags_defined
+#define lame_internal_flags_defined
+struct lame_internal_flags;
+typedef struct lame_internal_flags lame_internal_flags;
+#endif
+
+
+typedef enum short_block_e {
+    short_block_not_set = -1, /* allow LAME to decide */
+    short_block_allowed = 0, /* LAME may use them, even different block types for L/R */
+    short_block_coupled, /* LAME may use them, but always same block types in L/R */
+    short_block_dispensed, /* LAME will not use short blocks, long blocks only */
+    short_block_forced  /* LAME will not use long blocks, short blocks only */
+} short_block_t;
+
+/***********************************************************************
+*
+*  Control Parameters set by User.  These parameters are here for
+*  backwards compatibility with the old, non-shared lib API.
+*  Please use the lame_set_variablename() functions below
+*
+*
+***********************************************************************/
+struct lame_global_struct {
+    unsigned int class_id;
+    /* input description */
+    unsigned long num_samples; /* number of samples. default=2^32-1           */
+    int     num_channels;    /* input number of channels. default=2         */
+    int     in_samplerate;   /* input_samp_rate in Hz. default=44.1 kHz     */
+    int     out_samplerate;  /* output_samp_rate.
+                                default: LAME picks best value
+                                at least not used for MP3 decoding:
+                                Remember 44.1 kHz MP3s and AC97           */
+    float   scale;           /* scale input by this amount before encoding
+                                at least not used for MP3 decoding          */
+    float   scale_left;      /* scale input of channel 0 (left) by this
+                                amount before encoding                      */
+    float   scale_right;     /* scale input of channel 1 (right) by this
+                                amount before encoding                      */
+
+    /* general control params */
+    int     analysis;        /* collect data for a MP3 frame analyzer?      */
+    int     bWriteVbrTag;    /* add Xing VBR tag?                           */
+    int     decode_only;     /* use lame/mpglib to convert mp3 to wav       */
+    int     quality;         /* quality setting 0=best,  9=worst  default=5 */
+    MPEG_mode mode;          /* see enum in lame.h
+                                default = LAME picks best value             */
+    int     force_ms;        /* force M/S mode.  requires mode=1            */
+    int     free_format;     /* use free format? default=0                  */
+    int     findReplayGain;  /* find the RG value? default=0       */
+    int     decode_on_the_fly; /* decode on the fly? default=0                */
+    int     write_id3tag_automatic; /* 1 (default) writes ID3 tags, 0 not */
+
+    /*
+     * set either brate>0  or compression_ratio>0, LAME will compute
+     * the value of the variable not set.
+     * Default is compression_ratio = 11.025
+     */
+    int     brate;           /* bitrate                                    */
+    float   compression_ratio; /* sizeof(wav file)/sizeof(mp3 file)          */
+
+
+    /* frame params */
+    int     copyright;       /* mark as copyright. default=0           */
+    int     original;        /* mark as original. default=1            */
+    int     extension;       /* the MP3 'private extension' bit.
+                                Meaningless                            */
+    int     emphasis;        /* Input PCM is emphased PCM (for
+                                instance from one of the rarely
+                                emphased CDs), it is STRONGLY not
+                                recommended to use this, because
+                                psycho does not take it into account,
+                                and last but not least many decoders
+                                don't care about these bits          */
+    int     error_protection; /* use 2 bytes per frame for a CRC
+                                 checksum. default=0                    */
+    int     strict_ISO;      /* enforce ISO spec as much as possible   */
+
+    int     disable_reservoir; /* use bit reservoir?                     */
+
+    /* quantization/noise shaping */
+    int     quant_comp;
+    int     quant_comp_short;
+    int     experimentalY;
+    int     experimentalZ;
+    int     exp_nspsytune;
+
+    int     preset;
+
+    /* VBR control */
+    vbr_mode VBR;
+    float   VBR_q_frac;      /* Range [0,...,1[ */
+    int     VBR_q;           /* Range [0,...,9] */
+    int     VBR_mean_bitrate_kbps;
+    int     VBR_min_bitrate_kbps;
+    int     VBR_max_bitrate_kbps;
+    int     VBR_hard_min;    /* strictly enforce VBR_min_bitrate
+                                normaly, it will be violated for analog
+                                silence                                 */
+
+
+    /* resampling and filtering */
+    int     lowpassfreq;     /* freq in Hz. 0=lame choses.
+                                -1=no filter                          */
+    int     highpassfreq;    /* freq in Hz. 0=lame choses.
+                                -1=no filter                          */
+    int     lowpasswidth;    /* freq width of filter, in Hz
+                                (default=15%)                         */
+    int     highpasswidth;   /* freq width of filter, in Hz
+                                (default=15%)                         */
+
+
+
+    /*
+     * psycho acoustics and other arguments which you should not change
+     * unless you know what you are doing
+     */
+    float   maskingadjust;
+    float   maskingadjust_short;
+    int     ATHonly;         /* only use ATH                         */
+    int     ATHshort;        /* only use ATH for short blocks        */
+    int     noATH;           /* disable ATH                          */
+    int     ATHtype;         /* select ATH formula                   */
+    float   ATHcurve;        /* change ATH formula 4 shape           */
+    float   ATHlower;        /* lower ATH by this many db            */
+    int     athaa_type;      /* select ATH auto-adjust scheme        */
+    int     athaa_loudapprox; /* select ATH auto-adjust loudness calc */
+    float   athaa_sensitivity; /* dB, tune active region of auto-level */
+    short_block_t short_blocks;
+    int     useTemporal;     /* use temporal masking effect          */
+    float   interChRatio;
+    float   msfix;           /* Naoki's adjustment of Mid/Side maskings */
+
+    int     tune;            /* 0 off, 1 on */
+    float   tune_value_a;    /* used to pass values for debugging and stuff */
+
+    struct {
+        void    (*msgf) (const char *format, va_list ap);
+        void    (*debugf) (const char *format, va_list ap);
+        void    (*errorf) (const char *format, va_list ap);
+    } report;
+
+  /************************************************************************/
+    /* internal variables, do not set...                                    */
+    /* provided because they may be of use to calling application           */
+  /************************************************************************/
+
+    int     version;         /* 0=MPEG-2/2.5  1=MPEG-1               */
+    int     encoder_delay;
+    int     encoder_padding; /* number of samples of padding appended to input */
+    int     framesize;
+    int     frameNum;        /* number of frames encoded             */
+    int     lame_allocated_gfp; /* is this struct owned by calling
+                                   program or lame?                     */
+
+
+
+  /**************************************************************************/
+    /* more internal variables are stored in this structure:                  */
+  /**************************************************************************/
+    lame_internal_flags *internal_flags;
+
+
+    struct {
+        int     mmx;
+        int     amd3dnow;
+        int     sse;
+
+    } asm_optimizations;
+};
+
+#endif /* LAME_GLOBAL_FLAGS_H */
diff --git a/libmp3lame/lameerror.h b/libmp3lame/lameerror.h
new file mode 100644
index 0000000..7d9216b
--- /dev/null
+++ b/libmp3lame/lameerror.h
@@ -0,0 +1,26 @@
+/*
+ *  A collection of LAME Error Codes
+ *
+ *  Please use the constants defined here instead of some arbitrary
+ *  values. Currently the values starting at -10 to avoid intersection
+ *  with the -1, -2, -3 and -4 used in the current code.
+ *
+ *  May be this should be a part of the include/lame.h.
+ */
+
+typedef enum {
+    LAME_OKAY = 0,
+    LAME_NOERROR = 0,
+    LAME_GENERICERROR = -1,
+    LAME_NOMEM = -10,
+    LAME_BADBITRATE = -11,
+    LAME_BADSAMPFREQ = -12,
+    LAME_INTERNALERROR = -13,
+
+    FRONTEND_READERROR = -80,
+    FRONTEND_WRITEERROR = -81,
+    FRONTEND_FILETOOLARGE = -82,
+
+} lame_errorcodes_t;
+
+/* end of lameerror.h */
diff --git a/libmp3lame/liblame.def b/libmp3lame/liblame.def
new file mode 100644
index 0000000..8656aeb
--- /dev/null
+++ b/libmp3lame/liblame.def
@@ -0,0 +1,270 @@
+LIBRARY  libaudioenc.dll
+EXPORTS
+
+lame_init		@1
+
+lame_set_num_samples	@2
+lame_get_num_samples	@3
+
+lame_set_in_samplerate	@4
+lame_get_in_samplerate	@5
+
+lame_set_num_channels	@6
+lame_get_num_channels	@7
+
+lame_set_scale		@8
+lame_get_scale		@9
+
+lame_set_scale_left	@10
+lame_get_scale_left	@11
+
+lame_set_scale_right	@12
+lame_get_scale_right	@13
+
+lame_set_out_samplerate	@14
+lame_get_out_samplerate	@15
+
+lame_set_analysis	@16
+lame_get_analysis	@17
+
+lame_set_bWriteVbrTag	@18
+lame_get_bWriteVbrTag	@19
+
+lame_set_decode_only	@20
+lame_get_decode_only	@21
+
+lame_set_quality	@22
+lame_get_quality	@23
+
+lame_set_mode		@24
+lame_get_mode		@25
+
+lame_set_force_ms	@26
+lame_get_force_ms	@27
+
+lame_set_free_format	@28
+lame_get_free_format	@29
+
+
+lame_set_findReplayGain	@30
+lame_get_findReplayGain	@31
+
+lame_set_decode_on_the_fly	@32
+lame_get_decode_on_the_fly	@33
+
+lame_set_nogap_total	@34
+lame_get_nogap_total	@35
+
+lame_set_nogap_currentindex	@36
+lame_get_nogap_currentindex	@37
+
+
+lame_set_errorf		@38
+lame_set_debugf		@39
+lame_set_msgf		@40
+
+lame_set_brate		@41
+lame_get_brate		@42
+ 
+lame_set_compression_ratio	@43
+lame_get_compression_ratio	@44
+
+lame_set_preset		@45
+
+lame_set_asm_optimizations	@46
+
+
+lame_set_copyright	@47
+lame_get_copyright	@48
+
+lame_set_original	@49
+lame_get_original	@50
+
+lame_set_error_protection	@51
+lame_get_error_protection	@52
+
+lame_set_padding_type	@53
+lame_get_padding_type	@54
+
+lame_set_extension	@55
+lame_get_extension	@56
+
+lame_set_strict_ISO	@57
+lame_get_strict_ISO	@58
+
+lame_set_disable_reservoir	@59
+lame_get_disable_reservoir	@60
+
+lame_set_quant_comp	@61
+lame_get_quant_comp	@62
+lame_set_quant_comp_short	@63
+lame_get_quant_comp_short	@64
+
+lame_set_experimentalX	@65
+lame_get_experimentalX	@66
+
+lame_set_experimentalY	@67
+lame_get_experimentalY	@68
+
+lame_set_experimentalZ	@69
+lame_get_experimentalZ	@70
+
+lame_set_exp_nspsytune	@71
+lame_get_exp_nspsytune	@72
+
+lame_set_msfix		@73
+lame_get_msfix		@74
+
+lame_set_VBR		@75
+lame_get_VBR		@76
+
+lame_set_VBR_q		@77
+lame_get_VBR_q		@78
+
+lame_set_VBR_mean_bitrate_kbps	@79
+lame_get_VBR_mean_bitrate_kbps	@80
+
+lame_set_VBR_min_bitrate_kbps	@81
+lame_get_VBR_min_bitrate_kbps	@82
+
+lame_set_VBR_max_bitrate_kbps	@83
+lame_get_VBR_max_bitrate_kbps	@84
+
+lame_set_VBR_hard_min	@85
+lame_get_VBR_hard_min	@86
+
+lame_set_preset_expopts	@87
+
+lame_set_lowpassfreq	@88
+lame_get_lowpassfreq	@89
+
+lame_set_lowpasswidth	@90
+lame_get_lowpasswidth	@91
+
+lame_set_highpassfreq	@92
+lame_get_highpassfreq	@93
+
+lame_set_highpasswidth	@94
+lame_get_highpasswidth	@95
+
+lame_set_ATHonly	@96
+lame_get_ATHonly	@97
+
+lame_set_ATHshort	@98
+lame_get_ATHshort	@99
+
+lame_set_noATH		@100
+lame_get_noATH		@101
+
+lame_set_ATHtype	@102
+lame_get_ATHtype	@103
+
+lame_set_ATHlower	@104
+lame_get_ATHlower	@105
+
+lame_set_athaa_type	@106
+lame_get_athaa_type	@107
+
+lame_set_athaa_loudapprox	@108
+lame_get_athaa_loudapprox	@109
+
+lame_set_athaa_sensitivity	@110
+lame_get_athaa_sensitivity	@111
+
+lame_set_cwlimit	@112
+lame_get_cwlimit	@113
+
+lame_set_useTemporal	@114
+lame_get_useTemporal	@115
+
+lame_set_interChRatio	@116
+lame_get_interChRatio	@117
+
+lame_set_no_short_blocks	@118
+lame_get_no_short_blocks	@119
+lame_set_force_short_blocks	@120
+lame_get_force_short_blocks	@121
+lame_set_allow_diff_short	@122
+lame_get_allow_diff_short	@123
+
+lame_set_emphasis	@124
+lame_get_emphasis	@125
+
+lame_get_version	@126
+lame_get_encoder_delay	@127
+lame_get_encoder_padding	@128
+lame_get_framesize	@129
+
+lame_get_mf_samples_to_encode	@130
+lame_get_size_mp3buffer	@131
+lame_get_frameNum	@132
+lame_get_totalframes	@133
+
+lame_get_RadioGain	@134
+lame_get_AudiophileGain	@135
+lame_get_PeakSample	@136
+lame_get_noclipGainChange	@137
+lame_get_noclipScale	@138
+
+lame_init_params	@139
+
+get_lame_version	@140
+get_lame_short_version @141
+get_lame_very_short_version	@142
+get_psy_version		@143        
+get_lame_url		@144           
+
+get_lame_version_numerical	@145
+
+lame_print_config	@146
+lame_print_internals	@147
+
+lame_encode_buffer	@148
+lame_encode_buffer_interleaved	@149
+lame_encode_buffer_float	@150
+lame_encode_buffer_long	@151
+lame_encode_buffer_long2	@152
+lame_encode_buffer_int	@153
+lame_encode_flush	@154
+lame_encode_flush_nogap	@155
+
+lame_init_bitstream	@156
+
+lame_bitrate_hist	@157
+lame_bitrate_kbps	@158
+lame_stereo_mode_hist	@159
+lame_bitrate_stereo_mode_hist	@160
+lame_block_type_hist	@161
+lame_bitrate_block_type_hist	@162
+lame_mp3_tags_fid	@163
+lame_close		@164
+lame_get_lametag_frame	@165
+get_lame_os_bitness	@166
+lame_set_VBR_quality	@167
+lame_get_VBR_quality	@168
+
+
+bitrate_table		@500
+samplerate_table	@501
+
+id3tag_genre_list	@2000
+id3tag_init   		@2001
+id3tag_add_v2   	@2002
+id3tag_v1_only  	@2003
+id3tag_v2_only  	@2004
+id3tag_space_v1 	@2005
+id3tag_pad_v2   	@2006
+id3tag_set_title	@2007
+id3tag_set_artist	@2008
+id3tag_set_album	@2009
+id3tag_set_year		@2010
+id3tag_set_comment	@2011
+id3tag_set_track	@2012
+id3tag_set_genre	@2013
+id3tag_set_fieldvalue	@2014
+id3tag_set_albumart	@2015
+lame_get_id3v1_tag	@2016
+lame_get_id3v2_tag	@2017
+lame_set_write_id3tag_automatic	@2018
+lame_get_write_id3tag_automatic	@2019
+id3tag_set_pad	@2020
diff --git a/libmp3lame/libmp3lame.xcodeproj/project.pbxproj b/libmp3lame/libmp3lame.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..0966cc1
--- /dev/null
+++ b/libmp3lame/libmp3lame.xcodeproj/project.pbxproj
@@ -0,0 +1,379 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 45;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		D7D0FF8B1124E29800E01FE7 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF621124E29800E01FE7 /* config.h */; };
+		D7D0FF8C1124E29800E01FE7 /* quantize.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF631124E29800E01FE7 /* quantize.h */; };
+		D7D0FF8D1124E29800E01FE7 /* encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF641124E29800E01FE7 /* encoder.h */; };
+		D7D0FF8E1124E29800E01FE7 /* quantize_pvt.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF651124E29800E01FE7 /* quantize_pvt.c */; };
+		D7D0FF8F1124E29800E01FE7 /* newmdct.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF661124E29800E01FE7 /* newmdct.h */; };
+		D7D0FF901124E29800E01FE7 /* lame-analysis.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF671124E29800E01FE7 /* lame-analysis.h */; };
+		D7D0FF911124E29800E01FE7 /* id3tag.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF681124E29800E01FE7 /* id3tag.c */; };
+		D7D0FF921124E29800E01FE7 /* reservoir.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF691124E29800E01FE7 /* reservoir.c */; };
+		D7D0FF931124E29800E01FE7 /* tables.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF6A1124E29800E01FE7 /* tables.h */; };
+		D7D0FF941124E29800E01FE7 /* set_get.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF6B1124E29800E01FE7 /* set_get.h */; };
+		D7D0FF951124E29800E01FE7 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF6C1124E29800E01FE7 /* version.h */; };
+		D7D0FF961124E29800E01FE7 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF6D1124E29800E01FE7 /* version.c */; };
+		D7D0FF971124E29800E01FE7 /* machine.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF6E1124E29800E01FE7 /* machine.h */; };
+		D7D0FF981124E29800E01FE7 /* fft.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF6F1124E29800E01FE7 /* fft.h */; };
+		D7D0FF991124E29800E01FE7 /* encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF701124E29800E01FE7 /* encoder.c */; };
+		D7D0FF9A1124E29800E01FE7 /* fft.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF711124E29800E01FE7 /* fft.c */; };
+		D7D0FF9B1124E29800E01FE7 /* gain_analysis.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF721124E29800E01FE7 /* gain_analysis.c */; };
+		D7D0FF9C1124E29800E01FE7 /* mpglib_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF731124E29800E01FE7 /* mpglib_interface.c */; };
+		D7D0FF9D1124E29800E01FE7 /* quantize_pvt.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF741124E29800E01FE7 /* quantize_pvt.h */; };
+		D7D0FF9E1124E29800E01FE7 /* gain_analysis.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF751124E29800E01FE7 /* gain_analysis.h */; };
+		D7D0FF9F1124E29800E01FE7 /* quantize.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF761124E29800E01FE7 /* quantize.c */; };
+		D7D0FFA01124E29800E01FE7 /* set_get.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF771124E29800E01FE7 /* set_get.c */; };
+		D7D0FFA11124E29800E01FE7 /* tables.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF781124E29800E01FE7 /* tables.c */; };
+		D7D0FFA21124E29800E01FE7 /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF791124E29800E01FE7 /* util.c */; };
+		D7D0FFA31124E29800E01FE7 /* id3tag.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF7A1124E29800E01FE7 /* id3tag.h */; };
+		D7D0FFA41124E29800E01FE7 /* l3side.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF7B1124E29800E01FE7 /* l3side.h */; };
+		D7D0FFA51124E29800E01FE7 /* psymodel.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF7C1124E29800E01FE7 /* psymodel.h */; };
+		D7D0FFA61124E29800E01FE7 /* vbrquantize.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF7D1124E29800E01FE7 /* vbrquantize.h */; };
+		D7D0FFA71124E29800E01FE7 /* vbrquantize.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF7E1124E29800E01FE7 /* vbrquantize.c */; };
+		D7D0FFA81124E29800E01FE7 /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF7F1124E29800E01FE7 /* util.h */; };
+		D7D0FFA91124E29800E01FE7 /* bitstream.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF801124E29800E01FE7 /* bitstream.h */; };
+		D7D0FFAA1124E29800E01FE7 /* takehiro.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF811124E29800E01FE7 /* takehiro.c */; };
+		D7D0FFAB1124E29800E01FE7 /* presets.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF821124E29800E01FE7 /* presets.c */; };
+		D7D0FFAC1124E29800E01FE7 /* reservoir.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF831124E29800E01FE7 /* reservoir.h */; };
+		D7D0FFAD1124E29800E01FE7 /* lame.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF841124E29800E01FE7 /* lame.c */; };
+		D7D0FFAE1124E29800E01FE7 /* VbrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF851124E29800E01FE7 /* VbrTag.h */; };
+		D7D0FFAF1124E29800E01FE7 /* VbrTag.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF861124E29800E01FE7 /* VbrTag.c */; };
+		D7D0FFB01124E29800E01FE7 /* newmdct.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF871124E29800E01FE7 /* newmdct.c */; };
+		D7D0FFB11124E29800E01FE7 /* bitstream.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF881124E29800E01FE7 /* bitstream.c */; };
+		D7D0FFB21124E29800E01FE7 /* psymodel.c in Sources */ = {isa = PBXBuildFile; fileRef = D7D0FF891124E29800E01FE7 /* psymodel.c */; };
+		D7D0FFB31124E29800E01FE7 /* lame_global_flags.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D0FF8A1124E29800E01FE7 /* lame_global_flags.h */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		D2AAC0630554660B00DB518D /* libaudioenc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libaudioenc.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		D71350461124D56600E2C1DA /* MacConfigExternalDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = MacConfigExternalDebug.xcconfig; path = ../../MacConfigExternalDebug.xcconfig; sourceTree = SOURCE_ROOT; };
+		D71350471124D56600E2C1DA /* MacConfigExternalRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = MacConfigExternalRelease.xcconfig; path = ../../MacConfigExternalRelease.xcconfig; sourceTree = SOURCE_ROOT; };
+		D7D0FF621124E29800E01FE7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../config.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF631124E29800E01FE7 /* quantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF641124E29800E01FE7 /* encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encoder.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF651124E29800E01FE7 /* quantize_pvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = quantize_pvt.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF661124E29800E01FE7 /* newmdct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = newmdct.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF671124E29800E01FE7 /* lame-analysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "lame-analysis.h"; sourceTree = SOURCE_ROOT; };
+		D7D0FF681124E29800E01FE7 /* id3tag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = id3tag.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF691124E29800E01FE7 /* reservoir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = reservoir.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF6A1124E29800E01FE7 /* tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tables.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF6B1124E29800E01FE7 /* set_get.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = set_get.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF6C1124E29800E01FE7 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF6D1124E29800E01FE7 /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF6E1124E29800E01FE7 /* machine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = machine.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF6F1124E29800E01FE7 /* fft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fft.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF701124E29800E01FE7 /* encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = encoder.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF711124E29800E01FE7 /* fft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fft.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF721124E29800E01FE7 /* gain_analysis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gain_analysis.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF731124E29800E01FE7 /* mpglib_interface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpglib_interface.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF741124E29800E01FE7 /* quantize_pvt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize_pvt.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF751124E29800E01FE7 /* gain_analysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gain_analysis.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF761124E29800E01FE7 /* quantize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = quantize.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF771124E29800E01FE7 /* set_get.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = set_get.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF781124E29800E01FE7 /* tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tables.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF791124E29800E01FE7 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF7A1124E29800E01FE7 /* id3tag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = id3tag.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF7B1124E29800E01FE7 /* l3side.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l3side.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF7C1124E29800E01FE7 /* psymodel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psymodel.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF7D1124E29800E01FE7 /* vbrquantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vbrquantize.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF7E1124E29800E01FE7 /* vbrquantize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vbrquantize.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF7F1124E29800E01FE7 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF801124E29800E01FE7 /* bitstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitstream.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF811124E29800E01FE7 /* takehiro.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = takehiro.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF821124E29800E01FE7 /* presets.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = presets.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF831124E29800E01FE7 /* reservoir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reservoir.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF841124E29800E01FE7 /* lame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lame.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF851124E29800E01FE7 /* VbrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VbrTag.h; sourceTree = SOURCE_ROOT; };
+		D7D0FF861124E29800E01FE7 /* VbrTag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VbrTag.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF871124E29800E01FE7 /* newmdct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = newmdct.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF881124E29800E01FE7 /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF891124E29800E01FE7 /* psymodel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psymodel.c; sourceTree = SOURCE_ROOT; };
+		D7D0FF8A1124E29800E01FE7 /* lame_global_flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lame_global_flags.h; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		D289988505E68E00004EDB86 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		08FB7794FE84155DC02AAC07 /* libmp3lame */ = {
+			isa = PBXGroup;
+			children = (
+				D71350461124D56600E2C1DA /* MacConfigExternalDebug.xcconfig */,
+				D71350471124D56600E2C1DA /* MacConfigExternalRelease.xcconfig */,
+				08FB7795FE84155DC02AAC07 /* Source */,
+				1AB674ADFE9D54B511CA2CBB /* Products */,
+			);
+			name = libmp3lame;
+			sourceTree = "<group>";
+		};
+		08FB7795FE84155DC02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				D7D0FF621124E29800E01FE7 /* config.h */,
+				D7D0FF631124E29800E01FE7 /* quantize.h */,
+				D7D0FF641124E29800E01FE7 /* encoder.h */,
+				D7D0FF651124E29800E01FE7 /* quantize_pvt.c */,
+				D7D0FF661124E29800E01FE7 /* newmdct.h */,
+				D7D0FF671124E29800E01FE7 /* lame-analysis.h */,
+				D7D0FF681124E29800E01FE7 /* id3tag.c */,
+				D7D0FF691124E29800E01FE7 /* reservoir.c */,
+				D7D0FF6A1124E29800E01FE7 /* tables.h */,
+				D7D0FF6B1124E29800E01FE7 /* set_get.h */,
+				D7D0FF6C1124E29800E01FE7 /* version.h */,
+				D7D0FF6D1124E29800E01FE7 /* version.c */,
+				D7D0FF6E1124E29800E01FE7 /* machine.h */,
+				D7D0FF6F1124E29800E01FE7 /* fft.h */,
+				D7D0FF701124E29800E01FE7 /* encoder.c */,
+				D7D0FF711124E29800E01FE7 /* fft.c */,
+				D7D0FF721124E29800E01FE7 /* gain_analysis.c */,
+				D7D0FF731124E29800E01FE7 /* mpglib_interface.c */,
+				D7D0FF741124E29800E01FE7 /* quantize_pvt.h */,
+				D7D0FF751124E29800E01FE7 /* gain_analysis.h */,
+				D7D0FF761124E29800E01FE7 /* quantize.c */,
+				D7D0FF771124E29800E01FE7 /* set_get.c */,
+				D7D0FF781124E29800E01FE7 /* tables.c */,
+				D7D0FF791124E29800E01FE7 /* util.c */,
+				D7D0FF7A1124E29800E01FE7 /* id3tag.h */,
+				D7D0FF7B1124E29800E01FE7 /* l3side.h */,
+				D7D0FF7C1124E29800E01FE7 /* psymodel.h */,
+				D7D0FF7D1124E29800E01FE7 /* vbrquantize.h */,
+				D7D0FF7E1124E29800E01FE7 /* vbrquantize.c */,
+				D7D0FF7F1124E29800E01FE7 /* util.h */,
+				D7D0FF801124E29800E01FE7 /* bitstream.h */,
+				D7D0FF811124E29800E01FE7 /* takehiro.c */,
+				D7D0FF821124E29800E01FE7 /* presets.c */,
+				D7D0FF831124E29800E01FE7 /* reservoir.h */,
+				D7D0FF841124E29800E01FE7 /* lame.c */,
+				D7D0FF851124E29800E01FE7 /* VbrTag.h */,
+				D7D0FF861124E29800E01FE7 /* VbrTag.c */,
+				D7D0FF871124E29800E01FE7 /* newmdct.c */,
+				D7D0FF881124E29800E01FE7 /* bitstream.c */,
+				D7D0FF891124E29800E01FE7 /* psymodel.c */,
+				D7D0FF8A1124E29800E01FE7 /* lame_global_flags.h */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		1AB674ADFE9D54B511CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D2AAC0630554660B00DB518D /* libaudioenc.dylib */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		D2AAC0600554660B00DB518D /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7D0FF8B1124E29800E01FE7 /* config.h in Headers */,
+				D7D0FF8C1124E29800E01FE7 /* quantize.h in Headers */,
+				D7D0FF8D1124E29800E01FE7 /* encoder.h in Headers */,
+				D7D0FF8F1124E29800E01FE7 /* newmdct.h in Headers */,
+				D7D0FF901124E29800E01FE7 /* lame-analysis.h in Headers */,
+				D7D0FF931124E29800E01FE7 /* tables.h in Headers */,
+				D7D0FF941124E29800E01FE7 /* set_get.h in Headers */,
+				D7D0FF951124E29800E01FE7 /* version.h in Headers */,
+				D7D0FF971124E29800E01FE7 /* machine.h in Headers */,
+				D7D0FF981124E29800E01FE7 /* fft.h in Headers */,
+				D7D0FF9D1124E29800E01FE7 /* quantize_pvt.h in Headers */,
+				D7D0FF9E1124E29800E01FE7 /* gain_analysis.h in Headers */,
+				D7D0FFA31124E29800E01FE7 /* id3tag.h in Headers */,
+				D7D0FFA41124E29800E01FE7 /* l3side.h in Headers */,
+				D7D0FFA51124E29800E01FE7 /* psymodel.h in Headers */,
+				D7D0FFA61124E29800E01FE7 /* vbrquantize.h in Headers */,
+				D7D0FFA81124E29800E01FE7 /* util.h in Headers */,
+				D7D0FFA91124E29800E01FE7 /* bitstream.h in Headers */,
+				D7D0FFAC1124E29800E01FE7 /* reservoir.h in Headers */,
+				D7D0FFAE1124E29800E01FE7 /* VbrTag.h in Headers */,
+				D7D0FFB31124E29800E01FE7 /* lame_global_flags.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		D2AAC0620554660B00DB518D /* libmp3lame */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 1DEB914A08733D8E0010E9CD /* Build configuration list for PBXNativeTarget "libmp3lame" */;
+			buildPhases = (
+				D7B3852C1124E86C00250137 /* ShellScript */,
+				D2AAC0600554660B00DB518D /* Headers */,
+				D2AAC0610554660B00DB518D /* Sources */,
+				D289988505E68E00004EDB86 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = libmp3lame;
+			productName = libmp3lame;
+			productReference = D2AAC0630554660B00DB518D /* libaudioenc.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		08FB7793FE84155DC02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "libmp3lame" */;
+			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
+			hasScannedForEncodings = 1;
+			knownRegions = (
+				English,
+				Japanese,
+				French,
+				German,
+			);
+			mainGroup = 08FB7794FE84155DC02AAC07 /* libmp3lame */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				D2AAC0620554660B00DB518D /* libmp3lame */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		D7B3852C1124E86C00250137 /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 12;
+			files = (
+			);
+			inputPaths = (
+				"$(SRCROOT)/../configMac.h",
+			);
+			outputPaths = (
+				"$(SRCROOT)/../config.h",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "cp $SRCROOT/../configMac.h $SRCROOT/../config.h ";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		D2AAC0610554660B00DB518D /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7D0FF8E1124E29800E01FE7 /* quantize_pvt.c in Sources */,
+				D7D0FF911124E29800E01FE7 /* id3tag.c in Sources */,
+				D7D0FF921124E29800E01FE7 /* reservoir.c in Sources */,
+				D7D0FF961124E29800E01FE7 /* version.c in Sources */,
+				D7D0FF991124E29800E01FE7 /* encoder.c in Sources */,
+				D7D0FF9A1124E29800E01FE7 /* fft.c in Sources */,
+				D7D0FF9B1124E29800E01FE7 /* gain_analysis.c in Sources */,
+				D7D0FF9C1124E29800E01FE7 /* mpglib_interface.c in Sources */,
+				D7D0FF9F1124E29800E01FE7 /* quantize.c in Sources */,
+				D7D0FFA01124E29800E01FE7 /* set_get.c in Sources */,
+				D7D0FFA11124E29800E01FE7 /* tables.c in Sources */,
+				D7D0FFA21124E29800E01FE7 /* util.c in Sources */,
+				D7D0FFA71124E29800E01FE7 /* vbrquantize.c in Sources */,
+				D7D0FFAA1124E29800E01FE7 /* takehiro.c in Sources */,
+				D7D0FFAB1124E29800E01FE7 /* presets.c in Sources */,
+				D7D0FFAD1124E29800E01FE7 /* lame.c in Sources */,
+				D7D0FFAF1124E29800E01FE7 /* VbrTag.c in Sources */,
+				D7D0FFB01124E29800E01FE7 /* newmdct.c in Sources */,
+				D7D0FFB11124E29800E01FE7 /* bitstream.c in Sources */,
+				D7D0FFB21124E29800E01FE7 /* psymodel.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		1DEB914B08733D8E0010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				PRODUCT_NAME = audioenc;
+			};
+			name = Debug;
+		};
+		1DEB914C08733D8E0010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				PRODUCT_NAME = audioenc;
+			};
+			name = Release;
+		};
+		1DEB914F08733D8E0010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = D71350461124D56600E2C1DA /* MacConfigExternalDebug.xcconfig */;
+			buildSettings = {
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				OTHER_CFLAGS = (
+					"$(inherited)",
+					"-DHAVE_CONFIG_H",
+					"-O3",
+					"-ffast-math",
+					"-funroll-loops",
+					"-Wall",
+					"-fno-common",
+				);
+				USER_HEADER_SEARCH_PATHS = "../include ../ ../mpglib";
+			};
+			name = Debug;
+		};
+		1DEB915008733D8E0010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = D71350471124D56600E2C1DA /* MacConfigExternalRelease.xcconfig */;
+			buildSettings = {
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				OTHER_CFLAGS = (
+					"$(inherited)",
+					"-DHAVE_CONFIG_H",
+					"-O3",
+					"-ffast-math",
+					"-funroll-loops",
+					"-Wall",
+					"-fno-common",
+				);
+				USER_HEADER_SEARCH_PATHS = "../include ../ ../mpglib";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		1DEB914A08733D8E0010E9CD /* Build configuration list for PBXNativeTarget "libmp3lame" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB914B08733D8E0010E9CD /* Debug */,
+				1DEB914C08733D8E0010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "libmp3lame" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB914F08733D8E0010E9CD /* Debug */,
+				1DEB915008733D8E0010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/libmp3lame/libmp3lame_dll_vc6.dsp b/libmp3lame/libmp3lame_dll_vc6.dsp
new file mode 100644
index 0000000..8374315
--- /dev/null
+++ b/libmp3lame/libmp3lame_dll_vc6.dsp
@@ -0,0 +1,1238 @@
+# Microsoft Developer Studio Project File - Name="libmp3lame DLL" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

+

+CFG=libmp3lame DLL - Win32 Release

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "libmp3lame_dll_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "libmp3lame_dll_vc6.mak" CFG="libmp3lame DLL - Win32 Release"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "libmp3lame DLL - Win32 Release" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE "libmp3lame DLL - Win32 Debug" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE "libmp3lame DLL - Win32 Release NASM" (basierend auf  "Win32 (x86) Dynamic-Link Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+MTL=midl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "libmp3la"

+# PROP BASE Intermediate_Dir "libmp3la"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\libmp3lameDLL"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+LIB32=link.exe -lib

+# ADD BASE CPP /nologo /W3 /GX /O2 /Ob2 /D "WIN32" /D "HAVE_CONFIG_H" /D "NDEBUG" /D "_WINDOWS" /YX /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# ADD CPP /nologo /MD /W3 /O2 /Ob2 /I "../libmp3lame" /I "../" /I "../mpglib" /I "../include" /I ".." /D "NDEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /def:"..\include\lame.def" /force /out:"..\output\Release\libmp3lame.dll" /opt:NOWIN98

+# SUBTRACT LINK32 /nodefaultlib

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\libmp3lameDLL"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+LIB32=link.exe -lib

+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "HAVE_CONFIG_H" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /MDd /W3 /Zi /Od /I "../libmp3lame" /I "../" /I "../mpglib" /I "../include" /I ".." /D "_DEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT CPP /Fr /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /def:"..\include\lame.def" /force /out:"..\output\Debug\libmp3lame.dll" /opt:NOWIN98

+# SUBTRACT LINK32 /pdb:none /map /nodefaultlib

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "libmp3la"

+# PROP BASE Intermediate_Dir "libmp3la"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release_NASM"

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+# PROP Ignore_Export_Lib 0

+# PROP Target_Dir ""

+LIB32=link.exe -lib

+# ADD BASE CPP /nologo /W3 /GX /O2 /Ob2 /I "../" /I "../mpglib" /I "../include" /I ".." /D "NDEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# SUBTRACT BASE CPP /YX

+# ADD CPP /nologo /MD /W3 /O2 /Ob2 /I "../libmp3lame" /I "../" /I "../mpglib" /I "../include" /I ".." /D "NDEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "HAVE_CONFIG_H" /D "HAVE_NASM" /D "MMX_choose_table" /D "WIN32" /D "_CRT_SECURE_NO_DEPRECATE" /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LINK32=link.exe

+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386

+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /def:"..\include\lame.def" /force /out:"..\output\Release_NASM\libmp3lame.dll" /opt:NOWIN98

+# SUBTRACT LINK32 /nodefaultlib

+

+!ENDIF 

+

+# Begin Target

+

+# Name "libmp3lame DLL - Win32 Release"

+# Name "libmp3lame DLL - Win32 Debug"

+# Name "libmp3lame DLL - Win32 Release NASM"

+# Begin Group "encoder sources"

+

+# PROP Default_Filter "*.c"

+# Begin Source File

+

+SOURCE=.\bitstream.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\encoder.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\fft.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\gain_analysis.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\id3tag.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\lame.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\mpglib_interface.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\newmdct.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\presets.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\psymodel.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize_pvt.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\reservoir.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\set_get.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\tables.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\takehiro.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\util.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\vbrquantize.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\VbrTag.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\version.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# End Group

+# Begin Group "encoder header"

+

+# PROP Default_Filter ".h"

+# Begin Source File

+

+SOURCE=.\bitstream.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\encoder.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\fft.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\gain_analysis.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\id3tag.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\l3side.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=".\lame-analysis.h"

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\lame_global_flags.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\lameerror.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\machine.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\newmdct.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\psymodel.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize_pvt.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\reservoir.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\set_get.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\tables.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\util.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\vbrquantize.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\VbrTag.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\version.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# End Group

+# Begin Group "Asm"

+

+# PROP Default_Filter ""

+# Begin Source File

+

+SOURCE=.\i386\choose_table.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lameDLL

+InputPath=.\i386\choose_table.nas

+InputName=choose_table

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\cpu_feat.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lameDLL

+InputPath=.\i386\cpu_feat.nas

+InputName=cpu_feat

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fft.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fft3dn.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lameDLL

+InputPath=.\i386\fft3dn.nas

+InputName=fft3dn

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fftfpu.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fftsse.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lameDLL

+InputPath=.\i386\fftsse.nas

+InputName=fftsse

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\ffttbl.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\scalar.nas

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# End Group

+# Begin Group "decoder sources"

+

+# PROP Default_Filter ".c"

+# Begin Source File

+

+SOURCE=..\mpglib\common.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\dct64_i386.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\decode_i386.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\interface.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\layer1.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\layer2.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\layer3.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\tabinit.c

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lameDLL"

+

+!ENDIF 

+

+# End Source File

+# End Group

+# Begin Group "decoder header"

+

+# PROP Default_Filter ".h"

+# Begin Source File

+

+SOURCE=..\mpglib\common.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\dct64_i386.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\decode_i386.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\huffman.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\interface.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\layer1.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\layer2.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\layer3.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\mpg123.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\mpglib.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\mpglib\tabinit.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# End Group

+# Begin Source File

+

+SOURCE=..\configMS.h

+

+!IF  "$(CFG)" == "libmp3lame DLL - Win32 Release"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Debug"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ELSEIF  "$(CFG)" == "libmp3lame DLL - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=..\include\lame.def

+# PROP Exclude_From_Build 1

+# End Source File

+# End Target

+# End Project

diff --git a/libmp3lame/libmp3lame_icc.icproj b/libmp3lame/libmp3lame_icc.icproj
new file mode 100644
index 0000000..811b384
--- /dev/null
+++ b/libmp3lame/libmp3lame_icc.icproj
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Intel C++ Project"

+	Version="11.1"

+	Name="libmp3lame_icc"

+	ProjectGUID="{284005F2-24AA-40E2-BE3B-5F9398C47C0E}"

+	VCNestedProjectGUID="{6CE67DB9-84C3-43A5-A20F-A7B07F9A16BE}"

+	VCNestedProjectFileName="libmp3lame_icc.vcproj">

+	<Configurations>

+		<Configuration

+			Name="Release|Win32">

+			<Tool

+				Name="CppCmplrTool"

+				GenerateAlternateCodePaths="2"

+				UseProcessorExtensions="1"/>

+		</Configuration>

+		<Configuration

+			Name="Release NASM|Win32">

+			<Tool

+				Name="CppCmplrTool"

+				GenerateAlternateCodePaths="2"

+				UseProcessorExtensions="1"/>

+		</Configuration>

+	</Configurations>

+	<Files/>

+</VisualStudioProject>

diff --git a/libmp3lame/libmp3lame_icc.vcproj b/libmp3lame/libmp3lame_icc.vcproj
new file mode 100644
index 0000000..fe95944
--- /dev/null
+++ b/libmp3lame/libmp3lame_icc.vcproj
@@ -0,0 +1,615 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="libmp3lame_icc"

+	ProjectGUID="{6CE67DB9-84C3-43A5-A20F-A7B07F9A16BE}"

+	RootNamespace="libmp3lame_icc"

+	Keyword="Win32Proj"

+	TargetFrameworkVersion="0"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)ICC"

+			IntermediateDirectory="$(ConfigurationName)ICC"

+			ConfigurationType="4"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./"

+				PreprocessorDefinitions="_DEBUG,_WINDOWS,WIN32,HAVE_CONFIG_H,_CRT_SECURE_NO_DEPRECATE"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				EnableEnhancedInstructionSet="2"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)ICC"

+			IntermediateDirectory="$(ConfigurationName)ICC"

+			ConfigurationType="4"

+			CharacterSet="1"

+			WholeProgramOptimization="0"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				WholeProgramOptimization="true"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./"

+				PreprocessorDefinitions="NDEBUG,_WINDOWS,WIN32,HAVE_CONFIG_H,_CRT_SECURE_NO_DEPRECATE"

+				EnableEnhancedInstructionSet="2"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug NASM|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)ICC"

+			IntermediateDirectory="$(ConfigurationName)ICC"

+			ConfigurationType="4"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				WholeProgramOptimization="false"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./;./vector"

+				PreprocessorDefinitions="_DEBUG;_WINDOWS;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;HAVE_NASM;MMX_choose_table;USE_FFTSSE"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				EnableEnhancedInstructionSet="2"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release NASM|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)ICC"

+			IntermediateDirectory="$(ConfigurationName)ICC"

+			ConfigurationType="4"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./;./vector"

+				PreprocessorDefinitions="NDEBUG,_WINDOWS,WIN32,HAVE_CONFIG_H,_CRT_SECURE_NO_DEPRECATE,HAVE_NASM,MMX_choose_table,USE_FFTSSE"

+				EnableEnhancedInstructionSet="2"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source"

+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"

+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

+			>

+			<File

+				RelativePath=".\bitstream.c"

+				>

+			</File>

+			<File

+				RelativePath=".\encoder.c"

+				>

+			</File>

+			<File

+				RelativePath=".\fft.c"

+				>

+			</File>

+			<File

+				RelativePath=".\gain_analysis.c"

+				>

+			</File>

+			<File

+				RelativePath=".\id3tag.c"

+				>

+			</File>

+			<File

+				RelativePath=".\lame.c"

+				>

+			</File>

+			<File

+				RelativePath=".\mpglib_interface.c"

+				>

+			</File>

+			<File

+				RelativePath=".\newmdct.c"

+				>

+			</File>

+			<File

+				RelativePath=".\presets.c"

+				>

+			</File>

+			<File

+				RelativePath=".\psymodel.c"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize.c"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize_pvt.c"

+				>

+			</File>

+			<File

+				RelativePath=".\reservoir.c"

+				>

+			</File>

+			<File

+				RelativePath=".\set_get.c"

+				>

+			</File>

+			<File

+				RelativePath=".\tables.c"

+				>

+			</File>

+			<File

+				RelativePath=".\takehiro.c"

+				>

+			</File>

+			<File

+				RelativePath=".\util.c"

+				>

+			</File>

+			<File

+				RelativePath=".\vbrquantize.c"

+				>

+			</File>

+			<File

+				RelativePath=".\VbrTag.c"

+				>

+			</File>

+			<File

+				RelativePath=".\version.c"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header"

+			Filter="h;hpp;hxx;hm;inl;inc;xsd"

+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"

+			>

+			<File

+				RelativePath=".\bitstream.h"

+				>

+			</File>

+			<File

+				RelativePath="..\configMS.h"

+				>

+				<FileConfiguration

+					Name="Debug|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug GTK|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\encoder.h"

+				>

+			</File>

+			<File

+				RelativePath=".\fft.h"

+				>

+			</File>

+			<File

+				RelativePath=".\gain_analysis.h"

+				>

+			</File>

+			<File

+				RelativePath=".\id3tag.h"

+				>

+			</File>

+			<File

+				RelativePath=".\l3side.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lame-analysis.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lame_global_flags.h"

+				>

+			</File>

+			<File

+				RelativePath=".\vector\lame_intrin.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lameerror.h"

+				>

+			</File>

+			<File

+				RelativePath=".\machine.h"

+				>

+			</File>

+			<File

+				RelativePath=".\newmdct.h"

+				>

+			</File>

+			<File

+				RelativePath=".\psymodel.h"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize.h"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize_pvt.h"

+				>

+			</File>

+			<File

+				RelativePath=".\reservoir.h"

+				>

+			</File>

+			<File

+				RelativePath=".\set_get.h"

+				>

+			</File>

+			<File

+				RelativePath=".\tables.h"

+				>

+			</File>

+			<File

+				RelativePath=".\util.h"

+				>

+			</File>

+			<File

+				RelativePath=".\vbrquantize.h"

+				>

+			</File>

+			<File

+				RelativePath=".\VbrTag.h"

+				>

+			</File>

+			<File

+				RelativePath=".\version.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Interface"

+			>

+			<File

+				RelativePath="..\include\lame.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Assembly"

+			>

+			<File

+				RelativePath=".\i386\choose_table.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\i386\cpu_feat.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\i386\fft3dn.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\i386\fftsse.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\vector\xmm_quantize_sub.c"

+				>

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/libmp3lame/libmp3lame_vc6.dsp b/libmp3lame/libmp3lame_vc6.dsp
new file mode 100644
index 0000000..a68c602
--- /dev/null
+++ b/libmp3lame/libmp3lame_vc6.dsp
@@ -0,0 +1,487 @@
+# Microsoft Developer Studio Project File - Name="libmp3lame" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Static Library" 0x0104

+

+CFG=libmp3lame - Win32 Release

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "libmp3lame_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "libmp3lame_vc6.mak" CFG="libmp3lame - Win32 Release"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "libmp3lame - Win32 Release" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE "libmp3lame - Win32 Debug" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE "libmp3lame - Win32 Release NASM" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 0

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "libmp3la"

+# PROP BASE Intermediate_Dir "libmp3la"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\libmp3lame"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /O2 /Ob2 /D "WIN32" /D "HAVE_CONFIG_H" /D "NDEBUG" /D "_WINDOWS" /YX /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# ADD CPP /nologo /W3 /O2 /Ob2 /I "../" /I "../mpglib" /I "../include" /I ".." /D "NDEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo /out:"..\output\Release\libmp3lame-static.lib"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 1

+# PROP BASE Output_Dir "Debug"

+# PROP BASE Intermediate_Dir "Debug"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\libmp3lame"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "HAVE_CONFIG_H" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /W3 /ZI /Od /I "../" /I "../mpglib" /I "../include" /I ".." /D "_DEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo /out:"..\output\Debug\libmp3lame-static.lib"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "libmp3la"

+# PROP BASE Intermediate_Dir "libmp3la"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release_NASM"

+# PROP Intermediate_Dir "..\obj\Release_NASM\libmp3lame"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /O2 /Ob2 /I "../" /I "../mpglib" /I "../include" /I ".." /D "NDEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# SUBTRACT BASE CPP /YX

+# ADD CPP /nologo /W3 /O2 /Ob2 /I "../" /I "../mpglib" /I "../include" /I ".." /D "NDEBUG" /D "_WINDOWS" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /D "HAVE_NASM" /D "MMX_choose_table" /D "_CRT_SECURE_NO_DEPRECATE" /Gs1024 /FD /GAy /QIfdiv /QI0f /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo /out:"..\output\Release_NASM\libmp3lame-static.lib"

+

+!ENDIF 

+

+# Begin Target

+

+# Name "libmp3lame - Win32 Release"

+# Name "libmp3lame - Win32 Debug"

+# Name "libmp3lame - Win32 Release NASM"

+# Begin Group "Source"

+

+# PROP Default_Filter "c"

+# Begin Source File

+

+SOURCE=.\bitstream.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\encoder.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\fft.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\gain_analysis.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\id3tag.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\lame.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\mpglib_interface.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\newmdct.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\presets.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\psymodel.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize_pvt.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\reservoir.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\set_get.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\tables.c

+# ADD CPP /W1

+# End Source File

+# Begin Source File

+

+SOURCE=.\takehiro.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\util.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\vbrquantize.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\VbrTag.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\version.c

+# End Source File

+# End Group

+# Begin Group "Include"

+

+# PROP Default_Filter "h"

+# Begin Source File

+

+SOURCE=.\bitstream.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\configMS.h

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\encoder.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\fft.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\gain_analysis.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\id3tag.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\l3side.h

+# End Source File

+# Begin Source File

+

+SOURCE=".\lame-analysis.h"

+# End Source File

+# Begin Source File

+

+SOURCE=.\lame_global_flags.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\lameerror.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\machine.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\newmdct.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\psymodel.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\quantize_pvt.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\reservoir.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\set_get.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\tables.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\util.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\vbrquantize.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\VbrTag.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\version.h

+# End Source File

+# End Group

+# Begin Group "Asm"

+

+# PROP Default_Filter ".nas"

+# Begin Source File

+

+SOURCE=.\i386\choose_table.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lame

+InputPath=.\i386\choose_table.nas

+InputName=choose_table

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\cpu_feat.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lame

+InputPath=.\i386\cpu_feat.nas

+InputName=cpu_feat

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fft.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fft3dn.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lame

+InputPath=.\i386\fft3dn.nas

+InputName=fft3dn

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fftfpu.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\fftsse.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# PROP Ignore_Default_Tool 1

+# Begin Custom Build - Assembling $(InputName)...

+InputDir=.\i386

+IntDir=.\..\obj\Release_NASM\libmp3lame

+InputPath=.\i386\fftsse.nas

+InputName=fftsse

+

+"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	nasmw -f win32 -i $(InputDir)/ -DWIN32 $(InputPath) -o   $(IntDir)/$(InputName).obj

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\ffttbl.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\i386\scalar.nas

+

+!IF  "$(CFG)" == "libmp3lame - Win32 Release"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Debug"

+

+!ELSEIF  "$(CFG)" == "libmp3lame - Win32 Release NASM"

+

+# PROP Exclude_From_Build 1

+

+!ENDIF 

+

+# End Source File

+# End Group

+# End Target

+# End Project

diff --git a/libmp3lame/libmp3lame_vc8.vcproj b/libmp3lame/libmp3lame_vc8.vcproj
new file mode 100644
index 0000000..29b55f5
--- /dev/null
+++ b/libmp3lame/libmp3lame_vc8.vcproj
@@ -0,0 +1,650 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="libmp3lame_vc8"

+	ProjectGUID="{4B152319-0AF6-4E1B-A284-805D6483C5F1}"

+	RootNamespace="libmp3lame_vc8"

+	Keyword="Win32Proj"

+	TargetFrameworkVersion="0"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./"

+				PreprocessorDefinitions="_DEBUG;_WINDOWS;WIN32;_USRDLL;DLL_EXPORTS;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				EnableEnhancedInstructionSet="1"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				ModuleDefinitionFile="liblame.def"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			WholeProgramOptimization="0"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				WholeProgramOptimization="true"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./"

+				PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;_USRDLL;DLL_EXPORTS;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"

+				RuntimeLibrary="2"

+				EnableEnhancedInstructionSet="1"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				ModuleDefinitionFile="liblame.def"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug NASM|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				WholeProgramOptimization="false"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./;./vector"

+				PreprocessorDefinitions="_DEBUG;_WINDOWS;WIN32;_USRDLL;DLL_EXPORTS;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;HAVE_NASM;MMX_choose_table;USE_FFTSSE"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="3"

+				EnableEnhancedInstructionSet="1"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="$(SolutionDir)..\..\build\products\Debug\libaudioenc.dll"

+				ModuleDefinitionFile="liblame.def"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release NASM|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+				CommandLine="copy $(ProjectDir)..\configMS.h $(ProjectDir)..\config.h"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include;../;../mpglib;./;./vector"

+				PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;_USRDLL;DLL_EXPORTS;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;HAVE_NASM;MMX_choose_table;USE_FFTSSE"

+				EnableEnhancedInstructionSet="1"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="$(SolutionDir)..\..\build\products\Release\libaudioenc.dll"

+				ModuleDefinitionFile="liblame.def"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source"

+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"

+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

+			>

+			<File

+				RelativePath=".\bitstream.c"

+				>

+			</File>

+			<File

+				RelativePath=".\encoder.c"

+				>

+			</File>

+			<File

+				RelativePath=".\fft.c"

+				>

+			</File>

+			<File

+				RelativePath=".\gain_analysis.c"

+				>

+			</File>

+			<File

+				RelativePath=".\id3tag.c"

+				>

+			</File>

+			<File

+				RelativePath=".\lame.c"

+				>

+			</File>

+			<File

+				RelativePath=".\liblame.def"

+				>

+			</File>

+			<File

+				RelativePath=".\mpglib_interface.c"

+				>

+			</File>

+			<File

+				RelativePath=".\newmdct.c"

+				>

+			</File>

+			<File

+				RelativePath=".\presets.c"

+				>

+			</File>

+			<File

+				RelativePath=".\psymodel.c"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize.c"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize_pvt.c"

+				>

+			</File>

+			<File

+				RelativePath=".\reservoir.c"

+				>

+			</File>

+			<File

+				RelativePath=".\set_get.c"

+				>

+			</File>

+			<File

+				RelativePath=".\tables.c"

+				>

+			</File>

+			<File

+				RelativePath=".\takehiro.c"

+				>

+			</File>

+			<File

+				RelativePath=".\util.c"

+				>

+			</File>

+			<File

+				RelativePath=".\vbrquantize.c"

+				>

+			</File>

+			<File

+				RelativePath=".\VbrTag.c"

+				>

+			</File>

+			<File

+				RelativePath=".\version.c"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header"

+			Filter="h;hpp;hxx;hm;inl;inc;xsd"

+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"

+			>

+			<File

+				RelativePath=".\bitstream.h"

+				>

+			</File>

+			<File

+				RelativePath="..\configMS.h"

+				>

+				<FileConfiguration

+					Name="Debug|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug GTK|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\encoder.h"

+				>

+			</File>

+			<File

+				RelativePath=".\fft.h"

+				>

+			</File>

+			<File

+				RelativePath=".\gain_analysis.h"

+				>

+			</File>

+			<File

+				RelativePath=".\id3tag.h"

+				>

+			</File>

+			<File

+				RelativePath=".\l3side.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lame-analysis.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lame_global_flags.h"

+				>

+			</File>

+			<File

+				RelativePath=".\vector\lame_intrin.h"

+				>

+			</File>

+			<File

+				RelativePath=".\lameerror.h"

+				>

+			</File>

+			<File

+				RelativePath=".\machine.h"

+				>

+			</File>

+			<File

+				RelativePath=".\newmdct.h"

+				>

+			</File>

+			<File

+				RelativePath=".\psymodel.h"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize.h"

+				>

+			</File>

+			<File

+				RelativePath=".\quantize_pvt.h"

+				>

+			</File>

+			<File

+				RelativePath=".\reservoir.h"

+				>

+			</File>

+			<File

+				RelativePath=".\set_get.h"

+				>

+			</File>

+			<File

+				RelativePath=".\tables.h"

+				>

+			</File>

+			<File

+				RelativePath=".\util.h"

+				>

+			</File>

+			<File

+				RelativePath=".\vbrquantize.h"

+				>

+			</File>

+			<File

+				RelativePath=".\VbrTag.h"

+				>

+			</File>

+			<File

+				RelativePath=".\version.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Interface"

+			>

+			<File

+				RelativePath="..\include\lame.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Assembly"

+			>

+			<File

+				RelativePath=".\i386\choose_table.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\i386\cpu_feat.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\i386\fft3dn.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\i386\fftsse.nas"

+				>

+				<FileConfiguration

+					Name="Debug NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release NASM|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="Assembling $(InputName)..."

+						CommandLine="$(ProjectDir)\..\..\..\Tools\nasm\nasmw  -f win32 -i  $(InputDir) -DWIN32  $(InputDir)$(InputName).nas&#x0D;&#x0A;move $(InputDir)$(InputName).obj  &quot;$(OutDir)&quot;&#x0D;&#x0A;"

+						Outputs="$(OutDir)/$(InputName).obj"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\vector\xmm_quantize_sub.c"

+				>

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/libmp3lame/logoe.ico b/libmp3lame/logoe.ico
new file mode 100644
index 0000000..70994ae
--- /dev/null
+++ b/libmp3lame/logoe.ico
Binary files differ
diff --git a/libmp3lame/machine.h b/libmp3lame/machine.h
new file mode 100644
index 0000000..eccd0d4
--- /dev/null
+++ b/libmp3lame/machine.h
@@ -0,0 +1,179 @@
+/*
+ *      Machine dependent defines/includes for LAME.
+ *
+ *      Copyright (c) 1999 A.L. Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_MACHINE_H
+#define LAME_MACHINE_H
+
+#include "version.h"
+
+#if (LAME_RELEASE_VERSION == 0)
+#undef NDEBUG
+#endif
+
+#include <stdio.h>
+#include <assert.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#if  defined(__riscos__)  &&  defined(FPA10)
+# include "ymath.h"
+#else
+# include <math.h>
+#endif
+#include <limits.h>
+
+#include <ctype.h>
+
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if defined(macintosh)
+# include <types.h>
+# include <stat.h>
+#else
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# ifdef HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/*
+ * 3 different types of pow() functions:
+ *   - table lookup
+ *   - pow()
+ *   - exp()   on some machines this is claimed to be faster than pow()
+ */
+
+#define POW20(x) (assert(0 <= (x+Q_MAX2) && x < Q_MAX), pow20[x+Q_MAX2])
+/*#define POW20(x)  pow(2.0,((double)(x)-210)*.25) */
+/*#define POW20(x)  exp( ((double)(x)-210)*(.25*LOG2) ) */
+
+#define IPOW20(x)  (assert(0 <= x && x < Q_MAX), ipow20[x])
+/*#define IPOW20(x)  exp( -((double)(x)-210)*.1875*LOG2 ) */
+/*#define IPOW20(x)  pow(2.0,-((double)(x)-210)*.1875) */
+
+/* in case this is used without configure */
+#ifndef inline
+# define inline
+#endif
+
+#if defined(_MSC_VER)
+# undef inline
+# define inline _inline
+#elif defined(__SASC) || defined(__GNUC__) || defined(__ICC) || defined(__ECC)
+/* if __GNUC__ we always want to inline, not only if the user requests it */
+# undef inline
+# define inline __inline
+#endif
+
+#if    defined(_MSC_VER)
+# pragma warning( disable : 4244 )
+/*# pragma warning( disable : 4305 ) */
+#endif
+
+/*
+ * FLOAT    for variables which require at least 32 bits
+ * FLOAT8   for variables which require at least 64 bits
+ *
+ * On some machines, 64 bit will be faster than 32 bit.  Also, some math
+ * routines require 64 bit float, so setting FLOAT=float will result in a
+ * lot of conversions.
+ */
+
+#if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) )
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <float.h>
+# define FLOAT_MAX FLT_MAX
+#else
+# ifndef FLOAT
+typedef float FLOAT;
+#  ifdef FLT_MAX
+#   define FLOAT_MAX FLT_MAX
+#  else
+#   define FLOAT_MAX 1e37 /* approx */
+#  endif
+# endif
+#endif
+
+#ifndef FLOAT8 
+typedef double FLOAT8;
+# ifdef DBL_MAX
+#  define FLOAT8_MAX DBL_MAX
+# else
+#  define FLOAT8_MAX 1e99 /* approx */
+# endif
+#else
+# ifdef FLT_MAX
+#  define FLOAT8_MAX FLT_MAX
+# else
+#  define FLOAT8_MAX 1e37 /* approx */
+# endif
+#endif
+
+/* sample_t must be floating point, at least 32 bits */
+typedef FLOAT sample_t;
+typedef sample_t stereo_t[2];
+
+#define dimension_of(array) (sizeof(array)/sizeof(array[0]))
+#define beyond(array) (array+dimension_of(array))
+
+#if 1
+#define EQ(a,b) (\
+(fabs(a) > fabs(b)) \
+ ? (fabs((a)-(b)) <= (fabs(a) * 1e-6f)) \
+ : (fabs((a)-(b)) <= (fabs(b) * 1e-6f)))
+#else
+#define EQ(a,b) (fabs((a)-(b))<1E-37)
+#endif 
+
+#define NEQ(a,b) (!EQ(a,b))
+
+#endif
+
+/* end of machine.h */
diff --git a/libmp3lame/mpglib_interface.c b/libmp3lame/mpglib_interface.c
new file mode 100644
index 0000000..c3f029b
--- /dev/null
+++ b/libmp3lame/mpglib_interface.c
@@ -0,0 +1,411 @@
+/* -*- mode: C; mode: fold -*- */
+/*
+ *      LAME MP3 encoding engine
+ *
+ *      Copyright (c) 1999-2000 Mark Taylor
+ *      Copyright (c) 2003 Olcios
+ *      Copyright (c) 2008 Robert Hegemann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: mpglib_interface.c,v 1.35.2.2 2008/10/11 19:08:32 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_MPGLIB
+#define hip_global_struct mpstr_tag 
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "interface.h"
+
+#include "util.h"
+
+
+static MPSTR   mp; /* ugly, used by obsolete lame_decode functions */
+
+int
+lame_decode_exit(void)
+{
+    ExitMP3(&mp);
+    return 0;
+}
+
+
+int
+lame_decode_init(void)
+{
+    (void) InitMP3(&mp);
+    return 0;
+}
+
+
+
+
+/* copy mono samples */
+#define COPY_MONO(DST_TYPE, SRC_TYPE)                                                           \
+    DST_TYPE *pcm_l = (DST_TYPE *)pcm_l_raw;                                                    \
+    SRC_TYPE const *p_samples = (SRC_TYPE const *)p;                                            \
+    for (i = 0; i < processed_samples; i++)                                                     \
+      *pcm_l++ = (DST_TYPE)(*p_samples++);
+
+/* copy stereo samples */
+#define COPY_STEREO(DST_TYPE, SRC_TYPE)                                                         \
+    DST_TYPE *pcm_l = (DST_TYPE *)pcm_l_raw, *pcm_r = (DST_TYPE *)pcm_r_raw;                    \
+    SRC_TYPE const *p_samples = (SRC_TYPE const *)p;                                            \
+    for (i = 0; i < processed_samples; i++) {                                                   \
+      *pcm_l++ = (DST_TYPE)(*p_samples++);                                                      \
+      *pcm_r++ = (DST_TYPE)(*p_samples++);                                                      \
+    }
+
+
+
+/*
+ * For lame_decode:  return code
+ * -1     error
+ *  0     ok, but need more data before outputing any samples
+ *  n     number of samples output.  either 576 or 1152 depending on MP3 file.
+ */
+
+static int
+decode1_headersB_clipchoice(PMPSTR pmp, unsigned char *buffer, int len,
+                            char pcm_l_raw[], char pcm_r_raw[], mp3data_struct * mp3data,
+                            int *enc_delay, int *enc_padding,
+                            char *p, size_t psize, int decoded_sample_size,
+                            int (*decodeMP3_ptr) (PMPSTR, unsigned char *, int, char *, int,
+                            int *))
+{
+    static const int smpls[2][4] = {
+        /* Layer   I    II   III */
+        {0, 384, 1152, 1152}, /* MPEG-1     */
+        {0, 384, 1152, 576} /* MPEG-2(.5) */
+    };
+
+    int     processed_bytes;
+    int     processed_samples; /* processed samples per channel */
+    int     ret;
+    int     i;
+
+    mp3data->header_parsed = 0;
+
+    ret = (*decodeMP3_ptr) (pmp, buffer, len, p, (int) psize, &processed_bytes);
+    /* three cases:  
+     * 1. headers parsed, but data not complete
+     *       pmp->header_parsed==1 
+     *       pmp->framesize=0           
+     *       pmp->fsizeold=size of last frame, or 0 if this is first frame
+     *
+     * 2. headers, data parsed, but ancillary data not complete
+     *       pmp->header_parsed==1 
+     *       pmp->framesize=size of frame           
+     *       pmp->fsizeold=size of last frame, or 0 if this is first frame
+     *
+     * 3. frame fully decoded:  
+     *       pmp->header_parsed==0 
+     *       pmp->framesize=0           
+     *       pmp->fsizeold=size of frame (which is now the last frame)
+     *
+     */
+    if (pmp->header_parsed || pmp->fsizeold > 0 || pmp->framesize > 0) {
+        mp3data->header_parsed = 1;
+        mp3data->stereo = pmp->fr.stereo;
+        mp3data->samplerate = freqs[pmp->fr.sampling_frequency];
+        mp3data->mode = pmp->fr.mode;
+        mp3data->mode_ext = pmp->fr.mode_ext;
+        mp3data->framesize = smpls[pmp->fr.lsf][pmp->fr.lay];
+
+        /* free format, we need the entire frame before we can determine
+         * the bitrate.  If we haven't gotten the entire frame, bitrate=0 */
+        if (pmp->fsizeold > 0) /* works for free format and fixed, no overrun, temporal results are < 400.e6 */
+            mp3data->bitrate = 8 * (4 + pmp->fsizeold) * mp3data->samplerate /
+                (1.e3 * mp3data->framesize) + 0.5;
+        else if (pmp->framesize > 0)
+            mp3data->bitrate = 8 * (4 + pmp->framesize) * mp3data->samplerate /
+                (1.e3 * mp3data->framesize) + 0.5;
+        else
+            mp3data->bitrate = tabsel_123[pmp->fr.lsf][pmp->fr.lay - 1][pmp->fr.bitrate_index];
+
+
+
+        if (pmp->num_frames > 0) {
+            /* Xing VBR header found and num_frames was set */
+            mp3data->totalframes = pmp->num_frames;
+            mp3data->nsamp = mp3data->framesize * pmp->num_frames;
+            *enc_delay = pmp->enc_delay;
+            *enc_padding = pmp->enc_padding;
+        }
+    }
+
+    switch (ret) {
+    case MP3_OK:
+        switch (pmp->fr.stereo) {
+        case 1:
+            processed_samples = processed_bytes / decoded_sample_size;
+            if (decoded_sample_size == sizeof(short)) {
+                COPY_MONO(short, short)
+            }
+            else {
+                COPY_MONO(sample_t, FLOAT)
+            }
+            break;
+        case 2:
+            processed_samples = (processed_bytes / decoded_sample_size) >> 1;
+            if (decoded_sample_size == sizeof(short)) {
+                COPY_STEREO(short, short)
+            }
+            else {
+                COPY_STEREO(sample_t, FLOAT)
+            }
+            break;
+        default:
+            processed_samples = -1;
+            assert(0);
+            break;
+        }
+        break;
+
+    case MP3_NEED_MORE:
+        processed_samples = 0;
+        break;
+
+    case MP3_ERR:
+        processed_samples = -1;
+        break;
+
+    default:
+        processed_samples = -1;
+        assert(0);
+        break;
+    }
+
+    /*fprintf(stderr,"ok, more, err:  %i %i %i\n", MP3_OK, MP3_NEED_MORE, MP3_ERR ); */
+    /*fprintf(stderr,"ret = %i out=%i\n", ret, processed_samples ); */
+    return processed_samples;
+}
+
+
+#define OUTSIZE_CLIPPED   (4096*sizeof(short))
+
+int
+lame_decode1_headersB(unsigned char *buffer,
+                      int len,
+                      short pcm_l[], short pcm_r[], mp3data_struct * mp3data,
+                      int *enc_delay, int *enc_padding)
+{
+    static char out[OUTSIZE_CLIPPED];
+
+    return decode1_headersB_clipchoice(&mp, buffer, len, (char *) pcm_l, (char *) pcm_r, mp3data,
+                                       enc_delay, enc_padding, out, OUTSIZE_CLIPPED,
+                                       sizeof(short), decodeMP3);
+}
+
+
+
+
+
+/*
+ * For lame_decode:  return code
+ *  -1     error
+ *   0     ok, but need more data before outputing any samples
+ *   n     number of samples output.  Will be at most one frame of
+ *         MPEG data.  
+ */
+
+int
+lame_decode1_headers(unsigned char *buffer,
+                     int len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data)
+{
+    int     enc_delay, enc_padding;
+    return lame_decode1_headersB(buffer, len, pcm_l, pcm_r, mp3data, &enc_delay, &enc_padding);
+}
+
+
+int
+lame_decode1(unsigned char *buffer, int len, short pcm_l[], short pcm_r[])
+{
+    mp3data_struct mp3data;
+
+    return lame_decode1_headers(buffer, len, pcm_l, pcm_r, &mp3data);
+}
+
+
+/*
+ * For lame_decode:  return code
+ *  -1     error
+ *   0     ok, but need more data before outputing any samples
+ *   n     number of samples output.  a multiple of 576 or 1152 depending on MP3 file.
+ */
+
+int
+lame_decode_headers(unsigned char *buffer,
+                    int len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data)
+{
+    int     ret;
+    int     totsize = 0;     /* number of decoded samples per channel */
+
+    for (;;) {
+        switch (ret = lame_decode1_headers(buffer, len, pcm_l + totsize, pcm_r + totsize, mp3data)) {
+        case -1:
+            return ret;
+        case 0:
+            return totsize;
+        default:
+            totsize += ret;
+            len = 0;    /* future calls to decodeMP3 are just to flush buffers */
+            break;
+        }
+    }
+}
+
+
+int
+lame_decode(unsigned char *buffer, int len, short pcm_l[], short pcm_r[])
+{
+    mp3data_struct mp3data;
+
+    return lame_decode_headers(buffer, len, pcm_l, pcm_r, &mp3data);
+}
+
+
+
+
+hip_t hip_decode_init(void)
+{
+    hip_t hip = calloc(1, sizeof(hip_global_flags));
+    InitMP3(hip);
+    return hip;
+}
+
+
+int hip_decode_exit(hip_t hip)
+{
+    if (hip) {
+        ExitMP3(hip);
+        free(hip);
+    }
+    return 0;
+}
+
+
+/* we forbid input with more than 1152 samples per channel for output in the unclipped mode */
+#define OUTSIZE_UNCLIPPED (1152*2*sizeof(FLOAT))
+
+int
+hip_decode1_unclipped(hip_t hip, unsigned char *buffer, size_t len, sample_t pcm_l[], sample_t pcm_r[])
+{
+    static char out[OUTSIZE_UNCLIPPED];
+    mp3data_struct mp3data;
+    int     enc_delay, enc_padding;
+
+    if (hip) {
+        return decode1_headersB_clipchoice(hip, buffer, len, (char *) pcm_l, (char *) pcm_r, &mp3data,
+                                           &enc_delay, &enc_padding, out, OUTSIZE_UNCLIPPED,
+                                           sizeof(FLOAT), decodeMP3_unclipped);
+    }
+    return 0;
+}
+
+/*
+ * For lame_decode:  return code
+ *  -1     error
+ *   0     ok, but need more data before outputing any samples
+ *   n     number of samples output.  Will be at most one frame of
+ *         MPEG data.  
+ */
+
+int
+hip_decode1_headers(hip_t hip, unsigned char *buffer,
+                     size_t len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data)
+{
+    int     enc_delay, enc_padding;
+    return hip_decode1_headersB(hip, buffer, len, pcm_l, pcm_r, mp3data, &enc_delay, &enc_padding);
+}
+
+
+int
+hip_decode1(hip_t hip, unsigned char *buffer, size_t len, short pcm_l[], short pcm_r[])
+{
+    mp3data_struct mp3data;
+    return hip_decode1_headers(hip, buffer, len, pcm_l, pcm_r, &mp3data);
+}
+
+
+/*
+ * For hip_decode:  return code
+ *  -1     error
+ *   0     ok, but need more data before outputing any samples
+ *   n     number of samples output.  a multiple of 576 or 1152 depending on MP3 file.
+ */
+
+int
+hip_decode_headers(hip_t hip, unsigned char *buffer,
+                    size_t len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data)
+{
+    int     ret;
+    int     totsize = 0;     /* number of decoded samples per channel */
+
+    for (;;) {
+        switch (ret = hip_decode1_headers(hip, buffer, len, pcm_l + totsize, pcm_r + totsize, mp3data)) {
+        case -1:
+            return ret;
+        case 0:
+            return totsize;
+        default:
+            totsize += ret;
+            len = 0;    /* future calls to decodeMP3 are just to flush buffers */
+            break;
+        }
+    }
+}
+
+
+int
+hip_decode(hip_t hip, unsigned char *buffer, size_t len, short pcm_l[], short pcm_r[])
+{
+    mp3data_struct mp3data;
+    return hip_decode_headers(hip, buffer, len, pcm_l, pcm_r, &mp3data);
+}
+
+
+int
+hip_decode1_headersB(hip_t hip, unsigned char *buffer,
+                      size_t len,
+                      short pcm_l[], short pcm_r[], mp3data_struct * mp3data,
+                      int *enc_delay, int *enc_padding)
+{
+    static char out[OUTSIZE_CLIPPED];
+    if (hip) {
+        return decode1_headersB_clipchoice(hip, buffer, len, (char *) pcm_l, (char *) pcm_r, mp3data,
+                                           enc_delay, enc_padding, out, OUTSIZE_CLIPPED,
+                                           sizeof(short), decodeMP3);
+    }
+    return -1;
+}
+
+
+void hip_set_pinfo(hip_t hip, plotting_data* pinfo)
+{
+    if (hip) {
+        hip->pinfo = pinfo;
+    }
+}
+
+#endif
+
+/* end of mpglib_interface.c */
diff --git a/libmp3lame/newmdct.c b/libmp3lame/newmdct.c
new file mode 100644
index 0000000..774b532
--- /dev/null
+++ b/libmp3lame/newmdct.c
@@ -0,0 +1,1037 @@
+/*
+ *      MP3 window subband -> subband filtering -> mdct routine
+ *
+ *      Copyright (c) 1999-2000 Takehiro Tominaga
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ *         Special Thanks to Patrick De Smet for your advices.
+ */
+
+/* $Id: newmdct.c,v 1.37 2008/04/22 23:01:22 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "newmdct.h"
+
+
+
+#ifndef USE_GOGO_SUBBAND
+static const FLOAT enwindow[] = {
+    -4.77e-07 * 0.740951125354959 / 2.384e-06, 1.03951e-04 * 0.740951125354959 / 2.384e-06,
+    9.53674e-04 * 0.740951125354959 / 2.384e-06, 2.841473e-03 * 0.740951125354959 / 2.384e-06,
+    3.5758972e-02 * 0.740951125354959 / 2.384e-06, 3.401756e-03 * 0.740951125354959 / 2.384e-06, 9.83715e-04 * 0.740951125354959 / 2.384e-06, 9.9182e-05 * 0.740951125354959 / 2.384e-06, /* 15 */
+    1.2398e-05 * 0.740951125354959 / 2.384e-06, 1.91212e-04 * 0.740951125354959 / 2.384e-06,
+    2.283096e-03 * 0.740951125354959 / 2.384e-06, 1.6994476e-02 * 0.740951125354959 / 2.384e-06,
+    -1.8756866e-02 * 0.740951125354959 / 2.384e-06, -2.630711e-03 * 0.740951125354959 / 2.384e-06,
+    -2.47478e-04 * 0.740951125354959 / 2.384e-06, -1.4782e-05 * 0.740951125354959 / 2.384e-06,
+    9.063471690191471e-01,
+    1.960342806591213e-01,
+
+
+    -4.77e-07 * 0.773010453362737 / 2.384e-06, 1.05858e-04 * 0.773010453362737 / 2.384e-06,
+    9.30786e-04 * 0.773010453362737 / 2.384e-06, 2.521515e-03 * 0.773010453362737 / 2.384e-06,
+    3.5694122e-02 * 0.773010453362737 / 2.384e-06, 3.643036e-03 * 0.773010453362737 / 2.384e-06, 9.91821e-04 * 0.773010453362737 / 2.384e-06, 9.6321e-05 * 0.773010453362737 / 2.384e-06, /* 14 */
+    1.1444e-05 * 0.773010453362737 / 2.384e-06, 1.65462e-04 * 0.773010453362737 / 2.384e-06,
+    2.110004e-03 * 0.773010453362737 / 2.384e-06, 1.6112804e-02 * 0.773010453362737 / 2.384e-06,
+    -1.9634247e-02 * 0.773010453362737 / 2.384e-06, -2.803326e-03 * 0.773010453362737 / 2.384e-06,
+    -2.77042e-04 * 0.773010453362737 / 2.384e-06, -1.6689e-05 * 0.773010453362737 / 2.384e-06,
+    8.206787908286602e-01,
+    3.901806440322567e-01,
+
+
+    -4.77e-07 * 0.803207531480645 / 2.384e-06, 1.07288e-04 * 0.803207531480645 / 2.384e-06,
+    9.02653e-04 * 0.803207531480645 / 2.384e-06, 2.174854e-03 * 0.803207531480645 / 2.384e-06,
+    3.5586357e-02 * 0.803207531480645 / 2.384e-06, 3.858566e-03 * 0.803207531480645 / 2.384e-06, 9.95159e-04 * 0.803207531480645 / 2.384e-06, 9.3460e-05 * 0.803207531480645 / 2.384e-06, /* 13 */
+    1.0014e-05 * 0.803207531480645 / 2.384e-06, 1.40190e-04 * 0.803207531480645 / 2.384e-06,
+    1.937389e-03 * 0.803207531480645 / 2.384e-06, 1.5233517e-02 * 0.803207531480645 / 2.384e-06,
+    -2.0506859e-02 * 0.803207531480645 / 2.384e-06, -2.974033e-03 * 0.803207531480645 / 2.384e-06,
+    -3.07560e-04 * 0.803207531480645 / 2.384e-06, -1.8120e-05 * 0.803207531480645 / 2.384e-06,
+    7.416505462720353e-01,
+    5.805693545089249e-01,
+
+
+    -4.77e-07 * 0.831469612302545 / 2.384e-06, 1.08242e-04 * 0.831469612302545 / 2.384e-06,
+    8.68797e-04 * 0.831469612302545 / 2.384e-06, 1.800537e-03 * 0.831469612302545 / 2.384e-06,
+    3.5435200e-02 * 0.831469612302545 / 2.384e-06, 4.049301e-03 * 0.831469612302545 / 2.384e-06, 9.94205e-04 * 0.831469612302545 / 2.384e-06, 9.0599e-05 * 0.831469612302545 / 2.384e-06, /* 12 */
+    9.060e-06 * 0.831469612302545 / 2.384e-06, 1.16348e-04 * 0.831469612302545 / 2.384e-06,
+    1.766682e-03 * 0.831469612302545 / 2.384e-06, 1.4358521e-02 * 0.831469612302545 / 2.384e-06,
+    -2.1372318e-02 * 0.831469612302545 / 2.384e-06, -3.14188e-03 * 0.831469612302545 / 2.384e-06,
+    -3.39031e-04 * 0.831469612302545 / 2.384e-06, -1.9550e-05 * 0.831469612302545 / 2.384e-06,
+    6.681786379192989e-01,
+    7.653668647301797e-01,
+
+
+    -4.77e-07 * 0.857728610000272 / 2.384e-06, 1.08719e-04 * 0.857728610000272 / 2.384e-06,
+    8.29220e-04 * 0.857728610000272 / 2.384e-06, 1.399517e-03 * 0.857728610000272 / 2.384e-06,
+    3.5242081e-02 * 0.857728610000272 / 2.384e-06, 4.215240e-03 * 0.857728610000272 / 2.384e-06, 9.89437e-04 * 0.857728610000272 / 2.384e-06, 8.7261e-05 * 0.857728610000272 / 2.384e-06, /* 11 */
+    8.106e-06 * 0.857728610000272 / 2.384e-06, 9.3937e-05 * 0.857728610000272 / 2.384e-06,
+    1.597881e-03 * 0.857728610000272 / 2.384e-06, 1.3489246e-02 * 0.857728610000272 / 2.384e-06,
+    -2.2228718e-02 * 0.857728610000272 / 2.384e-06, -3.306866e-03 * 0.857728610000272 / 2.384e-06,
+    -3.71456e-04 * 0.857728610000272 / 2.384e-06, -2.1458e-05 * 0.857728610000272 / 2.384e-06,
+    5.993769336819237e-01,
+    9.427934736519954e-01,
+
+
+    -4.77e-07 * 0.881921264348355 / 2.384e-06, 1.08719e-04 * 0.881921264348355 / 2.384e-06,
+    7.8392e-04 * 0.881921264348355 / 2.384e-06, 9.71317e-04 * 0.881921264348355 / 2.384e-06,
+    3.5007000e-02 * 0.881921264348355 / 2.384e-06, 4.357815e-03 * 0.881921264348355 / 2.384e-06, 9.80854e-04 * 0.881921264348355 / 2.384e-06, 8.3923e-05 * 0.881921264348355 / 2.384e-06, /* 10 */
+    7.629e-06 * 0.881921264348355 / 2.384e-06, 7.2956e-05 * 0.881921264348355 / 2.384e-06,
+    1.432419e-03 * 0.881921264348355 / 2.384e-06, 1.2627602e-02 * 0.881921264348355 / 2.384e-06,
+    -2.3074150e-02 * 0.881921264348355 / 2.384e-06, -3.467083e-03 * 0.881921264348355 / 2.384e-06,
+    -4.04358e-04 * 0.881921264348355 / 2.384e-06, -2.3365e-05 * 0.881921264348355 / 2.384e-06,
+    5.345111359507916e-01,
+    1.111140466039205e+00,
+
+
+    -9.54e-07 * 0.903989293123443 / 2.384e-06, 1.08242e-04 * 0.903989293123443 / 2.384e-06,
+    7.31945e-04 * 0.903989293123443 / 2.384e-06, 5.15938e-04 * 0.903989293123443 / 2.384e-06,
+    3.4730434e-02 * 0.903989293123443 / 2.384e-06, 4.477024e-03 * 0.903989293123443 / 2.384e-06, 9.68933e-04 * 0.903989293123443 / 2.384e-06, 8.0585e-05 * 0.903989293123443 / 2.384e-06, /* 9 */
+    6.676e-06 * 0.903989293123443 / 2.384e-06, 5.2929e-05 * 0.903989293123443 / 2.384e-06,
+    1.269817e-03 * 0.903989293123443 / 2.384e-06, 1.1775017e-02 * 0.903989293123443 / 2.384e-06,
+    -2.3907185e-02 * 0.903989293123443 / 2.384e-06, -3.622532e-03 * 0.903989293123443 / 2.384e-06,
+    -4.38213e-04 * 0.903989293123443 / 2.384e-06, -2.5272e-05 * 0.903989293123443 / 2.384e-06,
+    4.729647758913199e-01,
+    1.268786568327291e+00,
+
+
+    -9.54e-07 * 0.92387953251128675613 / 2.384e-06,
+    1.06812e-04 * 0.92387953251128675613 / 2.384e-06,
+    6.74248e-04 * 0.92387953251128675613 / 2.384e-06,
+    3.3379e-05 * 0.92387953251128675613 / 2.384e-06,
+    3.4412861e-02 * 0.92387953251128675613 / 2.384e-06,
+    4.573822e-03 * 0.92387953251128675613 / 2.384e-06,
+    9.54151e-04 * 0.92387953251128675613 / 2.384e-06,
+    7.6771e-05 * 0.92387953251128675613 / 2.384e-06,
+    6.199e-06 * 0.92387953251128675613 / 2.384e-06, 3.4332e-05 * 0.92387953251128675613 / 2.384e-06,
+    1.111031e-03 * 0.92387953251128675613 / 2.384e-06,
+    1.0933399e-02 * 0.92387953251128675613 / 2.384e-06,
+    -2.4725437e-02 * 0.92387953251128675613 / 2.384e-06,
+    -3.771782e-03 * 0.92387953251128675613 / 2.384e-06,
+    -4.72546e-04 * 0.92387953251128675613 / 2.384e-06,
+    -2.7657e-05 * 0.92387953251128675613 / 2.384e-06,
+    4.1421356237309504879e-01, /* tan(PI/8) */
+    1.414213562373095e+00,
+
+
+    -9.54e-07 * 0.941544065183021 / 2.384e-06, 1.05381e-04 * 0.941544065183021 / 2.384e-06,
+    6.10352e-04 * 0.941544065183021 / 2.384e-06, -4.75883e-04 * 0.941544065183021 / 2.384e-06,
+    3.4055710e-02 * 0.941544065183021 / 2.384e-06, 4.649162e-03 * 0.941544065183021 / 2.384e-06, 9.35555e-04 * 0.941544065183021 / 2.384e-06, 7.3433e-05 * 0.941544065183021 / 2.384e-06, /* 7 */
+    5.245e-06 * 0.941544065183021 / 2.384e-06, 1.7166e-05 * 0.941544065183021 / 2.384e-06,
+    9.56535e-04 * 0.941544065183021 / 2.384e-06, 1.0103703e-02 * 0.941544065183021 / 2.384e-06,
+    -2.5527000e-02 * 0.941544065183021 / 2.384e-06, -3.914356e-03 * 0.941544065183021 / 2.384e-06,
+    -5.07355e-04 * 0.941544065183021 / 2.384e-06, -3.0041e-05 * 0.941544065183021 / 2.384e-06,
+    3.578057213145241e-01,
+    1.546020906725474e+00,
+
+
+    -9.54e-07 * 0.956940335732209 / 2.384e-06, 1.02520e-04 * 0.956940335732209 / 2.384e-06,
+    5.39303e-04 * 0.956940335732209 / 2.384e-06, -1.011848e-03 * 0.956940335732209 / 2.384e-06,
+    3.3659935e-02 * 0.956940335732209 / 2.384e-06, 4.703045e-03 * 0.956940335732209 / 2.384e-06, 9.15051e-04 * 0.956940335732209 / 2.384e-06, 7.0095e-05 * 0.956940335732209 / 2.384e-06, /* 6 */
+    4.768e-06 * 0.956940335732209 / 2.384e-06, 9.54e-07 * 0.956940335732209 / 2.384e-06,
+    8.06808e-04 * 0.956940335732209 / 2.384e-06, 9.287834e-03 * 0.956940335732209 / 2.384e-06,
+    -2.6310921e-02 * 0.956940335732209 / 2.384e-06, -4.048824e-03 * 0.956940335732209 / 2.384e-06,
+    -5.42164e-04 * 0.956940335732209 / 2.384e-06, -3.2425e-05 * 0.956940335732209 / 2.384e-06,
+    3.033466836073424e-01,
+    1.662939224605090e+00,
+
+
+    -1.431e-06 * 0.970031253194544 / 2.384e-06, 9.9182e-05 * 0.970031253194544 / 2.384e-06,
+    4.62532e-04 * 0.970031253194544 / 2.384e-06, -1.573563e-03 * 0.970031253194544 / 2.384e-06,
+    3.3225536e-02 * 0.970031253194544 / 2.384e-06, 4.737377e-03 * 0.970031253194544 / 2.384e-06, 8.91685e-04 * 0.970031253194544 / 2.384e-06, 6.6280e-05 * 0.970031253194544 / 2.384e-06, /* 5 */
+    4.292e-06 * 0.970031253194544 / 2.384e-06, -1.3828e-05 * 0.970031253194544 / 2.384e-06,
+    6.61850e-04 * 0.970031253194544 / 2.384e-06, 8.487225e-03 * 0.970031253194544 / 2.384e-06,
+    -2.7073860e-02 * 0.970031253194544 / 2.384e-06, -4.174709e-03 * 0.970031253194544 / 2.384e-06,
+    -5.76973e-04 * 0.970031253194544 / 2.384e-06, -3.4809e-05 * 0.970031253194544 / 2.384e-06,
+    2.504869601913055e-01,
+    1.763842528696710e+00,
+
+
+    -1.431e-06 * 0.98078528040323 / 2.384e-06, 9.5367e-05 * 0.98078528040323 / 2.384e-06,
+    3.78609e-04 * 0.98078528040323 / 2.384e-06, -2.161503e-03 * 0.98078528040323 / 2.384e-06,
+    3.2754898e-02 * 0.98078528040323 / 2.384e-06, 4.752159e-03 * 0.98078528040323 / 2.384e-06, 8.66413e-04 * 0.98078528040323 / 2.384e-06, 6.2943e-05 * 0.98078528040323 / 2.384e-06, /* 4 */
+    3.815e-06 * 0.98078528040323 / 2.384e-06, -2.718e-05 * 0.98078528040323 / 2.384e-06,
+    5.22137e-04 * 0.98078528040323 / 2.384e-06, 7.703304e-03 * 0.98078528040323 / 2.384e-06,
+    -2.7815342e-02 * 0.98078528040323 / 2.384e-06, -4.290581e-03 * 0.98078528040323 / 2.384e-06,
+    -6.11782e-04 * 0.98078528040323 / 2.384e-06, -3.7670e-05 * 0.98078528040323 / 2.384e-06,
+    1.989123673796580e-01,
+    1.847759065022573e+00,
+
+
+    -1.907e-06 * 0.989176509964781 / 2.384e-06, 9.0122e-05 * 0.989176509964781 / 2.384e-06,
+    2.88486e-04 * 0.989176509964781 / 2.384e-06, -2.774239e-03 * 0.989176509964781 / 2.384e-06,
+    3.2248020e-02 * 0.989176509964781 / 2.384e-06, 4.748821e-03 * 0.989176509964781 / 2.384e-06, 8.38757e-04 * 0.989176509964781 / 2.384e-06, 5.9605e-05 * 0.989176509964781 / 2.384e-06, /* 3 */
+    3.338e-06 * 0.989176509964781 / 2.384e-06, -3.9577e-05 * 0.989176509964781 / 2.384e-06,
+    3.88145e-04 * 0.989176509964781 / 2.384e-06, 6.937027e-03 * 0.989176509964781 / 2.384e-06,
+    -2.8532982e-02 * 0.989176509964781 / 2.384e-06, -4.395962e-03 * 0.989176509964781 / 2.384e-06,
+    -6.46591e-04 * 0.989176509964781 / 2.384e-06, -4.0531e-05 * 0.989176509964781 / 2.384e-06,
+    1.483359875383474e-01,
+    1.913880671464418e+00,
+
+
+    -1.907e-06 * 0.995184726672197 / 2.384e-06, 8.4400e-05 * 0.995184726672197 / 2.384e-06,
+    1.91689e-04 * 0.995184726672197 / 2.384e-06, -3.411293e-03 * 0.995184726672197 / 2.384e-06,
+    3.1706810e-02 * 0.995184726672197 / 2.384e-06, 4.728317e-03 * 0.995184726672197 / 2.384e-06,
+    8.09669e-04 * 0.995184726672197 / 2.384e-06, 5.579e-05 * 0.995184726672197 / 2.384e-06,
+    3.338e-06 * 0.995184726672197 / 2.384e-06, -5.0545e-05 * 0.995184726672197 / 2.384e-06,
+    2.59876e-04 * 0.995184726672197 / 2.384e-06, 6.189346e-03 * 0.995184726672197 / 2.384e-06,
+    -2.9224873e-02 * 0.995184726672197 / 2.384e-06, -4.489899e-03 * 0.995184726672197 / 2.384e-06,
+    -6.80923e-04 * 0.995184726672197 / 2.384e-06, -4.3392e-05 * 0.995184726672197 / 2.384e-06,
+    9.849140335716425e-02,
+    1.961570560806461e+00,
+
+
+    -2.384e-06 * 0.998795456205172 / 2.384e-06, 7.7724e-05 * 0.998795456205172 / 2.384e-06,
+    8.8215e-05 * 0.998795456205172 / 2.384e-06, -4.072189e-03 * 0.998795456205172 / 2.384e-06,
+    3.1132698e-02 * 0.998795456205172 / 2.384e-06, 4.691124e-03 * 0.998795456205172 / 2.384e-06,
+    7.79152e-04 * 0.998795456205172 / 2.384e-06, 5.2929e-05 * 0.998795456205172 / 2.384e-06,
+    2.861e-06 * 0.998795456205172 / 2.384e-06, -6.0558e-05 * 0.998795456205172 / 2.384e-06,
+    1.37329e-04 * 0.998795456205172 / 2.384e-06, 5.462170e-03 * 0.998795456205172 / 2.384e-06,
+    -2.9890060e-02 * 0.998795456205172 / 2.384e-06, -4.570484e-03 * 0.998795456205172 / 2.384e-06,
+    -7.14302e-04 * 0.998795456205172 / 2.384e-06, -4.6253e-05 * 0.998795456205172 / 2.384e-06,
+    4.912684976946725e-02,
+    1.990369453344394e+00,
+
+
+    3.5780907e-02 * SQRT2 * 0.5 / 2.384e-06, 1.7876148e-02 * SQRT2 * 0.5 / 2.384e-06,
+    3.134727e-03 * SQRT2 * 0.5 / 2.384e-06, 2.457142e-03 * SQRT2 * 0.5 / 2.384e-06,
+    9.71317e-04 * SQRT2 * 0.5 / 2.384e-06, 2.18868e-04 * SQRT2 * 0.5 / 2.384e-06,
+    1.01566e-04 * SQRT2 * 0.5 / 2.384e-06, 1.3828e-05 * SQRT2 * 0.5 / 2.384e-06,
+
+    3.0526638e-02 / 2.384e-06, 4.638195e-03 / 2.384e-06, 7.47204e-04 / 2.384e-06,
+    4.9591e-05 / 2.384e-06,
+    4.756451e-03 / 2.384e-06, 2.1458e-05 / 2.384e-06, -6.9618e-05 / 2.384e-06, /*    2.384e-06/2.384e-06 */
+};
+#endif
+
+
+#define NS 12
+#define NL 36
+
+static const FLOAT win[4][NL] = {
+    {
+     2.382191739347913e-13,
+     6.423305872147834e-13,
+     9.400849094049688e-13,
+     1.122435026096556e-12,
+     1.183840321267481e-12,
+     1.122435026096556e-12,
+     9.400849094049690e-13,
+     6.423305872147839e-13,
+     2.382191739347918e-13,
+
+     5.456116108943412e-12,
+     4.878985199565852e-12,
+     4.240448995017367e-12,
+     3.559909094758252e-12,
+     2.858043359288075e-12,
+     2.156177623817898e-12,
+     1.475637723558783e-12,
+     8.371015190102974e-13,
+     2.599706096327376e-13,
+
+     -5.456116108943412e-12,
+     -4.878985199565852e-12,
+     -4.240448995017367e-12,
+     -3.559909094758252e-12,
+     -2.858043359288076e-12,
+     -2.156177623817898e-12,
+     -1.475637723558783e-12,
+     -8.371015190102975e-13,
+     -2.599706096327376e-13,
+
+     -2.382191739347923e-13,
+     -6.423305872147843e-13,
+     -9.400849094049696e-13,
+     -1.122435026096556e-12,
+     -1.183840321267481e-12,
+     -1.122435026096556e-12,
+     -9.400849094049694e-13,
+     -6.423305872147840e-13,
+     -2.382191739347918e-13,
+     },
+    {
+     2.382191739347913e-13,
+     6.423305872147834e-13,
+     9.400849094049688e-13,
+     1.122435026096556e-12,
+     1.183840321267481e-12,
+     1.122435026096556e-12,
+     9.400849094049688e-13,
+     6.423305872147841e-13,
+     2.382191739347918e-13,
+
+     5.456116108943413e-12,
+     4.878985199565852e-12,
+     4.240448995017367e-12,
+     3.559909094758253e-12,
+     2.858043359288075e-12,
+     2.156177623817898e-12,
+     1.475637723558782e-12,
+     8.371015190102975e-13,
+     2.599706096327376e-13,
+
+     -5.461314069809755e-12,
+     -4.921085770524055e-12,
+     -4.343405037091838e-12,
+     -3.732668368707687e-12,
+     -3.093523840190885e-12,
+     -2.430835727329465e-12,
+     -1.734679010007751e-12,
+     -9.748253656609281e-13,
+     -2.797435120168326e-13,
+
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     -2.283748241799531e-13,
+     -4.037858874020686e-13,
+     -2.146547464825323e-13,
+     },
+    {
+     1.316524975873958e-01, /* win[SHORT_TYPE] */
+     4.142135623730950e-01,
+     7.673269879789602e-01,
+
+     1.091308501069271e+00, /* tantab_l */
+     1.303225372841206e+00,
+     1.569685577117490e+00,
+     1.920982126971166e+00,
+     2.414213562373094e+00,
+     3.171594802363212e+00,
+     4.510708503662055e+00,
+     7.595754112725146e+00,
+     2.290376554843115e+01,
+
+     0.98480775301220802032, /* cx */
+     0.64278760968653936292,
+     0.34202014332566882393,
+     0.93969262078590842791,
+     -0.17364817766693030343,
+     -0.76604444311897790243,
+     0.86602540378443870761,
+     0.500000000000000e+00,
+
+     -5.144957554275265e-01, /* ca */
+     -4.717319685649723e-01,
+     -3.133774542039019e-01,
+     -1.819131996109812e-01,
+     -9.457419252642064e-02,
+     -4.096558288530405e-02,
+     -1.419856857247115e-02,
+     -3.699974673760037e-03,
+
+     8.574929257125442e-01, /* cs */
+     8.817419973177052e-01,
+     9.496286491027329e-01,
+     9.833145924917901e-01,
+     9.955178160675857e-01,
+     9.991605581781475e-01,
+     9.998991952444470e-01,
+     9.999931550702802e-01,
+     },
+    {
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     0.000000000000000e+00,
+     2.283748241799531e-13,
+     4.037858874020686e-13,
+     2.146547464825323e-13,
+
+     5.461314069809755e-12,
+     4.921085770524055e-12,
+     4.343405037091838e-12,
+     3.732668368707687e-12,
+     3.093523840190885e-12,
+     2.430835727329466e-12,
+     1.734679010007751e-12,
+     9.748253656609281e-13,
+     2.797435120168326e-13,
+
+     -5.456116108943413e-12,
+     -4.878985199565852e-12,
+     -4.240448995017367e-12,
+     -3.559909094758253e-12,
+     -2.858043359288075e-12,
+     -2.156177623817898e-12,
+     -1.475637723558782e-12,
+     -8.371015190102975e-13,
+     -2.599706096327376e-13,
+
+     -2.382191739347913e-13,
+     -6.423305872147834e-13,
+     -9.400849094049688e-13,
+     -1.122435026096556e-12,
+     -1.183840321267481e-12,
+     -1.122435026096556e-12,
+     -9.400849094049688e-13,
+     -6.423305872147841e-13,
+     -2.382191739347918e-13,
+     }
+};
+
+#define tantab_l (win[SHORT_TYPE]+3)
+#define cx (win[SHORT_TYPE]+12)
+#define ca (win[SHORT_TYPE]+20)
+#define cs (win[SHORT_TYPE]+28)
+
+/************************************************************************
+*
+* window_subband()
+*
+* PURPOSE:  Overlapping window on PCM samples
+*
+* SEMANTICS:
+* 32 16-bit pcm samples are scaled to fractional 2's complement and
+* concatenated to the end of the window buffer #x#. The updated window
+* buffer #x# is then windowed by the analysis window #c# to produce the
+* windowed sample #z#
+*
+************************************************************************/
+
+/*
+ *      new IDCT routine written by Takehiro TOMINAGA
+ */
+static const int order[] = {
+    0, 1, 16, 17, 8, 9, 24, 25, 4, 5, 20, 21, 12, 13, 28, 29,
+    2, 3, 18, 19, 10, 11, 26, 27, 6, 7, 22, 23, 14, 15, 30, 31
+};
+
+
+/* returns sum_j=0^31 a[j]*cos(PI*j*(k+1/2)/32), 0<=k<32 */
+inline static void
+window_subband(const sample_t * x1, FLOAT a[SBLIMIT])
+{
+    int     i;
+    FLOAT const *wp = enwindow + 10;
+
+    const sample_t *x2 = &x1[238 - 14 - 286];
+
+    for (i = -15; i < 0; i++) {
+        FLOAT   w, s, t;
+
+        w = wp[-10];
+        s = x2[-224] * w;
+        t = x1[224] * w;
+        w = wp[-9];
+        s += x2[-160] * w;
+        t += x1[160] * w;
+        w = wp[-8];
+        s += x2[-96] * w;
+        t += x1[96] * w;
+        w = wp[-7];
+        s += x2[-32] * w;
+        t += x1[32] * w;
+        w = wp[-6];
+        s += x2[32] * w;
+        t += x1[-32] * w;
+        w = wp[-5];
+        s += x2[96] * w;
+        t += x1[-96] * w;
+        w = wp[-4];
+        s += x2[160] * w;
+        t += x1[-160] * w;
+        w = wp[-3];
+        s += x2[224] * w;
+        t += x1[-224] * w;
+
+        w = wp[-2];
+        s += x1[-256] * w;
+        t -= x2[256] * w;
+        w = wp[-1];
+        s += x1[-192] * w;
+        t -= x2[192] * w;
+        w = wp[0];
+        s += x1[-128] * w;
+        t -= x2[128] * w;
+        w = wp[1];
+        s += x1[-64] * w;
+        t -= x2[64] * w;
+        w = wp[2];
+        s += x1[0] * w;
+        t -= x2[0] * w;
+        w = wp[3];
+        s += x1[64] * w;
+        t -= x2[-64] * w;
+        w = wp[4];
+        s += x1[128] * w;
+        t -= x2[-128] * w;
+        w = wp[5];
+        s += x1[192] * w;
+        t -= x2[-192] * w;
+
+        /*
+         * this multiplyer could be removed, but it needs more 256 FLOAT data.
+         * thinking about the data cache performance, I think we should not
+         * use such a huge table. tt 2000/Oct/25
+         */
+        s *= wp[6];
+        w = t - s;
+        a[30 + i * 2] = t + s;
+        a[31 + i * 2] = wp[7] * w;
+        wp += 18;
+        x1--;
+        x2++;
+    }
+    {
+        FLOAT   s, t, u, v;
+        t = x1[-16] * wp[-10];
+        s = x1[-32] * wp[-2];
+        t += (x1[-48] - x1[16]) * wp[-9];
+        s += x1[-96] * wp[-1];
+        t += (x1[-80] + x1[48]) * wp[-8];
+        s += x1[-160] * wp[0];
+        t += (x1[-112] - x1[80]) * wp[-7];
+        s += x1[-224] * wp[1];
+        t += (x1[-144] + x1[112]) * wp[-6];
+        s -= x1[32] * wp[2];
+        t += (x1[-176] - x1[144]) * wp[-5];
+        s -= x1[96] * wp[3];
+        t += (x1[-208] + x1[176]) * wp[-4];
+        s -= x1[160] * wp[4];
+        t += (x1[-240] - x1[208]) * wp[-3];
+        s -= x1[224];
+
+        u = s - t;
+        v = s + t;
+
+        t = a[14];
+        s = a[15] - t;
+
+        a[31] = v + t;  /* A0 */
+        a[30] = u + s;  /* A1 */
+        a[15] = u - s;  /* A2 */
+        a[14] = v - t;  /* A3 */
+    }
+    {
+        FLOAT   xr;
+        xr = a[28] - a[0];
+        a[0] += a[28];
+        a[28] = xr * wp[-2 * 18 + 7];
+        xr = a[29] - a[1];
+        a[1] += a[29];
+        a[29] = xr * wp[-2 * 18 + 7];
+
+        xr = a[26] - a[2];
+        a[2] += a[26];
+        a[26] = xr * wp[-4 * 18 + 7];
+        xr = a[27] - a[3];
+        a[3] += a[27];
+        a[27] = xr * wp[-4 * 18 + 7];
+
+        xr = a[24] - a[4];
+        a[4] += a[24];
+        a[24] = xr * wp[-6 * 18 + 7];
+        xr = a[25] - a[5];
+        a[5] += a[25];
+        a[25] = xr * wp[-6 * 18 + 7];
+
+        xr = a[22] - a[6];
+        a[6] += a[22];
+        a[22] = xr * SQRT2;
+        xr = a[23] - a[7];
+        a[7] += a[23];
+        a[23] = xr * SQRT2 - a[7];
+        a[7] -= a[6];
+        a[22] -= a[7];
+        a[23] -= a[22];
+
+        xr = a[6];
+        a[6] = a[31] - xr;
+        a[31] = a[31] + xr;
+        xr = a[7];
+        a[7] = a[30] - xr;
+        a[30] = a[30] + xr;
+        xr = a[22];
+        a[22] = a[15] - xr;
+        a[15] = a[15] + xr;
+        xr = a[23];
+        a[23] = a[14] - xr;
+        a[14] = a[14] + xr;
+
+        xr = a[20] - a[8];
+        a[8] += a[20];
+        a[20] = xr * wp[-10 * 18 + 7];
+        xr = a[21] - a[9];
+        a[9] += a[21];
+        a[21] = xr * wp[-10 * 18 + 7];
+
+        xr = a[18] - a[10];
+        a[10] += a[18];
+        a[18] = xr * wp[-12 * 18 + 7];
+        xr = a[19] - a[11];
+        a[11] += a[19];
+        a[19] = xr * wp[-12 * 18 + 7];
+
+        xr = a[16] - a[12];
+        a[12] += a[16];
+        a[16] = xr * wp[-14 * 18 + 7];
+        xr = a[17] - a[13];
+        a[13] += a[17];
+        a[17] = xr * wp[-14 * 18 + 7];
+
+        xr = -a[20] + a[24];
+        a[20] += a[24];
+        a[24] = xr * wp[-12 * 18 + 7];
+        xr = -a[21] + a[25];
+        a[21] += a[25];
+        a[25] = xr * wp[-12 * 18 + 7];
+
+        xr = a[4] - a[8];
+        a[4] += a[8];
+        a[8] = xr * wp[-12 * 18 + 7];
+        xr = a[5] - a[9];
+        a[5] += a[9];
+        a[9] = xr * wp[-12 * 18 + 7];
+
+        xr = a[0] - a[12];
+        a[0] += a[12];
+        a[12] = xr * wp[-4 * 18 + 7];
+        xr = a[1] - a[13];
+        a[1] += a[13];
+        a[13] = xr * wp[-4 * 18 + 7];
+        xr = a[16] - a[28];
+        a[16] += a[28];
+        a[28] = xr * wp[-4 * 18 + 7];
+        xr = -a[17] + a[29];
+        a[17] += a[29];
+        a[29] = xr * wp[-4 * 18 + 7];
+
+        xr = SQRT2 * (a[2] - a[10]);
+        a[2] += a[10];
+        a[10] = xr;
+        xr = SQRT2 * (a[3] - a[11]);
+        a[3] += a[11];
+        a[11] = xr;
+        xr = SQRT2 * (-a[18] + a[26]);
+        a[18] += a[26];
+        a[26] = xr - a[18];
+        xr = SQRT2 * (-a[19] + a[27]);
+        a[19] += a[27];
+        a[27] = xr - a[19];
+
+        xr = a[2];
+        a[19] -= a[3];
+        a[3] -= xr;
+        a[2] = a[31] - xr;
+        a[31] += xr;
+        xr = a[3];
+        a[11] -= a[19];
+        a[18] -= xr;
+        a[3] = a[30] - xr;
+        a[30] += xr;
+        xr = a[18];
+        a[27] -= a[11];
+        a[19] -= xr;
+        a[18] = a[15] - xr;
+        a[15] += xr;
+
+        xr = a[19];
+        a[10] -= xr;
+        a[19] = a[14] - xr;
+        a[14] += xr;
+        xr = a[10];
+        a[11] -= xr;
+        a[10] = a[23] - xr;
+        a[23] += xr;
+        xr = a[11];
+        a[26] -= xr;
+        a[11] = a[22] - xr;
+        a[22] += xr;
+        xr = a[26];
+        a[27] -= xr;
+        a[26] = a[7] - xr;
+        a[7] += xr;
+
+        xr = a[27];
+        a[27] = a[6] - xr;
+        a[6] += xr;
+
+        xr = SQRT2 * (a[0] - a[4]);
+        a[0] += a[4];
+        a[4] = xr;
+        xr = SQRT2 * (a[1] - a[5]);
+        a[1] += a[5];
+        a[5] = xr;
+        xr = SQRT2 * (a[16] - a[20]);
+        a[16] += a[20];
+        a[20] = xr;
+        xr = SQRT2 * (a[17] - a[21]);
+        a[17] += a[21];
+        a[21] = xr;
+
+        xr = -SQRT2 * (a[8] - a[12]);
+        a[8] += a[12];
+        a[12] = xr - a[8];
+        xr = -SQRT2 * (a[9] - a[13]);
+        a[9] += a[13];
+        a[13] = xr - a[9];
+        xr = -SQRT2 * (a[25] - a[29]);
+        a[25] += a[29];
+        a[29] = xr - a[25];
+        xr = -SQRT2 * (a[24] + a[28]);
+        a[24] -= a[28];
+        a[28] = xr - a[24];
+
+        xr = a[24] - a[16];
+        a[24] = xr;
+        xr = a[20] - xr;
+        a[20] = xr;
+        xr = a[28] - xr;
+        a[28] = xr;
+
+        xr = a[25] - a[17];
+        a[25] = xr;
+        xr = a[21] - xr;
+        a[21] = xr;
+        xr = a[29] - xr;
+        a[29] = xr;
+
+        xr = a[17] - a[1];
+        a[17] = xr;
+        xr = a[9] - xr;
+        a[9] = xr;
+        xr = a[25] - xr;
+        a[25] = xr;
+        xr = a[5] - xr;
+        a[5] = xr;
+        xr = a[21] - xr;
+        a[21] = xr;
+        xr = a[13] - xr;
+        a[13] = xr;
+        xr = a[29] - xr;
+        a[29] = xr;
+
+        xr = a[1] - a[0];
+        a[1] = xr;
+        xr = a[16] - xr;
+        a[16] = xr;
+        xr = a[17] - xr;
+        a[17] = xr;
+        xr = a[8] - xr;
+        a[8] = xr;
+        xr = a[9] - xr;
+        a[9] = xr;
+        xr = a[24] - xr;
+        a[24] = xr;
+        xr = a[25] - xr;
+        a[25] = xr;
+        xr = a[4] - xr;
+        a[4] = xr;
+        xr = a[5] - xr;
+        a[5] = xr;
+        xr = a[20] - xr;
+        a[20] = xr;
+        xr = a[21] - xr;
+        a[21] = xr;
+        xr = a[12] - xr;
+        a[12] = xr;
+        xr = a[13] - xr;
+        a[13] = xr;
+        xr = a[28] - xr;
+        a[28] = xr;
+        xr = a[29] - xr;
+        a[29] = xr;
+
+        xr = a[0];
+        a[0] += a[31];
+        a[31] -= xr;
+        xr = a[1];
+        a[1] += a[30];
+        a[30] -= xr;
+        xr = a[16];
+        a[16] += a[15];
+        a[15] -= xr;
+        xr = a[17];
+        a[17] += a[14];
+        a[14] -= xr;
+        xr = a[8];
+        a[8] += a[23];
+        a[23] -= xr;
+        xr = a[9];
+        a[9] += a[22];
+        a[22] -= xr;
+        xr = a[24];
+        a[24] += a[7];
+        a[7] -= xr;
+        xr = a[25];
+        a[25] += a[6];
+        a[6] -= xr;
+        xr = a[4];
+        a[4] += a[27];
+        a[27] -= xr;
+        xr = a[5];
+        a[5] += a[26];
+        a[26] -= xr;
+        xr = a[20];
+        a[20] += a[11];
+        a[11] -= xr;
+        xr = a[21];
+        a[21] += a[10];
+        a[10] -= xr;
+        xr = a[12];
+        a[12] += a[19];
+        a[19] -= xr;
+        xr = a[13];
+        a[13] += a[18];
+        a[18] -= xr;
+        xr = a[28];
+        a[28] += a[3];
+        a[3] -= xr;
+        xr = a[29];
+        a[29] += a[2];
+        a[2] -= xr;
+    }
+
+}
+
+
+/*-------------------------------------------------------------------*/
+/*                                                                   */
+/*   Function: Calculation of the MDCT                               */
+/*   In the case of long blocks (type 0,1,3) there are               */
+/*   36 coefficents in the time domain and 18 in the frequency       */
+/*   domain.                                                         */
+/*   In the case of short blocks (type 2) there are 3                */
+/*   transformations with short length. This leads to 12 coefficents */
+/*   in the time and 6 in the frequency domain. In this case the     */
+/*   results are stored side by side in the vector out[].            */
+/*                                                                   */
+/*   New layer3                                                      */
+/*                                                                   */
+/*-------------------------------------------------------------------*/
+
+inline static void
+mdct_short(FLOAT * inout)
+{
+    int     l;
+    for (l = 0; l < 3; l++) {
+        FLOAT   tc0, tc1, tc2, ts0, ts1, ts2;
+
+        ts0 = inout[2 * 3] * win[SHORT_TYPE][0] - inout[5 * 3];
+        tc0 = inout[0 * 3] * win[SHORT_TYPE][2] - inout[3 * 3];
+        tc1 = ts0 + tc0;
+        tc2 = ts0 - tc0;
+
+        ts0 = inout[5 * 3] * win[SHORT_TYPE][0] + inout[2 * 3];
+        tc0 = inout[3 * 3] * win[SHORT_TYPE][2] + inout[0 * 3];
+        ts1 = ts0 + tc0;
+        ts2 = -ts0 + tc0;
+
+        tc0 = (inout[1 * 3] * win[SHORT_TYPE][1] - inout[4 * 3]) * 2.069978111953089e-11; /* tritab_s[1] */
+        ts0 = (inout[4 * 3] * win[SHORT_TYPE][1] + inout[1 * 3]) * 2.069978111953089e-11; /* tritab_s[1] */
+
+        inout[3 * 0] = tc1 * 1.907525191737280e-11 /* tritab_s[2] */  + tc0;
+        inout[3 * 5] = -ts1 * 1.907525191737280e-11 /* tritab_s[0] */  + ts0;
+
+        tc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11 /* tritab_s[2] */ ;
+        ts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0;
+        inout[3 * 1] = tc2 - ts1;
+        inout[3 * 2] = tc2 + ts1;
+
+        tc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0;
+        ts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11 /* tritab_s[0] */ ;
+        inout[3 * 3] = tc1 + ts2;
+        inout[3 * 4] = tc1 - ts2;
+
+        inout++;
+    }
+}
+
+inline static void
+mdct_long(FLOAT * out, FLOAT const *in)
+{
+    FLOAT   ct, st;
+    {
+        FLOAT   tc1, tc2, tc3, tc4, ts5, ts6, ts7, ts8;
+        /* 1,2, 5,6, 9,10, 13,14, 17 */
+        tc1 = in[17] - in[9];
+        tc3 = in[15] - in[11];
+        tc4 = in[14] - in[12];
+        ts5 = in[0] + in[8];
+        ts6 = in[1] + in[7];
+        ts7 = in[2] + in[6];
+        ts8 = in[3] + in[5];
+
+        out[17] = (ts5 + ts7 - ts8) - (ts6 - in[4]);
+        st = (ts5 + ts7 - ts8) * cx[7] + (ts6 - in[4]);
+        ct = (tc1 - tc3 - tc4) * cx[6];
+        out[5] = ct + st;
+        out[6] = ct - st;
+
+        tc2 = (in[16] - in[10]) * cx[6];
+        ts6 = ts6 * cx[7] + in[4];
+        ct = tc1 * cx[0] + tc2 + tc3 * cx[1] + tc4 * cx[2];
+        st = -ts5 * cx[4] + ts6 - ts7 * cx[5] + ts8 * cx[3];
+        out[1] = ct + st;
+        out[2] = ct - st;
+
+        ct = tc1 * cx[1] - tc2 - tc3 * cx[2] + tc4 * cx[0];
+        st = -ts5 * cx[5] + ts6 - ts7 * cx[3] + ts8 * cx[4];
+        out[9] = ct + st;
+        out[10] = ct - st;
+
+        ct = tc1 * cx[2] - tc2 + tc3 * cx[0] - tc4 * cx[1];
+        st = ts5 * cx[3] - ts6 + ts7 * cx[4] - ts8 * cx[5];
+        out[13] = ct + st;
+        out[14] = ct - st;
+    }
+    {
+        FLOAT   ts1, ts2, ts3, ts4, tc5, tc6, tc7, tc8;
+
+        ts1 = in[8] - in[0];
+        ts3 = in[6] - in[2];
+        ts4 = in[5] - in[3];
+        tc5 = in[17] + in[9];
+        tc6 = in[16] + in[10];
+        tc7 = in[15] + in[11];
+        tc8 = in[14] + in[12];
+
+        out[0] = (tc5 + tc7 + tc8) + (tc6 + in[13]);
+        ct = (tc5 + tc7 + tc8) * cx[7] - (tc6 + in[13]);
+        st = (ts1 - ts3 + ts4) * cx[6];
+        out[11] = ct + st;
+        out[12] = ct - st;
+
+        ts2 = (in[7] - in[1]) * cx[6];
+        tc6 = in[13] - tc6 * cx[7];
+        ct = tc5 * cx[3] - tc6 + tc7 * cx[4] + tc8 * cx[5];
+        st = ts1 * cx[2] + ts2 + ts3 * cx[0] + ts4 * cx[1];
+        out[3] = ct + st;
+        out[4] = ct - st;
+
+        ct = -tc5 * cx[5] + tc6 - tc7 * cx[3] - tc8 * cx[4];
+        st = ts1 * cx[1] + ts2 - ts3 * cx[2] - ts4 * cx[0];
+        out[7] = ct + st;
+        out[8] = ct - st;
+
+        ct = -tc5 * cx[4] + tc6 - tc7 * cx[5] - tc8 * cx[3];
+        st = ts1 * cx[0] - ts2 + ts3 * cx[1] - ts4 * cx[2];
+        out[15] = ct + st;
+        out[16] = ct - st;
+    }
+}
+
+
+void
+mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1)
+{
+    int     gr, k, ch;
+    const sample_t *wk;
+
+    wk = w0 + 286;
+    /* thinking cache performance, ch->gr loop is better than gr->ch loop */
+    for (ch = 0; ch < gfc->channels_out; ch++) {
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            int     band;
+            gr_info *const gi = &(gfc->l3_side.tt[gr][ch]);
+            FLOAT  *mdct_enc = gi->xr;
+            FLOAT  *samp = gfc->sb_sample[ch][1 - gr][0];
+
+            for (k = 0; k < 18 / 2; k++) {
+                window_subband(wk, samp);
+                window_subband(wk + 32, samp + 32);
+                samp += 64;
+                wk += 64;
+                /*
+                 * Compensate for inversion in the analysis filter
+                 */
+                for (band = 1; band < 32; band += 2) {
+                    samp[band - 32] *= -1;
+                }
+            }
+
+            /*
+             * Perform imdct of 18 previous subband samples
+             * + 18 current subband samples
+             */
+            for (band = 0; band < 32; band++, mdct_enc += 18) {
+                int     type = gi->block_type;
+                FLOAT const *const band0 = gfc->sb_sample[ch][gr][0] + order[band];
+                FLOAT  *const band1 = gfc->sb_sample[ch][1 - gr][0] + order[band];
+                if (gi->mixed_block_flag && band < 2)
+                    type = 0;
+                if (gfc->amp_filter[band] < 1e-12) {
+                    memset(mdct_enc, 0, 18 * sizeof(FLOAT));
+                }
+                else {
+                    if (gfc->amp_filter[band] < 1.0) {
+                        for (k = 0; k < 18; k++)
+                            band1[k * 32] *= gfc->amp_filter[band];
+                    }
+                    if (type == SHORT_TYPE) {
+                        for (k = -NS / 4; k < 0; k++) {
+                            FLOAT const w = win[SHORT_TYPE][k + 3];
+                            mdct_enc[k * 3 + 9] = band0[(9 + k) * 32] * w - band0[(8 - k) * 32];
+                            mdct_enc[k * 3 + 18] = band0[(14 - k) * 32] * w + band0[(15 + k) * 32];
+                            mdct_enc[k * 3 + 10] = band0[(15 + k) * 32] * w - band0[(14 - k) * 32];
+                            mdct_enc[k * 3 + 19] = band1[(2 - k) * 32] * w + band1[(3 + k) * 32];
+                            mdct_enc[k * 3 + 11] = band1[(3 + k) * 32] * w - band1[(2 - k) * 32];
+                            mdct_enc[k * 3 + 20] = band1[(8 - k) * 32] * w + band1[(9 + k) * 32];
+                        }
+                        mdct_short(mdct_enc);
+                    }
+                    else {
+                        FLOAT   work[18];
+                        for (k = -NL / 4; k < 0; k++) {
+                            FLOAT   a, b;
+                            a = win[type][k + 27] * band1[(k + 9) * 32]
+                                + win[type][k + 36] * band1[(8 - k) * 32];
+                            b = win[type][k + 9] * band0[(k + 9) * 32]
+                                - win[type][k + 18] * band0[(8 - k) * 32];
+                            work[k + 9] = a - b * tantab_l[k + 9];
+                            work[k + 18] = a * tantab_l[k + 9] + b;
+                        }
+
+                        mdct_long(mdct_enc, work);
+                    }
+                }
+                /*
+                 * Perform aliasing reduction butterfly
+                 */
+                if (type != SHORT_TYPE && band != 0) {
+                    for (k = 7; k >= 0; --k) {
+                        FLOAT   bu, bd;
+                        bu = mdct_enc[k] * ca[k] + mdct_enc[-1 - k] * cs[k];
+                        bd = mdct_enc[k] * cs[k] - mdct_enc[-1 - k] * ca[k];
+
+                        mdct_enc[-1 - k] = bu;
+                        mdct_enc[k] = bd;
+                    }
+                }
+            }
+        }
+        wk = w1 + 286;
+        if (gfc->mode_gr == 1) {
+            memcpy(gfc->sb_sample[ch][0], gfc->sb_sample[ch][1], 576 * sizeof(FLOAT));
+        }
+    }
+}
diff --git a/libmp3lame/newmdct.h b/libmp3lame/newmdct.h
new file mode 100644
index 0000000..7248d38
--- /dev/null
+++ b/libmp3lame/newmdct.h
@@ -0,0 +1,27 @@
+/*
+ *	New Modified DCT include file
+ *
+ *	Copyright (c) 1999 Takehiro TOMINAGA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_NEWMDCT_H
+#define LAME_NEWMDCT_H
+
+void    mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1);
+
+#endif /* LAME_NEWMDCT_H */
diff --git a/libmp3lame/presets.c b/libmp3lame/presets.c
new file mode 100644
index 0000000..7d40d33
--- /dev/null
+++ b/libmp3lame/presets.c
@@ -0,0 +1,391 @@
+/*
+ * presets.c -- Apply presets
+ *
+ *	Copyright (c) 2002-2008 Gabriel Bouvigne
+ *	Copyright (c) 2007-2008 Robert Hegemann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "set_get.h"
+#include "encoder.h"
+#include "util.h"
+#include "lame_global_flags.h"
+
+#define SET_OPTION(opt, val, def) if (enforce) \
+    (void) lame_set_##opt(gfp, val); \
+    else if (!(fabs(lame_get_##opt(gfp) - def) > 0)) \
+    (void) lame_set_##opt(gfp, val);
+
+#undef Min
+#undef Max
+
+static inline int
+min_int(int a, int b)
+{
+    if (a < b) {
+        return a;
+    }
+    return b;
+}
+
+static inline int
+max_int(int a, int b)
+{
+    if (a > b) {
+        return a;
+    }
+    return b;
+}
+
+
+
+typedef struct {
+    int     vbr_q;
+    int     quant_comp;
+    int     quant_comp_s;
+    int     expY;
+    FLOAT   st_lrm;          /*short threshold */
+    FLOAT   st_s;
+    FLOAT   masking_adj;
+    FLOAT   masking_adj_short;
+    FLOAT   ath_lower;
+    FLOAT   ath_curve;
+    FLOAT   ath_sensitivity;
+    FLOAT   interch;
+    int     safejoint;
+    int     sfb21mod;
+    FLOAT   msfix;
+} vbr_presets_t;
+
+    /* *INDENT-OFF* */
+    
+    /* Switch mappings for VBR mode VBR_RH */
+    static const vbr_presets_t vbr_old_switch_map[] = {
+    /*vbr_q  qcomp_l  qcomp_s  expY  st_lrm   st_s  mask adj_l  adj_s  ath_lower  ath_curve  ath_sens  interChR  safejoint sfb21mod  msfix */
+        {0,       9,       9,    0,   5.20, 125.0,      -4.2,   -6.3,       4.8,       1,          0,   0,              2,      21,  0.97},
+        {1,       9,       9,    0,   5.30, 125.0,      -3.6,   -5.6,       4.5,       1.5,        0,   0,              2,      21,  1.35},
+        {2,       9,       9,    0,   5.60, 125.0,      -2.2,   -3.5,       2.8,       2,          0,   0,              2,      21,  1.49},
+        {3,       9,       9,    1,   5.80, 130.0,      -1.8,   -2.8,       2.6,       3,         -4,   0,              2,      20,  1.64},
+        {4,       9,       9,    1,   6.00, 135.0,      -0.7,   -1.1,       1.1,       3.5,       -8,   0,              2,       0,  1.79},
+        {5,       9,       9,    1,   6.40, 140.0,       0.5,    0.4,      -7.5,       4,        -12,   0.0002,         0,       0,  1.95},
+        {6,       9,       9,    1,   6.60, 145.0,       0.67,   0.65,    -14.7,       6.5,      -19,   0.0004,         0,       0,  2.30},
+        {7,       9,       9,    1,   6.60, 145.0,       0.8,    0.75,    -19.7,       8,        -22,   0.0006,         0,       0,  2.70},
+        {8,       9,       9,    1,   6.60, 145.0,       1.2,    1.15,    -27.5,      10,        -23,   0.0007,         0,       0,  0   },
+        {9,       9,       9,    1,   6.60, 145.0,       1.6,    1.6,     -36,        11,        -25,   0.0008,         0,       0,  0   },
+        {10,      9,       9,    1,   6.60, 145.0,       2.0,    2.0,     -36,        12,        -25,   0.0008,         0,       0,  0   }
+    };
+    
+    static const vbr_presets_t vbr_psy_switch_map[] = {
+    /*vbr_q  qcomp_l  qcomp_s  expY  st_lrm   st_s  mask adj_l  adj_s  ath_lower  ath_curve  ath_sens  interChR  safejoint sfb21mod  msfix */
+        {0,       9,       9,    0,   4.20,  25.0,      -7.0,   -4.0,       7.5,       1,          0,   0,              2,      26,  0.97},
+        {1,       9,       9,    0,   4.20,  25.0,      -5.6,   -3.6,       4.5,       1.5,        0,   0,              2,      21,  1.35},
+        {2,       9,       9,    0,   4.20,  25.0,      -4.4,   -1.8,       2,         2,          0,   0,              2,      18,  1.49},
+        {3,       9,       9,    1,   4.20,  25.0,      -3.4,   -1.25,      1.1,       3,         -4,   0,              2,      15,  1.64},
+        {4,       9,       9,    1,   4.20,  25.0,      -2.2,    0.1,       0,         3.5,       -8,   0,              2,       0,  1.79},
+        {5,       9,       9,    1,   4.20,  25.0,      -1.0,    1.65,     -7.7,       4,        -12,   0.0002,         0,       0,  1.95},
+        {6,       9,       9,    1,   4.20,  25.0,      -0.0,    2.47,     -7.7,       6.5,      -19,   0.0004,         0,       0,  2   },
+        {7,       9,       9,    1,   4.20,  25.0,       0.5,    2.0,     -14.5,       8,        -22,   0.0006,         0,       0,  2   },
+        {8,       9,       9,    1,   4.20,  25.0,       1.0,    2.4,     -22.0,      10,        -23,   0.0007,         0,       0,  2   },
+        {9,       9,       9,    1,   4.20,  25.0,       1.5,    2.95,    -30.0,      11,        -25,   0.0008,         0,       0,  2   },
+        {10,      9,       9,    1,   4.20,  25.0,       2.0,    2.95,    -36.0,      12,        -30,   0.0008,         0,       0,  2   }
+    };
+    
+    /* *INDENT-ON* */
+
+#define NOOP(m) (void)p.m
+#define LERP(m) p.m = p.m + x * (q.m - p.m)
+
+static void
+apply_vbr_preset(lame_global_flags * gfp, int a, int enforce)
+{
+    vbr_presets_t const *vbr_preset = lame_get_VBR(gfp) == vbr_rh ? &vbr_old_switch_map[0]
+        : &vbr_psy_switch_map[0];
+    float   x = gfp->VBR_q_frac;
+    vbr_presets_t p = vbr_preset[a];
+    vbr_presets_t q = vbr_preset[a + 1];
+    vbr_presets_t const *set = &p;
+
+    NOOP(vbr_q);
+    NOOP(quant_comp);
+    NOOP(quant_comp_s);
+    NOOP(expY);
+    LERP(st_lrm);
+    LERP(st_s);
+    LERP(masking_adj);
+    LERP(masking_adj_short);
+    LERP(ath_lower);
+    LERP(ath_curve);
+    LERP(ath_sensitivity);
+    LERP(interch);
+    NOOP(safejoint);
+    NOOP(sfb21mod);
+    LERP(msfix);
+
+    (void) lame_set_VBR_q(gfp, set->vbr_q);
+    SET_OPTION(quant_comp, set->quant_comp, -1);
+    SET_OPTION(quant_comp_short, set->quant_comp_s, -1);
+    if (set->expY) {
+        (void) lame_set_experimentalY(gfp, set->expY);
+    }
+    SET_OPTION(short_threshold_lrm, set->st_lrm, -1);
+    SET_OPTION(short_threshold_s, set->st_s, -1);
+    SET_OPTION(maskingadjust, set->masking_adj, 0);
+    SET_OPTION(maskingadjust_short, set->masking_adj_short, 0);
+    SET_OPTION(ATHlower, set->ath_lower, 0);
+    SET_OPTION(ATHcurve, set->ath_curve, -1);
+    SET_OPTION(athaa_sensitivity, set->ath_sensitivity, 0);
+    if (set->interch > 0) {
+        SET_OPTION(interChRatio, set->interch, -1);
+    }
+
+    /* parameters for which there is no proper set/get interface */
+    if (set->safejoint > 0) {
+        (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | set->safejoint);
+    }
+    if (set->sfb21mod > 0) {
+        (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (set->sfb21mod << 20));
+    }
+    SET_OPTION(msfix, set->msfix, -1);
+
+    if (enforce == 0) {
+        gfp->VBR_q = a;
+        gfp->VBR_q_frac = x;
+    }
+}
+
+static int
+apply_abr_preset(lame_global_flags * gfp, int preset, int enforce)
+{
+    int     k;
+
+    typedef struct {
+        int     abr_kbps;
+        int     quant_comp;
+        int     quant_comp_s;
+        int     safejoint;
+        FLOAT   nsmsfix;
+        FLOAT   st_lrm;      /*short threshold */
+        FLOAT   st_s;
+        FLOAT   nsbass;
+        FLOAT   scale;
+        FLOAT   masking_adj;
+        FLOAT   ath_lower;
+        FLOAT   ath_curve;
+        FLOAT   interch;
+        int     sfscale;
+    } abr_presets_t;
+
+
+    /* *INDENT-OFF* */
+
+    /* 
+     *  Switch mappings for ABR mode
+     */
+    const abr_presets_t abr_switch_map[] = {        
+    /* kbps  quant q_s safejoint nsmsfix st_lrm  st_s  ns-bass scale   msk ath_lwr ath_curve  interch , sfscale */
+      {  8,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,  -30.0,     11,    0.0012,        1}, /*   8, impossible to use in stereo */
+      { 16,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,  -25.0,     11,    0.0010,        1}, /*  16 */
+      { 24,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,  -20.0,     11,    0.0010,        1}, /*  24 */
+      { 32,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,  -15.0,     11,    0.0010,        1}, /*  32 */
+      { 40,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,  -10.0,     11,    0.0009,        1}, /*  40 */
+      { 48,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,  -10.0,     11,    0.0009,        1}, /*  48 */
+      { 56,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,   -6.0,     11,    0.0008,        1}, /*  56 */
+      { 64,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,   -2.0,     11,    0.0008,        1}, /*  64 */
+      { 80,     9,  9,        0,      0,  6.60,  145,       0, 0.95,    0,     .0,      8,    0.0007,        1}, /*  80 */
+      { 96,     9,  9,        0,   2.50,  6.60,  145,       0, 0.95,    0,    1.0,      5.5,  0.0006,        1}, /*  96 */
+      {112,     9,  9,        0,   2.25,  6.60,  145,       0, 0.95,    0,    2.0,      4.5,  0.0005,        1}, /* 112 */
+      {128,     9,  9,        0,   1.95,  6.40,  140,       0, 0.95,    0,    3.0,      4,    0.0002,        1}, /* 128 */
+      {160,     9,  9,        1,   1.79,  6.00,  135,       0, 0.95,   -2,    5.0,      3.5,  0,             1}, /* 160 */
+      {192,     9,  9,        1,   1.49,  5.60,  125,       0, 0.97,   -4,    7.0,      3,    0,             0}, /* 192 */
+      {224,     9,  9,        1,   1.25,  5.20,  125,       0, 0.98,   -6,    9.0,      2,    0,             0}, /* 224 */
+      {256,     9,  9,        1,   0.97,  5.20,  125,       0, 1.00,   -8,   10.0,      1,    0,             0}, /* 256 */
+      {320,     9,  9,        1,   0.90,  5.20,  125,       0, 1.00,  -10,   12.0,      0,    0,             0}  /* 320 */
+    };
+
+    /* *INDENT-ON* */
+
+    /* Variables for the ABR stuff */
+    int     r;
+    int     actual_bitrate = preset;
+
+    r = nearestBitrateFullIndex(preset);
+
+
+    (void) lame_set_VBR(gfp, vbr_abr);
+    (void) lame_set_VBR_mean_bitrate_kbps(gfp, (actual_bitrate));
+    (void) lame_set_VBR_mean_bitrate_kbps(gfp, min_int(lame_get_VBR_mean_bitrate_kbps(gfp), 320));
+    (void) lame_set_VBR_mean_bitrate_kbps(gfp, max_int(lame_get_VBR_mean_bitrate_kbps(gfp), 8));
+    (void) lame_set_brate(gfp, lame_get_VBR_mean_bitrate_kbps(gfp));
+
+
+    /* parameters for which there is no proper set/get interface */
+    if (abr_switch_map[r].safejoint > 0)
+        (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); /* safejoint */
+
+    if (abr_switch_map[r].sfscale > 0)
+        (void) lame_set_sfscale(gfp, 1);
+
+    /* ns-bass tweaks */
+    if (fabs(abr_switch_map[r].nsbass) > 0) {
+        k = (int) (abr_switch_map[r].nsbass * 4);
+        if (k < 0)
+            k += 64;
+        (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 2));
+    }
+
+
+
+
+    SET_OPTION(quant_comp, abr_switch_map[r].quant_comp, -1);
+    SET_OPTION(quant_comp_short, abr_switch_map[r].quant_comp_s, -1);
+
+    SET_OPTION(msfix, abr_switch_map[r].nsmsfix, -1);
+
+    SET_OPTION(short_threshold_lrm, abr_switch_map[r].st_lrm, -1);
+    SET_OPTION(short_threshold_s, abr_switch_map[r].st_s, -1);
+
+    /* ABR seems to have big problems with clipping, especially at low bitrates */
+    /* so we compensate for that here by using a scale value depending on bitrate */
+    SET_OPTION(scale, abr_switch_map[r].scale, -1);
+
+    SET_OPTION(maskingadjust, abr_switch_map[r].masking_adj, 0);
+    if (abr_switch_map[r].masking_adj > 0) {
+        SET_OPTION(maskingadjust_short, abr_switch_map[r].masking_adj * .9, 0);
+    }
+    else {
+        SET_OPTION(maskingadjust_short, abr_switch_map[r].masking_adj * 1.1, 0);
+    }
+
+
+    SET_OPTION(ATHlower, abr_switch_map[r].ath_lower, 0);
+    SET_OPTION(ATHcurve, abr_switch_map[r].ath_curve, -1);
+
+    SET_OPTION(interChRatio, abr_switch_map[r].interch, -1);
+
+
+    return preset;
+}
+
+
+
+int
+apply_preset(lame_global_flags * gfp, int preset, int enforce)
+{
+    /*translate legacy presets */
+    switch (preset) {
+    case R3MIX:
+        {
+            preset = V3;
+            (void) lame_set_VBR(gfp, vbr_mtrh);
+            break;
+        }
+    case MEDIUM:
+        {
+            preset = V4;
+            (void) lame_set_VBR(gfp, vbr_rh);
+            break;
+        }
+    case MEDIUM_FAST:
+        {
+            preset = V4;
+            (void) lame_set_VBR(gfp, vbr_mtrh);
+            break;
+        }
+    case STANDARD:
+        {
+            preset = V2;
+            (void) lame_set_VBR(gfp, vbr_rh);
+            break;
+        }
+    case STANDARD_FAST:
+        {
+            preset = V2;
+            (void) lame_set_VBR(gfp, vbr_mtrh);
+            break;
+        }
+    case EXTREME:
+        {
+            preset = V0;
+            (void) lame_set_VBR(gfp, vbr_rh);
+            break;
+        }
+    case EXTREME_FAST:
+        {
+            preset = V0;
+            (void) lame_set_VBR(gfp, vbr_mtrh);
+            break;
+        }
+    case INSANE:
+        {
+            preset = 320;
+            gfp->preset = preset;
+            (void) apply_abr_preset(gfp, preset, enforce);
+            lame_set_VBR(gfp, vbr_off);
+            return preset;
+        }
+    }
+
+    gfp->preset = preset;
+    {
+        switch (preset) {
+        case V9:
+            apply_vbr_preset(gfp, 9, enforce);
+            return preset;
+        case V8:
+            apply_vbr_preset(gfp, 8, enforce);
+            return preset;
+        case V7:
+            apply_vbr_preset(gfp, 7, enforce);
+            return preset;
+        case V6:
+            apply_vbr_preset(gfp, 6, enforce);
+            return preset;
+        case V5:
+            apply_vbr_preset(gfp, 5, enforce);
+            return preset;
+        case V4:
+            apply_vbr_preset(gfp, 4, enforce);
+            return preset;
+        case V3:
+            apply_vbr_preset(gfp, 3, enforce);
+            return preset;
+        case V2:
+            apply_vbr_preset(gfp, 2, enforce);
+            return preset;
+        case V1:
+            apply_vbr_preset(gfp, 1, enforce);
+            return preset;
+        case V0:
+            apply_vbr_preset(gfp, 0, enforce);
+            return preset;
+        default:
+            break;
+        }
+    }
+    if (8 <= preset && preset <= 320) {
+        return apply_abr_preset(gfp, preset, enforce);
+    }
+
+    gfp->preset = 0;    /*no corresponding preset found */
+    return preset;
+}
diff --git a/libmp3lame/psymodel.c b/libmp3lame/psymodel.c
new file mode 100644
index 0000000..f550432
--- /dev/null
+++ b/libmp3lame/psymodel.c
@@ -0,0 +1,2998 @@
+/*
+ *      psymodel.c
+ *
+ *      Copyright (c) 1999-2000 Mark Taylor
+ *      Copyright (c) 2001-2002 Naoki Shibata
+ *      Copyright (c) 2000-2003 Takehiro Tominaga
+ *      Copyright (c) 2000-2008 Robert Hegemann
+ *      Copyright (c) 2000-2005 Gabriel Bouvigne
+ *      Copyright (c) 2000-2005 Alexander Leidinger
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: psymodel.c,v 1.185.2.2 2009/01/18 15:44:27 robert Exp $ */
+
+
+/*
+PSYCHO ACOUSTICS
+
+
+This routine computes the psycho acoustics, delayed by one granule.  
+
+Input: buffer of PCM data (1024 samples).  
+
+This window should be centered over the 576 sample granule window.
+The routine will compute the psycho acoustics for
+this granule, but return the psycho acoustics computed
+for the *previous* granule.  This is because the block
+type of the previous granule can only be determined
+after we have computed the psycho acoustics for the following
+granule.  
+
+Output:  maskings and energies for each scalefactor band.
+block type, PE, and some correlation measures.  
+The PE is used by CBR modes to determine if extra bits
+from the bit reservoir should be used.  The correlation
+measures are used to determine mid/side or regular stereo.
+*/
+/*
+Notation:
+
+barks:  a non-linear frequency scale.  Mapping from frequency to
+        barks is given by freq2bark()
+
+scalefactor bands: The spectrum (frequencies) are broken into 
+                   SBMAX "scalefactor bands".  Thes bands
+                   are determined by the MPEG ISO spec.  In
+                   the noise shaping/quantization code, we allocate
+                   bits among the partition bands to achieve the
+                   best possible quality
+
+partition bands:   The spectrum is also broken into about
+                   64 "partition bands".  Each partition 
+                   band is about .34 barks wide.  There are about 2-5
+                   partition bands for each scalefactor band.
+
+LAME computes all psycho acoustic information for each partition
+band.  Then at the end of the computations, this information
+is mapped to scalefactor bands.  The energy in each scalefactor
+band is taken as the sum of the energy in all partition bands
+which overlap the scalefactor band.  The maskings can be computed
+in the same way (and thus represent the average masking in that band)
+or by taking the minmum value multiplied by the number of
+partition bands used (which represents a minimum masking in that band).
+*/
+/*
+The general outline is as follows:
+
+1. compute the energy in each partition band
+2. compute the tonality in each partition band
+3. compute the strength of each partion band "masker"
+4. compute the masking (via the spreading function applied to each masker)
+5. Modifications for mid/side masking.  
+
+Each partition band is considiered a "masker".  The strength
+of the i'th masker in band j is given by:
+
+    s3(bark(i)-bark(j))*strength(i)
+
+The strength of the masker is a function of the energy and tonality.
+The more tonal, the less masking.  LAME uses a simple linear formula
+(controlled by NMT and TMN) which says the strength is given by the
+energy divided by a linear function of the tonality.
+*/
+/*
+s3() is the "spreading function".  It is given by a formula
+determined via listening tests.  
+
+The total masking in the j'th partition band is the sum over
+all maskings i.  It is thus given by the convolution of
+the strength with s3(), the "spreading function."
+
+masking(j) = sum_over_i  s3(i-j)*strength(i)  = s3 o strength
+
+where "o" = convolution operator.  s3 is given by a formula determined
+via listening tests.  It is normalized so that s3 o 1 = 1.
+
+Note: instead of a simple convolution, LAME also has the
+option of using "additive masking"
+
+The most critical part is step 2, computing the tonality of each
+partition band.  LAME has two tonality estimators.  The first
+is based on the ISO spec, and measures how predictiable the
+signal is over time.  The more predictable, the more tonal.
+The second measure is based on looking at the spectrum of
+a single granule.  The more peaky the spectrum, the more
+tonal.  By most indications, the latter approach is better.
+
+Finally, in step 5, the maskings for the mid and side
+channel are possibly increased.  Under certain circumstances,
+noise in the mid & side channels is assumed to also
+be masked by strong maskers in the L or R channels.
+
+
+Other data computed by the psy-model:
+
+ms_ratio        side-channel / mid-channel masking ratio (for previous granule)
+ms_ratio_next   side-channel / mid-channel masking ratio for this granule
+
+percep_entropy[2]     L and R values (prev granule) of PE - A measure of how 
+                      much pre-echo is in the previous granule
+percep_entropy_MS[2]  mid and side channel values (prev granule) of percep_entropy
+energy[4]             L,R,M,S energy in each channel, prev granule
+blocktype_d[2]        block type to use for previous granule
+*/
+
+
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "psymodel.h"
+#include "lame_global_flags.h"
+#include "fft.h"
+#include "lame-analysis.h"
+
+
+#define NSFIRLEN 21
+
+#ifdef M_LN10
+#define  LN_TO_LOG10  (M_LN10/10)
+#else
+#define  LN_TO_LOG10  0.2302585093
+#endif
+
+#ifdef NON_LINEAR_PSY
+
+static const float non_linear_psy_constant = .3;
+
+#define NON_LINEAR_SCALE_ITEM(x)   pow((x), non_linear_psy_constant)
+#define NON_LINEAR_SCALE_SUM(x)    pow((x), 1/non_linear_psy_constant)
+
+#if 0
+#define NON_LINEAR_SCALE_ENERGY(x) pow(10, (x)/10)
+#else
+#define NON_LINEAR_SCALE_ENERGY(x) (x)
+#endif
+
+#else
+
+#define NON_LINEAR_SCALE_ITEM(x)   (x)
+#define NON_LINEAR_SCALE_SUM(x)    (x)
+#define NON_LINEAR_SCALE_ENERGY(x) (x)
+
+#endif
+
+
+/*
+   L3psycho_anal.  Compute psycho acoustics.
+
+   Data returned to the calling program must be delayed by one 
+   granule. 
+
+   This is done in two places.  
+   If we do not need to know the blocktype, the copying
+   can be done here at the top of the program: we copy the data for
+   the last granule (computed during the last call) before it is
+   overwritten with the new data.  It looks like this:
+  
+   0. static psymodel_data 
+   1. calling_program_data = psymodel_data
+   2. compute psymodel_data
+    
+   For data which needs to know the blocktype, the copying must be
+   done at the end of this loop, and the old values must be saved:
+   
+   0. static psymodel_data_old 
+   1. compute psymodel_data
+   2. compute possible block type of this granule
+   3. compute final block type of previous granule based on #2.
+   4. calling_program_data = psymodel_data_old
+   5. psymodel_data_old = psymodel_data
+*/
+
+
+
+
+
+/* psycho_loudness_approx
+   jd - 2001 mar 12
+in:  energy   - BLKSIZE/2 elements of frequency magnitudes ^ 2
+     gfp      - uses out_samplerate, ATHtype (also needed for ATHformula)
+returns: loudness^2 approximation, a positive value roughly tuned for a value
+         of 1.0 for signals near clipping.
+notes:   When calibrated, feeding this function binary white noise at sample
+         values +32767 or -32768 should return values that approach 3.
+         ATHformula is used to approximate an equal loudness curve.
+future:  Data indicates that the shape of the equal loudness curve varies
+         with intensity.  This function might be improved by using an equal
+         loudness curve shaped for typical playback levels (instead of the
+         ATH, that is shaped for the threshold).  A flexible realization might
+         simply bend the existing ATH curve to achieve the desired shape.
+         However, the potential gain may not be enough to justify an effort.
+*/
+static  FLOAT
+psycho_loudness_approx(FLOAT const *energy, lame_internal_flags const *gfc)
+{
+    int     i;
+    FLOAT   loudness_power;
+
+    loudness_power = 0.0;
+    /* apply weights to power in freq. bands */
+    for (i = 0; i < BLKSIZE / 2; ++i)
+        loudness_power += energy[i] * gfc->ATH->eql_w[i];
+    loudness_power *= VO_SCALE;
+
+    return loudness_power;
+}
+
+static void
+compute_ffts(lame_global_flags const *gfp,
+             FLOAT fftenergy[HBLKSIZE],
+             FLOAT(*fftenergy_s)[HBLKSIZE_s],
+             FLOAT(*wsamp_l)[BLKSIZE],
+             FLOAT(*wsamp_s)[3][BLKSIZE_s], int gr_out, int chn, const sample_t * buffer[2]
+    )
+{
+    int     b, j;
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    if (chn < 2) {
+        fft_long(gfc, *wsamp_l, chn, buffer);
+        fft_short(gfc, *wsamp_s, chn, buffer);
+    }
+    /* FFT data for mid and side channel is derived from L & R */
+    else if (chn == 2) {
+        for (j = BLKSIZE - 1; j >= 0; --j) {
+            FLOAT const l = wsamp_l[0][j];
+            FLOAT const r = wsamp_l[1][j];
+            wsamp_l[0][j] = (l + r) * (FLOAT) (SQRT2 * 0.5);
+            wsamp_l[1][j] = (l - r) * (FLOAT) (SQRT2 * 0.5);
+        }
+        for (b = 2; b >= 0; --b) {
+            for (j = BLKSIZE_s - 1; j >= 0; --j) {
+                FLOAT const l = wsamp_s[0][b][j];
+                FLOAT const r = wsamp_s[1][b][j];
+                wsamp_s[0][b][j] = (l + r) * (FLOAT) (SQRT2 * 0.5);
+                wsamp_s[1][b][j] = (l - r) * (FLOAT) (SQRT2 * 0.5);
+            }
+        }
+    }
+
+    /*********************************************************************
+     *  compute energies
+     *********************************************************************/
+    fftenergy[0] = NON_LINEAR_SCALE_ENERGY(wsamp_l[0][0]);
+    fftenergy[0] *= fftenergy[0];
+
+    for (j = BLKSIZE / 2 - 1; j >= 0; --j) {
+        FLOAT const re = (*wsamp_l)[BLKSIZE / 2 - j];
+        FLOAT const im = (*wsamp_l)[BLKSIZE / 2 + j];
+        fftenergy[BLKSIZE / 2 - j] = NON_LINEAR_SCALE_ENERGY((re * re + im * im) * 0.5f);
+    }
+    for (b = 2; b >= 0; --b) {
+        fftenergy_s[b][0] = (*wsamp_s)[b][0];
+        fftenergy_s[b][0] *= fftenergy_s[b][0];
+        for (j = BLKSIZE_s / 2 - 1; j >= 0; --j) {
+            FLOAT const re = (*wsamp_s)[b][BLKSIZE_s / 2 - j];
+            FLOAT const im = (*wsamp_s)[b][BLKSIZE_s / 2 + j];
+            fftenergy_s[b][BLKSIZE_s / 2 - j] = NON_LINEAR_SCALE_ENERGY((re * re + im * im) * 0.5f);
+        }
+    }
+    /* total energy */
+    {
+        FLOAT   totalenergy = 0.0;
+        for (j = 11; j < HBLKSIZE; j++)
+            totalenergy += fftenergy[j];
+
+        gfc->tot_ener[chn] = totalenergy;
+    }
+
+    if (gfp->analysis) {
+        for (j = 0; j < HBLKSIZE; j++) {
+            gfc->pinfo->energy[gr_out][chn][j] = gfc->pinfo->energy_save[chn][j];
+            gfc->pinfo->energy_save[chn][j] = fftenergy[j];
+        }
+        gfc->pinfo->pe[gr_out][chn] = gfc->pe[chn];
+    }
+
+    /*********************************************************************
+     * compute loudness approximation (used for ATH auto-level adjustment) 
+     *********************************************************************/
+    if (gfp->athaa_loudapprox == 2 && chn < 2) { /*no loudness for mid/side ch */
+        gfc->loudness_sq[gr_out][chn] = gfc->loudness_sq_save[chn];
+        gfc->loudness_sq_save[chn]
+            = psycho_loudness_approx(fftenergy, gfc);
+    }
+}
+
+/* mask_add optimization */
+/* init the limit values used to avoid computing log in mask_add when it is not necessary */
+
+/* For example, with i = 10*log10(m2/m1)/10*16         (= log10(m2/m1)*16)
+ *
+ * abs(i)>8 is equivalent (as i is an integer) to
+ * abs(i)>=9
+ * i>=9 || i<=-9
+ * equivalent to (as i is the biggest integer smaller than log10(m2/m1)*16 
+ * or the smallest integer bigger than log10(m2/m1)*16 depending on the sign of log10(m2/m1)*16)
+ * log10(m2/m1)>=9/16 || log10(m2/m1)<=-9/16
+ * exp10 is strictly increasing thus this is equivalent to
+ * m2/m1 >= 10^(9/16) || m2/m1<=10^(-9/16) which are comparisons to constants
+ */
+
+
+#define I1LIMIT 8       /* as in if(i>8)  */
+#define I2LIMIT 23      /* as in if(i>24) -> changed 23 */
+#define MLIMIT  15      /* as in if(m<15) */
+
+static FLOAT ma_max_i1;
+static FLOAT ma_max_i2;
+static FLOAT ma_max_m;
+
+    /*This is the masking table:
+       According to tonality, values are going from 0dB (TMN)
+       to 9.3dB (NMT).
+       After additive masking computation, 8dB are added, so
+       final values are going from 8dB to 17.3dB
+     */
+static const FLOAT tab[] = {
+    1.0 /*pow(10, -0) */ ,
+    0.79433 /*pow(10, -0.1) */ ,
+    0.63096 /*pow(10, -0.2) */ ,
+    0.63096 /*pow(10, -0.2) */ ,
+    0.63096 /*pow(10, -0.2) */ ,
+    0.63096 /*pow(10, -0.2) */ ,
+    0.63096 /*pow(10, -0.2) */ ,
+    0.25119 /*pow(10, -0.6) */ ,
+    0.11749             /*pow(10, -0.93) */
+};
+
+
+
+
+static void
+init_mask_add_max_values(void)
+{
+    ma_max_i1 = pow(10, (I1LIMIT + 1) / 16.0);
+    ma_max_i2 = pow(10, (I2LIMIT + 1) / 16.0);
+    ma_max_m = pow(10, (MLIMIT) / 10.0);
+}
+
+
+
+
+/* addition of simultaneous masking   Naoki Shibata 2000/7 */
+inline static FLOAT
+mask_add(FLOAT m1, FLOAT m2, int kk, int b, lame_internal_flags const *gfc, int shortblock)
+{
+    static const FLOAT table1[] = {
+        3.3246 * 3.3246, 3.23837 * 3.23837, 3.15437 * 3.15437, 3.00412 * 3.00412, 2.86103 * 2.86103,
+        2.65407 * 2.65407, 2.46209 * 2.46209, 2.284 * 2.284,
+        2.11879 * 2.11879, 1.96552 * 1.96552, 1.82335 * 1.82335, 1.69146 * 1.69146,
+        1.56911 * 1.56911, 1.46658 * 1.46658, 1.37074 * 1.37074, 1.31036 * 1.31036,
+        1.25264 * 1.25264, 1.20648 * 1.20648, 1.16203 * 1.16203, 1.12765 * 1.12765,
+        1.09428 * 1.09428, 1.0659 * 1.0659, 1.03826 * 1.03826, 1.01895 * 1.01895,
+        1
+    };
+
+    static const FLOAT table2[] = {
+        1.33352 * 1.33352, 1.35879 * 1.35879, 1.38454 * 1.38454, 1.39497 * 1.39497,
+        1.40548 * 1.40548, 1.3537 * 1.3537, 1.30382 * 1.30382, 1.22321 * 1.22321,
+        1.14758 * 1.14758,
+        1
+    };
+
+    static const FLOAT table3[] = {
+        2.35364 * 2.35364, 2.29259 * 2.29259, 2.23313 * 2.23313, 2.12675 * 2.12675,
+        2.02545 * 2.02545, 1.87894 * 1.87894, 1.74303 * 1.74303, 1.61695 * 1.61695,
+        1.49999 * 1.49999, 1.39148 * 1.39148, 1.29083 * 1.29083, 1.19746 * 1.19746,
+        1.11084 * 1.11084, 1.03826 * 1.03826
+    };
+
+
+    int     i;
+    FLOAT   ratio;
+
+
+    if (m2 > m1) {
+        if (m2 < (m1 * ma_max_i2))
+            ratio = m2 / m1;
+        else
+            return (m1 + m2);
+    }
+    else {
+        if (m1 >= (m2 * ma_max_i2))
+            return (m1 + m2);
+        ratio = m1 / m2;
+    }
+    /*i = abs(10*log10(m2 / m1)/10*16);
+       m = 10*log10((m1+m2)/gfc->ATH->cb[k]); */
+
+
+    /* Should always be true, just checking */
+    assert(m1 >= 0);
+    assert(m2 >= 0);
+
+
+    m1 += m2;
+
+    if ((unsigned int) (b + 3) <= 3 + 3) { /* approximately, 1 bark = 3 partitions */
+        /* 65% of the cases */
+        /* originally 'if(i > 8)' */
+        if (ratio >= ma_max_i1) {
+            /* 43% of the total */
+            return m1;
+        }
+
+        /* 22% of the total */
+        i = (int) (FAST_LOG10_X(ratio, 16.0));
+        return m1 * table2[i];
+    }
+
+    /* m<15 equ log10((m1+m2)/gfc->ATH->cb[k])<1.5
+     * equ (m1+m2)/gfc->ATH->cb[k]<10^1.5
+     * equ (m1+m2)<10^1.5 * gfc->ATH->cb[k]
+     */
+
+    i = (int) FAST_LOG10_X(ratio, 16.0);
+    if (shortblock) {
+        m2 = gfc->ATH->cb_s[kk] * gfc->ATH->adjust;
+    }
+    else {
+        m2 = gfc->ATH->cb_l[kk] * gfc->ATH->adjust;
+    }
+    assert(m2 >= 0);
+    if (m1 < ma_max_m * m2) {
+        /* 3% of the total */
+        /* Originally if (m > 0) { */
+        if (m1 > m2) {
+            FLOAT   f, r;
+
+            f = 1.0;
+            if (i <= 13)
+                f = table3[i];
+
+            r = FAST_LOG10_X(m1 / m2, 10.0 / 15.0);
+            return m1 * ((table1[i] - f) * r + f);
+        }
+
+        if (i > 13)
+            return m1;
+
+        return m1 * table3[i];
+    }
+
+
+    /* 10% of total */
+    return m1 * table1[i];
+}
+
+
+/* addition of simultaneous masking   Naoki Shibata 2000/7 */
+inline static FLOAT
+vbrpsy_mask_add(FLOAT m1, FLOAT m2, int b)
+{
+    static const FLOAT table2[] = {
+        1.33352 * 1.33352, 1.35879 * 1.35879, 1.38454 * 1.38454, 1.39497 * 1.39497,
+        1.40548 * 1.40548, 1.3537 * 1.3537, 1.30382 * 1.30382, 1.22321 * 1.22321,
+        1.14758 * 1.14758,
+        1
+    };
+
+    FLOAT   ratio;
+
+    if (m1 < 0) {
+        m1 = 0;
+    }
+    if (m2 < 0) {
+        m2 = 0;
+    }
+    if (m1 <= 0) {
+        return m2;
+    }
+    if (m2 <= 0) {
+        return m1;
+    }
+    if (m2 > m1) {
+        ratio = m2 / m1;
+    }
+    else {
+        ratio = m1 / m2;
+    }    
+    if (-2 <= b && b <= 2) { /* approximately, 1 bark = 3 partitions */
+        /* originally 'if(i > 8)' */
+        if (ratio >= ma_max_i1) {
+            return m1 + m2;
+        }
+        else {
+            int     i = (int) (FAST_LOG10_X(ratio, 16.0));
+        return (m1 + m2) * table2[i];
+        }
+    }
+    if (ratio < ma_max_i2) {
+        return m1 + m2;
+    }
+    if (m1 < m2) {
+        m1 = m2;
+    }
+    return m1;
+}
+
+
+/*************************************************************** 
+ * compute interchannel masking effects
+ ***************************************************************/
+static void
+calc_interchannel_masking(lame_global_flags const *gfp, FLOAT ratio)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     sb, sblock;
+    FLOAT   l, r;
+    if (gfc->channels_out > 1) {
+        for (sb = 0; sb < SBMAX_l; sb++) {
+            l = gfc->thm[0].l[sb];
+            r = gfc->thm[1].l[sb];
+            gfc->thm[0].l[sb] += r * ratio;
+            gfc->thm[1].l[sb] += l * ratio;
+        }
+        for (sb = 0; sb < SBMAX_s; sb++) {
+            for (sblock = 0; sblock < 3; sblock++) {
+                l = gfc->thm[0].s[sb][sblock];
+                r = gfc->thm[1].s[sb][sblock];
+                gfc->thm[0].s[sb][sblock] += r * ratio;
+                gfc->thm[1].s[sb][sblock] += l * ratio;
+            }
+        }
+    }
+}
+
+
+
+/*************************************************************** 
+ * compute M/S thresholds from Johnston & Ferreira 1992 ICASSP paper
+ ***************************************************************/
+static void
+msfix1(lame_internal_flags * gfc)
+{
+    int     sb, sblock;
+    FLOAT   rside, rmid, mld;
+    for (sb = 0; sb < SBMAX_l; sb++) {
+        /* use this fix if L & R masking differs by 2db or less */
+        /* if db = 10*log10(x2/x1) < 2 */
+        /* if (x2 < 1.58*x1) { */
+        if (gfc->thm[0].l[sb] > 1.58 * gfc->thm[1].l[sb]
+            || gfc->thm[1].l[sb] > 1.58 * gfc->thm[0].l[sb])
+            continue;
+
+        mld = gfc->mld_l[sb] * gfc->en[3].l[sb];
+        rmid = Max(gfc->thm[2].l[sb], Min(gfc->thm[3].l[sb], mld));
+
+        mld = gfc->mld_l[sb] * gfc->en[2].l[sb];
+        rside = Max(gfc->thm[3].l[sb], Min(gfc->thm[2].l[sb], mld));
+        gfc->thm[2].l[sb] = rmid;
+        gfc->thm[3].l[sb] = rside;
+    }
+
+    for (sb = 0; sb < SBMAX_s; sb++) {
+        for (sblock = 0; sblock < 3; sblock++) {
+            if (gfc->thm[0].s[sb][sblock] > 1.58 * gfc->thm[1].s[sb][sblock]
+                || gfc->thm[1].s[sb][sblock] > 1.58 * gfc->thm[0].s[sb][sblock])
+                continue;
+
+            mld = gfc->mld_s[sb] * gfc->en[3].s[sb][sblock];
+            rmid = Max(gfc->thm[2].s[sb][sblock], Min(gfc->thm[3].s[sb][sblock], mld));
+
+            mld = gfc->mld_s[sb] * gfc->en[2].s[sb][sblock];
+            rside = Max(gfc->thm[3].s[sb][sblock], Min(gfc->thm[2].s[sb][sblock], mld));
+
+            gfc->thm[2].s[sb][sblock] = rmid;
+            gfc->thm[3].s[sb][sblock] = rside;
+        }
+    }
+}
+
+/*************************************************************** 
+ * Adjust M/S maskings if user set "msfix"
+ ***************************************************************/
+/* Naoki Shibata 2000 */
+static void
+ns_msfix(lame_internal_flags * gfc, FLOAT msfix, FLOAT athadjust)
+{
+    int     sb, sblock;
+    FLOAT   msfix2 = msfix;
+    FLOAT   athlower = pow(10, athadjust);
+
+    msfix *= 2.0;
+    msfix2 *= 2.0;
+    for (sb = 0; sb < SBMAX_l; sb++) {
+        FLOAT   thmLR, thmM, thmS, ath;
+        ath = (gfc->ATH->cb_l[gfc->bm_l[sb]]) * athlower;
+        thmLR = Min(Max(gfc->thm[0].l[sb], ath), Max(gfc->thm[1].l[sb], ath));
+        thmM = Max(gfc->thm[2].l[sb], ath);
+        thmS = Max(gfc->thm[3].l[sb], ath);
+        if (thmLR * msfix < thmM + thmS) {
+            FLOAT const f = thmLR * msfix2 / (thmM + thmS);
+            thmM *= f;
+            thmS *= f;
+            assert(thmM + thmS > 0);
+        }
+        gfc->thm[2].l[sb] = Min(thmM, gfc->thm[2].l[sb]);
+        gfc->thm[3].l[sb] = Min(thmS, gfc->thm[3].l[sb]);
+    }
+
+    athlower *= ((FLOAT) BLKSIZE_s / BLKSIZE);
+    for (sb = 0; sb < SBMAX_s; sb++) {
+        for (sblock = 0; sblock < 3; sblock++) {
+            FLOAT   thmLR, thmM, thmS, ath;
+            ath = (gfc->ATH->cb_s[gfc->bm_s[sb]]) * athlower;
+            thmLR = Min(Max(gfc->thm[0].s[sb][sblock], ath), Max(gfc->thm[1].s[sb][sblock], ath));
+            thmM = Max(gfc->thm[2].s[sb][sblock], ath);
+            thmS = Max(gfc->thm[3].s[sb][sblock], ath);
+
+            if (thmLR * msfix < thmM + thmS) {
+                FLOAT const f = thmLR * msfix / (thmM + thmS);
+                thmM *= f;
+                thmS *= f;
+                assert(thmM + thmS > 0);
+            }
+            gfc->thm[2].s[sb][sblock] = Min(gfc->thm[2].s[sb][sblock], thmM);
+            gfc->thm[3].s[sb][sblock] = Min(gfc->thm[3].s[sb][sblock], thmS);
+        }
+    }
+}
+
+/* short block threshold calculation (part 2)
+
+    partition band bo_s[sfb] is at the transition from scalefactor
+    band sfb to the next one sfb+1; enn and thmm have to be split
+    between them
+*/
+static void
+convert_partition2scalefac_s(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, int chn,
+                             int sblock)
+{
+    FLOAT   enn, thmm;
+    int     sb, b;
+    enn = thmm = 0.0;
+    for (sb = b = 0; sb < SBMAX_s; ++b, ++sb) {
+        int const bo_s_sb = gfc->bo_s[sb];
+        int const npart_s = gfc->npart_s;
+        int const b_lim = bo_s_sb < npart_s ? bo_s_sb : npart_s;
+        while (b < b_lim) {
+            assert(eb[b] >= 0); /* iff failed, it may indicate some index error elsewhere */
+            assert(thr[b] >= 0);
+            enn += eb[b];
+            thmm += thr[b];
+            b++;
+        }
+        gfc->en[chn].s[sb][sblock] = enn;
+        gfc->thm[chn].s[sb][sblock] = thmm;
+
+        if (b >= npart_s) {
+            ++sb;
+            break;
+        }
+        assert(eb[b] >= 0); /* iff failed, it may indicate some index error elsewhere */
+        assert(thr[b] >= 0);
+        {
+            /* at transition sfb -> sfb+1 */
+            FLOAT const w_curr = gfc->PSY->bo_s_weight[sb];
+            FLOAT const w_next = 1.0 - w_curr;
+            enn = w_curr * eb[b];
+            thmm = w_curr * thr[b];
+            gfc->en[chn].s[sb][sblock] += enn;
+            gfc->thm[chn].s[sb][sblock] += thmm;
+            enn = w_next * eb[b];
+            thmm = w_next * thr[b];
+        }
+    }
+    /* zero initialize the rest */
+    for (; sb < SBMAX_s; ++sb) {
+        gfc->en[chn].s[sb][sblock] = 0;
+        gfc->thm[chn].s[sb][sblock] = 0;
+    }
+}
+
+/* longblock threshold calculation (part 2) */
+static void
+convert_partition2scalefac_l(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, int chn)
+{
+    FLOAT   enn, thmm;
+    int     sb, b;
+    enn = thmm = 0.0;
+    for (sb = b = 0; sb < SBMAX_l; ++b, ++sb) {
+        int const bo_l_sb = gfc->bo_l[sb];
+        int const npart_l = gfc->npart_l;
+        int const b_lim = bo_l_sb < npart_l ? bo_l_sb : npart_l;
+        while (b < b_lim) {
+            assert(eb[b] >= 0); /* iff failed, it may indicate some index error elsewhere */
+            assert(thr[b] >= 0);
+            enn += eb[b];
+            thmm += thr[b];
+            b++;
+        }
+        gfc->en[chn].l[sb] = enn;
+        gfc->thm[chn].l[sb] = thmm;
+
+        if (b >= npart_l) {
+            ++sb;
+            break;
+        }
+        assert(eb[b] >= 0);
+        assert(thr[b] >= 0);
+        {
+            /* at transition sfb -> sfb+1 */
+            FLOAT const w_curr = gfc->PSY->bo_l_weight[sb];
+            FLOAT const w_next = 1.0 - w_curr;
+            enn = w_curr * eb[b];
+            thmm = w_curr * thr[b];
+            gfc->en[chn].l[sb] += enn;
+            gfc->thm[chn].l[sb] += thmm;
+            enn = w_next * eb[b];
+            thmm = w_next * thr[b];
+        }
+    }
+    /* zero initialize the rest */
+    for (; sb < SBMAX_l; ++sb) {
+        gfc->en[chn].l[sb] = 0;
+        gfc->thm[chn].l[sb] = 0;
+    }
+}
+
+
+static void
+compute_masking_s(lame_global_flags const *gfp,
+                  FLOAT(*fftenergy_s)[HBLKSIZE_s], FLOAT * eb, FLOAT * thr, int chn, int sblock)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i, j, b;
+
+    for (b = j = 0; b < gfc->npart_s; ++b) {
+        FLOAT   ebb = 0, m = 0;
+        int const n = gfc->numlines_s[b];
+        for (i = 0; i < n; ++i, ++j) {
+            FLOAT const el = fftenergy_s[sblock][j];
+            ebb += el;
+            if (m < el)
+                m = el;
+        }
+        eb[b] = ebb;
+    }
+    assert(b == gfc->npart_s);
+    assert(j == 129);
+    for (j = b = 0; b < gfc->npart_s; b++) {
+        int     kk = gfc->s3ind_s[b][0];
+        FLOAT   ecb = gfc->s3_ss[j++] * eb[kk];
+        ++kk;
+        while (kk <= gfc->s3ind_s[b][1]) {
+            ecb += gfc->s3_ss[j] * eb[kk];
+            ++j, ++kk;
+        }
+
+        {               /* limit calculated threshold by previous granule */
+            FLOAT const x = rpelev_s * gfc->nb_s1[chn][b];
+            thr[b] = Min(ecb, x);
+        }
+        if (gfc->blocktype_old[chn & 1] == SHORT_TYPE) {
+            /* limit calculated threshold by even older granule */
+            FLOAT const x = rpelev2_s * gfc->nb_s2[chn][b];
+            FLOAT const y = thr[b];
+            thr[b] = Min(x, y);
+        }
+
+        gfc->nb_s2[chn][b] = gfc->nb_s1[chn][b];
+        gfc->nb_s1[chn][b] = ecb;
+        assert(thr[b] >= 0);
+    }
+    for (; b <= CBANDS; ++b) {
+        eb[b] = 0;
+        thr[b] = 0;
+    }
+}
+
+static void
+block_type_set(lame_global_flags const *gfp, int *uselongblock, int *blocktype_d, int *blocktype)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     chn;
+
+    if (gfp->short_blocks == short_block_coupled
+        /* force both channels to use the same block type */
+        /* this is necessary if the frame is to be encoded in ms_stereo.  */
+        /* But even without ms_stereo, FhG  does this */
+        && !(uselongblock[0] && uselongblock[1]))
+        uselongblock[0] = uselongblock[1] = 0;
+
+    /* update the blocktype of the previous granule, since it depends on what
+     * happend in this granule */
+    for (chn = 0; chn < gfc->channels_out; chn++) {
+        blocktype[chn] = NORM_TYPE;
+        /* disable short blocks */
+        if (gfp->short_blocks == short_block_dispensed)
+            uselongblock[chn] = 1;
+        if (gfp->short_blocks == short_block_forced)
+            uselongblock[chn] = 0;
+
+        if (uselongblock[chn]) {
+            /* no attack : use long blocks */
+            assert(gfc->blocktype_old[chn] != START_TYPE);
+            if (gfc->blocktype_old[chn] == SHORT_TYPE)
+                blocktype[chn] = STOP_TYPE;
+        }
+        else {
+            /* attack : use short blocks */
+            blocktype[chn] = SHORT_TYPE;
+            if (gfc->blocktype_old[chn] == NORM_TYPE) {
+                gfc->blocktype_old[chn] = START_TYPE;
+            }
+            if (gfc->blocktype_old[chn] == STOP_TYPE)
+                gfc->blocktype_old[chn] = SHORT_TYPE;
+        }
+
+        blocktype_d[chn] = gfc->blocktype_old[chn]; /* value returned to calling program */
+        gfc->blocktype_old[chn] = blocktype[chn]; /* save for next call to l3psy_anal */
+    }
+}
+
+
+static inline FLOAT
+NS_INTERP(FLOAT x, FLOAT y, FLOAT r)
+{
+    /* was pow((x),(r))*pow((y),1-(r)) */
+    if (r >= 1.0)
+        return x;       /* 99.7% of the time */
+    if (r <= 0.0)
+        return y;
+    if (y > 0.0)
+        return pow(x / y, r) * y; /* rest of the time */
+    return 0.0;         /* never happens */
+}
+
+
+
+static  FLOAT
+pecalc_s(III_psy_ratio const *mr, FLOAT masking_lower)
+{
+    FLOAT   pe_s;
+    static const FLOAT regcoef_s[] = {
+        11.8,           /* these values are tuned only for 44.1kHz... */
+        13.6,
+        17.2,
+        32,
+        46.5,
+        51.3,
+        57.5,
+        67.1,
+        71.5,
+        84.6,
+        97.6,
+        130,
+/*      255.8 */
+    };
+    unsigned int sb, sblock;
+
+    pe_s = 1236.28 / 4;
+    for (sb = 0; sb < SBMAX_s - 1; sb++) {
+        for (sblock = 0; sblock < 3; sblock++) {
+            FLOAT const thm = mr->thm.s[sb][sblock];
+            assert(sb < dimension_of(regcoef_s));
+            if (thm > 0.0) {
+                FLOAT const x = thm * masking_lower;
+                FLOAT const en = mr->en.s[sb][sblock];
+                if (en > x) {
+                    if (en > x * 1e10) {
+                        pe_s += regcoef_s[sb] * (10.0 * LOG10);
+                    }
+                    else {
+                        assert(x > 0);
+                        pe_s += regcoef_s[sb] * FAST_LOG10(en / x);
+                    }
+                }
+            }
+        }
+    }
+
+    return pe_s;
+}
+
+static  FLOAT
+pecalc_l(III_psy_ratio const *mr, FLOAT masking_lower)
+{
+    FLOAT   pe_l;
+    static const FLOAT regcoef_l[] = {
+        6.8,            /* these values are tuned only for 44.1kHz... */
+        5.8,
+        5.8,
+        6.4,
+        6.5,
+        9.9,
+        12.1,
+        14.4,
+        15,
+        18.9,
+        21.6,
+        26.9,
+        34.2,
+        40.2,
+        46.8,
+        56.5,
+        60.7,
+        73.9,
+        85.7,
+        93.4,
+        126.1,
+/*      241.3 */
+    };
+    unsigned int sb;
+
+    pe_l = 1124.23 / 4;
+    for (sb = 0; sb < SBMAX_l - 1; sb++) {
+        FLOAT const thm = mr->thm.l[sb];
+        assert(sb < dimension_of(regcoef_l));
+        if (thm > 0.0) {
+            FLOAT const x = thm * masking_lower;
+            FLOAT const en = mr->en.l[sb];
+            if (en > x) {
+                if (en > x * 1e10) {
+                    pe_l += regcoef_l[sb] * (10.0 * LOG10);
+                }
+                else {
+                    assert(x > 0);
+                    pe_l += regcoef_l[sb] * FAST_LOG10(en / x);
+                }
+            }
+        }
+    }
+
+    return pe_l;
+}
+
+
+static void
+calc_energy(lame_internal_flags const *gfc, FLOAT const *fftenergy,
+            FLOAT * eb, FLOAT * max, FLOAT * avg)
+{
+    int     b, j;
+
+    for (b = j = 0; b < gfc->npart_l; ++b) {
+        FLOAT   ebb = 0, m = 0;
+        int     i;
+        for (i = 0; i < gfc->numlines_l[b]; ++i, ++j) {
+            FLOAT const el = fftenergy[j];
+            assert(el >= 0);
+            ebb += el;
+            if (m < el)
+                m = el;
+        }
+        eb[b] = ebb;
+        max[b] = m;
+        avg[b] = ebb * gfc->rnumlines_l[b];
+        assert(gfc->rnumlines_l[b] >= 0);
+        assert(ebb >= 0);
+        assert(eb[b] >= 0);
+        assert(max[b] >= 0);
+        assert(avg[b] >= 0);
+    }
+}
+
+
+static void
+calc_mask_index_l(lame_internal_flags const *gfc, FLOAT const *max,
+                  FLOAT const *avg, unsigned char *mask_idx)
+{
+    FLOAT   m, a;
+    int     b, k;
+    int const last_tab_entry = sizeof(tab) / sizeof(tab[0]) - 1;
+    b = 0;
+    a = avg[b] + avg[b + 1];
+    assert(a >= 0);
+    if (a > 0.0) {
+        m = max[b];
+        if (m < max[b + 1])
+            m = max[b + 1];
+        assert((gfc->numlines_l[b] + gfc->numlines_l[b + 1] - 1) > 0);
+        a = 20.0 * (m * 2.0 - a)
+            / (a * (gfc->numlines_l[b] + gfc->numlines_l[b + 1] - 1));
+        k = (int) a;
+        if (k > last_tab_entry)
+            k = last_tab_entry;
+        mask_idx[b] = k;
+    }
+    else {
+        mask_idx[b] = 0;
+    }
+
+    for (b = 1; b < gfc->npart_l - 1; b++) {
+        a = avg[b - 1] + avg[b] + avg[b + 1];
+        assert(a >= 0);
+        if (a > 0.0) {
+            m = max[b - 1];
+            if (m < max[b])
+                m = max[b];
+            if (m < max[b + 1])
+                m = max[b + 1];
+            assert((gfc->numlines_l[b - 1] + gfc->numlines_l[b] + gfc->numlines_l[b + 1] - 1) > 0);
+            a = 20.0 * (m * 3.0 - a)
+                / (a * (gfc->numlines_l[b - 1] + gfc->numlines_l[b] + gfc->numlines_l[b + 1] - 1));
+            k = (int) a;
+            if (k > last_tab_entry)
+                k = last_tab_entry;
+            mask_idx[b] = k;
+        }
+        else {
+            mask_idx[b] = 0;
+        }
+    }
+    assert(b > 0);
+    assert(b == gfc->npart_l - 1);
+
+    a = avg[b - 1] + avg[b];
+    assert(a >= 0);
+    if (a > 0.0) {
+        m = max[b - 1];
+        if (m < max[b])
+            m = max[b];
+        assert((gfc->numlines_l[b - 1] + gfc->numlines_l[b] - 1) > 0);
+        a = 20.0 * (m * 2.0 - a)
+            / (a * (gfc->numlines_l[b - 1] + gfc->numlines_l[b] - 1));
+        k = (int) a;
+        if (k > last_tab_entry)
+            k = last_tab_entry;
+        mask_idx[b] = k;
+    }
+    else {
+        mask_idx[b] = 0;
+    }
+    assert(b == (gfc->npart_l - 1));
+}
+
+
+int
+L3psycho_anal_ns(lame_global_flags const *gfp,
+                 const sample_t * buffer[2], int gr_out,
+                 III_psy_ratio masking_ratio[2][2],
+                 III_psy_ratio masking_MS_ratio[2][2],
+                 FLOAT percep_entropy[2], FLOAT percep_MS_entropy[2],
+                 FLOAT energy[4], int blocktype_d[2])
+{
+/* to get a good cache performance, one has to think about
+ * the sequence, in which the variables are used.  
+ * (Note: these static variables have been moved to the gfc-> struct,
+ * and their order in memory is layed out in util.h)
+ */
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    /* fft and energy calculation   */
+    FLOAT   wsamp_L[2][BLKSIZE];
+    FLOAT   wsamp_S[2][3][BLKSIZE_s];
+
+    /* convolution   */
+    FLOAT   eb_l[CBANDS + 1], eb_s[CBANDS + 1];
+    FLOAT   thr[CBANDS + 2];
+
+    /* block type  */
+    int     blocktype[2], uselongblock[2];
+
+    /* usual variables like loop indices, etc..    */
+    int     numchn, chn;
+    int     b, i, j, k;
+    int     sb, sblock;
+
+    /* variables used for --nspsytune */
+    FLOAT   ns_hpfsmpl[2][576];
+    FLOAT   pcfact;
+
+    unsigned char mask_idx_l[CBANDS + 2], mask_idx_s[CBANDS + 2];
+
+    memset(mask_idx_s, 0, sizeof(mask_idx_s));
+
+    numchn = gfc->channels_out;
+    /* chn=2 and 3 = Mid and Side channels */
+    if (gfp->mode == JOINT_STEREO)
+        numchn = 4;
+
+    if (gfp->VBR == vbr_off)
+        pcfact = gfc->ResvMax == 0 ? 0 : ((FLOAT) gfc->ResvSize) / gfc->ResvMax * 0.5;
+    else if (gfp->VBR == vbr_rh || gfp->VBR == vbr_mtrh || gfp->VBR == vbr_mt) {
+        /*static const FLOAT pcQns[10]={1.0,1.0,1.0,0.8,0.6,0.5,0.4,0.3,0.2,0.1};
+           pcfact = pcQns[gfp->VBR_q]; */
+        pcfact = 0.6;
+    }
+    else
+        pcfact = 1.0;
+
+    /**********************************************************************
+     *  Apply HPF of fs/4 to the input signal.
+     *  This is used for attack detection / handling.
+     **********************************************************************/
+    /* Don't copy the input buffer into a temporary buffer */
+    /* unroll the loop 2 times */
+    for (chn = 0; chn < gfc->channels_out; chn++) {
+        static const FLOAT fircoef[] = {
+            -8.65163e-18 * 2, -0.00851586 * 2, -6.74764e-18 * 2, 0.0209036 * 2,
+            -3.36639e-17 * 2, -0.0438162 * 2, -1.54175e-17 * 2, 0.0931738 * 2,
+            -5.52212e-17 * 2, -0.313819 * 2
+        };
+        /* apply high pass filter of fs/4 */
+        const sample_t *const firbuf = &buffer[chn][576 - 350 - NSFIRLEN + 192];
+        assert(sizeof(fircoef) / sizeof(fircoef[0]) == ((NSFIRLEN - 1) / 2));
+        for (i = 0; i < 576; i++) {
+            FLOAT   sum1, sum2;
+            sum1 = firbuf[i + 10];
+            sum2 = 0.0;
+            for (j = 0; j < ((NSFIRLEN - 1) / 2) - 1; j += 2) {
+                sum1 += fircoef[j] * (firbuf[i + j] + firbuf[i + NSFIRLEN - j]);
+                sum2 += fircoef[j + 1] * (firbuf[i + j + 1] + firbuf[i + NSFIRLEN - j - 1]);
+            }
+            ns_hpfsmpl[chn][i] = sum1 + sum2;
+        }
+        masking_ratio[gr_out][chn].en = gfc->en[chn];
+        masking_ratio[gr_out][chn].thm = gfc->thm[chn];
+        if (numchn > 2) {
+            /* MS maskings  */
+            /*percep_MS_entropy         [chn-2]     = gfc -> pe  [chn];  */
+            masking_MS_ratio[gr_out][chn].en = gfc->en[chn + 2];
+            masking_MS_ratio[gr_out][chn].thm = gfc->thm[chn + 2];
+        }
+    }
+
+    for (chn = 0; chn < numchn; chn++) {
+        FLOAT(*wsamp_l)[BLKSIZE];
+        FLOAT(*wsamp_s)[3][BLKSIZE_s];
+        FLOAT   en_subshort[12];
+        FLOAT   en_short[4] = { 0 };
+        FLOAT   attack_intensity[12];
+        int     ns_uselongblock = 1;
+        FLOAT   attackThreshold;
+        FLOAT   max[CBANDS], avg[CBANDS];
+        int     ns_attacks[4] = { 0 };
+        FLOAT   fftenergy[HBLKSIZE];
+        FLOAT   fftenergy_s[3][HBLKSIZE_s];
+
+
+        /*  rh 20040301: the following loops do access one off the limits
+         *  so I increase  the array dimensions by one and initialize the
+         *  accessed values to zero
+         */
+        assert(gfc->npart_s <= CBANDS);
+        assert(gfc->npart_l <= CBANDS);
+
+ /*************************************************************** 
+  * determine the block type (window type)
+  ***************************************************************/
+        /* calculate energies of each sub-shortblocks */
+        for (i = 0; i < 3; i++) {
+            en_subshort[i] = gfc->nsPsy.last_en_subshort[chn][i + 6];
+            assert(gfc->nsPsy.last_en_subshort[chn][i + 4] > 0);
+            attack_intensity[i]
+                = en_subshort[i] / gfc->nsPsy.last_en_subshort[chn][i + 4];
+            en_short[0] += en_subshort[i];
+        }
+
+        if (chn == 2) {
+            for (i = 0; i < 576; i++) {
+                FLOAT   l, r;
+                l = ns_hpfsmpl[0][i];
+                r = ns_hpfsmpl[1][i];
+                ns_hpfsmpl[0][i] = l + r;
+                ns_hpfsmpl[1][i] = l - r;
+            }
+        }
+        {
+            FLOAT const *pf = ns_hpfsmpl[chn & 1];
+            for (i = 0; i < 9; i++) {
+                FLOAT const *const pfe = pf + 576 / 9;
+                FLOAT   p = 1.;
+                for (; pf < pfe; pf++)
+                    if (p < fabs(*pf))
+                        p = fabs(*pf);
+
+                gfc->nsPsy.last_en_subshort[chn][i] = en_subshort[i + 3] = p;
+                en_short[1 + i / 3] += p;
+                if (p > en_subshort[i + 3 - 2]) {
+                    assert(en_subshort[i + 3 - 2] > 0);
+                    p = p / en_subshort[i + 3 - 2];
+                }
+                else if (en_subshort[i + 3 - 2] > p * 10.0) {
+                    assert(p > 0);
+                    p = en_subshort[i + 3 - 2] / (p * 10.0);
+                }
+                else
+                    p = 0.0;
+                attack_intensity[i + 3] = p;
+            }
+        }
+
+        if (gfp->analysis) {
+            FLOAT   x = attack_intensity[0];
+            for (i = 1; i < 12; i++)
+                if (x < attack_intensity[i])
+                    x = attack_intensity[i];
+            gfc->pinfo->ers[gr_out][chn] = gfc->pinfo->ers_save[chn];
+            gfc->pinfo->ers_save[chn] = x;
+        }
+
+        /* compare energies between sub-shortblocks */
+        attackThreshold = (chn == 3)
+            ? gfc->nsPsy.attackthre_s : gfc->nsPsy.attackthre;
+        for (i = 0; i < 12; i++)
+            if (!ns_attacks[i / 3] && attack_intensity[i] > attackThreshold)
+                ns_attacks[i / 3] = (i % 3) + 1;
+
+        /* should have energy change between short blocks,
+           in order to avoid periodic signals */
+        for (i = 1; i < 4; i++) {
+            float   ratio;
+            if (en_short[i - 1] > en_short[i]) {
+                assert(en_short[i] > 0);
+                ratio = en_short[i - 1] / en_short[i];
+            }
+            else {
+                assert(en_short[i - 1] > 0);
+                ratio = en_short[i] / en_short[i - 1];
+            }
+            if (ratio < 1.7) {
+                ns_attacks[i] = 0;
+                if (i == 1)
+                    ns_attacks[0] = 0;
+            }
+        }
+
+        if (ns_attacks[0] && gfc->nsPsy.last_attacks[chn])
+            ns_attacks[0] = 0;
+
+        if (gfc->nsPsy.last_attacks[chn] == 3 ||
+            ns_attacks[0] + ns_attacks[1] + ns_attacks[2] + ns_attacks[3]) {
+            ns_uselongblock = 0;
+
+            if (ns_attacks[1] && ns_attacks[0])
+                ns_attacks[1] = 0;
+            if (ns_attacks[2] && ns_attacks[1])
+                ns_attacks[2] = 0;
+            if (ns_attacks[3] && ns_attacks[2])
+                ns_attacks[3] = 0;
+        }
+
+        if (chn < 2) {
+            uselongblock[chn] = ns_uselongblock;
+        }
+        else {
+            if (ns_uselongblock == 0) {
+                uselongblock[0] = uselongblock[1] = 0;
+            }
+        }
+
+        /* there is a one granule delay.  Copy maskings computed last call
+         * into masking_ratio to return to calling program.
+         */
+        energy[chn] = gfc->tot_ener[chn];
+
+ /*********************************************************************
+  *  compute FFTs
+  *********************************************************************/
+        wsamp_s = wsamp_S + (chn & 1);
+        wsamp_l = wsamp_L + (chn & 1);
+        compute_ffts(gfp, fftenergy, fftenergy_s, wsamp_l, wsamp_s, gr_out, chn, buffer);
+
+ /*********************************************************************
+        *    Calculate the energy and the tonality of each partition.
+ *********************************************************************/
+        calc_energy(gfc, fftenergy, eb_l, max, avg);
+        calc_mask_index_l(gfc, max, avg, mask_idx_l);
+
+        /* compute masking thresholds for short blocks */
+        for (sblock = 0; sblock < 3; sblock++) {
+            FLOAT   enn, thmm;
+            compute_masking_s(gfp, fftenergy_s, eb_s, thr, chn, sblock);
+            convert_partition2scalefac_s(gfc, eb_s, thr, chn, sblock);
+
+            /****   short block pre-echo control   ****/
+            for (sb = 0; sb < SBMAX_s; sb++) {
+                thmm = gfc->thm[chn].s[sb][sblock];
+
+                thmm *= NS_PREECHO_ATT0;
+                if (ns_attacks[sblock] >= 2 || ns_attacks[sblock + 1] == 1) {
+                    int const idx = (sblock != 0) ? sblock - 1 : 2;
+                    double const p = NS_INTERP(gfc->thm[chn].s[sb][idx],
+                                               thmm, NS_PREECHO_ATT1 * pcfact);
+                    thmm = Min(thmm, p);
+                }
+
+                if (ns_attacks[sblock] == 1) {
+                    int const idx = (sblock != 0) ? sblock - 1 : 2;
+                    double const p = NS_INTERP(gfc->thm[chn].s[sb][idx],
+                                               thmm, NS_PREECHO_ATT2 * pcfact);
+                    thmm = Min(thmm, p);
+                }
+                else if ((sblock != 0 && ns_attacks[sblock - 1] == 3)
+                         || (sblock == 0 && gfc->nsPsy.last_attacks[chn] == 3)) {
+                    int const idx = (sblock != 2) ? sblock + 1 : 0;
+                    double const p = NS_INTERP(gfc->thm[chn].s[sb][idx],
+                                               thmm, NS_PREECHO_ATT2 * pcfact);
+                    thmm = Min(thmm, p);
+                }
+
+                /* pulse like signal detection for fatboy.wav and so on */
+                enn = en_subshort[sblock * 3 + 3] + en_subshort[sblock * 3 + 4]
+                    + en_subshort[sblock * 3 + 5];
+                if (en_subshort[sblock * 3 + 5] * 6 < enn) {
+                    thmm *= 0.5;
+                    if (en_subshort[sblock * 3 + 4] * 6 < enn)
+                        thmm *= 0.5;
+                }
+
+                gfc->thm[chn].s[sb][sblock] = thmm;
+            }
+        }
+        gfc->nsPsy.last_attacks[chn] = ns_attacks[2];
+
+ /*********************************************************************
+  *      convolve the partitioned energy and unpredictability
+  *      with the spreading function, s3_l[b][k]
+  ********************************************************************/
+        k = 0;
+        {
+            for (b = 0; b < gfc->npart_l; b++) {
+                FLOAT   eb2;
+                FLOAT   ecb;
+                /* convolve the partitioned energy with the spreading function */
+                int     kk = gfc->s3ind[b][0];
+                eb2 = eb_l[kk] * tab[mask_idx_l[kk]];
+                ecb = gfc->s3_ll[k++] * eb2;
+                while (++kk <= gfc->s3ind[b][1]) {
+                    eb2 = eb_l[kk] * tab[mask_idx_l[kk]];
+                    ecb = mask_add(ecb, gfc->s3_ll[k++] * eb2, kk, kk - b, gfc, 0);
+                }
+                ecb *= 0.158489319246111; /* pow(10,-0.8) */
+
+                /****   long block pre-echo control   ****/
+                /* dont use long block pre-echo control if previous granule was 
+                 * a short block.  This is to avoid the situation:   
+                 * frame0:  quiet (very low masking)  
+                 * frame1:  surge  (triggers short blocks)
+                 * frame2:  regular frame.  looks like pre-echo when compared to 
+                 *          frame0, but all pre-echo was in frame1.
+                 */
+                /* chn=0,1   L and R channels
+                   chn=2,3   S and M channels.
+                 */
+
+                if (gfc->blocktype_old[chn & 1] == SHORT_TYPE)
+                    thr[b] = ecb; /* Min(ecb, rpelev*gfc->nb_1[chn][b]); */
+                else
+                    thr[b] = NS_INTERP(Min(ecb,
+                                           Min(rpelev * gfc->nb_1[chn][b],
+                                               rpelev2 * gfc->nb_2[chn][b])), ecb, pcfact);
+
+                gfc->nb_2[chn][b] = gfc->nb_1[chn][b];
+                gfc->nb_1[chn][b] = ecb;
+            }
+        }
+        for (; b <= CBANDS; ++b) {
+            eb_l[b] = 0;
+            thr[b] = 0;
+        }
+        /* compute masking thresholds for long blocks */
+        convert_partition2scalefac_l(gfc, eb_l, thr, chn);
+
+    }                   /* end loop over chn */
+
+    if (gfp->mode == STEREO || gfp->mode == JOINT_STEREO) {
+        if (gfp->interChRatio > 0.0) {
+            calc_interchannel_masking(gfp, gfp->interChRatio);
+        }
+    }
+
+    if (gfp->mode == JOINT_STEREO) {
+        FLOAT   msfix;
+        msfix1(gfc);
+        msfix = gfp->msfix;
+        if (fabs(msfix) > 0.0)
+            ns_msfix(gfc, msfix, gfp->ATHlower * gfc->ATH->adjust);
+    }
+
+    /*************************************************************** 
+     * determine final block type
+     ***************************************************************/
+    block_type_set(gfp, uselongblock, blocktype_d, blocktype);
+
+    /*********************************************************************
+     * compute the value of PE to return ... no delay and advance
+     *********************************************************************/
+    for (chn = 0; chn < numchn; chn++) {
+        FLOAT  *ppe;
+        int     type;
+        III_psy_ratio const *mr;
+
+        if (chn > 1) {
+            ppe = percep_MS_entropy - 2;
+            type = NORM_TYPE;
+            if (blocktype_d[0] == SHORT_TYPE || blocktype_d[1] == SHORT_TYPE)
+                type = SHORT_TYPE;
+            mr = &masking_MS_ratio[gr_out][chn - 2];
+        }
+        else {
+            ppe = percep_entropy;
+            type = blocktype_d[chn];
+            mr = &masking_ratio[gr_out][chn];
+        }
+
+        if (type == SHORT_TYPE)
+            ppe[chn] = pecalc_s(mr, gfc->masking_lower);
+        else
+            ppe[chn] = pecalc_l(mr, gfc->masking_lower);
+
+
+        if (gfp->analysis)
+            gfc->pinfo->pe[gr_out][chn] = ppe[chn];
+
+    }
+    return 0;
+}
+
+
+
+
+
+static void
+vbrpsy_compute_fft_l(lame_global_flags const *gfp, const sample_t * buffer[2], int chn, int gr_out,
+                     FLOAT fftenergy[HBLKSIZE], FLOAT(*wsamp_l)[BLKSIZE])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     j;
+
+    if (chn < 2) {
+        fft_long(gfc, *wsamp_l, chn, buffer);
+    }
+    else if (chn == 2) {
+        /* FFT data for mid and side channel is derived from L & R */
+        for (j = BLKSIZE - 1; j >= 0; --j) {
+            FLOAT const l = wsamp_l[0][j];
+            FLOAT const r = wsamp_l[1][j];
+            wsamp_l[0][j] = (l + r) * (FLOAT) (SQRT2 * 0.5);
+            wsamp_l[1][j] = (l - r) * (FLOAT) (SQRT2 * 0.5);
+        }
+    }
+
+    /*********************************************************************
+    *  compute energies
+    *********************************************************************/
+    fftenergy[0] = NON_LINEAR_SCALE_ENERGY(wsamp_l[0][0]);
+    fftenergy[0] *= fftenergy[0];
+
+    for (j = BLKSIZE / 2 - 1; j >= 0; --j) {
+        FLOAT const re = (*wsamp_l)[BLKSIZE / 2 - j];
+        FLOAT const im = (*wsamp_l)[BLKSIZE / 2 + j];
+        fftenergy[BLKSIZE / 2 - j] = NON_LINEAR_SCALE_ENERGY((re * re + im * im) * 0.5f);
+    }
+    /* total energy */
+    {
+        FLOAT   totalenergy = 0.0;
+        for (j = 11; j < HBLKSIZE; j++)
+            totalenergy += fftenergy[j];
+
+        gfc->tot_ener[chn] = totalenergy;
+    }
+
+    if (gfp->analysis) {
+        for (j = 0; j < HBLKSIZE; j++) {
+            gfc->pinfo->energy[gr_out][chn][j] = gfc->pinfo->energy_save[chn][j];
+            gfc->pinfo->energy_save[chn][j] = fftenergy[j];
+        }
+        gfc->pinfo->pe[gr_out][chn] = gfc->pe[chn];
+    }
+}
+
+
+static void
+vbrpsy_compute_fft_s(lame_global_flags const *gfp, const sample_t * buffer[2], int chn, int sblock,
+                     FLOAT(*fftenergy_s)[HBLKSIZE_s], FLOAT(*wsamp_s)[3][BLKSIZE_s])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     j;
+
+    if (sblock == 0 && chn < 2) {
+        fft_short(gfc, *wsamp_s, chn, buffer);
+    }
+    if (chn == 2) {
+        /* FFT data for mid and side channel is derived from L & R */
+        for (j = BLKSIZE_s - 1; j >= 0; --j) {
+            FLOAT const l = wsamp_s[0][sblock][j];
+            FLOAT const r = wsamp_s[1][sblock][j];
+            wsamp_s[0][sblock][j] = (l + r) * (FLOAT) (SQRT2 * 0.5);
+            wsamp_s[1][sblock][j] = (l - r) * (FLOAT) (SQRT2 * 0.5);
+        }
+    }
+
+    /*********************************************************************
+    *  compute energies
+    *********************************************************************/
+    fftenergy_s[sblock][0] = (*wsamp_s)[sblock][0];
+    fftenergy_s[sblock][0] *= fftenergy_s[sblock][0];
+    for (j = BLKSIZE_s / 2 - 1; j >= 0; --j) {
+        FLOAT const re = (*wsamp_s)[sblock][BLKSIZE_s / 2 - j];
+        FLOAT const im = (*wsamp_s)[sblock][BLKSIZE_s / 2 + j];
+        fftenergy_s[sblock][BLKSIZE_s / 2 - j] =
+            NON_LINEAR_SCALE_ENERGY((re * re + im * im) * 0.5f);
+    }
+}
+
+
+    /*********************************************************************
+    * compute loudness approximation (used for ATH auto-level adjustment) 
+    *********************************************************************/
+static void
+vbrpsy_compute_loudness_approximation_l(lame_global_flags const *gfp, int gr_out, int chn,
+                                        FLOAT fftenergy[HBLKSIZE])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    if (gfp->athaa_loudapprox == 2 && chn < 2) { /*no loudness for mid/side ch */
+        gfc->loudness_sq[gr_out][chn] = gfc->loudness_sq_save[chn];
+        gfc->loudness_sq_save[chn] = psycho_loudness_approx(fftenergy, gfc);
+    }
+}
+
+
+    /**********************************************************************
+    *  Apply HPF of fs/4 to the input signal.
+    *  This is used for attack detection / handling.
+    **********************************************************************/
+static void
+vbrpsy_attack_detection(lame_global_flags const *gfp, const sample_t * buffer[2], int gr_out,
+                        III_psy_ratio masking_ratio[2][2], III_psy_ratio masking_MS_ratio[2][2],
+                        FLOAT energy[4], FLOAT sub_short_factor[4][3], int ns_attacks[4][4],
+                        int uselongblock[2])
+{
+    FLOAT   ns_hpfsmpl[2][576];
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int const n_chn_out = gfc->channels_out;
+    /* chn=2 and 3 = Mid and Side channels */
+    int const n_chn_psy = (gfp->mode == JOINT_STEREO) ? 4 : n_chn_out;
+    int     chn, i, j;
+    /* Don't copy the input buffer into a temporary buffer */
+    /* unroll the loop 2 times */
+    for (chn = 0; chn < n_chn_out; chn++) {
+        static const FLOAT fircoef[] = {
+            -8.65163e-18 * 2, -0.00851586 * 2, -6.74764e-18 * 2, 0.0209036 * 2,
+            -3.36639e-17 * 2, -0.0438162 * 2, -1.54175e-17 * 2, 0.0931738 * 2,
+            -5.52212e-17 * 2, -0.313819 * 2
+        };
+        /* apply high pass filter of fs/4 */
+        const sample_t *const firbuf = &buffer[chn][576 - 350 - NSFIRLEN + 192];
+        assert(dimension_of(fircoef) == ((NSFIRLEN - 1) / 2));
+        for (i = 0; i < 576; i++) {
+            FLOAT   sum1, sum2;
+            sum1 = firbuf[i + 10];
+            sum2 = 0.0;
+            for (j = 0; j < ((NSFIRLEN - 1) / 2) - 1; j += 2) {
+                sum1 += fircoef[j] * (firbuf[i + j] + firbuf[i + NSFIRLEN - j]);
+                sum2 += fircoef[j + 1] * (firbuf[i + j + 1] + firbuf[i + NSFIRLEN - j - 1]);
+            }
+            ns_hpfsmpl[chn][i] = sum1 + sum2;
+        }
+        masking_ratio[gr_out][chn].en = gfc->en[chn];
+        masking_ratio[gr_out][chn].thm = gfc->thm[chn];
+        if (n_chn_psy > 2) {
+            /* MS maskings  */
+            /*percep_MS_entropy         [chn-2]     = gfc -> pe  [chn];  */
+            masking_MS_ratio[gr_out][chn].en = gfc->en[chn + 2];
+            masking_MS_ratio[gr_out][chn].thm = gfc->thm[chn + 2];
+        }
+    }
+    for (chn = 0; chn < n_chn_psy; chn++) {
+        FLOAT   attack_intensity[12];
+        FLOAT   en_subshort[12];
+        FLOAT   en_short[4] = { 0, 0, 0, 0 };
+        FLOAT const *pf = ns_hpfsmpl[chn & 1];
+        FLOAT const attackThreshold = (chn == 3) ? gfc->nsPsy.attackthre_s : gfc->nsPsy.attackthre;
+        int     ns_uselongblock = 1;
+
+        if (chn == 2) {
+            for (i = 0, j = 576; j > 0; ++i, --j) {
+                FLOAT const l = ns_hpfsmpl[0][i];
+                FLOAT const r = ns_hpfsmpl[1][i];
+                ns_hpfsmpl[0][i] = l + r;
+                ns_hpfsmpl[1][i] = l - r;
+            }
+        }
+        /*************************************************************** 
+        * determine the block type (window type)
+        ***************************************************************/
+        /* calculate energies of each sub-shortblocks */
+        for (i = 0; i < 3; i++) {
+            en_subshort[i] = gfc->nsPsy.last_en_subshort[chn][i + 6];
+            assert(gfc->nsPsy.last_en_subshort[chn][i + 4] > 0);
+            attack_intensity[i]
+                = en_subshort[i] / gfc->nsPsy.last_en_subshort[chn][i + 4];
+            en_short[0] += en_subshort[i];
+        }
+
+        for (i = 0; i < 9; i++) {
+            FLOAT const *const pfe = pf + 576 / 9;
+            FLOAT   p = 1.;
+            for (; pf < pfe; pf++)
+                if (p < fabs(*pf))
+                    p = fabs(*pf);
+
+            gfc->nsPsy.last_en_subshort[chn][i] = en_subshort[i + 3] = p;
+            en_short[1 + i / 3] += p;
+            if (p > en_subshort[i + 3 - 2]) {
+                assert(en_subshort[i + 3 - 2] > 0);
+                p = p / en_subshort[i + 3 - 2];
+            }
+            else if (en_subshort[i + 3 - 2] > p * 10.0) {
+                assert(p > 0);
+                p = en_subshort[i + 3 - 2] / (p * 10.0);
+            }
+            else {
+                p = 0.0;
+            }
+            attack_intensity[i + 3] = p;
+        }
+        /* pulse like signal detection for fatboy.wav and so on */
+        for (i = 0; i < 3; ++i) {
+            FLOAT const enn =
+                en_subshort[i * 3 + 3] + en_subshort[i * 3 + 4] + en_subshort[i * 3 + 5];
+            FLOAT   factor = 1.f;
+            if (en_subshort[i * 3 + 5] * 6 < enn) {
+                factor *= 0.5f;
+                if (en_subshort[i * 3 + 4] * 6 < enn) {
+                    factor *= 0.5f;
+                }
+            }
+            sub_short_factor[chn][i] = factor;
+        }
+
+        if (gfp->analysis) {
+            FLOAT   x = attack_intensity[0];
+            for (i = 1; i < 12; i++) {
+                if (x < attack_intensity[i]) {
+                    x = attack_intensity[i];
+                }
+            }
+            gfc->pinfo->ers[gr_out][chn] = gfc->pinfo->ers_save[chn];
+            gfc->pinfo->ers_save[chn] = x;
+        }
+
+        /* compare energies between sub-shortblocks */
+        for (i = 0; i < 12; i++) {
+            if (!ns_attacks[chn][i / 3] && attack_intensity[i] > attackThreshold) {
+                ns_attacks[chn][i / 3] = (i % 3) + 1;
+            }
+        }
+
+        /* should have energy change between short blocks, in order to avoid periodic signals */
+        /* Good samples to show the effect are Trumpet test songs */
+        /* GB: tuned (1) to avoid too many short blocks for test sample TRUMPET */
+        /* RH: tuned (2) to let enough short blocks through for test sample FSOL and SNAPS */
+        for (i = 1; i < 4; i++) {
+            FLOAT const u = en_short[i - 1];
+            FLOAT const v = en_short[i];
+            FLOAT const m = Max(u, v);
+            if (m < 40000) { /* (2) */
+                if (u < 1.7 * v && v < 1.7 * u) { /* (1) */
+                    if (i == 1 && ns_attacks[chn][0] <= ns_attacks[chn][i]) {
+                        ns_attacks[chn][0] = 0;
+                    }
+                    ns_attacks[chn][i] = 0;
+                }
+            }
+        }
+
+        if (ns_attacks[chn][0] <= gfc->nsPsy.last_attacks[chn]) {
+            ns_attacks[chn][0] = 0;
+        }
+
+        if (gfc->nsPsy.last_attacks[chn] == 3 ||
+            ns_attacks[chn][0] + ns_attacks[chn][1] + ns_attacks[chn][2] + ns_attacks[chn][3]) {
+            ns_uselongblock = 0;
+
+            if (ns_attacks[chn][1] && ns_attacks[chn][0]) {
+                ns_attacks[chn][1] = 0;
+            }
+            if (ns_attacks[chn][2] && ns_attacks[chn][1]) {
+                ns_attacks[chn][2] = 0;
+            }
+            if (ns_attacks[chn][3] && ns_attacks[chn][2]) {
+                ns_attacks[chn][3] = 0;
+            }
+        }
+
+        if (chn < 2) {
+            uselongblock[chn] = ns_uselongblock;
+        }
+        else {
+            if (ns_uselongblock == 0) {
+                uselongblock[0] = uselongblock[1] = 0;
+            }
+        }
+
+        /* there is a one granule delay.  Copy maskings computed last call
+         * into masking_ratio to return to calling program.
+         */
+        energy[chn] = gfc->tot_ener[chn];
+    }
+}
+
+
+static void
+vbrpsy_skip_masking_s(lame_internal_flags * gfc, int chn, int sblock)
+{
+    if (sblock == 0) {
+        int     b;
+        for (b = 0; b < gfc->npart_s; b++) {
+            gfc->nb_s2[chn][b] = gfc->nb_s1[chn][b];
+            gfc->nb_s1[chn][b] = 0;
+        }
+    }
+}
+
+
+static void
+vbrpsy_skip_masking_l(lame_internal_flags * gfc, int chn)
+{
+    int     b;
+    for (b = 0; b < gfc->npart_l; b++) {
+        gfc->nb_2[chn][b] = gfc->nb_1[chn][b];
+        gfc->nb_1[chn][b] = 0;
+    }
+}
+
+
+static void
+psyvbr_calc_mask_index_s(lame_internal_flags const *gfc, FLOAT const *max,
+                         FLOAT const *avg, unsigned char *mask_idx)
+{
+    FLOAT   m, a;
+    int     b, k;
+    int const last_tab_entry = dimension_of(tab) - 1;
+    b = 0;
+    a = avg[b] + avg[b + 1];
+    assert(a >= 0);
+    if (a > 0.0) {
+        m = max[b];
+        if (m < max[b + 1])
+            m = max[b + 1];
+        assert((gfc->numlines_s[b] + gfc->numlines_s[b + 1] - 1) > 0);
+        a = 20.0 * (m * 2.0 - a)
+            / (a * (gfc->numlines_s[b] + gfc->numlines_s[b + 1] - 1));
+        k = (int) a;
+        if (k > last_tab_entry)
+            k = last_tab_entry;
+        mask_idx[b] = k;
+    }
+    else {
+        mask_idx[b] = 0;
+    }
+
+    for (b = 1; b < gfc->npart_s - 1; b++) {
+        a = avg[b - 1] + avg[b] + avg[b + 1];
+        assert(b + 1 < gfc->npart_s);
+        assert(a >= 0);
+        if (a > 0.0) {
+            m = max[b - 1];
+            if (m < max[b])
+                m = max[b];
+            if (m < max[b + 1])
+                m = max[b + 1];
+            assert((gfc->numlines_s[b - 1] + gfc->numlines_s[b] + gfc->numlines_s[b + 1] - 1) > 0);
+            a = 20.0 * (m * 3.0 - a)
+                / (a * (gfc->numlines_s[b - 1] + gfc->numlines_s[b] + gfc->numlines_s[b + 1] - 1));
+            k = (int) a;
+            if (k > last_tab_entry)
+                k = last_tab_entry;
+            mask_idx[b] = k;
+        }
+        else {
+            mask_idx[b] = 0;
+        }
+    }
+    assert(b > 0);
+    assert(b == gfc->npart_s - 1);
+
+    a = avg[b - 1] + avg[b];
+    assert(a >= 0);
+    if (a > 0.0) {
+        m = max[b - 1];
+        if (m < max[b])
+            m = max[b];
+        assert((gfc->numlines_s[b - 1] + gfc->numlines_s[b] - 1) > 0);
+        a = 20.0 * (m * 2.0 - a)
+            / (a * (gfc->numlines_s[b - 1] + gfc->numlines_s[b] - 1));
+        k = (int) a;
+        if (k > last_tab_entry)
+            k = last_tab_entry;
+        mask_idx[b] = k;
+    }
+    else {
+        mask_idx[b] = 0;
+    }
+    assert(b == (gfc->npart_s - 1));
+}
+
+
+static void
+vbrpsy_compute_masking_s(lame_global_flags const *gfp, FLOAT(*fftenergy_s)[HBLKSIZE_s], FLOAT * eb,
+                         FLOAT * thr, int chn, int sblock)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    FLOAT   max[CBANDS], avg[CBANDS];
+    int     i, j, b;
+    unsigned char mask_idx_s[CBANDS];
+
+    for (b = j = 0; b < gfc->npart_s; ++b) {
+        FLOAT   ebb = 0, m = 0;
+        int const n = gfc->numlines_s[b];
+        for (i = 0; i < n; ++i, ++j) {
+            FLOAT const el = fftenergy_s[sblock][j];
+            ebb += el;
+            if (m < el)
+                m = el;
+        }
+        eb[b] = ebb;
+        assert(ebb >= 0);
+        max[b] = m;
+        assert(n > 0);
+        avg[b] = ebb / n;
+        assert(avg[b] >= 0);
+    }
+    assert(b == gfc->npart_s);
+    assert(j == 129);
+    for (; b < CBANDS; ++b) {
+        max[b] = 0;
+        avg[b] = 0;
+    }
+    psyvbr_calc_mask_index_s(gfc, max, avg, mask_idx_s);
+    for (j = b = 0; b < gfc->npart_s; b++) {
+        int     kk = gfc->s3ind_s[b][0];
+        int const last = gfc->s3ind_s[b][1];
+        int     dd, dd_n;
+        FLOAT   x, ecb, avg_mask;
+        dd = mask_idx_s[kk];
+        dd_n = 1;
+        ecb = gfc->s3_ss[j] * eb[kk] * tab[mask_idx_s[kk]];
+        ++j, ++kk;
+        while (kk <= last) {
+            dd += mask_idx_s[kk];
+            dd_n += 1;
+            x = gfc->s3_ss[j] * eb[kk] * tab[mask_idx_s[kk]];
+            ecb = vbrpsy_mask_add(ecb, x, kk - b);
+            ++j, ++kk;
+        }
+        dd = (1 + 2 * dd) / (2 * dd_n);
+        avg_mask = tab[dd] * 0.5;
+        ecb *= avg_mask;
+#if 0                   /* we can do PRE ECHO control now here, or do it later */
+        if (gfc->blocktype_old[chn & 0x01] == SHORT_TYPE) {
+            /* limit calculated threshold by even older granule */
+            FLOAT const t1 = rpelev_s * gfc->nb_s1[chn][b];
+            FLOAT const t2 = rpelev2_s * gfc->nb_s2[chn][b];
+            FLOAT const tm = (t2 > 0) ? Min(ecb, t2) : ecb;
+            thr[b] = (t1 > 0) ? NS_INTERP(Min(tm, t1), ecb, 0.6) : ecb;
+        }
+        else {
+            /* limit calculated threshold by older granule */
+            FLOAT const t1 = rpelev_s * gfc->nb_s1[chn][b];
+            thr[b] = (t1 > 0) ? NS_INTERP(Min(ecb, t1), ecb, 0.6) : ecb;
+        }
+#else /* we do it later */
+        thr[b] = ecb;
+#endif
+        gfc->nb_s2[chn][b] = gfc->nb_s1[chn][b];
+        gfc->nb_s1[chn][b] = ecb;
+        {
+            /*  if THR exceeds EB, the quantization routines will take the difference
+             *  from other bands. in case of strong tonal samples (tonaltest.wav)
+             *  this leads to heavy distortions. that's why we limit THR here.
+             */
+            x = max[b];
+            x *= gfc->minval_s[b];
+            x *= avg_mask;
+            if (thr[b] > x) {
+                thr[b] = x;
+            }
+        }
+        if (gfc->masking_lower > 1) {
+            thr[b] *= gfc->masking_lower;
+        }
+        if (thr[b] > eb[b]) {
+            thr[b] = eb[b];
+        }
+        if (gfc->masking_lower < 1) {
+            thr[b] *= gfc->masking_lower;
+        }
+
+        assert(thr[b] >= 0);
+    }
+    for (; b < CBANDS; ++b) {
+        eb[b] = 0;
+        thr[b] = 0;
+    }
+}
+
+
+static void
+vbrpsy_compute_masking_l(lame_internal_flags * gfc, FLOAT fftenergy[HBLKSIZE], FLOAT eb_l[CBANDS],
+                         FLOAT thr[CBANDS], int chn)
+{
+    FLOAT   max[CBANDS], avg[CBANDS];
+    unsigned char mask_idx_l[CBANDS + 2];
+    int     k, b;
+
+ /*********************************************************************
+    *    Calculate the energy and the tonality of each partition.
+ *********************************************************************/
+    calc_energy(gfc, fftenergy, eb_l, max, avg);
+    calc_mask_index_l(gfc, max, avg, mask_idx_l);
+
+ /*********************************************************************
+    *      convolve the partitioned energy and unpredictability
+    *      with the spreading function, s3_l[b][k]
+ ********************************************************************/
+    k = 0;
+    for (b = 0; b < gfc->npart_l; b++) {
+        FLOAT   x, ecb, avg_mask, t;
+        /* convolve the partitioned energy with the spreading function */
+        int     kk = gfc->s3ind[b][0];
+        int const last = gfc->s3ind[b][1];
+        int     dd = 0, dd_n = 0;
+        dd = mask_idx_l[kk];
+        dd_n += 1;
+        ecb = gfc->s3_ll[k] * eb_l[kk] * tab[mask_idx_l[kk]];
+        ++k, ++kk;
+        while (kk <= last) {
+            dd += mask_idx_l[kk];
+            dd_n += 1;
+            x = gfc->s3_ll[k] * eb_l[kk] * tab[mask_idx_l[kk]];
+            t = vbrpsy_mask_add(ecb, x, kk - b);
+#if 0
+            ecb += eb_l[kk];
+            if (ecb > t) {
+                ecb = t;
+            }
+#else
+            ecb = t;
+#endif
+            ++k, ++kk;
+        }
+        dd = (1 + 2 * dd) / (2 * dd_n);
+        avg_mask = tab[dd] * 0.5;
+        ecb *= avg_mask;
+
+        /****   long block pre-echo control   ****/
+        /* dont use long block pre-echo control if previous granule was 
+         * a short block.  This is to avoid the situation:   
+         * frame0:  quiet (very low masking)  
+         * frame1:  surge  (triggers short blocks)
+         * frame2:  regular frame.  looks like pre-echo when compared to 
+         *          frame0, but all pre-echo was in frame1.
+         */
+        /* chn=0,1   L and R channels
+           chn=2,3   S and M channels.
+         */
+        if (gfc->blocktype_old[chn & 0x01] == SHORT_TYPE) {
+            FLOAT const ecb_limit = rpelev * gfc->nb_1[chn][b];
+            if (ecb_limit > 0) {
+                thr[b] = Min(ecb, ecb_limit);
+            }
+            else {
+                /* Robert 071209:
+                   Because we don't calculate long block psy when we know a granule
+                   should be of short blocks, we don't have any clue how the granule
+                   before would have looked like as a long block. So we have to guess
+                   a little bit for this END_TYPE block.
+                   Most of the time we get away with this sloppyness. (fingers crossed :)
+                   The speed increase is worth it.
+                 */
+                thr[b] = Min(ecb, eb_l[b] * NS_PREECHO_ATT2);
+            }
+        }
+        else {
+            FLOAT   ecb_limit_2 = rpelev2 * gfc->nb_2[chn][b];
+            FLOAT   ecb_limit_1 = rpelev * gfc->nb_1[chn][b];
+            FLOAT   ecb_limit;
+            if (ecb_limit_2 <= 0) {
+                ecb_limit_2 = ecb;
+            }
+            if (ecb_limit_1 <= 0) {
+                ecb_limit_1 = ecb;
+            }
+            if (gfc->blocktype_old[chn & 0x01] == NORM_TYPE) {
+                ecb_limit = Min(ecb_limit_1, ecb_limit_2);
+            }
+            else {
+                ecb_limit = ecb_limit_1;
+            }
+            thr[b] = Min(ecb, ecb_limit);
+        }
+        gfc->nb_2[chn][b] = gfc->nb_1[chn][b];
+        gfc->nb_1[chn][b] = ecb;
+        {
+            /*  if THR exceeds EB, the quantization routines will take the difference
+             *  from other bands. in case of strong tonal samples (tonaltest.wav)
+             *  this leads to heavy distortions. that's why we limit THR here.
+             */
+            x = max[b];
+            x *= gfc->minval_l[b];
+            x *= avg_mask;
+            if (thr[b] > x) {
+                thr[b] = x;
+            }
+        }
+        if (gfc->masking_lower > 1) {
+            thr[b] *= gfc->masking_lower;
+        }
+        if (thr[b] > eb_l[b]) {
+            thr[b] = eb_l[b];
+        }
+        if (gfc->masking_lower < 1) {
+            thr[b] *= gfc->masking_lower;
+        }
+        assert(thr[b] >= 0);
+    }
+    for (; b < CBANDS; ++b) {
+        eb_l[b] = 0;
+        thr[b] = 0;
+    }
+}
+
+
+static void
+vbrpsy_compute_block_type(lame_global_flags const *gfp, int *uselongblock)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     chn;
+
+    if (gfp->short_blocks == short_block_coupled
+        /* force both channels to use the same block type */
+        /* this is necessary if the frame is to be encoded in ms_stereo.  */
+        /* But even without ms_stereo, FhG  does this */
+        && !(uselongblock[0] && uselongblock[1]))
+        uselongblock[0] = uselongblock[1] = 0;
+
+    for (chn = 0; chn < gfc->channels_out; chn++) {
+        /* disable short blocks */
+        if (gfp->short_blocks == short_block_dispensed) {
+            uselongblock[chn] = 1;
+        }
+        if (gfp->short_blocks == short_block_forced) {
+            uselongblock[chn] = 0;
+        }
+    }
+}
+
+
+static void
+vbrpsy_apply_block_type(lame_global_flags const *gfp, int const *uselongblock, int *blocktype_d)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     chn;
+
+    /* update the blocktype of the previous granule, since it depends on what
+     * happend in this granule */
+    for (chn = 0; chn < gfc->channels_out; chn++) {
+        int     blocktype = NORM_TYPE;
+        /* disable short blocks */
+
+        if (uselongblock[chn]) {
+            /* no attack : use long blocks */
+            assert(gfc->blocktype_old[chn] != START_TYPE);
+            if (gfc->blocktype_old[chn] == SHORT_TYPE)
+                blocktype = STOP_TYPE;
+        }
+        else {
+            /* attack : use short blocks */
+            blocktype = SHORT_TYPE;
+            if (gfc->blocktype_old[chn] == NORM_TYPE) {
+                gfc->blocktype_old[chn] = START_TYPE;
+            }
+            if (gfc->blocktype_old[chn] == STOP_TYPE)
+                gfc->blocktype_old[chn] = SHORT_TYPE;
+        }
+
+        blocktype_d[chn] = gfc->blocktype_old[chn]; /* value returned to calling program */
+        gfc->blocktype_old[chn] = blocktype; /* save for next call to l3psy_anal */
+    }
+}
+
+
+/*************************************************************** 
+ * compute M/S thresholds from Johnston & Ferreira 1992 ICASSP paper
+ ***************************************************************/
+
+static void
+vbrpsy_compute_MS_thresholds(FLOAT eb[4][CBANDS], FLOAT thr[4][CBANDS], FLOAT cb_mld[CBANDS],
+                             FLOAT ath_cb[CBANDS], FLOAT athadjust, FLOAT msfix, int n)
+{
+    FLOAT const msfix2 = msfix * 2;
+    FLOAT const athlower = msfix > 0 ? pow(10, athadjust) : 1;
+    FLOAT   rside, rmid;
+    int     b;
+    for (b = 0; b < n; ++b) {
+        FLOAT const ebM = eb[2][b];
+        FLOAT const ebS = eb[3][b];
+        FLOAT const thmL = thr[0][b];
+        FLOAT const thmR = thr[1][b];
+        FLOAT   thmM = thr[2][b];
+        FLOAT   thmS = thr[3][b];
+
+        /* use this fix if L & R masking differs by 2db or less */
+        /* if db = 10*log10(x2/x1) < 2 */
+        /* if (x2 < 1.58*x1) { */
+        if (thmL <= 1.58 * thmR && thmR <= 1.58 * thmL) {
+            FLOAT const mld_m = cb_mld[b] * ebS;
+            FLOAT const mld_s = cb_mld[b] * ebM;
+            rmid = Max(thmM, Min(thmS, mld_m));
+            rside = Max(thmS, Min(thmM, mld_s));
+        }
+        else {
+            rmid = thmM;
+            rside = thmS;
+        }
+        if (msfix > 0) {
+            /***************************************************************/
+            /* Adjust M/S maskings if user set "msfix"                     */
+            /***************************************************************/
+            /* Naoki Shibata 2000 */
+            FLOAT   thmLR, thmMS;
+            FLOAT const ath = ath_cb[b] * athlower;
+            thmLR = Min(Max(thmL, ath), Max(thmR, ath));
+            thmM = Max(rmid, ath);
+            thmS = Max(rside, ath);
+            thmMS = thmM + thmS;
+            if (thmMS > 0 && (thmLR * msfix2) < thmMS) {
+                FLOAT const f = thmLR * msfix2 / thmMS;
+                thmM *= f;
+                thmS *= f;
+                assert(thmMS > 0);
+            }
+            rmid = Min(thmM, rmid);
+            rside = Min(thmS, rside);
+        }
+        if (rmid > ebM) {
+            rmid = ebM;
+        }
+        if (rside > ebS) {
+            rside = ebS;
+        }
+        thr[2][b] = rmid;
+        thr[3][b] = rside;
+    }
+}
+
+
+
+/*
+ * NOTE: the bitrate reduction from the inter-channel masking effect is low
+ * compared to the chance of getting annyoing artefacts. L3psycho_anal_vbr does
+ * not use this feature. (Robert 071216)
+*/
+
+int
+L3psycho_anal_vbr(lame_global_flags const *gfp,
+                  const sample_t * buffer[2], int gr_out,
+                  III_psy_ratio masking_ratio[2][2],
+                  III_psy_ratio masking_MS_ratio[2][2],
+                  FLOAT percep_entropy[2], FLOAT percep_MS_entropy[2],
+                  FLOAT energy[4], int blocktype_d[2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    /* fft and energy calculation   */
+    FLOAT(*wsamp_l)[BLKSIZE];
+    FLOAT(*wsamp_s)[3][BLKSIZE_s];
+    FLOAT   fftenergy[HBLKSIZE];
+    FLOAT   fftenergy_s[3][HBLKSIZE_s];
+    FLOAT   wsamp_L[2][BLKSIZE];
+    FLOAT   wsamp_S[2][3][BLKSIZE_s];
+    FLOAT   eb[4][CBANDS], thr[4][CBANDS];
+
+    FLOAT   sub_short_factor[4][3];
+    FLOAT   thmm;
+    FLOAT   pcfact = 0.6f;
+
+    /* block type  */
+    int     ns_attacks[4][4] = { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} };
+    int     uselongblock[2];
+
+    /* usual variables like loop indices, etc..    */
+    int     chn, sb, sblock;
+
+    /* chn=2 and 3 = Mid and Side channels */
+    int const n_chn_psy = (gfp->mode == JOINT_STEREO) ? 4 : gfc->channels_out;
+
+    vbrpsy_attack_detection(gfp, buffer, gr_out, masking_ratio, masking_MS_ratio, energy,
+                            sub_short_factor, ns_attacks, uselongblock);
+
+    vbrpsy_compute_block_type(gfp, uselongblock);
+
+    /* LONG BLOCK CASE */
+    {
+        for (chn = 0; chn < n_chn_psy; chn++) {
+            int const ch01 = chn & 0x01;
+
+            wsamp_l = wsamp_L + ch01;
+            vbrpsy_compute_fft_l(gfp, buffer, chn, gr_out, fftenergy, wsamp_l);
+            vbrpsy_compute_loudness_approximation_l(gfp, gr_out, chn, fftenergy);
+
+            if (uselongblock[ch01]) {
+                vbrpsy_compute_masking_l(gfc, fftenergy, eb[chn], thr[chn], chn);
+            }
+            else {
+                vbrpsy_skip_masking_l(gfc, chn);
+            }
+        }
+        if ((uselongblock[0] + uselongblock[1]) == 2) {
+            /* M/S channel */
+            if (gfp->mode == JOINT_STEREO) {
+                vbrpsy_compute_MS_thresholds(eb, thr, gfc->mld_cb_l, gfc->ATH->cb_l,
+                                             gfp->ATHlower * gfc->ATH->adjust, gfp->msfix,
+                                             gfc->npart_l);
+            }
+            /* L/R channel */
+#if 0
+            if (gfp->mode == STEREO || gfp->mode == JOINT_STEREO) {
+            }
+#endif
+        }
+        /* TODO: apply adaptive ATH masking here ?? */
+        for (chn = 0; chn < n_chn_psy; chn++) {
+            int const ch01 = chn & 0x01;
+            if (uselongblock[ch01]) {
+                convert_partition2scalefac_l(gfc, eb[chn], thr[chn], chn);
+            }
+        }
+    }
+
+    /* SHORT BLOCKS CASE */
+    {
+        for (sblock = 0; sblock < 3; sblock++) {
+            for (chn = 0; chn < n_chn_psy; ++chn) {
+                int const ch01 = chn & 0x01;
+
+                if (uselongblock[ch01]) {
+                    vbrpsy_skip_masking_s(gfc, chn, sblock);
+                }
+                else {
+                    /* compute masking thresholds for short blocks */
+                    wsamp_s = wsamp_S + ch01;
+                    vbrpsy_compute_fft_s(gfp, buffer, chn, sblock, fftenergy_s, wsamp_s);
+                    vbrpsy_compute_masking_s(gfp, fftenergy_s, eb[chn], thr[chn], chn, sblock);
+                }
+            }
+            if ((uselongblock[0] + uselongblock[1]) == 0) {
+                /* M/S channel */
+                if (gfp->mode == JOINT_STEREO) {
+                    vbrpsy_compute_MS_thresholds(eb, thr, gfc->mld_cb_s, gfc->ATH->cb_s,
+                                                 gfp->ATHlower * gfc->ATH->adjust, gfp->msfix,
+                                                 gfc->npart_s);
+                }
+                /* L/R channel */
+#if 0
+                if (gfp->mode == STEREO || gfp->mode == JOINT_STEREO) {
+                }
+#endif
+            }
+            /* TODO: apply adaptive ATH masking here ?? */
+            for (chn = 0; chn < n_chn_psy; ++chn) {
+                int const ch01 = chn & 0x01;
+                if (!uselongblock[ch01]) {
+                    convert_partition2scalefac_s(gfc, eb[chn], thr[chn], chn, sblock);
+                }
+            }
+        }
+
+        /****   short block pre-echo control   ****/
+        for (chn = 0; chn < n_chn_psy; chn++) {
+            int const ch01 = chn & 0x01;
+
+            if (uselongblock[ch01]) {
+                continue;
+            }
+            for (sb = 0; sb < SBMAX_s; sb++) {
+                FLOAT   new_thmm[3];
+                for (sblock = 0; sblock < 3; sblock++) {
+                    thmm = gfc->thm[chn].s[sb][sblock];
+                    thmm *= NS_PREECHO_ATT0;
+
+                    if (ns_attacks[chn][sblock] >= 2 || ns_attacks[chn][sblock + 1] == 1) {
+                        int const idx = (sblock != 0) ? sblock - 1 : 2;
+                        double const p = NS_INTERP(gfc->thm[chn].s[sb][idx],
+                                                   thmm, NS_PREECHO_ATT1 * pcfact);
+                        thmm = Min(thmm, p);
+                    }
+                    else if (ns_attacks[chn][sblock] == 1) {
+                        int const idx = (sblock != 0) ? sblock - 1 : 2;
+                        double const p = NS_INTERP(gfc->thm[chn].s[sb][idx],
+                                                   thmm, NS_PREECHO_ATT2 * pcfact);
+                        thmm = Min(thmm, p);
+                    }
+                    else if ((sblock != 0 && ns_attacks[chn][sblock - 1] == 3)
+                             || (sblock == 0 && gfc->nsPsy.last_attacks[chn] == 3)) {
+                        int const idx = (sblock != 2) ? sblock + 1 : 0;
+                        double const p = NS_INTERP(gfc->thm[chn].s[sb][idx],
+                                                   thmm, NS_PREECHO_ATT2 * pcfact);
+                        thmm = Min(thmm, p);
+                    }
+
+                    /* pulse like signal detection for fatboy.wav and so on */
+                    thmm *= sub_short_factor[chn][sblock];
+
+                    new_thmm[sblock] = thmm;
+                }
+                for (sblock = 0; sblock < 3; sblock++) {
+                    gfc->thm[chn].s[sb][sblock] = new_thmm[sblock];
+                }
+            }
+        }
+    }
+    for (chn = 0; chn < n_chn_psy; chn++) {
+        gfc->nsPsy.last_attacks[chn] = ns_attacks[chn][2];
+    }
+
+
+    /*************************************************************** 
+    * determine final block type
+    ***************************************************************/
+    vbrpsy_apply_block_type(gfp, uselongblock, blocktype_d);
+
+    /*********************************************************************
+    * compute the value of PE to return ... no delay and advance
+    *********************************************************************/
+    for (chn = 0; chn < n_chn_psy; chn++) {
+        FLOAT  *ppe;
+        int     type;
+        III_psy_ratio const *mr;
+
+        if (chn > 1) {
+            ppe = percep_MS_entropy - 2;
+            type = NORM_TYPE;
+            if (blocktype_d[0] == SHORT_TYPE || blocktype_d[1] == SHORT_TYPE)
+                type = SHORT_TYPE;
+            mr = &masking_MS_ratio[gr_out][chn - 2];
+        }
+        else {
+            ppe = percep_entropy;
+            type = blocktype_d[chn];
+            mr = &masking_ratio[gr_out][chn];
+        }
+
+        if (type == SHORT_TYPE) {
+            ppe[chn] = pecalc_s(mr, gfc->masking_lower);
+        }
+        else {
+            ppe[chn] = pecalc_l(mr, gfc->masking_lower);
+        }
+
+        if (gfp->analysis) {
+            gfc->pinfo->pe[gr_out][chn] = ppe[chn];
+        }
+    }
+    return 0;
+}
+
+
+
+
+
+static  FLOAT
+s3_func_x(FLOAT bark, FLOAT hf_slope)
+{
+    FLOAT   tempx = bark, tempy;
+
+    if (tempx >= 0) {
+        tempy = -tempx * 27;
+    }
+    else {
+        tempy = tempx * hf_slope;
+    }
+    if (tempy <= -72.0) {
+        return 0;
+    }
+    return exp(tempy * LN_TO_LOG10);
+}
+
+static  FLOAT
+norm_s3_func_x(FLOAT hf_slope)
+{
+    double  lim_a = 0, lim_b = 0;
+    {
+        double  x = 0, l, h;
+        for (x = 0; s3_func_x(x, hf_slope) > 1e-20; x -= 1);
+        l = x;
+        h = 0;
+        while (fabs(h - l) > 1e-12) {
+            x = (h + l) / 2;
+            if (s3_func_x(x, hf_slope) > 0) {
+                h = x;
+            }
+            else {
+                l = x;
+            }
+        }
+        lim_a = l;
+    }
+    {
+        double  x = 0, l, h;
+        for (x = 0; s3_func_x(x, hf_slope) > 1e-20; x += 1);
+        l = 0;
+        h = x;
+        while (fabs(h - l) > 1e-12) {
+            x = (h + l) / 2;
+            if (s3_func_x(x, hf_slope) > 0) {
+                l = x;
+            }
+            else {
+                h = x;
+            }
+        }
+        lim_b = h;
+    }
+    {
+        double  sum = 0;
+        int const m = 1000;
+        int     i;
+        for (i = 0; i <= m; ++i) {
+            double  x = lim_a + i * (lim_b - lim_a) / m;
+            double  y = s3_func_x(x, hf_slope);
+            sum += y;
+        }
+        {
+            double  norm = (m + 1) / (sum * (lim_b - lim_a));
+            /*printf( "norm = %lf\n",norm); */
+            return norm;
+        }
+    }
+}
+
+
+
+/* 
+ *   The spreading function.  Values returned in units of energy
+ */
+static  FLOAT
+s3_func(FLOAT bark)
+{
+    FLOAT   tempx, x, tempy, temp;
+    tempx = bark;
+    if (tempx >= 0)
+        tempx *= 3;
+    else
+        tempx *= 1.5;
+
+    if (tempx >= 0.5 && tempx <= 2.5) {
+        temp = tempx - 0.5;
+        x = 8.0 * (temp * temp - 2.0 * temp);
+    }
+    else
+        x = 0.0;
+    tempx += 0.474;
+    tempy = 15.811389 + 7.5 * tempx - 17.5 * sqrt(1.0 + tempx * tempx);
+
+    if (tempy <= -60.0)
+        return 0.0;
+
+    tempx = exp((x + tempy) * LN_TO_LOG10);
+
+    /* Normalization.  The spreading function should be normalized so that:
+       +inf
+       /
+       |  s3 [ bark ]  d(bark)   =  1
+       /
+       -inf
+     */
+    tempx /= .6609193;
+    return tempx;
+}
+
+#if 0
+static  FLOAT
+norm_s3_func(void)
+{
+    double  lim_a = 0, lim_b = 0;
+    double  x = 0, l, h;
+    for (x = 0; s3_func(x) > 1e-20; x -= 1);
+    l = x;
+    h = 0;
+    while (fabs(h - l) > 1e-12) {
+        x = (h + l) / 2;
+        if (s3_func(x) > 0) {
+            h = x;
+        }
+        else {
+            l = x;
+        }
+    }
+    lim_a = l;
+    for (x = 0; s3_func(x) > 1e-20; x += 1);
+    l = 0;
+    h = x;
+    while (fabs(h - l) > 1e-12) {
+        x = (h + l) / 2;
+        if (s3_func(x) > 0) {
+            l = x;
+        }
+        else {
+            h = x;
+        }
+    }
+    lim_b = h;
+    {
+        double  sum = 0;
+        int const m = 1000;
+        int     i;
+        for (i = 0; i <= m; ++i) {
+            double  x = lim_a + i * (lim_b - lim_a) / m;
+            double  y = s3_func(x);
+            sum += y;
+        }
+        {
+            double  norm = (m + 1) / (sum * (lim_b - lim_a));
+            /*printf( "norm = %lf\n",norm); */
+            return norm;
+        }
+    }
+}
+#endif
+
+static int
+init_numline(int *numlines, int *bo, int *bm,
+             FLOAT * bval, FLOAT * bval_width, FLOAT * mld, FLOAT * bo_w,
+             FLOAT sfreq, int blksize, int const *scalepos, FLOAT deltafreq, int sbmax)
+{
+    FLOAT   b_frq[CBANDS + 1];
+    FLOAT   f_tmp;
+    FLOAT   sample_freq_frac = sfreq / (sbmax > 15 ? 2 * 576 : 2 * 192);
+    int     partition[HBLKSIZE] = { 0 };
+    int     i, j, k, ni;
+    int     sfb;
+    sfreq /= blksize;
+    j = 0;
+    ni = 0;
+    /* compute numlines, the number of spectral lines in each partition band */
+    /* each partition band should be about DELBARK wide. */
+    for (i = 0; i < CBANDS; i++) {
+        FLOAT   bark1;
+        int     j2;
+        bark1 = freq2bark(sfreq * j);
+
+        b_frq[i] = sfreq * j;
+
+        for (j2 = j; freq2bark(sfreq * j2) - bark1 < DELBARK && j2 <= blksize / 2; j2++);
+
+        numlines[i] = j2 - j;
+        ni = i + 1;
+
+        while (j < j2) {
+            assert(j < HBLKSIZE);
+            partition[j++] = i;
+        }
+        if (j > blksize / 2) {
+            j = blksize / 2;
+            ++i;
+            break;
+        }
+    }
+    assert(i < CBANDS);
+    b_frq[i] = sfreq * j;
+
+    for (sfb = 0; sfb < sbmax; sfb++) {
+        int     i1, i2, start, end;
+        FLOAT   arg;
+        start = scalepos[sfb];
+        end = scalepos[sfb + 1];
+
+        i1 = floor(.5 + deltafreq * (start - .5));
+        if (i1 < 0)
+            i1 = 0;
+        i2 = floor(.5 + deltafreq * (end - .5));
+
+        if (i2 > blksize / 2)
+            i2 = blksize / 2;
+
+        bm[sfb] = (partition[i1] + partition[i2]) / 2;
+        bo[sfb] = partition[i2];
+
+        f_tmp = sample_freq_frac * end;
+        /* calculate how much of this band belongs to current scalefactor band */
+        bo_w[sfb] = (f_tmp - b_frq[bo[sfb]]) / (b_frq[bo[sfb] + 1] - b_frq[bo[sfb]]);
+        if (bo_w[sfb] < 0) {
+            bo_w[sfb] = 0;
+        }
+        else {
+            if (bo_w[sfb] > 1) {
+                bo_w[sfb] = 1;
+            }
+        }
+        /* setup stereo demasking thresholds */
+        /* formula reverse enginerred from plot in paper */
+        arg = freq2bark(sfreq * scalepos[sfb] * deltafreq);
+        arg = (Min(arg, 15.5) / 15.5);
+
+        mld[sfb] = pow(10.0, 1.25 * (1 - cos(PI * arg)) - 2.5);
+    }
+
+    /* compute bark values of each critical band */
+    j = 0;
+    for (k = 0; k < ni; k++) {
+        int const w = numlines[k];
+        FLOAT   bark1, bark2;
+
+        bark1 = freq2bark(sfreq * (j));
+        bark2 = freq2bark(sfreq * (j + w - 1));
+        bval[k] = .5 * (bark1 + bark2);
+
+        bark1 = freq2bark(sfreq * (j - .5));
+        bark2 = freq2bark(sfreq * (j + w - .5));
+        bval_width[k] = bark2 - bark1;
+        j += w;
+    }
+
+    return ni;
+}
+
+static int
+init_s3_values(FLOAT ** p,
+               int (*s3ind)[2], int npart, FLOAT const *bval, FLOAT const *bval_width,
+               FLOAT const *norm, int use_old_s3)
+{
+    FLOAT   s3[CBANDS][CBANDS];
+    /* The s3 array is not linear in the bark scale.
+     * bval[x] should be used to get the bark value.
+     */
+    int     i, j, k;
+    int     numberOfNoneZero = 0;
+
+    /* s[i][j], the value of the spreading function,
+     * centered at band j (masker), for band i (maskee)
+     *
+     * i.e.: sum over j to spread into signal barkval=i
+     * NOTE: i and j are used opposite as in the ISO docs
+     */
+    if (use_old_s3) {
+        for (i = 0; i < npart; i++) {
+            for (j = 0; j < npart; j++) {
+                FLOAT   v = s3_func(bval[i] - bval[j]) * bval_width[j];
+                s3[i][j] = v * norm[i];
+            }
+        }
+    }
+    else {
+        for (j = 0; j < npart; j++) {
+            FLOAT   hf_slope = 15 + Min(21 / bval[j], 12);
+            FLOAT   s3_x_norm = norm_s3_func_x(hf_slope);
+            for (i = 0; i < npart; i++) {
+                FLOAT   v = s3_x_norm * s3_func_x(bval[i] - bval[j], hf_slope) * bval_width[j];
+                s3[i][j] = v * norm[i];
+            }
+        }
+    }
+    for (i = 0; i < npart; i++) {
+        for (j = 0; j < npart; j++) {
+            if (s3[i][j] > 0.0f)
+                break;
+        }
+        s3ind[i][0] = j;
+
+        for (j = npart - 1; j > 0; j--) {
+            if (s3[i][j] > 0.0f)
+                break;
+        }
+        s3ind[i][1] = j;
+        numberOfNoneZero += (s3ind[i][1] - s3ind[i][0] + 1);
+    }
+    *p = malloc(sizeof(FLOAT) * numberOfNoneZero);
+    if (!*p)
+        return -1;
+
+    k = 0;
+    for (i = 0; i < npart; i++)
+        for (j = s3ind[i][0]; j <= s3ind[i][1]; j++)
+            (*p)[k++] = s3[i][j];
+
+    return 0;
+}
+
+static  FLOAT
+stereo_demask(double f)
+{
+    /* setup stereo demasking thresholds */
+    /* formula reverse enginerred from plot in paper */
+    double  arg = freq2bark(f);
+    arg = (Min(arg, 15.5) / 15.5);
+
+    return pow(10.0, 1.25 * (1 - cos(PI * arg)) - 2.5);
+}
+
+int
+psymodel_init(lame_global_flags * gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     i, j, b, sb, k;
+    int     use_old_s3 = 1;
+    FLOAT   bvl_a = 13, bvl_b = 24;
+    FLOAT   snr_l_a = 0, snr_l_b = 0;
+    FLOAT   snr_s_a = -8.25, snr_s_b = -4.5;
+
+    FLOAT   bval[CBANDS];
+    FLOAT   bval_width[CBANDS];
+    FLOAT   norm[CBANDS];
+    FLOAT const sfreq = gfp->out_samplerate;
+
+    switch (gfp->experimentalZ) {
+    default:
+    case 0:
+        use_old_s3 = 1;
+        break;
+    case 1:
+        use_old_s3 = (gfp->VBR == vbr_mtrh || gfp->VBR == vbr_mt) ? 0 : 1;
+        break;
+    case 2:
+        use_old_s3 = 0;
+        break;
+    case 3:
+        bvl_a = 8;
+        snr_l_a = -1.75;
+        snr_l_b = -0.0125;
+        snr_s_a = -8.25;
+        snr_s_b = -2.25;
+        break;
+    }
+    gfc->ms_ener_ratio_old = .25;
+    gfc->blocktype_old[0] = gfc->blocktype_old[1] = NORM_TYPE; /* the vbr header is long blocks */
+
+    for (i = 0; i < 4; ++i) {
+        for (j = 0; j < CBANDS; ++j) {
+            gfc->nb_1[i][j] = 1e20;
+            gfc->nb_2[i][j] = 1e20;
+            gfc->nb_s1[i][j] = gfc->nb_s2[i][j] = 1.0;
+        }
+        for (sb = 0; sb < SBMAX_l; sb++) {
+            gfc->en[i].l[sb] = 1e20;
+            gfc->thm[i].l[sb] = 1e20;
+        }
+        for (j = 0; j < 3; ++j) {
+            for (sb = 0; sb < SBMAX_s; sb++) {
+                gfc->en[i].s[sb][j] = 1e20;
+                gfc->thm[i].s[sb][j] = 1e20;
+            }
+            gfc->nsPsy.last_attacks[i] = 0;
+        }
+        for (j = 0; j < 9; j++)
+            gfc->nsPsy.last_en_subshort[i][j] = 10.;
+    }
+
+
+    /* init. for loudness approx. -jd 2001 mar 27 */
+    gfc->loudness_sq_save[0] = gfc->loudness_sq_save[1] = 0.0;
+
+
+
+    /*************************************************************************
+     * now compute the psychoacoustic model specific constants
+     ************************************************************************/
+    /* compute numlines, bo, bm, bval, bval_width, mld */
+    gfc->npart_l
+        = init_numline(gfc->numlines_l, gfc->bo_l, gfc->bm_l,
+                       bval, bval_width, gfc->mld_l, gfc->PSY->bo_l_weight,
+                       sfreq, BLKSIZE, gfc->scalefac_band.l, BLKSIZE / (2.0 * 576), SBMAX_l);
+    assert(gfc->npart_l < CBANDS);
+    /* compute the spreading function */
+    for (i = 0; i < gfc->npart_l; i++) {
+        double  snr = snr_l_a;
+        if (bval[i] >= bvl_a) {
+            snr = snr_l_b * (bval[i] - bvl_a) / (bvl_b - bvl_a)
+                + snr_l_a * (bvl_b - bval[i]) / (bvl_b - bvl_a);
+        }
+        norm[i] = pow(10.0, snr / 10.0);
+        if (gfc->numlines_l[i] > 0) {
+            gfc->rnumlines_l[i] = 1.0 / gfc->numlines_l[i];
+        }
+        else {
+            gfc->rnumlines_l[i] = 0;
+        }
+    }
+    i = init_s3_values(&gfc->s3_ll, gfc->s3ind, gfc->npart_l, bval, bval_width, norm, use_old_s3);
+    if (i)
+        return i;
+
+    /* compute long block specific values, ATH and MINVAL */
+    j = 0;
+    for (i = 0; i < gfc->npart_l; i++) {
+        double  x;
+
+        /* ATH */
+        x = FLOAT_MAX;
+        for (k = 0; k < gfc->numlines_l[i]; k++, j++) {
+            FLOAT const freq = sfreq * j / (1000.0 * BLKSIZE);
+            FLOAT   level;
+            /* freq = Min(.1,freq); */ /* ATH below 100 Hz constant, not further climbing */
+            level = ATHformula(freq * 1000, gfp) - 20; /* scale to FFT units; returned value is in dB */
+            level = pow(10., 0.1 * level); /* convert from dB -> energy */
+            level *= gfc->numlines_l[i];
+            if (x > level)
+                x = level;
+        }
+        gfc->ATH->cb_l[i] = x;
+
+        /* MINVAL.
+           For low freq, the strength of the masking is limited by minval
+           this is an ISO MPEG1 thing, dont know if it is really needed */
+        /* FIXME: it does work to reduce low-freq problems in S53-Wind-Sax
+           and lead-voice samples, but introduces some 3 kbps bit bloat too.
+           TODO: Further refinement of the shape of this hack.
+        */
+        x = -20 + bval[i] * 20 / 10;
+        if (x > 6) {
+            x = 100;
+        }
+        if (x < -15) {
+            x = -15;
+        }
+        x -= 8.;
+        gfc->minval_l[i] = pow(10.0, x / 10.) * gfc->numlines_l[i];
+    }
+
+    /************************************************************************
+     * do the same things for short blocks
+     ************************************************************************/
+    gfc->npart_s
+        = init_numline(gfc->numlines_s, gfc->bo_s, gfc->bm_s,
+                       bval, bval_width, gfc->mld_s, gfc->PSY->bo_s_weight,
+                       sfreq, BLKSIZE_s, gfc->scalefac_band.s, BLKSIZE_s / (2.0 * 192), SBMAX_s);
+    assert(gfc->npart_s < CBANDS);
+
+    /* SNR formula. short block is normalized by SNR. is it still right ? */
+    j = 0;
+    for (i = 0; i < gfc->npart_s; i++) {
+        double  x;
+        double  snr = snr_s_a;
+        if (bval[i] >= bvl_a) {
+            snr = snr_s_b * (bval[i] - bvl_a) / (bvl_b - bvl_a)
+                + snr_s_a * (bvl_b - bval[i]) / (bvl_b - bvl_a);
+        }
+        norm[i] = pow(10.0, snr / 10.0);
+
+        /* ATH */
+        x = FLOAT_MAX;
+        for (k = 0; k < gfc->numlines_s[i]; k++, j++) {
+            FLOAT const freq = sfreq * j / (1000.0 * BLKSIZE_s);
+            FLOAT   level;
+            /* freq = Min(.1,freq); */ /* ATH below 100 Hz constant, not further climbing */
+            level = ATHformula(freq * 1000, gfp) - 20; /* scale to FFT units; returned value is in dB */
+            level = pow(10., 0.1 * level); /* convert from dB -> energy */
+            level *= gfc->numlines_s[i];
+            if (x > level)
+                x = level;
+        }
+        gfc->ATH->cb_s[i] = x;
+
+        /* MINVAL.
+           For low freq, the strength of the masking is limited by minval
+           this is an ISO MPEG1 thing, dont know if it is really needed */
+        x = (-7.0 + bval[i] * 7.0 / 12.0);
+        if (bval[i] > 12) {
+            x *= 1+log(1+x)*3.1;
+        }
+        if (bval[i] < 12) {
+            x *= 1+log(1-x)*2.3;
+        }
+        if (x < -15) {
+            x = -15;
+        }
+        x -= 8;
+        gfc->minval_s[i] = pow(10.0, x / 10) * gfc->numlines_s[i];
+    }
+
+    i = init_s3_values(&gfc->s3_ss, gfc->s3ind_s, gfc->npart_s, bval, bval_width, norm, use_old_s3);
+    if (i)
+        return i;
+
+
+    init_mask_add_max_values();
+    init_fft(gfc);
+
+    /* setup temporal masking */
+    gfc->decay = exp(-1.0 * LOG10 / (temporalmask_sustain_sec * sfreq / 192.0));
+
+    {
+        FLOAT   msfix;
+        msfix = NS_MSFIX;
+        if (gfp->exp_nspsytune & 2)
+            msfix = 1.0;
+        if (fabs(gfp->msfix) > 0.0)
+            msfix = gfp->msfix;
+        gfp->msfix = msfix;
+
+        /* spread only from npart_l bands.  Normally, we use the spreading
+         * function to convolve from npart_l down to npart_l bands 
+         */
+        for (b = 0; b < gfc->npart_l; b++)
+            if (gfc->s3ind[b][1] > gfc->npart_l - 1)
+                gfc->s3ind[b][1] = gfc->npart_l - 1;
+    }
+
+    /*  prepare for ATH auto adjustment:
+     *  we want to decrease the ATH by 12 dB per second
+     */
+#define  frame_duration (576. * gfc->mode_gr / sfreq)
+    gfc->ATH->decay = pow(10., -12. / 10. * frame_duration);
+    gfc->ATH->adjust = 0.01; /* minimum, for leading low loudness */
+    gfc->ATH->adjust_limit = 1.0; /* on lead, allow adjust up to maximum */
+#undef  frame_duration
+
+    assert(gfc->bo_l[SBMAX_l - 1] <= gfc->npart_l);
+    assert(gfc->bo_s[SBMAX_s - 1] <= gfc->npart_s);
+
+    if (gfp->ATHtype != -1) {
+        /* compute equal loudness weights (eql_w) */
+        FLOAT   freq;
+        FLOAT const freq_inc = (FLOAT) gfp->out_samplerate / (FLOAT) (BLKSIZE);
+        FLOAT   eql_balance = 0.0;
+        freq = 0.0;
+        for (i = 0; i < BLKSIZE / 2; ++i) {
+            /* convert ATH dB to relative power (not dB) */
+            /*  to determine eql_w */
+            freq += freq_inc;
+            gfc->ATH->eql_w[i] = 1. / pow(10, ATHformula(freq, gfp) / 10);
+            eql_balance += gfc->ATH->eql_w[i];
+        }
+        eql_balance = 1.0 / eql_balance;
+        for (i = BLKSIZE / 2; --i >= 0;) { /* scale weights */
+            gfc->ATH->eql_w[i] *= eql_balance;
+        }
+    }
+    {
+        for (b = j = 0; b < gfc->npart_s; ++b) {
+            for (i = 0; i < gfc->numlines_s[b]; ++i) {
+                ++j;
+            }
+        }
+        assert(j == 129);
+        for (b = j = 0; b < gfc->npart_l; ++b) {
+            for (i = 0; i < gfc->numlines_l[b]; ++i) {
+                ++j;
+            }
+        }
+        assert(j == 513);
+    }
+    j = 0;
+    for (i = 0; i < gfc->npart_l; i++) {
+        FLOAT const freq = sfreq * (j + gfc->numlines_l[i] / 2) / (1.0 * BLKSIZE);
+        gfc->mld_cb_l[i] = stereo_demask(freq);
+        j += gfc->numlines_l[i];
+    }
+    for (; i < CBANDS; ++i) {
+        gfc->mld_cb_l[i] = 1;
+    }
+    j = 0;
+    for (i = 0; i < gfc->npart_s; i++) {
+        FLOAT const freq = sfreq * (j + gfc->numlines_s[i] / 2) / (1.0 * BLKSIZE_s);
+        gfc->mld_cb_s[i] = stereo_demask(freq);
+        j += gfc->numlines_s[i];
+    }
+    for (; i < CBANDS; ++i) {
+        gfc->mld_cb_s[i] = 1;
+    }
+    return 0;
+}
diff --git a/libmp3lame/psymodel.h b/libmp3lame/psymodel.h
new file mode 100644
index 0000000..5253fd4
--- /dev/null
+++ b/libmp3lame/psymodel.h
@@ -0,0 +1,79 @@
+/*
+ *	psymodel.h
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_PSYMODEL_H
+#define LAME_PSYMODEL_H
+
+
+int     L3psycho_anal_ns(lame_global_flags const *gfc,
+                         const sample_t * buffer[2], int gr,
+                         III_psy_ratio ratio[2][2],
+                         III_psy_ratio MS_ratio[2][2],
+                         FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]);
+
+int     L3psycho_anal_vbr(lame_global_flags const *gfc,
+                          const sample_t * buffer[2], int gr,
+                          III_psy_ratio ratio[2][2],
+                          III_psy_ratio MS_ratio[2][2],
+                          FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]);
+
+
+int     psymodel_init(lame_global_flags * gfp);
+
+
+#define rpelev 2
+#define rpelev2 16
+#define rpelev_s 2
+#define rpelev2_s 16
+
+/* size of each partition band, in barks: */
+#define DELBARK .34
+#define CW_LOWER_INDEX 6
+
+
+#if 1
+    /* AAC values, results in more masking over MP3 values */
+# define TMN 18
+# define NMT 6
+#else
+    /* MP3 values */
+# define TMN 29
+# define NMT 6
+#endif
+
+/* ISO values */
+#define CONV1 (-.299)
+#define CONV2 (-.43)
+
+/* tuned for output level (sensitive to energy scale) */
+#define VO_SCALE (1./( 14752*14752 )/(BLKSIZE/2))
+
+#define temporalmask_sustain_sec 0.01
+
+#define NS_PREECHO_ATT0 0.8
+#define NS_PREECHO_ATT1 0.6
+#define NS_PREECHO_ATT2 0.3
+
+#define NS_MSFIX 3.5
+#define NSATTACKTHRE 4.4
+#define NSATTACKTHRE_S 25
+
+#endif /* LAME_PSYMODEL_H */
diff --git a/libmp3lame/quantize.c b/libmp3lame/quantize.c
new file mode 100644
index 0000000..3a2023f
--- /dev/null
+++ b/libmp3lame/quantize.c
@@ -0,0 +1,2027 @@
+/*
+ * MP3 quantization
+ *
+ *      Copyright (c) 1999-2000 Mark Taylor
+ *      Copyright (c) 1999-2003 Takehiro Tominaga
+ *      Copyright (c) 2000-2007 Robert Hegemann
+ *      Copyright (c) 2001-2005 Gabriel Bouvigne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: quantize.c,v 1.201.2.1 2008/08/05 14:16:07 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "quantize_pvt.h"
+#include "lame_global_flags.h"
+#include "reservoir.h"
+#include "bitstream.h"
+#include "vbrquantize.h"
+#include "quantize.h"
+#ifdef HAVE_XMMINTRIN_H
+#include "vector/lame_intrin.h"
+#endif
+
+
+
+
+/* convert from L/R <-> Mid/Side */
+static void
+ms_convert(III_side_info_t * l3_side, int gr)
+{
+    int     i;
+    for (i = 0; i < 576; ++i) {
+        FLOAT   l, r;
+        l = l3_side->tt[gr][0].xr[i];
+        r = l3_side->tt[gr][1].xr[i];
+        l3_side->tt[gr][0].xr[i] = (l + r) * (FLOAT) (SQRT2 * 0.5);
+        l3_side->tt[gr][1].xr[i] = (l - r) * (FLOAT) (SQRT2 * 0.5);
+    }
+}
+
+/************************************************************************
+ *
+ *      init_outer_loop()
+ *  mt 6/99
+ *
+ *  initializes cod_info, scalefac and xrpow
+ *
+ *  returns 0 if all energies in xr are zero, else 1
+ *
+ ************************************************************************/
+
+static void
+init_xrpow_core_c(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum)
+{
+    int     i;
+    FLOAT   tmp;
+    *sum = 0;
+    for (i = 0; i <= upper; ++i) {
+        tmp = fabs(cod_info->xr[i]);
+        *sum += tmp;
+        xrpow[i] = sqrt(tmp * sqrt(tmp));
+
+        if (xrpow[i] > cod_info->xrpow_max)
+            cod_info->xrpow_max = xrpow[i];
+    }
+}
+
+
+
+
+
+void
+init_xrpow_core_init(lame_internal_flags * const gfc)
+{
+    gfc->init_xrpow_core = init_xrpow_core_c;
+
+#if defined(HAVE_XMMINTRIN_H)
+    if (gfc->CPU_features.SSE)
+        gfc->init_xrpow_core = init_xrpow_core_sse;
+#endif
+}
+
+
+
+static int
+init_xrpow(lame_internal_flags * gfc, gr_info * const cod_info, FLOAT xrpow[576])
+{
+    FLOAT   sum = 0;
+    int     i;
+    int const upper = cod_info->max_nonzero_coeff;
+
+    assert(xrpow != NULL);
+    cod_info->xrpow_max = 0;
+
+    /*  check if there is some energy we have to quantize
+     *  and calculate xrpow matching our fresh scalefactors
+     */
+    assert(0 <= upper && upper <= 575);
+    memset(&(xrpow[upper]), 0, (576 - upper) * sizeof(xrpow[0]));
+
+
+    gfc->init_xrpow_core(cod_info, xrpow, upper, &sum);
+
+    /*  return 1 if we have something to quantize, else 0
+     */
+    if (sum > (FLOAT) 1E-20) {
+        int     j = 0;
+        if (gfc->substep_shaping & 2)
+            j = 1;
+
+        for (i = 0; i < cod_info->psymax; i++)
+            gfc->pseudohalf[i] = j;
+
+        return 1;
+    }
+
+    memset(&cod_info->l3_enc[0], 0, sizeof(int) * 576);
+    return 0;
+}
+
+
+
+
+
+extern FLOAT athAdjust(FLOAT a, FLOAT x, FLOAT athFloor);
+
+
+
+/*
+Gabriel Bouvigne feb/apr 2003
+Analog silence detection in partitionned sfb21
+or sfb12 for short blocks
+
+From top to bottom of sfb, changes to 0
+coeffs which are below ath. It stops on the first
+coeff higher than ath.
+*/
+static void
+psfb21_analogsilence(lame_internal_flags const *gfc, gr_info * const cod_info)
+{
+    ATH_t const *const ATH = gfc->ATH;
+    FLOAT  *const xr = cod_info->xr;
+
+    if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type, but not SHORT blocks */
+        int     gsfb;
+        int     stop = 0;
+        for (gsfb = PSFB21 - 1; gsfb >= 0 && !stop; gsfb--) {
+            int const start = gfc->scalefac_band.psfb21[gsfb];
+            int const end = gfc->scalefac_band.psfb21[gsfb + 1];
+            int     j;
+            FLOAT   ath21;
+            ath21 = athAdjust(ATH->adjust, ATH->psfb21[gsfb], ATH->floor);
+
+            if (gfc->nsPsy.longfact[21] > 1e-12f)
+                ath21 *= gfc->nsPsy.longfact[21];
+
+            for (j = end - 1; j >= start; j--) {
+                if (fabs(xr[j]) < ath21)
+                    xr[j] = 0;
+                else {
+                    stop = 1;
+                    break;
+                }
+            }
+        }
+    }
+    else {
+        /*note: short blocks coeffs are reordered */
+        int     block;
+        for (block = 0; block < 3; block++) {
+
+            int     gsfb;
+            int     stop = 0;
+            for (gsfb = PSFB12 - 1; gsfb >= 0 && !stop; gsfb--) {
+                int const start = gfc->scalefac_band.s[12] * 3 +
+                    (gfc->scalefac_band.s[13] - gfc->scalefac_band.s[12]) * block +
+                    (gfc->scalefac_band.psfb12[gsfb] - gfc->scalefac_band.psfb12[0]);
+                int const end =
+                    start + (gfc->scalefac_band.psfb12[gsfb + 1] - gfc->scalefac_band.psfb12[gsfb]);
+                int     j;
+                FLOAT   ath12;
+                ath12 = athAdjust(ATH->adjust, ATH->psfb12[gsfb], ATH->floor);
+
+                if (gfc->nsPsy.shortfact[12] > 1e-12f)
+                    ath12 *= gfc->nsPsy.shortfact[12];
+
+                for (j = end - 1; j >= start; j--) {
+                    if (fabs(xr[j]) < ath12)
+                        xr[j] = 0;
+                    else {
+                        stop = 1;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+}
+
+
+
+
+
+static void
+init_outer_loop(lame_internal_flags const *gfc, gr_info * const cod_info)
+{
+    int     sfb, j;
+    /*  initialize fresh cod_info
+     */
+    cod_info->part2_3_length = 0;
+    cod_info->big_values = 0;
+    cod_info->count1 = 0;
+    cod_info->global_gain = 210;
+    cod_info->scalefac_compress = 0;
+    /* mixed_block_flag, block_type was set in psymodel.c */
+    cod_info->table_select[0] = 0;
+    cod_info->table_select[1] = 0;
+    cod_info->table_select[2] = 0;
+    cod_info->subblock_gain[0] = 0;
+    cod_info->subblock_gain[1] = 0;
+    cod_info->subblock_gain[2] = 0;
+    cod_info->subblock_gain[3] = 0; /* this one is always 0 */
+    cod_info->region0_count = 0;
+    cod_info->region1_count = 0;
+    cod_info->preflag = 0;
+    cod_info->scalefac_scale = 0;
+    cod_info->count1table_select = 0;
+    cod_info->part2_length = 0;
+    cod_info->sfb_lmax = SBPSY_l;
+    cod_info->sfb_smin = SBPSY_s;
+    cod_info->psy_lmax = gfc->sfb21_extra ? SBMAX_l : SBPSY_l;
+    cod_info->psymax = cod_info->psy_lmax;
+    cod_info->sfbmax = cod_info->sfb_lmax;
+    cod_info->sfbdivide = 11;
+    for (sfb = 0; sfb < SBMAX_l; sfb++) {
+        cod_info->width[sfb]
+            = gfc->scalefac_band.l[sfb + 1] - gfc->scalefac_band.l[sfb];
+        cod_info->window[sfb] = 3; /* which is always 0. */
+    }
+    if (cod_info->block_type == SHORT_TYPE) {
+        FLOAT   ixwork[576];
+        FLOAT  *ix;
+
+        cod_info->sfb_smin = 0;
+        cod_info->sfb_lmax = 0;
+        if (cod_info->mixed_block_flag) {
+            /*
+             *  MPEG-1:      sfbs 0-7 long block, 3-12 short blocks
+             *  MPEG-2(.5):  sfbs 0-5 long block, 3-12 short blocks
+             */
+            cod_info->sfb_smin = 3;
+            cod_info->sfb_lmax = gfc->mode_gr * 2 + 4;
+        }
+        cod_info->psymax
+            = cod_info->sfb_lmax
+            + 3 * ((gfc->sfb21_extra ? SBMAX_s : SBPSY_s) - cod_info->sfb_smin);
+        cod_info->sfbmax = cod_info->sfb_lmax + 3 * (SBPSY_s - cod_info->sfb_smin);
+        cod_info->sfbdivide = cod_info->sfbmax - 18;
+        cod_info->psy_lmax = cod_info->sfb_lmax;
+        /* re-order the short blocks, for more efficient encoding below */
+        /* By Takehiro TOMINAGA */
+        /*
+           Within each scalefactor band, data is given for successive
+           time windows, beginning with window 0 and ending with window 2.
+           Within each window, the quantized values are then arranged in
+           order of increasing frequency...
+         */
+        ix = &cod_info->xr[gfc->scalefac_band.l[cod_info->sfb_lmax]];
+        memcpy(ixwork, cod_info->xr, 576 * sizeof(FLOAT));
+        for (sfb = cod_info->sfb_smin; sfb < SBMAX_s; sfb++) {
+            int const start = gfc->scalefac_band.s[sfb];
+            int const end = gfc->scalefac_band.s[sfb + 1];
+            int     window, l;
+            for (window = 0; window < 3; window++) {
+                for (l = start; l < end; l++) {
+                    *ix++ = ixwork[3 * l + window];
+                }
+            }
+        }
+
+        j = cod_info->sfb_lmax;
+        for (sfb = cod_info->sfb_smin; sfb < SBMAX_s; sfb++) {
+            cod_info->width[j] = cod_info->width[j + 1] = cod_info->width[j + 2]
+                = gfc->scalefac_band.s[sfb + 1] - gfc->scalefac_band.s[sfb];
+            cod_info->window[j] = 0;
+            cod_info->window[j + 1] = 1;
+            cod_info->window[j + 2] = 2;
+            j += 3;
+        }
+    }
+
+    cod_info->count1bits = 0;
+    cod_info->sfb_partition_table = nr_of_sfb_block[0][0];
+    cod_info->slen[0] = 0;
+    cod_info->slen[1] = 0;
+    cod_info->slen[2] = 0;
+    cod_info->slen[3] = 0;
+
+    cod_info->max_nonzero_coeff = 575;
+
+    /*  fresh scalefactors are all zero
+     */
+    memset(cod_info->scalefac, 0, sizeof(cod_info->scalefac));
+
+    psfb21_analogsilence(gfc, cod_info);
+}
+
+
+
+/************************************************************************
+ *
+ *      bin_search_StepSize()
+ *
+ *  author/date??
+ *
+ *  binary step size search
+ *  used by outer_loop to get a quantizer step size to start with
+ *
+ ************************************************************************/
+
+typedef enum {
+    BINSEARCH_NONE,
+    BINSEARCH_UP,
+    BINSEARCH_DOWN
+} binsearchDirection_t;
+
+static int
+bin_search_StepSize(lame_internal_flags * const gfc, gr_info * const cod_info,
+                    int desired_rate, const int ch, const FLOAT xrpow[576])
+{
+    int     nBits;
+    int     CurrentStep = gfc->CurrentStep[ch];
+    int     flag_GoneOver = 0;
+    int const start = gfc->OldValue[ch];
+    binsearchDirection_t Direction = BINSEARCH_NONE;
+    cod_info->global_gain = start;
+    desired_rate -= cod_info->part2_length;
+
+    assert(CurrentStep);
+    for (;;) {
+        int     step;
+        nBits = count_bits(gfc, xrpow, cod_info, 0);
+
+        if (CurrentStep == 1 || nBits == desired_rate)
+            break;      /* nothing to adjust anymore */
+
+        if (nBits > desired_rate) {
+            /* increase Quantize_StepSize */
+            if (Direction == BINSEARCH_DOWN)
+                flag_GoneOver = 1;
+
+            if (flag_GoneOver)
+                CurrentStep /= 2;
+            Direction = BINSEARCH_UP;
+            step = CurrentStep;
+        }
+        else {
+            /* decrease Quantize_StepSize */
+            if (Direction == BINSEARCH_UP)
+                flag_GoneOver = 1;
+
+            if (flag_GoneOver)
+                CurrentStep /= 2;
+            Direction = BINSEARCH_DOWN;
+            step = -CurrentStep;
+        }
+        cod_info->global_gain += step;
+        if (cod_info->global_gain < 0) {
+            cod_info->global_gain = 0;
+            flag_GoneOver = 1;
+        }
+        if (cod_info->global_gain > 255) {
+            cod_info->global_gain = 255;
+            flag_GoneOver = 1;
+        }
+    }
+
+    assert(cod_info->global_gain >= 0);
+    assert(cod_info->global_gain < 256);
+
+    while (nBits > desired_rate && cod_info->global_gain < 255) {
+        cod_info->global_gain++;
+        nBits = count_bits(gfc, xrpow, cod_info, 0);
+    }
+    gfc->CurrentStep[ch] = (start - cod_info->global_gain >= 4) ? 4 : 2;
+    gfc->OldValue[ch] = cod_info->global_gain;
+    cod_info->part2_3_length = nBits;
+    return nBits;
+}
+
+
+
+
+/************************************************************************
+ *
+ *      trancate_smallspectrums()
+ *
+ *  Takehiro TOMINAGA 2002-07-21
+ *
+ *  trancate smaller nubmers into 0 as long as the noise threshold is allowed.
+ *
+ ************************************************************************/
+static int
+floatcompare(const void *v1, const void *v2)
+{
+    const FLOAT *const a = v1, *const b = v2;
+    if (*a > *b)
+        return 1;
+    if (*a < *b)
+        return -1;
+    return 0;
+}
+
+void
+trancate_smallspectrums(lame_internal_flags const *gfc,
+                        gr_info * const gi, const FLOAT * const l3_xmin, FLOAT * const work)
+{
+    int     sfb, j, width;
+    FLOAT   distort[SFBMAX];
+    calc_noise_result dummy;
+
+    if ((!(gfc->substep_shaping & 4) && gi->block_type == SHORT_TYPE)
+        || gfc->substep_shaping & 0x80)
+        return;
+    (void) calc_noise(gi, l3_xmin, distort, &dummy, 0);
+    for (j = 0; j < 576; j++) {
+        FLOAT   xr = 0.0;
+        if (gi->l3_enc[j] != 0)
+            xr = fabs(gi->xr[j]);
+        work[j] = xr;
+    }
+
+    j = 0;
+    sfb = 8;
+    if (gi->block_type == SHORT_TYPE)
+        sfb = 6;
+    do {
+        FLOAT   allowedNoise, trancateThreshold;
+        int     nsame, start;
+
+        width = gi->width[sfb];
+        j += width;
+        if (distort[sfb] >= 1.0)
+            continue;
+
+        qsort(&work[j - width], width, sizeof(FLOAT), floatcompare);
+        if (EQ(work[j - 1], 0.0))
+            continue;   /* all zero sfb */
+
+        allowedNoise = (1.0 - distort[sfb]) * l3_xmin[sfb];
+        trancateThreshold = 0.0;
+        start = 0;
+        do {
+            FLOAT   noise;
+            for (nsame = 1; start + nsame < width; nsame++)
+                if (NEQ(work[start + j - width], work[start + j + nsame - width]))
+                    break;
+
+            noise = work[start + j - width] * work[start + j - width] * nsame;
+            if (allowedNoise < noise) {
+                if (start != 0)
+                    trancateThreshold = work[start + j - width - 1];
+                break;
+            }
+            allowedNoise -= noise;
+            start += nsame;
+        } while (start < width);
+        if (EQ(trancateThreshold, 0.0))
+            continue;
+
+/*      printf("%e %e %e\n", */
+/*             trancateThreshold/l3_xmin[sfb], */
+/*             trancateThreshold/(l3_xmin[sfb]*start), */
+/*             trancateThreshold/(l3_xmin[sfb]*(start+width)) */
+/*          ); */
+/*      if (trancateThreshold > 1000*l3_xmin[sfb]*start) */
+/*          trancateThreshold = 1000*l3_xmin[sfb]*start; */
+
+        do {
+            if (fabs(gi->xr[j - width]) <= trancateThreshold)
+                gi->l3_enc[j - width] = 0;
+        } while (--width > 0);
+    } while (++sfb < gi->psymax);
+
+    gi->part2_3_length = noquant_count_bits(gfc, gi, 0);
+}
+
+
+/*************************************************************************
+ *
+ *      loop_break()
+ *
+ *  author/date??
+ *
+ *  Function: Returns zero if there is a scalefac which has not been
+ *            amplified. Otherwise it returns one.
+ *
+ *************************************************************************/
+
+inline static int
+loop_break(const gr_info * const cod_info)
+{
+    int     sfb;
+
+    for (sfb = 0; sfb < cod_info->sfbmax; sfb++)
+        if (cod_info->scalefac[sfb]
+            + cod_info->subblock_gain[cod_info->window[sfb]] == 0)
+            return 0;
+
+    return 1;
+}
+
+
+
+
+/*  mt 5/99:  Function: Improved calc_noise for a single channel   */
+
+/*************************************************************************
+ *
+ *      quant_compare()
+ *
+ *  author/date??
+ *
+ *  several different codes to decide which quantization is better
+ *
+ *************************************************************************/
+
+static double
+penalties(double noise)
+{
+    return FAST_LOG10(0.368 + 0.632 * noise * noise * noise);
+}
+
+static double
+get_klemm_noise(const FLOAT * distort, const gr_info * const gi)
+{
+    int     sfb;
+    double  klemm_noise = 1E-37;
+    for (sfb = 0; sfb < gi->psymax; sfb++)
+        klemm_noise += penalties(distort[sfb]);
+
+    return Max(1e-20, klemm_noise);
+}
+
+inline static int
+quant_compare(const int quant_comp,
+              const calc_noise_result * const best,
+              calc_noise_result * const calc, const gr_info * const gi, const FLOAT * distort)
+{
+    /*
+       noise is given in decibels (dB) relative to masking thesholds.
+
+       over_noise:  ??? (the previous comment is fully wrong)
+       tot_noise:   ??? (the previous comment is fully wrong)
+       max_noise:   max quantization noise
+
+     */
+    int     better;
+
+    switch (quant_comp) {
+    default:
+    case 9:{
+            if (best->over_count > 0) {
+                /* there are distorted sfb */
+                better = calc->over_SSD <= best->over_SSD;
+                if (calc->over_SSD == best->over_SSD)
+                    better = calc->bits < best->bits;
+            }
+            else {
+                /* no distorted sfb */
+                better = ((calc->max_noise < 0) &&
+                          ((calc->max_noise * 10 + calc->bits) <=
+                           (best->max_noise * 10 + best->bits)));
+            }
+            break;
+        }
+
+    case 0:
+        better = calc->over_count < best->over_count
+            || (calc->over_count == best->over_count && calc->over_noise < best->over_noise)
+            || (calc->over_count == best->over_count &&
+                EQ(calc->over_noise, best->over_noise) && calc->tot_noise < best->tot_noise);
+        break;
+
+    case 8:
+        calc->max_noise = get_klemm_noise(distort, gi);
+        /*lint --fallthrough */
+    case 1:
+        better = calc->max_noise < best->max_noise;
+        break;
+    case 2:
+        better = calc->tot_noise < best->tot_noise;
+        break;
+    case 3:
+        better = (calc->tot_noise < best->tot_noise)
+            && (calc->max_noise < best->max_noise);
+        break;
+    case 4:
+        better = (calc->max_noise <= 0.0 && best->max_noise > 0.2)
+            || (calc->max_noise <= 0.0 &&
+                best->max_noise < 0.0 &&
+                best->max_noise > calc->max_noise - 0.2 && calc->tot_noise < best->tot_noise)
+            || (calc->max_noise <= 0.0 &&
+                best->max_noise > 0.0 &&
+                best->max_noise > calc->max_noise - 0.2 &&
+                calc->tot_noise < best->tot_noise + best->over_noise)
+            || (calc->max_noise > 0.0 &&
+                best->max_noise > -0.05 &&
+                best->max_noise > calc->max_noise - 0.1 &&
+                calc->tot_noise + calc->over_noise < best->tot_noise + best->over_noise)
+            || (calc->max_noise > 0.0 &&
+                best->max_noise > -0.1 &&
+                best->max_noise > calc->max_noise - 0.15 &&
+                calc->tot_noise + calc->over_noise + calc->over_noise <
+                best->tot_noise + best->over_noise + best->over_noise);
+        break;
+    case 5:
+        better = calc->over_noise < best->over_noise
+            || (EQ(calc->over_noise, best->over_noise) && calc->tot_noise < best->tot_noise);
+        break;
+    case 6:
+        better = calc->over_noise < best->over_noise
+            || (EQ(calc->over_noise, best->over_noise) &&
+                (calc->max_noise < best->max_noise
+                 || (EQ(calc->max_noise, best->max_noise) && calc->tot_noise <= best->tot_noise)
+                ));
+        break;
+    case 7:
+        better = calc->over_count < best->over_count || calc->over_noise < best->over_noise;
+        break;
+    }
+
+
+    if (best->over_count == 0) {
+        /*
+           If no distorted bands, only use this quantization
+           if it is better, and if it uses less bits.
+           Unfortunately, part2_3_length is sometimes a poor
+           estimator of the final size at low bitrates.
+         */
+        better = better && calc->bits < best->bits;
+    }
+
+
+    return better;
+}
+
+
+
+/*************************************************************************
+ *
+ *          amp_scalefac_bands()
+ *
+ *  author/date??
+ *
+ *  Amplify the scalefactor bands that violate the masking threshold.
+ *  See ISO 11172-3 Section C.1.5.4.3.5
+ *
+ *  distort[] = noise/masking
+ *  distort[] > 1   ==> noise is not masked
+ *  distort[] < 1   ==> noise is masked
+ *  max_dist = maximum value of distort[]
+ *
+ *  Three algorithms:
+ *  noise_shaping_amp
+ *        0             Amplify all bands with distort[]>1.
+ *
+ *        1             Amplify all bands with distort[] >= max_dist^(.5);
+ *                     ( 50% in the db scale)
+ *
+ *        2             Amplify first band with distort[] >= max_dist;
+ *
+ *
+ *  For algorithms 0 and 1, if max_dist < 1, then amplify all bands
+ *  with distort[] >= .95*max_dist.  This is to make sure we always
+ *  amplify at least one band.
+ *
+ *
+ *************************************************************************/
+static void
+amp_scalefac_bands(lame_global_flags const *gfp,
+                   gr_info * const cod_info, FLOAT const *distort, FLOAT xrpow[576], int bRefine)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     j, sfb;
+    FLOAT   ifqstep34, trigger;
+    int     noise_shaping_amp;
+
+    if (cod_info->scalefac_scale == 0) {
+        ifqstep34 = 1.29683955465100964055; /* 2**(.75*.5) */
+    }
+    else {
+        ifqstep34 = 1.68179283050742922612; /* 2**(.75*1) */
+    }
+
+    /* compute maximum value of distort[]  */
+    trigger = 0;
+    for (sfb = 0; sfb < cod_info->sfbmax; sfb++) {
+        if (trigger < distort[sfb])
+            trigger = distort[sfb];
+    }
+
+    noise_shaping_amp = gfc->noise_shaping_amp;
+    if (noise_shaping_amp == 3) {
+        if (bRefine == 1)
+            noise_shaping_amp = 2;
+        else
+            noise_shaping_amp = 1;
+    }
+    switch (noise_shaping_amp) {
+    case 2:
+        /* amplify exactly 1 band */
+        break;
+
+    case 1:
+        /* amplify bands within 50% of max (on db scale) */
+        if (trigger > 1.0)
+            trigger = pow(trigger, .5);
+        else
+            trigger *= .95;
+        break;
+
+    case 0:
+    default:
+        /* ISO algorithm.  amplify all bands with distort>1 */
+        if (trigger > 1.0)
+            trigger = 1.0;
+        else
+            trigger *= .95;
+        break;
+    }
+
+    j = 0;
+    for (sfb = 0; sfb < cod_info->sfbmax; sfb++) {
+        int const width = cod_info->width[sfb];
+        int     l;
+        j += width;
+        if (distort[sfb] < trigger)
+            continue;
+
+        if (gfc->substep_shaping & 2) {
+            gfc->pseudohalf[sfb] = !gfc->pseudohalf[sfb];
+            if (!gfc->pseudohalf[sfb] && gfc->noise_shaping_amp == 2)
+                return;
+        }
+        cod_info->scalefac[sfb]++;
+        for (l = -width; l < 0; l++) {
+            xrpow[j + l] *= ifqstep34;
+            if (xrpow[j + l] > cod_info->xrpow_max)
+                cod_info->xrpow_max = xrpow[j + l];
+        }
+
+        if (gfc->noise_shaping_amp == 2)
+            return;
+    }
+}
+
+/*************************************************************************
+ *
+ *      inc_scalefac_scale()
+ *
+ *  Takehiro Tominaga 2000-xx-xx
+ *
+ *  turns on scalefac scale and adjusts scalefactors
+ *
+ *************************************************************************/
+
+static void
+inc_scalefac_scale(gr_info * const cod_info, FLOAT xrpow[576])
+{
+    int     l, j, sfb;
+    const FLOAT ifqstep34 = 1.29683955465100964055;
+
+    j = 0;
+    for (sfb = 0; sfb < cod_info->sfbmax; sfb++) {
+        int const width = cod_info->width[sfb];
+        int     s = cod_info->scalefac[sfb];
+        if (cod_info->preflag)
+            s += pretab[sfb];
+        j += width;
+        if (s & 1) {
+            s++;
+            for (l = -width; l < 0; l++) {
+                xrpow[j + l] *= ifqstep34;
+                if (xrpow[j + l] > cod_info->xrpow_max)
+                    cod_info->xrpow_max = xrpow[j + l];
+            }
+        }
+        cod_info->scalefac[sfb] = s >> 1;
+    }
+    cod_info->preflag = 0;
+    cod_info->scalefac_scale = 1;
+}
+
+
+
+/*************************************************************************
+ *
+ *      inc_subblock_gain()
+ *
+ *  Takehiro Tominaga 2000-xx-xx
+ *
+ *  increases the subblock gain and adjusts scalefactors
+ *
+ *************************************************************************/
+
+static int
+inc_subblock_gain(const lame_internal_flags * const gfc, gr_info * const cod_info, FLOAT xrpow[576])
+{
+    int     sfb, window;
+    int    *const scalefac = cod_info->scalefac;
+
+    /* subbloc_gain can't do anything in the long block region */
+    for (sfb = 0; sfb < cod_info->sfb_lmax; sfb++) {
+        if (scalefac[sfb] >= 16)
+            return 1;
+    }
+
+    for (window = 0; window < 3; window++) {
+        int     s1, s2, l, j;
+        s1 = s2 = 0;
+
+        for (sfb = cod_info->sfb_lmax + window; sfb < cod_info->sfbdivide; sfb += 3) {
+            if (s1 < scalefac[sfb])
+                s1 = scalefac[sfb];
+        }
+        for (; sfb < cod_info->sfbmax; sfb += 3) {
+            if (s2 < scalefac[sfb])
+                s2 = scalefac[sfb];
+        }
+
+        if (s1 < 16 && s2 < 8)
+            continue;
+
+        if (cod_info->subblock_gain[window] >= 7)
+            return 1;
+
+        /* even though there is no scalefactor for sfb12
+         * subblock gain affects upper frequencies too, that's why
+         * we have to go up to SBMAX_s
+         */
+        cod_info->subblock_gain[window]++;
+        j = gfc->scalefac_band.l[cod_info->sfb_lmax];
+        for (sfb = cod_info->sfb_lmax + window; sfb < cod_info->sfbmax; sfb += 3) {
+            FLOAT   amp;
+            int const width = cod_info->width[sfb];
+            int     s = scalefac[sfb];
+            assert(s >= 0);
+            s = s - (4 >> cod_info->scalefac_scale);
+            if (s >= 0) {
+                scalefac[sfb] = s;
+                j += width * 3;
+                continue;
+            }
+
+            scalefac[sfb] = 0;
+            {
+                int const gain = 210 + (s << (cod_info->scalefac_scale + 1));
+                amp = IPOW20(gain);
+            }
+            j += width * (window + 1);
+            for (l = -width; l < 0; l++) {
+                xrpow[j + l] *= amp;
+                if (xrpow[j + l] > cod_info->xrpow_max)
+                    cod_info->xrpow_max = xrpow[j + l];
+            }
+            j += width * (3 - window - 1);
+        }
+
+        {
+            FLOAT const amp = IPOW20(202);
+            j += cod_info->width[sfb] * (window + 1);
+            for (l = -cod_info->width[sfb]; l < 0; l++) {
+                xrpow[j + l] *= amp;
+                if (xrpow[j + l] > cod_info->xrpow_max)
+                    cod_info->xrpow_max = xrpow[j + l];
+            }
+        }
+    }
+    return 0;
+}
+
+
+
+/********************************************************************
+ *
+ *      balance_noise()
+ *
+ *  Takehiro Tominaga /date??
+ *  Robert Hegemann 2000-09-06: made a function of it
+ *
+ *  amplifies scalefactor bands,
+ *   - if all are already amplified returns 0
+ *   - if some bands are amplified too much:
+ *      * try to increase scalefac_scale
+ *      * if already scalefac_scale was set
+ *          try on short blocks to increase subblock gain
+ *
+ ********************************************************************/
+inline static int
+balance_noise(lame_global_flags const *const gfp,
+              gr_info * const cod_info, FLOAT const *distort, FLOAT xrpow[576], int bRefine)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     status;
+
+    amp_scalefac_bands(gfp, cod_info, distort, xrpow, bRefine);
+
+    /* check to make sure we have not amplified too much
+     * loop_break returns 0 if there is an unamplified scalefac
+     * scale_bitcount returns 0 if no scalefactors are too large
+     */
+
+    status = loop_break(cod_info);
+
+    if (status)
+        return 0;       /* all bands amplified */
+
+    /* not all scalefactors have been amplified.  so these
+     * scalefacs are possibly valid.  encode them:
+     */
+    if (gfc->mode_gr == 2)
+        status = scale_bitcount(cod_info);
+    else
+        status = scale_bitcount_lsf(gfc, cod_info);
+
+    if (!status)
+        return 1;       /* amplified some bands not exceeding limits */
+
+    /*  some scalefactors are too large.
+     *  lets try setting scalefac_scale=1
+     */
+    if (gfc->noise_shaping > 1) {
+        memset(&gfc->pseudohalf[0], 0, sizeof(gfc->pseudohalf));
+        if (!cod_info->scalefac_scale) {
+            inc_scalefac_scale(cod_info, xrpow);
+            status = 0;
+        }
+        else {
+            if (cod_info->block_type == SHORT_TYPE && gfc->subblock_gain > 0) {
+                status = inc_subblock_gain(gfc, cod_info, xrpow)
+                    || loop_break(cod_info);
+            }
+        }
+    }
+
+    if (!status) {
+        if (gfc->mode_gr == 2)
+            status = scale_bitcount(cod_info);
+        else
+            status = scale_bitcount_lsf(gfc, cod_info);
+    }
+    return !status;
+}
+
+
+
+/************************************************************************
+ *
+ *  outer_loop ()
+ *
+ *  Function: The outer iteration loop controls the masking conditions
+ *  of all scalefactorbands. It computes the best scalefac and
+ *  global gain. This module calls the inner iteration loop
+ *
+ *  mt 5/99 completely rewritten to allow for bit reservoir control,
+ *  mid/side channels with L/R or mid/side masking thresholds,
+ *  and chooses best quantization instead of last quantization when
+ *  no distortion free quantization can be found.
+ *
+ *  added VBR support mt 5/99
+ *
+ *  some code shuffle rh 9/00
+ ************************************************************************/
+
+static int
+outer_loop(lame_global_flags const *gfp, gr_info * const cod_info, const FLOAT * const l3_xmin, /* allowed distortion */
+           FLOAT xrpow[576], /* coloured magnitudes of spectral */
+           const int ch, const int targ_bits)
+{                       /* maximum allowed bits */
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    gr_info cod_info_w;
+    FLOAT   save_xrpow[576];
+    FLOAT   distort[SFBMAX];
+    calc_noise_result best_noise_info;
+    int     huff_bits;
+    int     better;
+    int     age;
+    calc_noise_data prev_noise;
+    int     best_part2_3_length = 9999999;
+    int     bEndOfSearch = 0;
+    int     bRefine = 0;
+    int     best_ggain_pass1 = 0;
+
+    (void) bin_search_StepSize(gfc, cod_info, targ_bits, ch, xrpow);
+
+    if (!gfc->noise_shaping)
+        /* fast mode, no noise shaping, we are ready */
+        return 100;     /* default noise_info.over_count */
+
+    memset(&prev_noise, 0, sizeof(calc_noise_data));
+
+
+    /* compute the distortion in this quantization */
+    /* coefficients and thresholds both l/r (or both mid/side) */
+    (void) calc_noise(cod_info, l3_xmin, distort, &best_noise_info, &prev_noise);
+    best_noise_info.bits = cod_info->part2_3_length;
+
+    cod_info_w = *cod_info;
+    age = 0;
+    /* if (gfp->VBR == vbr_rh || gfp->VBR == vbr_mtrh) */
+    memcpy(save_xrpow, xrpow, sizeof(FLOAT) * 576);
+
+    while (!bEndOfSearch) {
+        /* BEGIN MAIN LOOP */
+        do {
+            calc_noise_result noise_info;
+            int     search_limit;
+            int     maxggain = 255;
+
+            /* When quantization with no distorted bands is found,
+             * allow up to X new unsuccesful tries in serial. This
+             * gives us more possibilities for different quant_compare modes.
+             * Much more than 3 makes not a big difference, it is only slower.
+             */
+
+            if (gfc->substep_shaping & 2) {
+                search_limit = 20;
+            }
+            else {
+                search_limit = 3;
+            }
+
+
+
+            /* Check if the last scalefactor band is distorted.
+             * in VBR mode we can't get rid of the distortion, so quit now
+             * and VBR mode will try again with more bits.
+             * (makes a 10% speed increase, the files I tested were
+             * binary identical, 2000/05/20 Robert Hegemann)
+             * distort[] > 1 means noise > allowed noise
+             */
+            if (gfc->sfb21_extra) {
+                if (distort[cod_info_w.sfbmax] > 1.0)
+                    break;
+                if (cod_info_w.block_type == SHORT_TYPE
+                    && (distort[cod_info_w.sfbmax + 1] > 1.0
+                        || distort[cod_info_w.sfbmax + 2] > 1.0))
+                    break;
+            }
+
+            /* try a new scalefactor conbination on cod_info_w */
+            if (balance_noise(gfp, &cod_info_w, distort, xrpow, bRefine) == 0)
+                break;
+            if (cod_info_w.scalefac_scale)
+                maxggain = 254;
+
+            /* inner_loop starts with the initial quantization step computed above
+             * and slowly increases until the bits < huff_bits.
+             * Thus it is important not to start with too large of an inital
+             * quantization step.  Too small is ok, but inner_loop will take longer
+             */
+            huff_bits = targ_bits - cod_info_w.part2_length;
+            if (huff_bits <= 0)
+                break;
+
+            /*  increase quantizer stepsize until needed bits are below maximum
+             */
+            while ((cod_info_w.part2_3_length
+                    = count_bits(gfc, xrpow, &cod_info_w, &prev_noise)) > huff_bits
+                   && cod_info_w.global_gain <= maxggain)
+                cod_info_w.global_gain++;
+
+            if (cod_info_w.global_gain > maxggain)
+                break;
+
+            if (best_noise_info.over_count == 0) {
+
+                while ((cod_info_w.part2_3_length
+                        = count_bits(gfc, xrpow, &cod_info_w, &prev_noise)) > best_part2_3_length
+                       && cod_info_w.global_gain <= maxggain)
+                    cod_info_w.global_gain++;
+
+                if (cod_info_w.global_gain > maxggain)
+                    break;
+            }
+
+            /* compute the distortion in this quantization */
+            (void) calc_noise(&cod_info_w, l3_xmin, distort, &noise_info, &prev_noise);
+            noise_info.bits = cod_info_w.part2_3_length;
+
+            /* check if this quantization is better
+             * than our saved quantization */
+            if (cod_info->block_type != SHORT_TYPE) /* NORM, START or STOP type */
+                better = gfp->quant_comp;
+            else
+                better = gfp->quant_comp_short;
+
+
+            better = quant_compare(better, &best_noise_info, &noise_info, &cod_info_w, distort);
+
+
+            /* save data so we can restore this quantization later */
+            if (better) {
+                best_part2_3_length = cod_info->part2_3_length;
+                best_noise_info = noise_info;
+                *cod_info = cod_info_w;
+                age = 0;
+                /* save data so we can restore this quantization later */
+                /*if (gfp->VBR == vbr_rh || gfp->VBR == vbr_mtrh) */  {
+                    /* store for later reuse */
+                    memcpy(save_xrpow, xrpow, sizeof(FLOAT) * 576);
+                }
+            }
+            else {
+                /* early stop? */
+                if (gfc->full_outer_loop == 0) {
+                    if (++age > search_limit && best_noise_info.over_count == 0)
+                        break;
+                    if ((gfc->noise_shaping_amp == 3) && bRefine && age > 30)
+                        break;
+                    if ((gfc->noise_shaping_amp == 3) && bRefine &&
+                        (cod_info_w.global_gain - best_ggain_pass1) > 15)
+                        break;
+                }
+            }
+        }
+        while ((cod_info_w.global_gain + cod_info_w.scalefac_scale) < 255);
+
+        if (gfc->noise_shaping_amp == 3) {
+            if (!bRefine) {
+                /* refine search */
+                cod_info_w = *cod_info;
+                memcpy(xrpow, save_xrpow, sizeof(FLOAT) * 576);
+                age = 0;
+                best_ggain_pass1 = cod_info_w.global_gain;
+
+                bRefine = 1;
+            }
+            else {
+                /* search already refined, stop */
+                bEndOfSearch = 1;
+            }
+
+        }
+        else {
+            bEndOfSearch = 1;
+        }
+    }
+
+    assert((cod_info->global_gain + cod_info->scalefac_scale) <= 255);
+    /*  finish up
+     */
+    if (gfp->VBR == vbr_rh || gfp->VBR == vbr_mtrh)
+        /* restore for reuse on next try */
+        memcpy(xrpow, save_xrpow, sizeof(FLOAT) * 576);
+    /*  do the 'substep shaping'
+     */
+    else if (gfc->substep_shaping & 1)
+        trancate_smallspectrums(gfc, cod_info, l3_xmin, xrpow);
+
+    return best_noise_info.over_count;
+}
+
+
+
+
+
+/************************************************************************
+ *
+ *      iteration_finish_one()
+ *
+ *  Robert Hegemann 2000-09-06
+ *
+ *  update reservoir status after FINAL quantization/bitrate
+ *
+ ************************************************************************/
+
+static void
+iteration_finish_one(lame_internal_flags * gfc, int gr, int ch)
+{
+    III_side_info_t *const l3_side = &gfc->l3_side;
+    gr_info *const cod_info = &l3_side->tt[gr][ch];
+
+    /*  try some better scalefac storage
+     */
+    best_scalefac_store(gfc, gr, ch, l3_side);
+
+    /*  best huffman_divide may save some bits too
+     */
+    if (gfc->use_best_huffman == 1)
+        best_huffman_divide(gfc, cod_info);
+
+    /*  update reservoir status after FINAL quantization/bitrate
+     */
+    ResvAdjust(gfc, cod_info);
+}
+
+
+
+/*********************************************************************
+ *
+ *      VBR_encode_granule()
+ *
+ *  2000-09-04 Robert Hegemann
+ *
+ *********************************************************************/
+
+static void
+VBR_encode_granule(lame_global_flags const *gfp, gr_info * const cod_info, const FLOAT * const l3_xmin, /* allowed distortion of the scalefactor */
+                   FLOAT xrpow[576], /* coloured magnitudes of spectral values */
+                   const int ch, int min_bits, int max_bits)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    gr_info bst_cod_info;
+    FLOAT   bst_xrpow[576];
+    int const Max_bits = max_bits;
+    int     real_bits = max_bits + 1;
+    int     this_bits = (max_bits + min_bits) / 2;
+    int     dbits, over, found = 0;
+    int const sfb21_extra = gfc->sfb21_extra;
+
+    assert(Max_bits <= MAX_BITS_PER_CHANNEL);
+    memset(bst_cod_info.l3_enc, 0, sizeof(bst_cod_info.l3_enc));
+
+    /*  search within round about 40 bits of optimal
+     */
+    do {
+        assert(this_bits >= min_bits);
+        assert(this_bits <= max_bits);
+        assert(min_bits <= max_bits);
+
+        if (this_bits > Max_bits - 42)
+            gfc->sfb21_extra = 0;
+        else
+            gfc->sfb21_extra = sfb21_extra;
+
+        over = outer_loop(gfp, cod_info, l3_xmin, xrpow, ch, this_bits);
+
+        /*  is quantization as good as we are looking for ?
+         *  in this case: is no scalefactor band distorted?
+         */
+        if (over <= 0) {
+            found = 1;
+            /*  now we know it can be done with "real_bits"
+             *  and maybe we can skip some iterations
+             */
+            real_bits = cod_info->part2_3_length;
+
+            /*  store best quantization so far
+             */
+            bst_cod_info = *cod_info;
+            memcpy(bst_xrpow, xrpow, sizeof(FLOAT) * 576);
+
+            /*  try with fewer bits
+             */
+            max_bits = real_bits - 32;
+            dbits = max_bits - min_bits;
+            this_bits = (max_bits + min_bits) / 2;
+        }
+        else {
+            /*  try with more bits
+             */
+            min_bits = this_bits + 32;
+            dbits = max_bits - min_bits;
+            this_bits = (max_bits + min_bits) / 2;
+
+            if (found) {
+                found = 2;
+                /*  start again with best quantization so far
+                 */
+                *cod_info = bst_cod_info;
+                memcpy(xrpow, bst_xrpow, sizeof(FLOAT) * 576);
+            }
+        }
+    } while (dbits > 12);
+
+    gfc->sfb21_extra = sfb21_extra;
+
+    /*  found=0 => nothing found, use last one
+     *  found=1 => we just found the best and left the loop
+     *  found=2 => we restored a good one and have now l3_enc to restore too
+     */
+    if (found == 2) {
+        memcpy(cod_info->l3_enc, bst_cod_info.l3_enc, sizeof(int) * 576);
+    }
+    assert(cod_info->part2_3_length <= Max_bits);
+
+}
+
+
+
+/************************************************************************
+ *
+ *      get_framebits()
+ *
+ *  Robert Hegemann 2000-09-05
+ *
+ *  calculates
+ *  * how many bits are available for analog silent granules
+ *  * how many bits to use for the lowest allowed bitrate
+ *  * how many bits each bitrate would provide
+ *
+ ************************************************************************/
+
+static void
+get_framebits(lame_global_flags const *gfp, int frameBits[15])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     bitsPerFrame, i;
+
+    /*  always use at least this many bits per granule per channel
+     *  unless we detect analog silence, see below
+     */
+    gfc->bitrate_index = gfc->VBR_min_bitrate;
+    bitsPerFrame = getframebits(gfp);
+
+    /*  bits for analog silence
+     */
+    gfc->bitrate_index = 1;
+    bitsPerFrame = getframebits(gfp);
+
+    for (i = 1; i <= gfc->VBR_max_bitrate; i++) {
+        gfc->bitrate_index = i;
+        frameBits[i] = ResvFrameBegin(gfp, &bitsPerFrame);
+    }
+}
+
+
+
+/*********************************************************************
+ *
+ *      VBR_prepare()
+ *
+ *  2000-09-04 Robert Hegemann
+ *
+ *  * converts LR to MS coding when necessary
+ *  * calculates allowed/adjusted quantization noise amounts
+ *  * detects analog silent frames
+ *
+ *  some remarks:
+ *  - lower masking depending on Quality setting
+ *  - quality control together with adjusted ATH MDCT scaling
+ *    on lower quality setting allocate more noise from
+ *    ATH masking, and on higher quality setting allocate
+ *    less noise from ATH masking.
+ *  - experiments show that going more than 2dB over GPSYCHO's
+ *    limits ends up in very annoying artefacts
+ *
+ *********************************************************************/
+
+/* RH: this one needs to be overhauled sometime */
+
+static int
+VBR_old_prepare(lame_global_flags const *gfp,
+                FLOAT pe[2][2], FLOAT const ms_ener_ratio[2],
+                III_psy_ratio ratio[2][2],
+                FLOAT l3_xmin[2][2][SFBMAX],
+                int frameBits[16], int min_bits[2][2], int max_bits[2][2], int bands[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+
+    FLOAT   masking_lower_db, adjust = 0.0;
+    int     gr, ch;
+    int     analog_silence = 1;
+    int     avg, mxb, bits = 0;
+
+    gfc->bitrate_index = gfc->VBR_max_bitrate;
+    avg = ResvFrameBegin(gfp, &avg) / gfc->mode_gr;
+
+    get_framebits(gfp, frameBits);
+
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        mxb = on_pe(gfp, pe, max_bits[gr], avg, gr, 0);
+        if (gfc->mode_ext == MPG_MD_MS_LR) {
+            ms_convert(&gfc->l3_side, gr);
+            reduce_side(max_bits[gr], ms_ener_ratio[gr], avg, mxb);
+        }
+        for (ch = 0; ch < gfc->channels_out; ++ch) {
+            gr_info *const cod_info = &gfc->l3_side.tt[gr][ch];
+
+            if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type */
+                adjust = 1.28 / (1 + exp(3.5 - pe[gr][ch] / 300.)) - 0.05;
+                masking_lower_db = gfc->PSY->mask_adjust - adjust;
+            }
+            else {
+                adjust = 2.56 / (1 + exp(3.5 - pe[gr][ch] / 300.)) - 0.14;
+                masking_lower_db = gfc->PSY->mask_adjust_short - adjust;
+            }
+            gfc->masking_lower = pow(10.0, masking_lower_db * 0.1);
+
+            init_outer_loop(gfc, cod_info);
+            bands[gr][ch] = calc_xmin(gfp, &ratio[gr][ch], cod_info, l3_xmin[gr][ch]);
+            if (bands[gr][ch])
+                analog_silence = 0;
+
+            min_bits[gr][ch] = 126;
+
+            bits += max_bits[gr][ch];
+        }
+    }
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            if (bits > frameBits[gfc->VBR_max_bitrate]) {
+                max_bits[gr][ch] *= frameBits[gfc->VBR_max_bitrate];
+                max_bits[gr][ch] /= bits;
+            }
+            if (min_bits[gr][ch] > max_bits[gr][ch])
+                min_bits[gr][ch] = max_bits[gr][ch];
+
+        }               /* for ch */
+    }                   /* for gr */
+
+    return analog_silence;
+}
+
+static void
+bitpressure_strategy(lame_internal_flags const *gfc,
+                     FLOAT l3_xmin[2][2][SFBMAX], int min_bits[2][2], int max_bits[2][2])
+{
+    int     gr, ch, sfb;
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            gr_info const *const gi = &gfc->l3_side.tt[gr][ch];
+            FLOAT  *pxmin = l3_xmin[gr][ch];
+            for (sfb = 0; sfb < gi->psy_lmax; sfb++)
+                *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_l / SBMAX_l;
+
+            if (gi->block_type == SHORT_TYPE) {
+                for (sfb = gi->sfb_smin; sfb < SBMAX_s; sfb++) {
+                    *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_s / SBMAX_s;
+                    *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_s / SBMAX_s;
+                    *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_s / SBMAX_s;
+                }
+            }
+            max_bits[gr][ch] = Max(min_bits[gr][ch], 0.9 * max_bits[gr][ch]);
+        }
+    }
+}
+
+/************************************************************************
+ *
+ *      VBR_iteration_loop()
+ *
+ *  tries to find out how many bits are needed for each granule and channel
+ *  to get an acceptable quantization. An appropriate bitrate will then be
+ *  choosed for quantization.  rh 8/99
+ *
+ *  Robert Hegemann 2000-09-06 rewrite
+ *
+ ************************************************************************/
+
+void
+VBR_old_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                       FLOAT ms_ener_ratio[2], III_psy_ratio ratio[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    FLOAT   l3_xmin[2][2][SFBMAX];
+
+    FLOAT   xrpow[576];
+    int     bands[2][2];
+    int     frameBits[15];
+    int     used_bits;
+    int     bits;
+    int     min_bits[2][2], max_bits[2][2];
+    int     mean_bits;
+    int     ch, gr, analog_silence;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+
+    analog_silence = VBR_old_prepare(gfp, pe, ms_ener_ratio, ratio,
+                                     l3_xmin, frameBits, min_bits, max_bits, bands);
+
+    /*---------------------------------*/
+    for (;;) {
+
+        /*  quantize granules with lowest possible number of bits
+         */
+
+        used_bits = 0;
+
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                int     ret;
+                gr_info *const cod_info = &l3_side->tt[gr][ch];
+
+                /*  init_outer_loop sets up cod_info, scalefac and xrpow
+                 */
+                ret = init_xrpow(gfc, cod_info, xrpow);
+                if (ret == 0 || max_bits[gr][ch] == 0) {
+                    /*  xr contains no energy
+                     *  l3_enc, our encoding data, will be quantized to zero
+                     */
+                    continue; /* with next channel */
+                }
+
+                VBR_encode_granule(gfp, cod_info, l3_xmin[gr][ch], xrpow,
+                                   ch, min_bits[gr][ch], max_bits[gr][ch]);
+
+                /*  do the 'substep shaping'
+                 */
+                if (gfc->substep_shaping & 1) {
+                    trancate_smallspectrums(gfc, &l3_side->tt[gr][ch], l3_xmin[gr][ch], xrpow);
+                }
+
+                ret = cod_info->part2_3_length + cod_info->part2_length;
+                used_bits += ret;
+            }           /* for ch */
+        }               /* for gr */
+
+        /*  find lowest bitrate able to hold used bits
+         */
+        if (analog_silence && !gfp->VBR_hard_min)
+            /*  we detected analog silence and the user did not specify
+             *  any hard framesize limit, so start with smallest possible frame
+             */
+            gfc->bitrate_index = 1;
+        else
+            gfc->bitrate_index = gfc->VBR_min_bitrate;
+
+        for (; gfc->bitrate_index < gfc->VBR_max_bitrate; gfc->bitrate_index++) {
+            if (used_bits <= frameBits[gfc->bitrate_index])
+                break;
+        }
+        bits = ResvFrameBegin(gfp, &mean_bits);
+
+        if (used_bits <= bits)
+            break;
+
+        bitpressure_strategy(gfc, l3_xmin, min_bits, max_bits);
+
+    }                   /* breaks adjusted */
+    /*--------------------------------------*/
+
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            iteration_finish_one(gfc, gr, ch);
+        }               /* for ch */
+    }                   /* for gr */
+    ResvFrameEnd(gfc, mean_bits);
+}
+
+
+
+static int
+VBR_new_prepare(lame_global_flags const *gfp,
+                FLOAT pe[2][2], III_psy_ratio ratio[2][2],
+                FLOAT l3_xmin[2][2][SFBMAX], int frameBits[16], int max_bits[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+
+    int     gr, ch;
+    int     analog_silence = 1;
+    int     avg, bits = 0;
+    int     maximum_framebits;
+
+    if (!gfp->free_format) {
+        gfc->bitrate_index = gfc->VBR_max_bitrate;
+        (void) ResvFrameBegin(gfp, &avg);
+
+        get_framebits(gfp, frameBits);
+        maximum_framebits = frameBits[gfc->VBR_max_bitrate];
+    }
+    else {
+        gfc->bitrate_index = 0;
+        maximum_framebits = ResvFrameBegin(gfp, &avg);
+        frameBits[0] = maximum_framebits;
+    }
+
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        (void) on_pe(gfp, pe, max_bits[gr], avg, gr, 0);
+        if (gfc->mode_ext == MPG_MD_MS_LR) {
+            ms_convert(&gfc->l3_side, gr);
+        }
+        for (ch = 0; ch < gfc->channels_out; ++ch) {
+            gr_info *const cod_info = &gfc->l3_side.tt[gr][ch];
+
+            gfc->masking_lower = pow(10.0, gfc->PSY->mask_adjust * 0.1);
+
+            init_outer_loop(gfc, cod_info);
+            if (0 != calc_xmin(gfp, &ratio[gr][ch], cod_info, l3_xmin[gr][ch]))
+                analog_silence = 0;
+
+            bits += max_bits[gr][ch];
+        }
+    }
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            if (bits > maximum_framebits) {
+                max_bits[gr][ch] *= maximum_framebits;
+                max_bits[gr][ch] /= bits;
+            }
+
+        }               /* for ch */
+    }                   /* for gr */
+
+    return analog_silence;
+}
+
+
+#if 0
+static int
+getFramesizeInBytesPerSecond(lame_global_flags const *gfp, int bits_used)
+{
+    lame_internal_flags const *gfc = gfp->internal_flags;
+    int const tmp = (gfp->version == 0) ? 72 : 144;
+    int const bytes_used = (bits_used + 7) / 8;
+    int const bytes_per_second =
+        (gfp->out_samplerate * (bytes_used + gfc->sideinfo_len) + (tmp - 1)) / tmp;
+    return bytes_per_second;
+}
+
+static int
+getFramesize_kbps(lame_global_flags const *gfp, int bits_used)
+{
+    int const bytes_per_second = getFramesizeInBytesPerSecond(gfp, bits_used);
+    int const kbps = (bytes_per_second + 999) / 1000;
+    return kbps;
+}
+#endif
+
+
+void
+VBR_new_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                       FLOAT ms_ener_ratio[2], III_psy_ratio ratio[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    FLOAT   l3_xmin[2][2][SFBMAX];
+
+    FLOAT   xrpow[2][2][576];
+    int     frameBits[15];
+    int     used_bits;
+    int     max_bits[2][2];
+    int     ch, gr, analog_silence;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+
+    (void) ms_ener_ratio; /* not used */
+
+    analog_silence = VBR_new_prepare(gfp, pe, ratio, l3_xmin, frameBits, max_bits);
+
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            gr_info *const cod_info = &l3_side->tt[gr][ch];
+
+            /*  init_outer_loop sets up cod_info, scalefac and xrpow
+             */
+            if (0 == init_xrpow(gfc, cod_info, xrpow[gr][ch])) {
+                max_bits[gr][ch] = 0; /* silent granule needs no bits */
+            }
+        }               /* for ch */
+    }                   /* for gr */
+
+    /*  quantize granules with lowest possible number of bits
+     */
+
+    used_bits = VBR_encode_frame(gfc, xrpow, l3_xmin, max_bits);
+
+    if (!gfp->free_format) {
+        /*  find lowest bitrate able to hold used bits
+         */
+        if (analog_silence && !gfp->VBR_hard_min) {
+            /*  we detected analog silence and the user did not specify
+             *  any hard framesize limit, so start with smallest possible frame
+             */
+            gfc->bitrate_index = 1;
+        }
+        else {
+            gfc->bitrate_index = gfc->VBR_min_bitrate;
+        }
+
+        for (; gfc->bitrate_index < gfc->VBR_max_bitrate; gfc->bitrate_index++) {
+            if (used_bits <= frameBits[gfc->bitrate_index])
+                break;
+        }
+        if (gfc->bitrate_index > gfc->VBR_max_bitrate) {
+            gfc->bitrate_index = gfc->VBR_max_bitrate;
+        }
+    }
+    else {
+#if 0
+        static int mmm = 0;
+        int     fff = getFramesize_kbps(gfp, used_bits);
+        int     hhh = getFramesize_kbps(gfp, MAX_BITS_PER_GRANULE * gfc->mode_gr);
+        if (mmm < fff)
+            mmm = fff;
+        printf("demand=%3d kbps  max=%3d kbps   limit=%3d kbps\n", fff, mmm, hhh);
+#endif
+        gfc->bitrate_index = 0;
+    }
+    if (used_bits <= frameBits[gfc->bitrate_index]) {
+        /* update Reservoire status */
+        int     mean_bits, fullframebits;
+        fullframebits = ResvFrameBegin(gfp, &mean_bits);
+        assert(used_bits <= fullframebits);
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                gr_info const *const cod_info = &l3_side->tt[gr][ch];
+                ResvAdjust(gfc, cod_info);
+            }
+        }
+        ResvFrameEnd(gfc, mean_bits);
+    }
+    else {
+        /* SHOULD NOT HAPPEN INTERNAL ERROR
+         */
+        ERRORF(gfc, "INTERNAL ERROR IN VBR NEW CODE, please send bug report\n");
+        exit(-1);
+    }
+}
+
+
+
+
+
+/********************************************************************
+ *
+ *  calc_target_bits()
+ *
+ *  calculates target bits for ABR encoding
+ *
+ *  mt 2000/05/31
+ *
+ ********************************************************************/
+
+static void
+calc_target_bits(lame_global_flags const *gfp,
+                 FLOAT pe[2][2],
+                 FLOAT const ms_ener_ratio[2],
+                 int targ_bits[2][2], int *analog_silence_bits, int *max_frame_bits)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    III_side_info_t const *const l3_side = &gfc->l3_side;
+    FLOAT   res_factor;
+    int     gr, ch, totbits, mean_bits;
+
+    gfc->bitrate_index = gfc->VBR_max_bitrate;
+    *max_frame_bits = ResvFrameBegin(gfp, &mean_bits);
+
+    gfc->bitrate_index = 1;
+    mean_bits = getframebits(gfp) - gfc->sideinfo_len * 8;
+    *analog_silence_bits = mean_bits / (gfc->mode_gr * gfc->channels_out);
+
+    mean_bits = gfp->VBR_mean_bitrate_kbps * gfp->framesize * 1000;
+    if (gfc->substep_shaping & 1)
+        mean_bits *= 1.09;
+    mean_bits /= gfp->out_samplerate;
+    mean_bits -= gfc->sideinfo_len * 8;
+    mean_bits /= (gfc->mode_gr * gfc->channels_out);
+
+    /*
+       res_factor is the percentage of the target bitrate that should
+       be used on average.  the remaining bits are added to the
+       bitreservoir and used for difficult to encode frames.
+
+       Since we are tracking the average bitrate, we should adjust
+       res_factor "on the fly", increasing it if the average bitrate
+       is greater than the requested bitrate, and decreasing it
+       otherwise.  Reasonable ranges are from .9 to 1.0
+
+       Until we get the above suggestion working, we use the following
+       tuning:
+       compression ratio    res_factor
+       5.5  (256kbps)         1.0      no need for bitreservoir
+       11   (128kbps)         .93      7% held for reservoir
+
+       with linear interpolation for other values.
+
+     */
+    res_factor = .93 + .07 * (11.0 - gfp->compression_ratio) / (11.0 - 5.5);
+    if (res_factor < .90)
+        res_factor = .90;
+    if (res_factor > 1.00)
+        res_factor = 1.00;
+
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        int     sum = 0;
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            targ_bits[gr][ch] = res_factor * mean_bits;
+
+            if (pe[gr][ch] > 700) {
+                int     add_bits = (pe[gr][ch] - 700) / 1.4;
+
+                gr_info const *const cod_info = &l3_side->tt[gr][ch];
+                targ_bits[gr][ch] = res_factor * mean_bits;
+
+                /* short blocks use a little extra, no matter what the pe */
+                if (cod_info->block_type == SHORT_TYPE) {
+                    if (add_bits < mean_bits / 2)
+                        add_bits = mean_bits / 2;
+                }
+                /* at most increase bits by 1.5*average */
+                if (add_bits > mean_bits * 3 / 2)
+                    add_bits = mean_bits * 3 / 2;
+                else if (add_bits < 0)
+                    add_bits = 0;
+
+                targ_bits[gr][ch] += add_bits;
+            }
+            if (targ_bits[gr][ch] > MAX_BITS_PER_CHANNEL) {
+                targ_bits[gr][ch] = MAX_BITS_PER_CHANNEL;
+            }
+            sum += targ_bits[gr][ch];
+        }               /* for ch */
+        if (sum > MAX_BITS_PER_GRANULE) {
+            for (ch = 0; ch < gfc->channels_out; ++ch) {
+                targ_bits[gr][ch] *= MAX_BITS_PER_GRANULE;
+                targ_bits[gr][ch] /= sum;
+            }
+        }
+    }                   /* for gr */
+
+    if (gfc->mode_ext == MPG_MD_MS_LR)
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            reduce_side(targ_bits[gr], ms_ener_ratio[gr], mean_bits * gfc->channels_out,
+                        MAX_BITS_PER_GRANULE);
+        }
+
+    /*  sum target bits
+     */
+    totbits = 0;
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            if (targ_bits[gr][ch] > MAX_BITS_PER_CHANNEL)
+                targ_bits[gr][ch] = MAX_BITS_PER_CHANNEL;
+            totbits += targ_bits[gr][ch];
+        }
+    }
+
+    /*  repartion target bits if needed
+     */
+    if (totbits > *max_frame_bits) {
+        for (gr = 0; gr < gfc->mode_gr; gr++) {
+            for (ch = 0; ch < gfc->channels_out; ch++) {
+                targ_bits[gr][ch] *= *max_frame_bits;
+                targ_bits[gr][ch] /= totbits;
+            }
+        }
+    }
+}
+
+
+
+
+
+
+/********************************************************************
+ *
+ *  ABR_iteration_loop()
+ *
+ *  encode a frame with a disired average bitrate
+ *
+ *  mt 2000/05/31
+ *
+ ********************************************************************/
+
+void
+ABR_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                   FLOAT ms_ener_ratio[2], III_psy_ratio ratio[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    FLOAT   l3_xmin[SFBMAX];
+    FLOAT   xrpow[576];
+    int     targ_bits[2][2];
+    int     mean_bits, max_frame_bits;
+    int     ch, gr, ath_over;
+    int     analog_silence_bits;
+    gr_info *cod_info;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+
+    mean_bits = 0;
+
+    calc_target_bits(gfp, pe, ms_ener_ratio, targ_bits, &analog_silence_bits, &max_frame_bits);
+
+    /*  encode granules
+     */
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+
+        if (gfc->mode_ext == MPG_MD_MS_LR) {
+            ms_convert(&gfc->l3_side, gr);
+        }
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            FLOAT   adjust, masking_lower_db;
+            cod_info = &l3_side->tt[gr][ch];
+
+            if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type */
+                /* adjust = 1.28/(1+exp(3.5-pe[gr][ch]/300.))-0.05; */
+                adjust = 0;
+                masking_lower_db = gfc->PSY->mask_adjust - adjust;
+            }
+            else {
+                /* adjust = 2.56/(1+exp(3.5-pe[gr][ch]/300.))-0.14; */
+                adjust = 0;
+                masking_lower_db = gfc->PSY->mask_adjust_short - adjust;
+            }
+            gfc->masking_lower = pow(10.0, masking_lower_db * 0.1);
+
+
+            /*  cod_info, scalefac and xrpow get initialized in init_outer_loop
+             */
+            init_outer_loop(gfc, cod_info);
+            if (init_xrpow(gfc, cod_info, xrpow)) {
+                /*  xr contains energy we will have to encode
+                 *  calculate the masking abilities
+                 *  find some good quantization in outer_loop
+                 */
+                ath_over = calc_xmin(gfp, &ratio[gr][ch], cod_info, l3_xmin);
+                if (0 == ath_over) /* analog silence */
+                    targ_bits[gr][ch] = analog_silence_bits;
+
+                (void) outer_loop(gfp, cod_info, l3_xmin, xrpow, ch, targ_bits[gr][ch]);
+            }
+            iteration_finish_one(gfc, gr, ch);
+        }               /* ch */
+    }                   /* gr */
+
+    /*  find a bitrate which can refill the resevoir to positive size.
+     */
+    for (gfc->bitrate_index = gfc->VBR_min_bitrate;
+         gfc->bitrate_index <= gfc->VBR_max_bitrate; gfc->bitrate_index++) {
+        if (ResvFrameBegin(gfp, &mean_bits) >= 0)
+            break;
+    }
+    assert(gfc->bitrate_index <= gfc->VBR_max_bitrate);
+
+    ResvFrameEnd(gfc, mean_bits);
+}
+
+
+
+
+
+
+/************************************************************************
+ *
+ *      CBR_iteration_loop()
+ *
+ *  author/date??
+ *
+ *  encodes one frame of MP3 data with constant bitrate
+ *
+ ************************************************************************/
+
+void
+CBR_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                   FLOAT ms_ener_ratio[2], III_psy_ratio ratio[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    FLOAT   l3_xmin[SFBMAX];
+    FLOAT   xrpow[576];
+    int     targ_bits[2];
+    int     mean_bits, max_bits;
+    int     gr, ch;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+    gr_info *cod_info;
+
+    (void) ResvFrameBegin(gfp, &mean_bits);
+
+    /* quantize! */
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+
+        /*  calculate needed bits
+         */
+        max_bits = on_pe(gfp, pe, targ_bits, mean_bits, gr, gr);
+
+        if (gfc->mode_ext == MPG_MD_MS_LR) {
+            ms_convert(&gfc->l3_side, gr);
+            reduce_side(targ_bits, ms_ener_ratio[gr], mean_bits, max_bits);
+        }
+
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            FLOAT   adjust, masking_lower_db;
+            cod_info = &l3_side->tt[gr][ch];
+
+            if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type */
+                /* adjust = 1.28/(1+exp(3.5-pe[gr][ch]/300.))-0.05; */
+                adjust = 0;
+                masking_lower_db = gfc->PSY->mask_adjust - adjust;
+            }
+            else {
+                /* adjust = 2.56/(1+exp(3.5-pe[gr][ch]/300.))-0.14; */
+                adjust = 0;
+                masking_lower_db = gfc->PSY->mask_adjust_short - adjust;
+            }
+            gfc->masking_lower = pow(10.0, masking_lower_db * 0.1);
+
+            /*  init_outer_loop sets up cod_info, scalefac and xrpow
+             */
+            init_outer_loop(gfc, cod_info);
+            if (init_xrpow(gfc, cod_info, xrpow)) {
+                /*  xr contains energy we will have to encode
+                 *  calculate the masking abilities
+                 *  find some good quantization in outer_loop
+                 */
+                (void) calc_xmin(gfp, &ratio[gr][ch], cod_info, l3_xmin);
+                (void) outer_loop(gfp, cod_info, l3_xmin, xrpow, ch, targ_bits[ch]);
+            }
+
+            iteration_finish_one(gfc, gr, ch);
+            assert(cod_info->part2_3_length <= MAX_BITS_PER_CHANNEL);
+            assert(cod_info->part2_3_length <= targ_bits[ch]);
+        }               /* for ch */
+    }                   /* for gr */
+
+    ResvFrameEnd(gfc, mean_bits);
+}
diff --git a/libmp3lame/quantize.h b/libmp3lame/quantize.h
new file mode 100644
index 0000000..7bd9199
--- /dev/null
+++ b/libmp3lame/quantize.h
@@ -0,0 +1,41 @@
+/*
+ * MP3 quantization
+ *
+ * Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_QUANTIZE_H
+#define LAME_QUANTIZE_H
+
+void    trancate_smallspectrums(lame_internal_flags const * gfc, gr_info * const gi,
+                                const FLOAT * const l3_xmin, FLOAT * const work);
+
+void    CBR_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                           FLOAT ms_ratio[2], III_psy_ratio ratio[2][2]);
+
+void    VBR_old_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                               FLOAT ms_ratio[2], III_psy_ratio ratio[2][2]);
+
+void    VBR_new_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                               FLOAT ms_ratio[2], III_psy_ratio ratio[2][2]);
+
+void    ABR_iteration_loop(lame_global_flags const *gfp, FLOAT pe[2][2],
+                           FLOAT ms_ratio[2], III_psy_ratio ratio[2][2]);
+
+
+#endif /* LAME_QUANTIZE_H */
diff --git a/libmp3lame/quantize_pvt.c b/libmp3lame/quantize_pvt.c
new file mode 100644
index 0000000..39680f9
--- /dev/null
+++ b/libmp3lame/quantize_pvt.c
@@ -0,0 +1,1067 @@
+/*
+ *      quantize_pvt source file
+ *
+ *      Copyright (c) 1999-2002 Takehiro Tominaga
+ *      Copyright (c) 2000-2002 Robert Hegemann
+ *      Copyright (c) 2001 Naoki Shibata
+ *      Copyright (c) 2002-2005 Gabriel Bouvigne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: quantize_pvt.c,v 1.153.2.2 2009/01/18 15:44:28 robert Exp $ */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "quantize_pvt.h"
+#include "lame_global_flags.h"
+#include "reservoir.h"
+#include "lame-analysis.h"
+#include <float.h>
+
+
+#define NSATHSCALE 100  /* Assuming dynamic range=96dB, this value should be 92 */
+
+/*
+  The following table is used to implement the scalefactor
+  partitioning for MPEG2 as described in section
+  2.4.3.2 of the IS. The indexing corresponds to the
+  way the tables are presented in the IS:
+
+  [table_number][row_in_table][column of nr_of_sfb]
+*/
+const int nr_of_sfb_block[6][3][4] = {
+    {
+     {6, 5, 5, 5},
+     {9, 9, 9, 9},
+     {6, 9, 9, 9}
+     },
+    {
+     {6, 5, 7, 3},
+     {9, 9, 12, 6},
+     {6, 9, 12, 6}
+     },
+    {
+     {11, 10, 0, 0},
+     {18, 18, 0, 0},
+     {15, 18, 0, 0}
+     },
+    {
+     {7, 7, 7, 0},
+     {12, 12, 12, 0},
+     {6, 15, 12, 0}
+     },
+    {
+     {6, 6, 6, 3},
+     {12, 9, 9, 6},
+     {6, 12, 9, 6}
+     },
+    {
+     {8, 8, 5, 0},
+     {15, 12, 9, 0},
+     {6, 18, 9, 0}
+     }
+};
+
+
+/* Table B.6: layer3 preemphasis */
+const int pretab[SBMAX_l] = {
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
+};
+
+/*
+  Here are MPEG1 Table B.8 and MPEG2 Table B.1
+  -- Layer III scalefactor bands. 
+  Index into this using a method such as:
+    idx  = fr_ps->header->sampling_frequency
+           + (fr_ps->header->version * 3)
+*/
+
+
+const scalefac_struct sfBandIndex[9] = {
+    {                   /* Table B.2.b: 22.05 kHz */
+     {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464,
+      522, 576},
+     {0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* Table B.2.c: 24 kHz */ /* docs: 332. mpg123(broken): 330 */
+     {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 332, 394, 464,
+      540, 576},
+     {0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* Table B.2.a: 16 kHz */
+     {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464,
+      522, 576},
+     {0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* Table B.8.b: 44.1 kHz */
+     {0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342, 418,
+      576},
+     {0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* Table B.8.c: 48 kHz */
+     {0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330, 384,
+      576},
+     {0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* Table B.8.a: 32 kHz */
+     {0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448, 550,
+      576},
+     {0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* MPEG-2.5 11.025 kHz */
+     {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464,
+      522, 576},
+     {0 / 3, 12 / 3, 24 / 3, 36 / 3, 54 / 3, 78 / 3, 108 / 3, 144 / 3, 186 / 3, 240 / 3, 312 / 3,
+      402 / 3, 522 / 3, 576 / 3}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* MPEG-2.5 12 kHz */
+     {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464,
+      522, 576},
+     {0 / 3, 12 / 3, 24 / 3, 36 / 3, 54 / 3, 78 / 3, 108 / 3, 144 / 3, 186 / 3, 240 / 3, 312 / 3,
+      402 / 3, 522 / 3, 576 / 3}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     },
+    {                   /* MPEG-2.5 8 kHz */
+     {0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570,
+      572, 574, 576},
+     {0 / 3, 24 / 3, 48 / 3, 72 / 3, 108 / 3, 156 / 3, 216 / 3, 288 / 3, 372 / 3, 480 / 3, 486 / 3,
+      492 / 3, 498 / 3, 576 / 3}
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb21 pseudo sub bands */
+     , {0, 0, 0, 0, 0, 0, 0} /*  sfb12 pseudo sub bands */
+     }
+};
+
+
+
+FLOAT   pow20[Q_MAX + Q_MAX2 + 1];
+FLOAT   ipow20[Q_MAX];
+FLOAT   pow43[PRECALC_SIZE];
+/* initialized in first call to iteration_init */
+#ifdef TAKEHIRO_IEEE754_HACK
+FLOAT   adj43asm[PRECALC_SIZE];
+#else
+FLOAT   adj43[PRECALC_SIZE];
+#endif
+
+/* 
+compute the ATH for each scalefactor band 
+cd range:  0..96db
+
+Input:  3.3kHz signal  32767 amplitude  (3.3kHz is where ATH is smallest = -5db)
+longblocks:  sfb=12   en0/bw=-11db    max_en0 = 1.3db
+shortblocks: sfb=5           -9db              0db
+
+Input:  1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 (repeated)
+longblocks:  amp=1      sfb=12   en0/bw=-103 db      max_en0 = -92db
+            amp=32767   sfb=12           -12 db                 -1.4db 
+
+Input:  1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 (repeated)
+shortblocks: amp=1      sfb=5   en0/bw= -99                    -86 
+            amp=32767   sfb=5           -9  db                  4db 
+
+
+MAX energy of largest wave at 3.3kHz = 1db
+AVE energy of largest wave at 3.3kHz = -11db
+Let's take AVE:  -11db = maximum signal in sfb=12.  
+Dynamic range of CD: 96db.  Therefor energy of smallest audible wave 
+in sfb=12  = -11  - 96 = -107db = ATH at 3.3kHz.  
+
+ATH formula for this wave: -5db.  To adjust to LAME scaling, we need
+ATH = ATH_formula  - 103  (db)
+ATH = ATH * 2.5e-10      (ener)
+
+*/
+
+static  FLOAT
+ATHmdct(lame_global_flags const *gfp, FLOAT f)
+{
+    FLOAT   ath;
+
+    ath = ATHformula(f, gfp);
+
+    ath -= NSATHSCALE;
+
+    /* modify the MDCT scaling for the ATH and convert to energy */
+    ath = pow(10.0, ath / 10.0 + gfp->ATHlower);
+    return ath;
+}
+
+static void
+compute_ath(lame_global_flags * gfp)
+{
+    FLOAT  *const ATH_l = gfp->internal_flags->ATH->l;
+    FLOAT  *const ATH_psfb21 = gfp->internal_flags->ATH->psfb21;
+    FLOAT  *const ATH_s = gfp->internal_flags->ATH->s;
+    FLOAT  *const ATH_psfb12 = gfp->internal_flags->ATH->psfb12;
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     sfb, i, start, end;
+    FLOAT   ATH_f;
+    FLOAT const samp_freq = gfp->out_samplerate;
+
+    for (sfb = 0; sfb < SBMAX_l; sfb++) {
+        start = gfc->scalefac_band.l[sfb];
+        end = gfc->scalefac_band.l[sfb + 1];
+        ATH_l[sfb] = FLOAT_MAX;
+        for (i = start; i < end; i++) {
+            FLOAT const freq = i * samp_freq / (2 * 576);
+            ATH_f = ATHmdct(gfp, freq); /* freq in kHz */
+            ATH_l[sfb] = Min(ATH_l[sfb], ATH_f);
+        }
+    }
+
+    for (sfb = 0; sfb < PSFB21; sfb++) {
+        start = gfc->scalefac_band.psfb21[sfb];
+        end = gfc->scalefac_band.psfb21[sfb + 1];
+        ATH_psfb21[sfb] = FLOAT_MAX;
+        for (i = start; i < end; i++) {
+            FLOAT const freq = i * samp_freq / (2 * 576);
+            ATH_f = ATHmdct(gfp, freq); /* freq in kHz */
+            ATH_psfb21[sfb] = Min(ATH_psfb21[sfb], ATH_f);
+        }
+    }
+
+    for (sfb = 0; sfb < SBMAX_s; sfb++) {
+        start = gfc->scalefac_band.s[sfb];
+        end = gfc->scalefac_band.s[sfb + 1];
+        ATH_s[sfb] = FLOAT_MAX;
+        for (i = start; i < end; i++) {
+            FLOAT const freq = i * samp_freq / (2 * 192);
+            ATH_f = ATHmdct(gfp, freq); /* freq in kHz */
+            ATH_s[sfb] = Min(ATH_s[sfb], ATH_f);
+        }
+        ATH_s[sfb] *= (gfc->scalefac_band.s[sfb + 1] - gfc->scalefac_band.s[sfb]);
+    }
+
+    for (sfb = 0; sfb < PSFB12; sfb++) {
+        start = gfc->scalefac_band.psfb12[sfb];
+        end = gfc->scalefac_band.psfb12[sfb + 1];
+        ATH_psfb12[sfb] = FLOAT_MAX;
+        for (i = start; i < end; i++) {
+            FLOAT const freq = i * samp_freq / (2 * 192);
+            ATH_f = ATHmdct(gfp, freq); /* freq in kHz */
+            ATH_psfb12[sfb] = Min(ATH_psfb12[sfb], ATH_f);
+        }
+        /*not sure about the following */
+        ATH_psfb12[sfb] *= (gfc->scalefac_band.s[13] - gfc->scalefac_band.s[12]);
+    }
+
+
+    /*  no-ATH mode:
+     *  reduce ATH to -200 dB
+     */
+
+    if (gfp->noATH) {
+        for (sfb = 0; sfb < SBMAX_l; sfb++) {
+            ATH_l[sfb] = 1E-20;
+        }
+        for (sfb = 0; sfb < PSFB21; sfb++) {
+            ATH_psfb21[sfb] = 1E-20;
+        }
+        for (sfb = 0; sfb < SBMAX_s; sfb++) {
+            ATH_s[sfb] = 1E-20;
+        }
+        for (sfb = 0; sfb < PSFB12; sfb++) {
+            ATH_psfb12[sfb] = 1E-20;
+        }
+    }
+
+    /*  work in progress, don't rely on it too much
+     */
+    gfc->ATH->floor = 10. * log10(ATHmdct(gfp, -1.));
+
+    /*
+       {   FLOAT g=10000, t=1e30, x;
+       for ( f = 100; f < 10000; f++ ) {
+       x = ATHmdct( gfp, f );
+       if ( t > x ) t = x, g = f;
+       }
+       printf("min=%g\n", g);
+       } */
+}
+
+
+
+
+/************************************************************************/
+/*  initialization for iteration_loop */
+/************************************************************************/
+void
+iteration_init(lame_global_flags * gfp)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+    int     i;
+
+    if (gfc->iteration_init_init == 0) {
+        gfc->iteration_init_init = 1;
+
+        l3_side->main_data_begin = 0;
+        compute_ath(gfp);
+
+        pow43[0] = 0.0;
+        for (i = 1; i < PRECALC_SIZE; i++)
+            pow43[i] = pow((FLOAT) i, 4.0 / 3.0);
+
+#ifdef TAKEHIRO_IEEE754_HACK
+        adj43asm[0] = 0.0;
+        for (i = 1; i < PRECALC_SIZE; i++)
+            adj43asm[i] = i - 0.5 - pow(0.5 * (pow43[i - 1] + pow43[i]), 0.75);
+#else
+        for (i = 0; i < PRECALC_SIZE - 1; i++)
+            adj43[i] = (i + 1) - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75);
+        adj43[i] = 0.5;
+#endif
+        for (i = 0; i < Q_MAX; i++)
+            ipow20[i] = pow(2.0, (double) (i - 210) * -0.1875);
+        for (i = 0; i <= Q_MAX + Q_MAX2; i++)
+            pow20[i] = pow(2.0, (double) (i - 210 - Q_MAX2) * 0.25);
+
+        huffman_init(gfc);
+        init_xrpow_core_init(gfc);
+
+        {
+            FLOAT   bass, alto, treble, sfb21;
+
+            i = (gfp->exp_nspsytune >> 2) & 63;
+            if (i >= 32)
+                i -= 64;
+            bass = pow(10, i / 4.0 / 10.0);
+
+            i = (gfp->exp_nspsytune >> 8) & 63;
+            if (i >= 32)
+                i -= 64;
+            alto = pow(10, i / 4.0 / 10.0);
+
+            i = (gfp->exp_nspsytune >> 14) & 63;
+            if (i >= 32)
+                i -= 64;
+            treble = pow(10, i / 4.0 / 10.0);
+
+            /*  to be compatible with Naoki's original code, the next 6 bits
+             *  define only the amount of changing treble for sfb21 */
+            i = (gfp->exp_nspsytune >> 20) & 63;
+            if (i >= 32)
+                i -= 64;
+            sfb21 = treble * pow(10, i / 4.0 / 10.0);
+            for (i = 0; i < SBMAX_l; i++) {
+                FLOAT   f;
+                if (i <= 6)
+                    f = bass;
+                else if (i <= 13)
+                    f = alto;
+                else if (i <= 20)
+                    f = treble;
+                else
+                    f = sfb21;
+
+                gfc->nsPsy.longfact[i] = f;
+            }
+            for (i = 0; i < SBMAX_s; i++) {
+                FLOAT   f;
+                if (i <= 5)
+                    f = bass;
+                else if (i <= 10)
+                    f = alto;
+                else if (i <= 11)
+                    f = treble;
+                else
+                    f = sfb21;
+
+                gfc->nsPsy.shortfact[i] = f;
+            }
+        }
+    }
+}
+
+
+
+
+
+/************************************************************************
+ * allocate bits among 2 channels based on PE
+ * mt 6/99
+ * bugfixes rh 8/01: often allocated more than the allowed 4095 bits
+ ************************************************************************/
+int
+on_pe(lame_global_flags const *gfp, FLOAT pe[][2],
+      int targ_bits[2], int mean_bits, int gr, int cbr)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     extra_bits, tbits, bits;
+    int     add_bits[2];
+    int     max_bits;        /* maximum allowed bits for this granule */
+    int     ch;
+
+    /* allocate targ_bits for granule */
+    ResvMaxBits(gfp, mean_bits, &tbits, &extra_bits, cbr);
+    max_bits = tbits + extra_bits;
+    if (max_bits > MAX_BITS_PER_GRANULE) /* hard limit per granule */
+        max_bits = MAX_BITS_PER_GRANULE;
+
+    for (bits = 0, ch = 0; ch < gfc->channels_out; ++ch) {
+        /******************************************************************
+         * allocate bits for each channel 
+         ******************************************************************/
+        targ_bits[ch] = Min(MAX_BITS_PER_CHANNEL, tbits / gfc->channels_out);
+
+        add_bits[ch] = targ_bits[ch] * pe[gr][ch] / 700.0 - targ_bits[ch];
+
+        /* at most increase bits by 1.5*average */
+        if (add_bits[ch] > mean_bits * 3 / 4)
+            add_bits[ch] = mean_bits * 3 / 4;
+        if (add_bits[ch] < 0)
+            add_bits[ch] = 0;
+
+        if (add_bits[ch] + targ_bits[ch] > MAX_BITS_PER_CHANNEL)
+            add_bits[ch] = Max(0, MAX_BITS_PER_CHANNEL - targ_bits[ch]);
+
+        bits += add_bits[ch];
+    }
+    if (bits > extra_bits) {
+        for (ch = 0; ch < gfc->channels_out; ++ch) {
+            add_bits[ch] = extra_bits * add_bits[ch] / bits;
+        }
+    }
+
+    for (ch = 0; ch < gfc->channels_out; ++ch) {
+        targ_bits[ch] += add_bits[ch];
+        extra_bits -= add_bits[ch];
+    }
+
+    for (bits = 0, ch = 0; ch < gfc->channels_out; ++ch) {
+        bits += targ_bits[ch];
+    }
+    if (bits > MAX_BITS_PER_GRANULE) {
+        int     sum = 0;
+        for (ch = 0; ch < gfc->channels_out; ++ch) {
+            targ_bits[ch] *= MAX_BITS_PER_GRANULE;
+            targ_bits[ch] /= bits;
+            sum += targ_bits[ch];
+        }
+        assert(sum <= MAX_BITS_PER_GRANULE);
+    }
+
+    return max_bits;
+}
+
+
+
+
+void
+reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits)
+{
+    int     move_bits;
+    FLOAT   fac;
+
+    assert(max_bits <= MAX_BITS_PER_GRANULE);
+    assert(targ_bits[0] + targ_bits[1] <= MAX_BITS_PER_GRANULE);
+
+    /*  ms_ener_ratio = 0:  allocate 66/33  mid/side  fac=.33  
+     *  ms_ener_ratio =.5:  allocate 50/50 mid/side   fac= 0 */
+    /* 75/25 split is fac=.5 */
+    /* float fac = .50*(.5-ms_ener_ratio[gr])/.5; */
+    fac = .33 * (.5 - ms_ener_ratio) / .5;
+    if (fac < 0)
+        fac = 0;
+    if (fac > .5)
+        fac = .5;
+
+    /* number of bits to move from side channel to mid channel */
+    /*    move_bits = fac*targ_bits[1];  */
+    move_bits = fac * .5 * (targ_bits[0] + targ_bits[1]);
+
+    if (move_bits > MAX_BITS_PER_CHANNEL - targ_bits[0]) {
+        move_bits = MAX_BITS_PER_CHANNEL - targ_bits[0];
+    }
+    if (move_bits < 0)
+        move_bits = 0;
+
+    if (targ_bits[1] >= 125) {
+        /* dont reduce side channel below 125 bits */
+        if (targ_bits[1] - move_bits > 125) {
+
+            /* if mid channel already has 2x more than average, dont bother */
+            /* mean_bits = bits per granule (for both channels) */
+            if (targ_bits[0] < mean_bits)
+                targ_bits[0] += move_bits;
+            targ_bits[1] -= move_bits;
+        }
+        else {
+            targ_bits[0] += targ_bits[1] - 125;
+            targ_bits[1] = 125;
+        }
+    }
+
+    move_bits = targ_bits[0] + targ_bits[1];
+    if (move_bits > max_bits) {
+        targ_bits[0] = (max_bits * targ_bits[0]) / move_bits;
+        targ_bits[1] = (max_bits * targ_bits[1]) / move_bits;
+    }
+    assert(targ_bits[0] <= MAX_BITS_PER_CHANNEL);
+    assert(targ_bits[1] <= MAX_BITS_PER_CHANNEL);
+    assert(targ_bits[0] + targ_bits[1] <= MAX_BITS_PER_GRANULE);
+}
+
+
+/**
+ *  Robert Hegemann 2001-04-27:
+ *  this adjusts the ATH, keeping the original noise floor
+ *  affects the higher frequencies more than the lower ones
+ */
+
+FLOAT
+athAdjust(FLOAT a, FLOAT x, FLOAT athFloor)
+{
+    /*  work in progress
+     */
+    FLOAT const o = 90.30873362;
+    FLOAT const p = 94.82444863;
+    FLOAT   u = FAST_LOG10_X(x, 10.0);
+    FLOAT const v = a * a;
+    FLOAT   w = 0.0;
+    u -= athFloor;      /* undo scaling */
+    if (v > 1E-20)
+        w = 1. + FAST_LOG10_X(v, 10.0 / o);
+    if (w < 0)
+        w = 0.;
+    u *= w;
+    u += athFloor + o - p; /* redo scaling */
+
+    return pow(10., 0.1 * u);
+}
+
+
+
+/*************************************************************************/
+/*            calc_xmin                                                  */
+/*************************************************************************/
+
+/*
+  Calculate the allowed distortion for each scalefactor band,
+  as determined by the psychoacoustic model.
+  xmin(sb) = ratio(sb) * en(sb) / bw(sb)
+
+  returns number of sfb's with energy > ATH
+*/
+int
+calc_xmin(lame_global_flags const *gfp,
+          III_psy_ratio const *const ratio, gr_info * const cod_info, FLOAT * pxmin)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     sfb, gsfb, j = 0, ath_over = 0, k;
+    ATH_t const *const ATH = gfc->ATH;
+    const FLOAT *const xr = cod_info->xr;
+    int     max_nonzero;
+    int const enable_athaa_fix = (gfp->VBR == vbr_mtrh) ? 1 : 0;
+    FLOAT   masking_lower = gfc->masking_lower;
+
+    if (gfp->VBR == vbr_mtrh || gfp->VBR == vbr_mt) {
+        masking_lower = 1.0f; /* was already done in PSY-Model */
+    }
+
+    for (gsfb = 0; gsfb < cod_info->psy_lmax; gsfb++) {
+        FLOAT   en0, xmin;
+        FLOAT   rh1, rh2;
+        int     width, l;
+
+        if (gfp->VBR == vbr_rh || gfp->VBR == vbr_mtrh)
+            xmin = athAdjust(ATH->adjust, ATH->l[gsfb], ATH->floor);
+        else
+            xmin = ATH->adjust * ATH->l[gsfb];
+
+        width = cod_info->width[gsfb];
+        rh1 = xmin / width;
+#ifdef DBL_EPSILON
+        rh2 = DBL_EPSILON;
+#else
+        rh2 = 2.2204460492503131e-016;
+#endif
+        l = width >> 1;
+        en0 = 0.0;
+        do {
+            FLOAT   xa, xb;
+            xa = xr[j] * xr[j];
+            en0 += xa;
+            rh2 += (xa < rh1) ? xa : rh1;
+            j++;
+            xb = xr[j] * xr[j];
+            en0 += xb;
+            rh2 += (xb < rh1) ? xb : rh1;
+            j++;
+        } while (--l > 0);
+        if (en0 > xmin)
+            ath_over++;
+
+        if (gsfb == SBPSY_l) {
+            FLOAT   x = xmin * gfc->nsPsy.longfact[gsfb];
+            if (rh2 < x) {
+                rh2 = x;
+            }
+        }
+        if (enable_athaa_fix) {
+            xmin = rh2;
+        }
+        if (!gfp->ATHonly) {
+            FLOAT const e = ratio->en.l[gsfb];
+            if (e > 0.0f) {
+                FLOAT   x;
+                x = en0 * ratio->thm.l[gsfb] * masking_lower / e;
+                if (enable_athaa_fix)
+                    x *= gfc->nsPsy.longfact[gsfb];
+                if (xmin < x)
+                    xmin = x;
+            }
+        }
+        if (enable_athaa_fix)
+            *pxmin++ = xmin;
+        else
+            *pxmin++ = xmin * gfc->nsPsy.longfact[gsfb];
+    }                   /* end of long block loop */
+
+
+
+
+    /*use this function to determine the highest non-zero coeff */
+    max_nonzero = 575;
+    if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type, but not SHORT */
+        k = 576;
+        while (k-- && EQ(xr[k], 0)) {
+            max_nonzero = k;
+        }
+    }
+    cod_info->max_nonzero_coeff = max_nonzero;
+
+
+
+    for (sfb = cod_info->sfb_smin; gsfb < cod_info->psymax; sfb++, gsfb += 3) {
+        int     width, b;
+        FLOAT   tmpATH;
+        if (gfp->VBR == vbr_rh || gfp->VBR == vbr_mtrh)
+            tmpATH = athAdjust(ATH->adjust, ATH->s[sfb], ATH->floor);
+        else
+            tmpATH = ATH->adjust * ATH->s[sfb];
+
+        width = cod_info->width[gsfb];
+        for (b = 0; b < 3; b++) {
+            FLOAT   en0 = 0.0, xmin;
+            FLOAT   rh1, rh2;
+            int     l = width >> 1;
+
+            rh1 = tmpATH / width;
+#ifdef DBL_EPSILON
+            rh2 = DBL_EPSILON;
+#else
+            rh2 = 2.2204460492503131e-016;
+#endif
+            do {
+                FLOAT   xa, xb;
+                xa = xr[j] * xr[j];
+                en0 += xa;
+                rh2 += (xa < rh1) ? xa : rh1;
+                j++;
+                xb = xr[j] * xr[j];
+                en0 += xb;
+                rh2 += (xb < rh1) ? xb : rh1;
+                j++;
+            } while (--l > 0);
+            if (en0 > tmpATH)
+                ath_over++;
+            if (sfb == SBPSY_s) {
+                FLOAT   x = tmpATH * gfc->nsPsy.shortfact[sfb];
+                if (rh2 < x) {
+                    rh2 = x;
+                }
+            }
+            if (enable_athaa_fix)
+                xmin = rh2;
+            else
+                xmin = tmpATH;
+
+            if (!gfp->ATHonly && !gfp->ATHshort) {
+                FLOAT const e = ratio->en.s[sfb][b];
+                if (e > 0.0f) {
+                    FLOAT   x;
+                    x = en0 * ratio->thm.s[sfb][b] * masking_lower / e;
+                    if (enable_athaa_fix)
+                        x *= gfc->nsPsy.shortfact[sfb];
+                    if (xmin < x)
+                        xmin = x;
+                }
+            }
+            if (enable_athaa_fix)
+                *pxmin++ = xmin;
+            else
+                *pxmin++ = xmin * gfc->nsPsy.shortfact[sfb];
+        }               /* b */
+        if (gfp->useTemporal) {
+            if (pxmin[-3] > pxmin[-3 + 1])
+                pxmin[-3 + 1] += (pxmin[-3] - pxmin[-3 + 1]) * gfc->decay;
+            if (pxmin[-3 + 1] > pxmin[-3 + 2])
+                pxmin[-3 + 2] += (pxmin[-3 + 1] - pxmin[-3 + 2]) * gfc->decay;
+        }
+    }                   /* end of short block sfb loop */
+
+    return ath_over;
+}
+
+
+static  FLOAT
+calc_noise_core_c(const gr_info * const cod_info, int *startline, int l, FLOAT step)
+{
+    FLOAT   noise = 0;
+    int     j = *startline;
+    const int *const ix = cod_info->l3_enc;
+
+    if (j > cod_info->count1) {
+        while (l--) {
+            FLOAT   temp;
+            temp = cod_info->xr[j];
+            j++;
+            noise += temp * temp;
+            temp = cod_info->xr[j];
+            j++;
+            noise += temp * temp;
+        }
+    }
+    else if (j > cod_info->big_values) {
+        FLOAT   ix01[2];
+        ix01[0] = 0;
+        ix01[1] = step;
+        while (l--) {
+            FLOAT   temp;
+            temp = fabs(cod_info->xr[j]) - ix01[ix[j]];
+            j++;
+            noise += temp * temp;
+            temp = fabs(cod_info->xr[j]) - ix01[ix[j]];
+            j++;
+            noise += temp * temp;
+        }
+    }
+    else {
+        while (l--) {
+            FLOAT   temp;
+            temp = fabs(cod_info->xr[j]) - pow43[ix[j]] * step;
+            j++;
+            noise += temp * temp;
+            temp = fabs(cod_info->xr[j]) - pow43[ix[j]] * step;
+            j++;
+            noise += temp * temp;
+        }
+    }
+
+    *startline = j;
+    return noise;
+}
+
+
+/*************************************************************************/
+/*            calc_noise                                                 */
+/*************************************************************************/
+
+/* -oo dB  =>  -1.00 */
+/* - 6 dB  =>  -0.97 */
+/* - 3 dB  =>  -0.80 */
+/* - 2 dB  =>  -0.64 */
+/* - 1 dB  =>  -0.38 */
+/*   0 dB  =>   0.00 */
+/* + 1 dB  =>  +0.49 */
+/* + 2 dB  =>  +1.06 */
+/* + 3 dB  =>  +1.68 */
+/* + 6 dB  =>  +3.69 */
+/* +10 dB  =>  +6.45 */
+
+int
+calc_noise(gr_info const *const cod_info,
+           FLOAT const *l3_xmin,
+           FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise)
+{
+    int     sfb, l, over = 0;
+    FLOAT   over_noise_db = 0;
+    FLOAT   tot_noise_db = 0; /*    0 dB relative to masking */
+    FLOAT   max_noise = -20.0; /* -200 dB relative to masking */
+    int     j = 0;
+    const int *scalefac = cod_info->scalefac;
+
+    res->over_SSD = 0;
+
+
+    for (sfb = 0; sfb < cod_info->psymax; sfb++) {
+        int const s =
+            cod_info->global_gain - (((*scalefac++) + (cod_info->preflag ? pretab[sfb] : 0))
+                                     << (cod_info->scalefac_scale + 1))
+            - cod_info->subblock_gain[cod_info->window[sfb]] * 8;
+        FLOAT   noise = 0.0;
+
+        if (prev_noise && (prev_noise->step[sfb] == s)) {
+
+            /* use previously computed values */
+            noise = prev_noise->noise[sfb];
+            j += cod_info->width[sfb];
+            *distort++ = noise / *l3_xmin++;
+
+            noise = prev_noise->noise_log[sfb];
+
+        }
+        else {
+            FLOAT const step = POW20(s);
+            l = cod_info->width[sfb] >> 1;
+
+            if ((j + cod_info->width[sfb]) > cod_info->max_nonzero_coeff) {
+                int     usefullsize;
+                usefullsize = cod_info->max_nonzero_coeff - j + 1;
+
+                if (usefullsize > 0)
+                    l = usefullsize >> 1;
+                else
+                    l = 0;
+            }
+
+            noise = calc_noise_core_c(cod_info, &j, l, step);
+
+
+            if (prev_noise) {
+                /* save noise values */
+                prev_noise->step[sfb] = s;
+                prev_noise->noise[sfb] = noise;
+            }
+
+            noise = *distort++ = noise / *l3_xmin++;
+
+            /* multiplying here is adding in dB, but can overflow */
+            noise = FAST_LOG10(Max(noise, 1E-20));
+
+            if (prev_noise) {
+                /* save noise values */
+                prev_noise->noise_log[sfb] = noise;
+            }
+        }
+
+        if (prev_noise) {
+            /* save noise values */
+            prev_noise->global_gain = cod_info->global_gain;;
+        }
+
+
+        /*tot_noise *= Max(noise, 1E-20); */
+        tot_noise_db += noise;
+
+        if (noise > 0.0) {
+            int     tmp;
+
+            tmp = Max((int) (noise * 10 + .5), 1);
+            res->over_SSD += tmp * tmp;
+
+            over++;
+            /* multiplying here is adding in dB -but can overflow */
+            /*over_noise *= noise; */
+            over_noise_db += noise;
+        }
+        max_noise = Max(max_noise, noise);
+
+    }
+
+    res->over_count = over;
+    res->tot_noise = tot_noise_db;
+    res->over_noise = over_noise_db;
+    res->max_noise = max_noise;
+
+    return over;
+}
+
+
+
+
+
+
+
+
+/************************************************************************
+ *
+ *  set_pinfo()
+ *
+ *  updates plotting data    
+ *
+ *  Mark Taylor 2000-??-??                
+ *
+ *  Robert Hegemann: moved noise/distortion calc into it
+ *
+ ************************************************************************/
+
+static void
+set_pinfo(lame_global_flags const *gfp,
+          gr_info * const cod_info, const III_psy_ratio * const ratio, const int gr, const int ch)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     sfb, sfb2;
+    int     j, i, l, start, end, bw;
+    FLOAT   en0, en1;
+    FLOAT const ifqstep = (cod_info->scalefac_scale == 0) ? .5 : 1.0;
+    int const *const scalefac = cod_info->scalefac;
+
+    FLOAT   l3_xmin[SFBMAX], xfsf[SFBMAX];
+    calc_noise_result noise;
+
+    (void) calc_xmin(gfp, ratio, cod_info, l3_xmin);
+    (void) calc_noise(cod_info, l3_xmin, xfsf, &noise, 0);
+
+    j = 0;
+    sfb2 = cod_info->sfb_lmax;
+    if (cod_info->block_type != SHORT_TYPE && !cod_info->mixed_block_flag)
+        sfb2 = 22;
+    for (sfb = 0; sfb < sfb2; sfb++) {
+        start = gfc->scalefac_band.l[sfb];
+        end = gfc->scalefac_band.l[sfb + 1];
+        bw = end - start;
+        for (en0 = 0.0; j < end; j++)
+            en0 += cod_info->xr[j] * cod_info->xr[j];
+        en0 /= bw;
+        /* convert to MDCT units */
+        en1 = 1e15;     /* scaling so it shows up on FFT plot */
+        gfc->pinfo->en[gr][ch][sfb] = en1 * en0;
+        gfc->pinfo->xfsf[gr][ch][sfb] = en1 * l3_xmin[sfb] * xfsf[sfb] / bw;
+
+        if (ratio->en.l[sfb] > 0 && !gfp->ATHonly)
+            en0 = en0 / ratio->en.l[sfb];
+        else
+            en0 = 0.0;
+
+        gfc->pinfo->thr[gr][ch][sfb] = en1 * Max(en0 * ratio->thm.l[sfb], gfc->ATH->l[sfb]);
+
+        /* there is no scalefactor bands >= SBPSY_l */
+        gfc->pinfo->LAMEsfb[gr][ch][sfb] = 0;
+        if (cod_info->preflag && sfb >= 11)
+            gfc->pinfo->LAMEsfb[gr][ch][sfb] = -ifqstep * pretab[sfb];
+
+        if (sfb < SBPSY_l) {
+            assert(scalefac[sfb] >= 0); /* scfsi should be decoded by caller side */
+            gfc->pinfo->LAMEsfb[gr][ch][sfb] -= ifqstep * scalefac[sfb];
+        }
+    }                   /* for sfb */
+
+    if (cod_info->block_type == SHORT_TYPE) {
+        sfb2 = sfb;
+        for (sfb = cod_info->sfb_smin; sfb < SBMAX_s; sfb++) {
+            start = gfc->scalefac_band.s[sfb];
+            end = gfc->scalefac_band.s[sfb + 1];
+            bw = end - start;
+            for (i = 0; i < 3; i++) {
+                for (en0 = 0.0, l = start; l < end; l++) {
+                    en0 += cod_info->xr[j] * cod_info->xr[j];
+                    j++;
+                }
+                en0 = Max(en0 / bw, 1e-20);
+                /* convert to MDCT units */
+                en1 = 1e15; /* scaling so it shows up on FFT plot */
+
+                gfc->pinfo->en_s[gr][ch][3 * sfb + i] = en1 * en0;
+                gfc->pinfo->xfsf_s[gr][ch][3 * sfb + i] = en1 * l3_xmin[sfb2] * xfsf[sfb2] / bw;
+                if (ratio->en.s[sfb][i] > 0)
+                    en0 = en0 / ratio->en.s[sfb][i];
+                else
+                    en0 = 0.0;
+                if (gfp->ATHonly || gfp->ATHshort)
+                    en0 = 0;
+
+                gfc->pinfo->thr_s[gr][ch][3 * sfb + i] =
+                    en1 * Max(en0 * ratio->thm.s[sfb][i], gfc->ATH->s[sfb]);
+
+                /* there is no scalefactor bands >= SBPSY_s */
+                gfc->pinfo->LAMEsfb_s[gr][ch][3 * sfb + i]
+                    = -2.0 * cod_info->subblock_gain[i];
+                if (sfb < SBPSY_s) {
+                    gfc->pinfo->LAMEsfb_s[gr][ch][3 * sfb + i] -= ifqstep * scalefac[sfb2];
+                }
+                sfb2++;
+            }
+        }
+    }                   /* block type short */
+    gfc->pinfo->LAMEqss[gr][ch] = cod_info->global_gain;
+    gfc->pinfo->LAMEmainbits[gr][ch] = cod_info->part2_3_length + cod_info->part2_length;
+    gfc->pinfo->LAMEsfbits[gr][ch] = cod_info->part2_length;
+
+    gfc->pinfo->over[gr][ch] = noise.over_count;
+    gfc->pinfo->max_noise[gr][ch] = noise.max_noise * 10.0;
+    gfc->pinfo->over_noise[gr][ch] = noise.over_noise * 10.0;
+    gfc->pinfo->tot_noise[gr][ch] = noise.tot_noise * 10.0;
+    gfc->pinfo->over_SSD[gr][ch] = noise.over_SSD;
+}
+
+
+/************************************************************************
+ *
+ *  set_frame_pinfo()
+ *
+ *  updates plotting data for a whole frame  
+ *
+ *  Robert Hegemann 2000-10-21                          
+ *
+ ************************************************************************/
+
+void
+set_frame_pinfo(lame_global_flags const *gfp, III_psy_ratio ratio[2][2])
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     ch;
+    int     gr;
+
+    gfc->masking_lower = 1.0;
+
+    /* for every granule and channel patch l3_enc and set info
+     */
+    for (gr = 0; gr < gfc->mode_gr; gr++) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            gr_info *const cod_info = &gfc->l3_side.tt[gr][ch];
+            int     scalefac_sav[SFBMAX];
+            memcpy(scalefac_sav, cod_info->scalefac, sizeof(scalefac_sav));
+
+            /* reconstruct the scalefactors in case SCFSI was used 
+             */
+            if (gr == 1) {
+                int     sfb;
+                for (sfb = 0; sfb < cod_info->sfb_lmax; sfb++) {
+                    if (cod_info->scalefac[sfb] < 0) /* scfsi */
+                        cod_info->scalefac[sfb] = gfc->l3_side.tt[0][ch].scalefac[sfb];
+                }
+            }
+
+            set_pinfo(gfp, cod_info, &ratio[gr][ch], gr, ch);
+            memcpy(cod_info->scalefac, scalefac_sav, sizeof(scalefac_sav));
+        }               /* for ch */
+    }                   /* for gr */
+}
diff --git a/libmp3lame/quantize_pvt.h b/libmp3lame/quantize_pvt.h
new file mode 100644
index 0000000..1a41190
--- /dev/null
+++ b/libmp3lame/quantize_pvt.h
@@ -0,0 +1,130 @@
+/*
+ *	quantize_pvt include file
+ *
+ *	Copyright (c) 1999 Takehiro TOMINAGA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_QUANTIZE_PVT_H
+#define LAME_QUANTIZE_PVT_H
+
+#define IXMAX_VAL 8206  /* ix always <= 8191+15.    see count_bits() */
+
+/* buggy Winamp decoder cannot handle values > 8191 */
+/* #define IXMAX_VAL 8191 */
+
+#define PRECALC_SIZE (IXMAX_VAL+2)
+
+
+extern const int nr_of_sfb_block[6][3][4];
+extern const int pretab[SBMAX_l];
+extern const int slen1_tab[16];
+extern const int slen2_tab[16];
+
+extern const scalefac_struct sfBandIndex[9];
+
+extern FLOAT pow43[PRECALC_SIZE];
+#ifdef TAKEHIRO_IEEE754_HACK
+extern FLOAT adj43asm[PRECALC_SIZE];
+#else
+extern FLOAT adj43[PRECALC_SIZE];
+#endif
+
+#define Q_MAX (256+1)
+#define Q_MAX2 116      /* minimum possible number of
+                           -cod_info->global_gain
+                           + ((scalefac[] + (cod_info->preflag ? pretab[sfb] : 0))
+                           << (cod_info->scalefac_scale + 1))
+                           + cod_info->subblock_gain[cod_info->window[sfb]] * 8;
+
+                           for long block, 0+((15+3)<<2) = 18*4 = 72
+                           for short block, 0+(15<<2)+7*8 = 15*4+56 = 116
+                         */
+
+extern FLOAT pow20[Q_MAX + Q_MAX2 + 1];
+extern FLOAT ipow20[Q_MAX];
+extern FLOAT iipow20[Q_MAX2 + 1];
+
+typedef struct calc_noise_result_t {
+    FLOAT   over_noise;      /* sum of quantization noise > masking */
+    FLOAT   tot_noise;       /* sum of all quantization noise */
+    FLOAT   max_noise;       /* max quantization noise */
+    int     over_count;      /* number of quantization noise > masking */
+    int     over_SSD;        /* SSD-like cost of distorted bands */
+    int     bits;
+} calc_noise_result;
+
+
+/**
+* allows re-use of previously
+* computed noise values
+*/
+typedef struct calc_noise_data_t {
+    int     global_gain;
+    int     sfb_count1;
+    int     step[39];
+    FLOAT   noise[39];
+    FLOAT   noise_log[39];
+} calc_noise_data;
+
+
+int     on_pe(lame_global_flags const *gfp, FLOAT pe[2][2],
+              int targ_bits[2], int mean_bits, int gr, int cbr);
+
+void    reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits);
+
+
+void    iteration_init(lame_global_flags * gfp);
+
+
+int     calc_xmin(lame_global_flags const *gfp,
+                  III_psy_ratio const *const ratio, gr_info * const cod_info, FLOAT * l3_xmin);
+
+int     calc_noise(const gr_info * const cod_info,
+                   const FLOAT * l3_xmin,
+                   FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise);
+
+void    set_frame_pinfo(lame_global_flags const *gfp, III_psy_ratio ratio[2][2]);
+
+
+
+
+/* takehiro.c */
+
+int     count_bits(lame_internal_flags const *const gfc, const FLOAT * const xr,
+                   gr_info * const cod_info, calc_noise_data * prev_noise);
+int     noquant_count_bits(lame_internal_flags const *const gfc,
+                           gr_info * const cod_info, calc_noise_data * prev_noise);
+
+
+void    best_huffman_divide(const lame_internal_flags * const gfc, gr_info * const cod_info);
+
+void    best_scalefac_store(const lame_internal_flags * gfc, const int gr, const int ch,
+                            III_side_info_t * const l3_side);
+
+int     scale_bitcount(gr_info * const cod_info);
+int     scale_bitcount_lsf(const lame_internal_flags * gfp, gr_info * const cod_info);
+
+void    huffman_init(lame_internal_flags * const gfc);
+
+void    init_xrpow_core_init(lame_internal_flags * const gfc);
+
+FLOAT   athAdjust(FLOAT a, FLOAT x, FLOAT athFloor);
+
+#define LARGE_BITS 100000
+
+#endif /* LAME_QUANTIZE_PVT_H */
diff --git a/libmp3lame/reservoir.c b/libmp3lame/reservoir.c
new file mode 100644
index 0000000..78d0292
--- /dev/null
+++ b/libmp3lame/reservoir.c
@@ -0,0 +1,304 @@
+/*
+ *      bit reservoir source file
+ *
+ *      Copyright (c) 1999-2000 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: reservoir.c,v 1.40.2.2 2010/03/21 12:11:30 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "reservoir.h"
+
+#include "bitstream.h"
+#include "lame-analysis.h"
+#include "lame_global_flags.h"
+
+/*
+  ResvFrameBegin:
+  Called (repeatedly) at the beginning of a frame. Updates the maximum
+  size of the reservoir, and checks to make sure main_data_begin
+  was set properly by the formatter
+*/
+
+/*
+ *  Background information:
+ *
+ *  This is the original text from the ISO standard. Because of
+ *  sooo many bugs and irritations correcting comments are added
+ *  in brackets []. A '^W' means you should remove the last word.
+ *
+ *  1) The following rule can be used to calculate the maximum
+ *     number of bits used for one granule [^W frame]:
+ *     At the highest possible bitrate of Layer III (320 kbps
+ *     per stereo signal [^W^W^W], 48 kHz) the frames must be of
+ *     [^W^W^W are designed to have] constant length, i.e.
+ *     one buffer [^W^W the frame] length is:
+ *
+ *         320 kbps * 1152/48 kHz = 7680 bit = 960 byte
+ *
+ *     This value is used as the maximum buffer per channel [^W^W] at
+ *     lower bitrates [than 320 kbps]. At 64 kbps mono or 128 kbps
+ *     stereo the main granule length is 64 kbps * 576/48 kHz = 768 bit
+ *     [per granule and channel] at 48 kHz sampling frequency.
+ *     This means that there is a maximum deviation (short time buffer
+ *     [= reservoir]) of 7680 - 2*2*768 = 4608 bits is allowed at 64 kbps.
+ *     The actual deviation is equal to the number of bytes [with the
+ *     meaning of octets] denoted by the main_data_end offset pointer.
+ *     The actual maximum deviation is (2^9-1)*8 bit = 4088 bits
+ *     [for MPEG-1 and (2^8-1)*8 bit for MPEG-2, both are hard limits].
+ *     ... The xchange of buffer bits between the left and right channel
+ *     is allowed without restrictions [exception: dual channel].
+ *     Because of the [constructed] constraint on the buffer size
+ *     main_data_end is always set to 0 in the case of bit_rate_index==14,
+ *     i.e. data rate 320 kbps per stereo signal [^W^W^W]. In this case
+ *     all data are allocated between adjacent header [^W sync] words
+ *     [, i.e. there is no buffering at all].
+ */
+
+int
+ResvFrameBegin(lame_global_flags const *gfp, int *mean_bits)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     fullFrameBits;
+    int     resvLimit;
+    int     maxmp3buf;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+    int     frameLength;
+
+    frameLength = getframebits(gfp);
+    *mean_bits = (frameLength - gfc->sideinfo_len * 8) / gfc->mode_gr;
+
+/*
+ *  Meaning of the variables:
+ *      resvLimit: (0, 8, ..., 8*255 (MPEG-2), 8*511 (MPEG-1))
+ *          Number of bits can be stored in previous frame(s) due to
+ *          counter size constaints
+ *      maxmp3buf: ( ??? ... 8*1951 (MPEG-1 and 2), 8*2047 (MPEG-2.5))
+ *          Number of bits allowed to encode one frame (you can take 8*511 bit
+ *          from the bit reservoir and at most 8*1440 bit from the current
+ *          frame (320 kbps, 32 kHz), so 8*1951 bit is the largest possible
+ *          value for MPEG-1 and -2)
+ *
+ *          maximum allowed granule/channel size times 4 = 8*2047 bits.,
+ *          so this is the absolute maximum supported by the format.
+ *
+ *
+ *      fullFrameBits:  maximum number of bits available for encoding
+ *                      the current frame.
+ *
+ *      mean_bits:      target number of bits per granule.
+ *
+ *      frameLength:
+ *
+ *      gfc->ResvMax:   maximum allowed reservoir
+ *
+ *      gfc->ResvSize:  current reservoir size
+ *
+ *      l3_side->resvDrain_pre:
+ *         ancillary data to be added to previous frame:
+ *         (only usefull in VBR modes if it is possible to have
+ *         maxmp3buf < fullFrameBits)).  Currently disabled,
+ *         see #define NEW_DRAIN
+ *         2010-02-13: RH now enabled, it seems to be needed for CBR too,
+ *                     as there exists one example, where the FhG decoder
+ *                     can't decode a -b320 CBR file anymore.
+ *
+ *      l3_side->resvDrain_post:
+ *         ancillary data to be added to this frame:
+ *
+ */
+
+    /* main_data_begin has 9 bits in MPEG-1, 8 bits MPEG-2 */
+    resvLimit = (8 * 256) * gfc->mode_gr - 8;
+
+    /* maximum allowed frame size.  dont use more than this number of
+       bits, even if the frame has the space for them: */
+    if (gfp->brate > 320) {
+        /* in freeformat the buffer is constant */
+        maxmp3buf =
+            8 * ((int) ((gfp->brate * 1000) / (gfp->out_samplerate / (FLOAT) 1152) / 8 + .5));
+    }
+    else {
+        /*all mp3 decoders should have enough buffer to handle this value: size of a 320kbps 32kHz frame */
+        maxmp3buf = 8 * 1440;
+
+        /* Bouvigne suggests this more lax interpretation of the ISO doc
+           instead of using 8*960. */
+
+        if (gfp->strict_ISO) {
+            maxmp3buf = 8 * ((int) (320000 / (gfp->out_samplerate / (FLOAT) 1152) / 8 + .5));
+        }
+    }
+
+    gfc->ResvMax = maxmp3buf - frameLength;
+    if (gfc->ResvMax > resvLimit)
+        gfc->ResvMax = resvLimit;
+    if (gfc->ResvMax < 0 || gfp->disable_reservoir)
+        gfc->ResvMax = 0;
+
+    fullFrameBits = *mean_bits * gfc->mode_gr + Min(gfc->ResvSize, gfc->ResvMax);
+
+    if (fullFrameBits > maxmp3buf)
+        fullFrameBits = maxmp3buf;
+
+    assert(0 == gfc->ResvMax % 8);
+    assert(gfc->ResvMax >= 0);
+
+    l3_side->resvDrain_pre = 0;
+
+    if (gfc->pinfo != NULL) {
+        gfc->pinfo->mean_bits = *mean_bits / 2; /* expected bits per channel per granule [is this also right for mono/stereo, MPEG-1/2 ?] */
+        gfc->pinfo->resvsize = gfc->ResvSize;
+    }
+
+    return fullFrameBits;
+}
+
+
+/*
+  ResvMaxBits
+  returns targ_bits:  target number of bits to use for 1 granule
+         extra_bits:  amount extra available from reservoir
+  Mark Taylor 4/99
+*/
+void
+ResvMaxBits(lame_global_flags const *gfp, int mean_bits, int *targ_bits, int *extra_bits, int cbr)
+{
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     add_bits;
+    int     ResvSize = gfc->ResvSize, ResvMax = gfc->ResvMax;
+
+    /* conpensate the saved bits used in the 1st granule */
+    if (cbr)
+        ResvSize += mean_bits;
+
+    if (gfc->substep_shaping & 1)
+        ResvMax *= 0.9;
+
+    *targ_bits = mean_bits;
+
+    /* extra bits if the reservoir is almost full */
+    if (ResvSize * 10 > ResvMax * 9) {
+        add_bits = ResvSize - (ResvMax * 9) / 10;
+        *targ_bits += add_bits;
+        gfc->substep_shaping |= 0x80;
+    }
+    else {
+        add_bits = 0;
+        gfc->substep_shaping &= 0x7f;
+        /* build up reservoir.  this builds the reservoir a little slower
+         * than FhG.  It could simple be mean_bits/15, but this was rigged
+         * to always produce 100 (the old value) at 128kbs */
+        /*    *targ_bits -= (int) (mean_bits/15.2); */
+        if (!gfp->disable_reservoir && !(gfc->substep_shaping & 1))
+            *targ_bits -= .1 * mean_bits;
+    }
+
+
+    /* amount from the reservoir we are allowed to use. ISO says 6/10 */
+    *extra_bits = (ResvSize < (gfc->ResvMax * 6) / 10 ? ResvSize : (gfc->ResvMax * 6) / 10);
+    *extra_bits -= add_bits;
+
+    if (*extra_bits < 0)
+        *extra_bits = 0;
+
+
+}
+
+/*
+  ResvAdjust:
+  Called after a granule's bit allocation. Readjusts the size of
+  the reservoir to reflect the granule's usage.
+*/
+void
+ResvAdjust(lame_internal_flags * gfc, gr_info const *gi)
+{
+    gfc->ResvSize -= gi->part2_3_length + gi->part2_length;
+}
+
+
+/*
+  ResvFrameEnd:
+  Called after all granules in a frame have been allocated. Makes sure
+  that the reservoir size is within limits, possibly by adding stuffing
+  bits.
+*/
+void
+ResvFrameEnd(lame_internal_flags * gfc, int mean_bits)
+{
+    int     stuffingBits;
+    int     over_bits;
+    III_side_info_t *const l3_side = &gfc->l3_side;
+
+
+    gfc->ResvSize += mean_bits * gfc->mode_gr;
+    stuffingBits = 0;
+    l3_side->resvDrain_post = 0;
+    l3_side->resvDrain_pre = 0;
+
+    /* we must be byte aligned */
+    if ((over_bits = gfc->ResvSize % 8) != 0)
+        stuffingBits += over_bits;
+
+
+    over_bits = (gfc->ResvSize - stuffingBits) - gfc->ResvMax;
+    if (over_bits > 0) {
+        assert(0 == over_bits % 8);
+        assert(over_bits >= 0);
+        stuffingBits += over_bits;
+    }
+
+    /* NOTE: enabling the NEW_DRAIN code fixes some problems with FhG decoder
+             shipped with MS Windows operating systems. Using this, it is even
+             possible to use Gabriel's lax buffer consideration again, which
+             assumes, any decoder should have a buffer large enough
+             for a 320 kbps frame at 32 kHz sample rate.
+
+       old drain code:
+             lame -b320 BlackBird.wav ---> does not play with GraphEdit.exe using FhG decoder V1.5 Build 50
+
+       new drain code:
+             lame -b320 BlackBird.wav ---> plays fine with GraphEdit.exe using FhG decoder V1.5 Build 50
+
+             Robert Hegemann, 2010-02-13.
+     */
+    /* drain as many bits as possible into previous frame ancillary data
+     * In particular, in VBR mode ResvMax may have changed, and we have
+     * to make sure main_data_begin does not create a reservoir bigger
+     * than ResvMax  mt 4/00*/
+    {
+        int     mdb_bytes = Min(l3_side->main_data_begin * 8, stuffingBits) / 8;
+        l3_side->resvDrain_pre += 8 * mdb_bytes;
+        stuffingBits -= 8 * mdb_bytes;
+        gfc->ResvSize -= 8 * mdb_bytes;
+        l3_side->main_data_begin -= mdb_bytes;
+    }
+    /* drain the rest into this frames ancillary data */
+    l3_side->resvDrain_post += stuffingBits;
+    gfc->ResvSize -= stuffingBits;
+
+    return;
+}
diff --git a/libmp3lame/reservoir.h b/libmp3lame/reservoir.h
new file mode 100644
index 0000000..433d9be
--- /dev/null
+++ b/libmp3lame/reservoir.h
@@ -0,0 +1,31 @@
+/*
+ *	bit reservoir include file
+ *
+ *	Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_RESERVOIR_H
+#define LAME_RESERVOIR_H
+
+int     ResvFrameBegin(lame_global_flags const *gfp, int *mean_bits);
+void    ResvMaxBits(lame_global_flags const *gfp, int mean_bits, int *targ_bits, int *max_bits,
+                    int cbr);
+void    ResvAdjust(lame_internal_flags * gfc, gr_info const *gi);
+void    ResvFrameEnd(lame_internal_flags * gfc, int mean_bits);
+
+#endif /* LAME_RESERVOIR_H */
diff --git a/libmp3lame/set_get.c b/libmp3lame/set_get.c
new file mode 100644
index 0000000..36a3bfb
--- /dev/null
+++ b/libmp3lame/set_get.c
@@ -0,0 +1,1883 @@
+/* -*- mode: C; mode: fold -*- */
+/*
+ * set/get functions for lame_global_flags
+ *
+ * Copyright (c) 2001-2005 Alexander Leidinger
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: set_get.c,v 1.88 2008/04/12 18:18:07 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "bitstream.h"  /* because of compute_flushbits */
+
+#include "set_get.h"
+#include "lame_global_flags.h"
+
+/*
+ * input stream description
+ */
+
+/* number of samples */
+/* it's unlikely for this function to return an error */
+int
+lame_set_num_samples(lame_global_flags * gfp, unsigned long num_samples)
+{
+    /* default = 2^32-1 */
+
+    gfp->num_samples = num_samples;
+
+    return 0;
+}
+
+unsigned long
+lame_get_num_samples(const lame_global_flags * gfp)
+{
+    return gfp->num_samples;
+}
+
+
+/* input samplerate */
+int
+lame_set_in_samplerate(lame_global_flags * gfp, int in_samplerate)
+{
+    /* input sample rate in Hz,  default = 44100 Hz */
+    gfp->in_samplerate = in_samplerate;
+
+    return 0;
+}
+
+int
+lame_get_in_samplerate(const lame_global_flags * gfp)
+{
+    return gfp->in_samplerate;
+}
+
+
+/* number of channels in input stream */
+int
+lame_set_num_channels(lame_global_flags * gfp, int num_channels)
+{
+    /* default = 2 */
+
+    if (2 < num_channels || 0 == num_channels)
+        return -1;      /* we don't support more than 2 channels */
+
+    gfp->num_channels = num_channels;
+
+    return 0;
+}
+
+int
+lame_get_num_channels(const lame_global_flags * gfp)
+{
+    return gfp->num_channels;
+}
+
+
+/* scale the input by this amount before encoding (not used for decoding) */
+int
+lame_set_scale(lame_global_flags * gfp, float scale)
+{
+    /* default = 0 */
+    gfp->scale = scale;
+
+    return 0;
+}
+
+float
+lame_get_scale(const lame_global_flags * gfp)
+{
+    return gfp->scale;
+}
+
+
+/* scale the channel 0 (left) input by this amount before 
+   encoding (not used for decoding) */
+int
+lame_set_scale_left(lame_global_flags * gfp, float scale)
+{
+    /* default = 0 */
+    gfp->scale_left = scale;
+
+    return 0;
+}
+
+float
+lame_get_scale_left(const lame_global_flags * gfp)
+{
+    return gfp->scale_left;
+}
+
+
+/* scale the channel 1 (right) input by this amount before 
+   encoding (not used for decoding) */
+int
+lame_set_scale_right(lame_global_flags * gfp, float scale)
+{
+    /* default = 0 */
+    gfp->scale_right = scale;
+
+    return 0;
+}
+
+float
+lame_get_scale_right(const lame_global_flags * gfp)
+{
+    return gfp->scale_right;
+}
+
+
+/* output sample rate in Hz */
+int
+lame_set_out_samplerate(lame_global_flags * gfp, int out_samplerate)
+{
+    /*
+     * default = 0: LAME picks best value based on the amount
+     *              of compression
+     * MPEG only allows:
+     *  MPEG1    32, 44.1,   48khz
+     *  MPEG2    16, 22.05,  24
+     *  MPEG2.5   8, 11.025, 12
+     *
+     * (not used by decoding routines)
+     */
+    gfp->out_samplerate = out_samplerate;
+
+    return 0;
+}
+
+int
+lame_get_out_samplerate(const lame_global_flags * gfp)
+{
+    return gfp->out_samplerate;
+}
+
+
+
+
+/*
+ * general control parameters
+ */
+
+/* collect data for an MP3 frame analzyer */
+int
+lame_set_analysis(lame_global_flags * gfp, int analysis)
+{
+    /* default = 0 */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > analysis || 1 < analysis)
+        return -1;
+
+    gfp->analysis = analysis;
+
+    return 0;
+}
+
+int
+lame_get_analysis(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->analysis && 1 >= gfp->analysis);
+
+    return gfp->analysis;
+}
+
+
+/* write a Xing VBR header frame */
+int
+lame_set_bWriteVbrTag(lame_global_flags * gfp, int bWriteVbrTag)
+{
+    /* default = 1 (on) for VBR/ABR modes, 0 (off) for CBR mode */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > bWriteVbrTag || 1 < bWriteVbrTag)
+        return -1;
+
+    gfp->bWriteVbrTag = bWriteVbrTag;
+
+    return 0;
+}
+
+int
+lame_get_bWriteVbrTag(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->bWriteVbrTag && 1 >= gfp->bWriteVbrTag);
+
+    return gfp->bWriteVbrTag;
+}
+
+
+
+/* decode only, use lame/mpglib to convert mp3 to wav */
+int
+lame_set_decode_only(lame_global_flags * gfp, int decode_only)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > decode_only || 1 < decode_only)
+        return -1;
+
+    gfp->decode_only = decode_only;
+
+    return 0;
+}
+
+int
+lame_get_decode_only(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->decode_only && 1 >= gfp->decode_only);
+
+    return gfp->decode_only;
+}
+
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+/* 1=encode a Vorbis .ogg file.  default=0 */
+/* DEPRECATED */
+int CDECL lame_set_ogg(lame_global_flags *, int);
+int CDECL lame_get_ogg(const lame_global_flags *);
+#else
+#endif
+
+/* encode a Vorbis .ogg file */
+/* DEPRECATED */
+int
+lame_set_ogg(lame_global_flags * gfp, int ogg)
+{
+    (void) gfp;
+    (void) ogg;
+    return -1;
+}
+
+int
+lame_get_ogg(const lame_global_flags * gfp)
+{
+    (void) gfp;
+    return 0;
+}
+
+
+/*
+ * Internal algorithm selection.
+ * True quality is determined by the bitrate but this variable will effect
+ * quality by selecting expensive or cheap algorithms.
+ * quality=0..9.  0=best (very slow).  9=worst.  
+ * recommended:  3     near-best quality, not too slow
+ *               5     good quality, fast
+ *               7     ok quality, really fast
+ */
+int
+lame_set_quality(lame_global_flags * gfp, int quality)
+{
+    gfp->quality = quality;
+
+    return 0;
+}
+
+int
+lame_get_quality(const lame_global_flags * gfp)
+{
+    return gfp->quality;
+}
+
+
+/* mode = STEREO, JOINT_STEREO, DUAL_CHANNEL (not supported), MONO */
+int
+lame_set_mode(lame_global_flags * gfp, MPEG_mode mode)
+{
+    int     mpg_mode = mode;
+
+    /* default: lame chooses based on compression ratio and input channels */
+
+    if (mpg_mode < 0 || MAX_INDICATOR <= mpg_mode)
+        return -1;      /* Unknown MPEG mode! */
+
+    gfp->mode = mode;
+
+    return 0;
+}
+
+MPEG_mode
+lame_get_mode(const lame_global_flags * gfp)
+{
+    assert(gfp->mode < MAX_INDICATOR);
+
+    return gfp->mode;
+}
+
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+/*
+  mode_automs.  Use a M/S mode with a switching threshold based on
+  compression ratio
+  DEPRECATED
+*/
+int CDECL lame_set_mode_automs(lame_global_flags *, int);
+int CDECL lame_get_mode_automs(const lame_global_flags *);
+#else
+#endif
+
+/* Us a M/S mode with a switching threshold based on compression ratio */
+/* DEPRECATED */
+int
+lame_set_mode_automs(lame_global_flags * gfp, int mode_automs)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > mode_automs || 1 < mode_automs)
+        return -1;
+
+    lame_set_mode(gfp, JOINT_STEREO);
+
+    return 0;
+}
+
+int
+lame_get_mode_automs(const lame_global_flags * gfp)
+{
+    (void) gfp;
+    return 1;
+}
+
+
+/*
+ * Force M/S for all frames.  For testing only.
+ * Requires mode = 1.
+ */
+int
+lame_set_force_ms(lame_global_flags * gfp, int force_ms)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > force_ms || 1 < force_ms)
+        return -1;
+
+    gfp->force_ms = force_ms;
+
+    return 0;
+}
+
+int
+lame_get_force_ms(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->force_ms && 1 >= gfp->force_ms);
+
+    return gfp->force_ms;
+}
+
+
+/* Use free_format. */
+int
+lame_set_free_format(lame_global_flags * gfp, int free_format)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > free_format || 1 < free_format)
+        return -1;
+
+    gfp->free_format = free_format;
+
+    return 0;
+}
+
+int
+lame_get_free_format(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->free_format && 1 >= gfp->free_format);
+
+    return gfp->free_format;
+}
+
+
+
+/* Perform ReplayGain analysis */
+int
+lame_set_findReplayGain(lame_global_flags * gfp, int findReplayGain)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > findReplayGain || 1 < findReplayGain)
+        return -1;
+
+    gfp->findReplayGain = findReplayGain;
+
+    return 0;
+}
+
+int
+lame_get_findReplayGain(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->findReplayGain && 1 >= gfp->findReplayGain);
+
+    return gfp->findReplayGain;
+}
+
+
+/* Decode on the fly. Find the peak sample. If ReplayGain analysis is 
+   enabled then perform it on the decoded data. */
+int
+lame_set_decode_on_the_fly(lame_global_flags * gfp, int decode_on_the_fly)
+{
+#ifndef DECODE_ON_THE_FLY
+    return -1;
+#else
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > decode_on_the_fly || 1 < decode_on_the_fly)
+        return -1;
+
+    gfp->decode_on_the_fly = decode_on_the_fly;
+
+    return 0;
+#endif
+}
+
+int
+lame_get_decode_on_the_fly(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->decode_on_the_fly && 1 >= gfp->decode_on_the_fly);
+
+    return gfp->decode_on_the_fly;
+}
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+/* DEPRECATED: now does the same as lame_set_findReplayGain()
+   default = 0 (disabled) */
+int CDECL lame_set_ReplayGain_input(lame_global_flags *, int);
+int CDECL lame_get_ReplayGain_input(const lame_global_flags *);
+
+/* DEPRECATED: now does the same as
+   lame_set_decode_on_the_fly() && lame_set_findReplayGain()
+   default = 0 (disabled) */
+int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int);
+int CDECL lame_get_ReplayGain_decode(const lame_global_flags *);
+
+/* DEPRECATED: now does the same as lame_set_decode_on_the_fly()
+   default = 0 (disabled) */
+int CDECL lame_set_findPeakSample(lame_global_flags *, int);
+int CDECL lame_get_findPeakSample(const lame_global_flags *);
+#else
+#endif
+
+/* DEPRECATED. same as lame_set_decode_on_the_fly() */
+int
+lame_set_findPeakSample(lame_global_flags * gfp, int arg)
+{
+    return lame_set_decode_on_the_fly(gfp, arg);
+}
+
+int
+lame_get_findPeakSample(const lame_global_flags * gfp)
+{
+    return lame_get_decode_on_the_fly(gfp);
+}
+
+/* DEPRECATED. same as lame_set_findReplayGain() */
+int
+lame_set_ReplayGain_input(lame_global_flags * gfp, int arg)
+{
+    return lame_set_findReplayGain(gfp, arg);
+}
+
+int
+lame_get_ReplayGain_input(const lame_global_flags * gfp)
+{
+    return lame_get_findReplayGain(gfp);
+}
+
+/* DEPRECATED. same as lame_set_decode_on_the_fly() &&
+   lame_set_findReplayGain() */
+int
+lame_set_ReplayGain_decode(lame_global_flags * gfp, int arg)
+{
+    if (lame_set_decode_on_the_fly(gfp, arg) < 0 || lame_set_findReplayGain(gfp, arg) < 0)
+        return -1;
+    else
+        return 0;
+}
+
+int
+lame_get_ReplayGain_decode(const lame_global_flags * gfp)
+{
+    if (lame_get_decode_on_the_fly(gfp) > 0 && lame_get_findReplayGain(gfp) > 0)
+        return 1;
+    else
+        return 0;
+}
+
+
+/* set and get some gapless encoding flags */
+
+int
+lame_set_nogap_total(lame_global_flags * gfp, int the_nogap_total)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->nogap_total = the_nogap_total;
+    return 0;
+}
+
+int
+lame_get_nogap_total(const lame_global_flags * gfp)
+{
+    return gfp->internal_flags->nogap_total;
+}
+
+int
+lame_set_nogap_currentindex(lame_global_flags * gfp, int the_nogap_index)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->nogap_current = the_nogap_index;
+    return 0;
+}
+
+int
+lame_get_nogap_currentindex(const lame_global_flags * gfp)
+{
+    return gfp->internal_flags->nogap_current;
+}
+
+
+/* message handlers */
+int
+lame_set_errorf(lame_global_flags * gfp, void (*func) (const char *, va_list))
+{
+    gfp->report.errorf = func;
+
+    return 0;
+}
+
+int
+lame_set_debugf(lame_global_flags * gfp, void (*func) (const char *, va_list))
+{
+    gfp->report.debugf = func;
+
+    return 0;
+}
+
+int
+lame_set_msgf(lame_global_flags * gfp, void (*func) (const char *, va_list))
+{
+    gfp->report.msgf = func;
+
+    return 0;
+}
+
+
+/*
+ * Set one of
+ *  - brate
+ *  - compression ratio.
+ *
+ * Default is compression ratio of 11.
+ */
+int
+lame_set_brate(lame_global_flags * gfp, int brate)
+{
+    gfp->brate = brate;
+
+    if (brate > 320) {
+        gfp->disable_reservoir = 1;
+    }
+
+    return 0;
+}
+
+int
+lame_get_brate(const lame_global_flags * gfp)
+{
+    return gfp->brate;
+}
+
+int
+lame_set_compression_ratio(lame_global_flags * gfp, float compression_ratio)
+{
+    gfp->compression_ratio = compression_ratio;
+
+    return 0;
+}
+
+float
+lame_get_compression_ratio(const lame_global_flags * gfp)
+{
+    return gfp->compression_ratio;
+}
+
+
+
+
+/*
+ * frame parameters
+ */
+
+/* Mark as copyright protected. */
+int
+lame_set_copyright(lame_global_flags * gfp, int copyright)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > copyright || 1 < copyright)
+        return -1;
+
+    gfp->copyright = copyright;
+
+    return 0;
+}
+
+int
+lame_get_copyright(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->copyright && 1 >= gfp->copyright);
+
+    return gfp->copyright;
+}
+
+
+/* Mark as original. */
+int
+lame_set_original(lame_global_flags * gfp, int original)
+{
+    /* default = 1 (enabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > original || 1 < original)
+        return -1;
+
+    gfp->original = original;
+
+    return 0;
+}
+
+int
+lame_get_original(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->original && 1 >= gfp->original);
+
+    return gfp->original;
+}
+
+
+/*
+ * error_protection.
+ * Use 2 bytes from each frame for CRC checksum.
+ */
+int
+lame_set_error_protection(lame_global_flags * gfp, int error_protection)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > error_protection || 1 < error_protection)
+        return -1;
+
+    gfp->error_protection = error_protection;
+
+    return 0;
+}
+
+int
+lame_get_error_protection(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->error_protection && 1 >= gfp->error_protection);
+
+    return gfp->error_protection;
+}
+
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+/* padding_type. 0=pad no frames  1=pad all frames 2=adjust padding(default) */
+int CDECL lame_set_padding_type(lame_global_flags *, Padding_type);
+Padding_type CDECL lame_get_padding_type(const lame_global_flags *);
+#else
+#endif
+
+/*
+ * padding_type.
+ *  PAD_NO     = pad no frames
+ *  PAD_ALL    = pad all frames
+ *  PAD_ADJUST = adjust padding
+ */
+int
+lame_set_padding_type(lame_global_flags * gfp, Padding_type padding_type)
+{
+    (void) gfp;
+    (void) padding_type;
+    return 0;
+}
+
+Padding_type
+lame_get_padding_type(const lame_global_flags * gfp)
+{
+    (void) gfp;
+    return PAD_ADJUST;
+}
+
+
+/* MP3 'private extension' bit. Meaningless. */
+int
+lame_set_extension(lame_global_flags * gfp, int extension)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > extension || 1 < extension)
+        return -1;
+
+    gfp->extension = extension;
+
+    return 0;
+}
+
+int
+lame_get_extension(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->extension && 1 >= gfp->extension);
+
+    return gfp->extension;
+}
+
+
+/* Enforce strict ISO compliance. */
+int
+lame_set_strict_ISO(lame_global_flags * gfp, int strict_ISO)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > strict_ISO || 1 < strict_ISO)
+        return -1;
+
+    gfp->strict_ISO = strict_ISO;
+
+    return 0;
+}
+
+int
+lame_get_strict_ISO(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->strict_ISO && 1 >= gfp->strict_ISO);
+
+    return gfp->strict_ISO;
+}
+
+
+
+
+/********************************************************************
+ * quantization/noise shaping 
+ ***********************************************************************/
+
+/* Disable the bit reservoir. For testing only. */
+int
+lame_set_disable_reservoir(lame_global_flags * gfp, int disable_reservoir)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > disable_reservoir || 1 < disable_reservoir)
+        return -1;
+
+    gfp->disable_reservoir = disable_reservoir;
+
+    return 0;
+}
+
+int
+lame_get_disable_reservoir(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->disable_reservoir && 1 >= gfp->disable_reservoir);
+
+    return gfp->disable_reservoir;
+}
+
+
+
+
+int
+lame_set_experimentalX(lame_global_flags * gfp, int experimentalX)
+{
+    lame_set_quant_comp(gfp, experimentalX);
+    lame_set_quant_comp_short(gfp, experimentalX);
+
+    return 0;
+}
+
+int
+lame_get_experimentalX(const lame_global_flags * gfp)
+{
+    return lame_get_quant_comp(gfp);
+}
+
+
+/* Select a different "best quantization" function. default = 0 */
+int
+lame_set_quant_comp(lame_global_flags * gfp, int quant_type)
+{
+    gfp->quant_comp = quant_type;
+
+    return 0;
+}
+
+int
+lame_get_quant_comp(const lame_global_flags * gfp)
+{
+    return gfp->quant_comp;
+}
+
+
+/* Select a different "best quantization" function. default = 0 */
+int
+lame_set_quant_comp_short(lame_global_flags * gfp, int quant_type)
+{
+    gfp->quant_comp_short = quant_type;
+
+    return 0;
+}
+
+int
+lame_get_quant_comp_short(const lame_global_flags * gfp)
+{
+    return gfp->quant_comp_short;
+}
+
+
+/* Another experimental option. For testing only. */
+int
+lame_set_experimentalY(lame_global_flags * gfp, int experimentalY)
+{
+    gfp->experimentalY = experimentalY;
+
+    return 0;
+}
+
+int
+lame_get_experimentalY(const lame_global_flags * gfp)
+{
+    return gfp->experimentalY;
+}
+
+
+int
+lame_set_experimentalZ(lame_global_flags * gfp, int experimentalZ)
+{
+    gfp->experimentalZ = experimentalZ;
+    return 0;
+}
+
+int
+lame_get_experimentalZ(const lame_global_flags * gfp)
+{
+    return gfp->experimentalZ;
+}
+
+
+/* Naoki's psycho acoustic model. */
+int
+lame_set_exp_nspsytune(lame_global_flags * gfp, int exp_nspsytune)
+{
+    /* default = 0 (disabled) */
+
+    gfp->exp_nspsytune = exp_nspsytune;
+
+    return 0;
+}
+
+int
+lame_get_exp_nspsytune(const lame_global_flags * gfp)
+{
+    return gfp->exp_nspsytune;
+}
+
+
+
+
+/********************************************************************
+ * VBR control
+ ***********************************************************************/
+
+/* Types of VBR.  default = vbr_off = CBR */
+int
+lame_set_VBR(lame_global_flags * gfp, vbr_mode VBR)
+{
+    int     vbr_q = VBR;
+
+    if (0 > vbr_q || vbr_max_indicator <= vbr_q)
+        return -1;      /* Unknown VBR mode! */
+
+    gfp->VBR = VBR;
+
+    return 0;
+}
+
+vbr_mode
+lame_get_VBR(const lame_global_flags * gfp)
+{
+    assert(gfp->VBR < vbr_max_indicator);
+
+    return gfp->VBR;
+}
+
+
+/*
+ * VBR quality level.
+ *  0 = highest
+ *  9 = lowest 
+ */
+int
+lame_set_VBR_q(lame_global_flags * gfp, int VBR_q)
+{
+    int     ret = 0;
+
+    if (0 > VBR_q) {
+        ret = -1;       /* Unknown VBR quality level! */
+        VBR_q = 0;
+    }
+    if (9 < VBR_q) {
+        ret = -1;
+        VBR_q = 9;
+    }
+
+    gfp->VBR_q = VBR_q;
+    gfp->VBR_q_frac = 0;
+/*    lame_set_ATHcurve(gfp, VBR_q);
+*/
+    return ret;
+}
+
+int
+lame_get_VBR_q(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->VBR_q && 10 > gfp->VBR_q);
+
+    return gfp->VBR_q;
+}
+
+int
+lame_set_VBR_quality(lame_global_flags * gfp, float VBR_q)
+{
+    int     ret = 0;
+
+    if (0 > VBR_q) {
+        ret = -1;       /* Unknown VBR quality level! */
+        VBR_q = 0;
+    }
+    if (9.999 < VBR_q) {
+        ret = -1;
+        VBR_q = 9.999;
+    }
+
+    gfp->VBR_q = (int) VBR_q;
+    gfp->VBR_q_frac = VBR_q - gfp->VBR_q;
+
+    return ret;
+}
+
+float
+lame_get_VBR_quality(const lame_global_flags * gfp)
+{
+    return gfp->VBR_q + gfp->VBR_q_frac;
+}
+
+
+/* Ignored except for VBR = vbr_abr (ABR mode) */
+int
+lame_set_VBR_mean_bitrate_kbps(lame_global_flags * gfp, int VBR_mean_bitrate_kbps)
+{
+    gfp->VBR_mean_bitrate_kbps = VBR_mean_bitrate_kbps;
+
+    return 0;
+}
+
+int
+lame_get_VBR_mean_bitrate_kbps(const lame_global_flags * gfp)
+{
+    return gfp->VBR_mean_bitrate_kbps;
+}
+
+int
+lame_set_VBR_min_bitrate_kbps(lame_global_flags * gfp, int VBR_min_bitrate_kbps)
+{
+    gfp->VBR_min_bitrate_kbps = VBR_min_bitrate_kbps;
+
+    return 0;
+}
+
+int
+lame_get_VBR_min_bitrate_kbps(const lame_global_flags * gfp)
+{
+    return gfp->VBR_min_bitrate_kbps;
+}
+
+int
+lame_set_VBR_max_bitrate_kbps(lame_global_flags * gfp, int VBR_max_bitrate_kbps)
+{
+    gfp->VBR_max_bitrate_kbps = VBR_max_bitrate_kbps;
+
+    return 0;
+}
+
+int
+lame_get_VBR_max_bitrate_kbps(const lame_global_flags * gfp)
+{
+    return gfp->VBR_max_bitrate_kbps;
+}
+
+
+/*
+ * Strictly enforce VBR_min_bitrate.
+ * Normally it will be violated for analog silence.
+ */
+int
+lame_set_VBR_hard_min(lame_global_flags * gfp, int VBR_hard_min)
+{
+    /* default = 0 (disabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > VBR_hard_min || 1 < VBR_hard_min)
+        return -1;
+
+    gfp->VBR_hard_min = VBR_hard_min;
+
+    return 0;
+}
+
+int
+lame_get_VBR_hard_min(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->VBR_hard_min && 1 >= gfp->VBR_hard_min);
+
+    return gfp->VBR_hard_min;
+}
+
+
+/********************************************************************
+ * Filtering control
+ ***********************************************************************/
+
+/*
+ * Freqency in Hz to apply lowpass.
+ *   0 = default = lame chooses
+ *  -1 = disabled
+ */
+int
+lame_set_lowpassfreq(lame_global_flags * gfp, int lowpassfreq)
+{
+    gfp->lowpassfreq = lowpassfreq;
+
+    return 0;
+}
+
+int
+lame_get_lowpassfreq(const lame_global_flags * gfp)
+{
+    return gfp->lowpassfreq;
+}
+
+
+/*
+ * Width of transition band (in Hz).
+ *  default = one polyphase filter band
+ */
+int
+lame_set_lowpasswidth(lame_global_flags * gfp, int lowpasswidth)
+{
+    gfp->lowpasswidth = lowpasswidth;
+
+    return 0;
+}
+
+int
+lame_get_lowpasswidth(const lame_global_flags * gfp)
+{
+    return gfp->lowpasswidth;
+}
+
+
+/*
+ * Frequency in Hz to apply highpass.
+ *   0 = default = lame chooses
+ *  -1 = disabled
+ */
+int
+lame_set_highpassfreq(lame_global_flags * gfp, int highpassfreq)
+{
+    gfp->highpassfreq = highpassfreq;
+
+    return 0;
+}
+
+int
+lame_get_highpassfreq(const lame_global_flags * gfp)
+{
+    return gfp->highpassfreq;
+}
+
+
+/*
+ * Width of transition band (in Hz).
+ *  default = one polyphase filter band
+ */
+int
+lame_set_highpasswidth(lame_global_flags * gfp, int highpasswidth)
+{
+    gfp->highpasswidth = highpasswidth;
+
+    return 0;
+}
+
+int
+lame_get_highpasswidth(const lame_global_flags * gfp)
+{
+    return gfp->highpasswidth;
+}
+
+
+
+
+/*
+ * psycho acoustics and other arguments which you should not change 
+ * unless you know what you are doing
+ */
+
+
+/* Adjust masking values. */
+int
+lame_set_maskingadjust(lame_global_flags * gfp, float adjust)
+{
+    gfp->maskingadjust = adjust;
+    return 0;
+}
+
+float
+lame_get_maskingadjust(const lame_global_flags * gfp)
+{
+    return gfp->maskingadjust;
+}
+
+int
+lame_set_maskingadjust_short(lame_global_flags * gfp, float adjust)
+{
+    gfp->maskingadjust_short = adjust;
+    return 0;
+}
+
+float
+lame_get_maskingadjust_short(const lame_global_flags * gfp)
+{
+    return gfp->maskingadjust_short;
+}
+
+/* Only use ATH for masking. */
+int
+lame_set_ATHonly(lame_global_flags * gfp, int ATHonly)
+{
+    gfp->ATHonly = ATHonly;
+
+    return 0;
+}
+
+int
+lame_get_ATHonly(const lame_global_flags * gfp)
+{
+    return gfp->ATHonly;
+}
+
+
+/* Only use ATH for short blocks. */
+int
+lame_set_ATHshort(lame_global_flags * gfp, int ATHshort)
+{
+    gfp->ATHshort = ATHshort;
+
+    return 0;
+}
+
+int
+lame_get_ATHshort(const lame_global_flags * gfp)
+{
+    return gfp->ATHshort;
+}
+
+
+/* Disable ATH. */
+int
+lame_set_noATH(lame_global_flags * gfp, int noATH)
+{
+    gfp->noATH = noATH;
+
+    return 0;
+}
+
+int
+lame_get_noATH(const lame_global_flags * gfp)
+{
+    return gfp->noATH;
+}
+
+
+/* Select ATH formula. */
+int
+lame_set_ATHtype(lame_global_flags * gfp, int ATHtype)
+{
+    /* XXX: ATHtype should be converted to an enum. */
+    gfp->ATHtype = ATHtype;
+
+    return 0;
+}
+
+int
+lame_get_ATHtype(const lame_global_flags * gfp)
+{
+    return gfp->ATHtype;
+}
+
+
+/* Select ATH formula 4 shape. */
+int
+lame_set_ATHcurve(lame_global_flags * gfp, float ATHcurve)
+{
+    gfp->ATHcurve = ATHcurve;
+
+    return 0;
+}
+
+float
+lame_get_ATHcurve(const lame_global_flags * gfp)
+{
+    return gfp->ATHcurve;
+}
+
+
+/* Lower ATH by this many db. */
+int
+lame_set_ATHlower(lame_global_flags * gfp, float ATHlower)
+{
+    gfp->ATHlower = -ATHlower / 10.0;
+    return 0;
+}
+
+float
+lame_get_ATHlower(const lame_global_flags * gfp)
+{
+    return -gfp->ATHlower * 10.0;
+}
+
+
+/* Select ATH adaptive adjustment scheme. */
+int
+lame_set_athaa_type(lame_global_flags * gfp, int athaa_type)
+{
+    gfp->athaa_type = athaa_type;
+    return 0;
+}
+
+int
+lame_get_athaa_type(const lame_global_flags * gfp)
+{
+    return gfp->athaa_type;
+}
+
+
+/* Select the loudness approximation used by the ATH adaptive auto-leveling. */
+int
+lame_set_athaa_loudapprox(lame_global_flags * gfp, int athaa_loudapprox)
+{
+    (void) athaa_loudapprox;
+    ERRORF(gfp->internal_flags, "--athaa-loudapprox is obsolete\n");
+    return 0;
+}
+
+int
+lame_get_athaa_loudapprox(const lame_global_flags * gfp)
+{
+    (void) gfp;
+    /* obsolete, the type known under number 2 is the only survival */
+    return 2;
+}
+
+
+/* Adjust (in dB) the point below which adaptive ATH level adjustment occurs. */
+int
+lame_set_athaa_sensitivity(lame_global_flags * gfp, float athaa_sensitivity)
+{
+    gfp->athaa_sensitivity = athaa_sensitivity;
+
+    return 0;
+}
+
+float
+lame_get_athaa_sensitivity(const lame_global_flags * gfp)
+{
+    return gfp->athaa_sensitivity;
+}
+
+
+/* Predictability limit (ISO tonality formula) */
+int     lame_set_cwlimit(lame_global_flags * gfp, int cwlimit);
+int     lame_get_cwlimit(const lame_global_flags * gfp);
+
+int
+lame_set_cwlimit(lame_global_flags * gfp, int cwlimit)
+{
+    (void) gfp;
+    (void) cwlimit;
+    return 0;
+}
+
+int
+lame_get_cwlimit(const lame_global_flags * gfp)
+{
+    (void) gfp;
+    return 0;
+}
+
+
+
+/*
+ * Allow blocktypes to differ between channels.
+ * default:
+ *  0 for jstereo => block types coupled
+ *  1 for stereo  => block types may differ
+ */
+int
+lame_set_allow_diff_short(lame_global_flags * gfp, int allow_diff_short)
+{
+    gfp->short_blocks = allow_diff_short ? short_block_allowed : short_block_coupled;
+
+    return 0;
+}
+
+int
+lame_get_allow_diff_short(const lame_global_flags * gfp)
+{
+    if (gfp->short_blocks == short_block_allowed)
+        return 1;       /* short blocks allowed to differ */
+    else
+        return 0;       /* not set, dispensed, forced or coupled */
+}
+
+
+/* Use temporal masking effect */
+int
+lame_set_useTemporal(lame_global_flags * gfp, int useTemporal)
+{
+    /* default = 1 (enabled) */
+
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > useTemporal || 1 < useTemporal)
+        return -1;
+
+    gfp->useTemporal = useTemporal;
+
+    return 0;
+}
+
+int
+lame_get_useTemporal(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->useTemporal && 1 >= gfp->useTemporal);
+
+    return gfp->useTemporal;
+}
+
+
+/* Use inter-channel masking effect */
+int
+lame_set_interChRatio(lame_global_flags * gfp, float ratio)
+{
+    /* default = 0.0 (no inter-channel maskin) */
+    if (!(0 <= ratio && ratio <= 1.0))
+        return -1;
+
+    gfp->interChRatio = ratio;
+
+    return 0;
+}
+
+float
+lame_get_interChRatio(const lame_global_flags * gfp)
+{
+    assert((0 <= gfp->interChRatio && gfp->interChRatio <= 1.0) || EQ(gfp->interChRatio, -1));
+
+    return gfp->interChRatio;
+}
+
+
+/* Use pseudo substep shaping method */
+int
+lame_set_substep(lame_global_flags * gfp, int method)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    /* default = 0.0 (no substep noise shaping) */
+    if (!(0 <= method && method <= 7))
+        return -1;
+
+    gfc->substep_shaping = method;
+    return 0;
+}
+
+int
+lame_get_substep(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    assert(0 <= gfc->substep_shaping && gfc->substep_shaping <= 7);
+    return gfc->substep_shaping;
+}
+
+/* scalefactors scale */
+int
+lame_set_sfscale(lame_global_flags * gfp, int val)
+{
+    if (val)
+        gfp->internal_flags->noise_shaping = 2;
+    else
+        gfp->internal_flags->noise_shaping = 1;
+    return 0;
+}
+
+int
+lame_get_sfscale(const lame_global_flags * gfp)
+{
+    return (gfp->internal_flags->noise_shaping == 2);
+}
+
+/* subblock gain */
+int
+lame_set_subblock_gain(lame_global_flags * gfp, int sbgain)
+{
+    gfp->internal_flags->subblock_gain = sbgain;
+    return sbgain;
+}
+
+int
+lame_get_subblock_gain(const lame_global_flags * gfp)
+{
+    return gfp->internal_flags->subblock_gain;
+}
+
+
+/* Disable short blocks. */
+int
+lame_set_no_short_blocks(lame_global_flags * gfp, int no_short_blocks)
+{
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > no_short_blocks || 1 < no_short_blocks)
+        return -1;
+
+    gfp->short_blocks = no_short_blocks ? short_block_dispensed : short_block_allowed;
+
+    return 0;
+}
+
+int
+lame_get_no_short_blocks(const lame_global_flags * gfp)
+{
+    switch (gfp->short_blocks) {
+    default:
+    case short_block_not_set:
+        return -1;
+    case short_block_dispensed:
+        return 1;
+    case short_block_allowed:
+    case short_block_coupled:
+    case short_block_forced:
+        return 0;
+    }
+}
+
+
+/* Force short blocks. */
+int
+lame_set_force_short_blocks(lame_global_flags * gfp, int short_blocks)
+{
+    /* enforce disable/enable meaning, if we need more than two values
+       we need to switch to an enum to have an apropriate representation
+       of the possible meanings of the value */
+    if (0 > short_blocks || 1 < short_blocks)
+        return -1;
+
+    if (short_blocks == 1)
+        gfp->short_blocks = short_block_forced;
+    else if (gfp->short_blocks == short_block_forced)
+        gfp->short_blocks = short_block_allowed;
+
+    return 0;
+}
+
+int
+lame_get_force_short_blocks(const lame_global_flags * gfp)
+{
+    switch (gfp->short_blocks) {
+    default:
+    case short_block_not_set:
+        return -1;
+    case short_block_dispensed:
+    case short_block_allowed:
+    case short_block_coupled:
+        return 0;
+    case short_block_forced:
+        return 1;
+    }
+}
+
+int
+lame_set_short_threshold_lrm(lame_global_flags * gfp, float lrm)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->nsPsy.attackthre = lrm;
+    return 0;
+}
+
+float
+lame_get_short_threshold_lrm(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->nsPsy.attackthre;
+}
+
+int
+lame_set_short_threshold_s(lame_global_flags * gfp, float s)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    gfc->nsPsy.attackthre_s = s;
+    return 0;
+}
+
+float
+lame_get_short_threshold_s(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->nsPsy.attackthre_s;
+}
+
+int
+lame_set_short_threshold(lame_global_flags * gfp, float lrm, float s)
+{
+    lame_set_short_threshold_lrm(gfp, lrm);
+    lame_set_short_threshold_s(gfp, s);
+    return 0;
+}
+
+
+/*
+ * Input PCM is emphased PCM
+ * (for instance from one of the rarely emphased CDs).
+ *
+ * It is STRONGLY not recommended to use this, because psycho does not
+ * take it into account, and last but not least many decoders
+ * ignore these bits
+ */
+int
+lame_set_emphasis(lame_global_flags * gfp, int emphasis)
+{
+    /* XXX: emphasis should be converted to an enum */
+    if (0 > emphasis || 4 <= emphasis)
+        return -1;
+
+    gfp->emphasis = emphasis;
+
+    return 0;
+}
+
+int
+lame_get_emphasis(const lame_global_flags * gfp)
+{
+    assert(0 <= gfp->emphasis && 4 > gfp->emphasis);
+
+    return gfp->emphasis;
+}
+
+
+
+
+/***************************************************************/
+/* internal variables, cannot be set...                        */
+/* provided because they may be of use to calling application  */
+/***************************************************************/
+
+/* MPEG version.
+ *  0 = MPEG-2
+ *  1 = MPEG-1
+ * (2 = MPEG-2.5)    
+ */
+int
+lame_get_version(const lame_global_flags * gfp)
+{
+    return gfp->version;
+}
+
+
+/* Encoder delay. */
+int
+lame_get_encoder_delay(const lame_global_flags * gfp)
+{
+    return gfp->encoder_delay;
+}
+
+/* padding added to the end of the input */
+int
+lame_get_encoder_padding(const lame_global_flags * gfp)
+{
+    return gfp->encoder_padding;
+}
+
+
+/* Size of MPEG frame. */
+int
+lame_get_framesize(const lame_global_flags * gfp)
+{
+    return gfp->framesize;
+}
+
+
+/* Number of frames encoded so far. */
+int
+lame_get_frameNum(const lame_global_flags * gfp)
+{
+    return gfp->frameNum;
+}
+
+int
+lame_get_mf_samples_to_encode(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->mf_samples_to_encode;
+}
+
+int     CDECL
+lame_get_size_mp3buffer(const lame_global_flags * gfp)
+{
+    int     size;
+    compute_flushbits(gfp, &size);
+    return size;
+}
+
+int
+lame_get_RadioGain(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->RadioGain;
+}
+
+int
+lame_get_AudiophileGain(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->AudiophileGain;
+}
+
+float
+lame_get_PeakSample(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return (float) gfc->PeakSample;
+}
+
+int
+lame_get_noclipGainChange(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->noclipGainChange;
+}
+
+float
+lame_get_noclipScale(const lame_global_flags * gfp)
+{
+    lame_internal_flags *gfc = gfp->internal_flags;
+    return gfc->noclipScale;
+}
+
+
+/*
+ * LAME's estimate of the total number of frames to be encoded.
+ * Only valid if calling program set num_samples.
+ */
+int
+lame_get_totalframes(const lame_global_flags * gfp)
+{
+    int     totalframes;
+    /* estimate based on user set num_samples: */
+    totalframes =
+        2 + ((double) gfp->num_samples * gfp->out_samplerate) /
+        ((double) gfp->in_samplerate * gfp->framesize);
+
+    /* check to see if we underestimated totalframes */
+    /*    if (totalframes < gfp->frameNum) */
+    /*        totalframes = gfp->frameNum; */
+
+    return totalframes;
+}
+
+
+
+
+
+int
+lame_set_preset(lame_global_flags * gfp, int preset)
+{
+    gfp->preset = preset;
+    return apply_preset(gfp, preset, 1);
+}
+
+
+
+int
+lame_set_asm_optimizations(lame_global_flags * gfp, int optim, int mode)
+{
+    mode = (mode == 1 ? 1 : 0);
+    switch (optim) {
+    case MMX:{
+            gfp->asm_optimizations.mmx = mode;
+            return optim;
+        }
+    case AMD_3DNOW:{
+            gfp->asm_optimizations.amd3dnow = mode;
+            return optim;
+        }
+    case SSE:{
+            gfp->asm_optimizations.sse = mode;
+            return optim;
+        }
+    default:
+        return optim;
+    }
+}
+
+
+void
+lame_set_write_id3tag_automatic(lame_global_flags * gfp, int v)
+{
+    if (gfp) {
+        gfp->write_id3tag_automatic = v;
+    }
+}
+
+
+int
+lame_get_write_id3tag_automatic(lame_global_flags const *gfp)
+{
+    if (gfp) {
+        return gfp->write_id3tag_automatic;
+    }
+    return 1;
+}
+
+
+/*
+
+UNDOCUMENTED, experimental settings.  These routines are not prototyped
+in lame.h.  You should not use them, they are experimental and may
+change.  
+
+*/
+
+
+/*
+ *  just another daily changing developer switch  
+ */
+void CDECL lame_set_tune(lame_global_flags *, float);
+
+void
+lame_set_tune(lame_global_flags * gfp, float val)
+{
+    gfp->tune_value_a = val;
+    gfp->tune = 1;
+}
+
+/* Custom msfix hack */
+void
+lame_set_msfix(lame_global_flags * gfp, double msfix)
+{
+    /* default = 0 */
+    gfp->msfix = msfix;
+}
+
+float
+lame_get_msfix(const lame_global_flags * gfp)
+{
+    return gfp->msfix;
+}
+
+#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
+int CDECL lame_set_preset_expopts(lame_global_flags *, int);
+#else
+#endif
+
+int
+lame_set_preset_expopts(lame_global_flags * gfp, int preset_expopts)
+{
+    (void) gfp;
+    (void) preset_expopts;
+    return 0;
+}
+
+
+int
+lame_set_preset_notune(lame_global_flags * gfp, int preset_notune)
+{
+    (void) gfp;
+    (void) preset_notune;
+    return 0;
+}
diff --git a/libmp3lame/set_get.h b/libmp3lame/set_get.h
new file mode 100644
index 0000000..cd392b2
--- /dev/null
+++ b/libmp3lame/set_get.h
@@ -0,0 +1,81 @@
+/*
+ * set_get.h -- Internal set/get definitions
+ *
+ * Copyright (C) 2003 Gabriel Bouvigne / Lame project
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SET_GET_H__
+#define __SET_GET_H__
+
+
+#if defined(__cplusplus)
+extern  "C" {
+#endif
+
+#if defined(WIN32)
+#undef CDECL
+#define CDECL _cdecl
+#else
+#define CDECL
+#endif
+
+
+/* select psychoacoustic model */
+
+/* manage short blocks */
+    int CDECL lame_set_short_threshold(lame_global_flags *, float, float);
+    int CDECL lame_set_short_threshold_lrm(lame_global_flags *, float);
+    float CDECL lame_get_short_threshold_lrm(const lame_global_flags *);
+    int CDECL lame_set_short_threshold_s(lame_global_flags *, float);
+    float CDECL lame_get_short_threshold_s(const lame_global_flags *);
+
+
+    int CDECL lame_set_maskingadjust(lame_global_flags *, float);
+    float CDECL lame_get_maskingadjust(const lame_global_flags *);
+
+    int CDECL lame_set_maskingadjust_short(lame_global_flags *, float);
+    float CDECL lame_get_maskingadjust_short(const lame_global_flags *);
+
+/* select ATH formula 4 shape */
+    int CDECL lame_set_ATHcurve(lame_global_flags *, float);
+    float CDECL lame_get_ATHcurve(const lame_global_flags *);
+
+    int CDECL lame_set_preset_notune(lame_global_flags *, int);
+
+/* substep shaping method */
+    int CDECL lame_set_substep(lame_global_flags *, int);
+    int CDECL lame_get_substep(const lame_global_flags *);
+
+/* scalefactors scale */
+    int CDECL lame_set_sfscale(lame_global_flags *, int);
+    int CDECL lame_get_sfscale(const lame_global_flags *);
+
+/* subblock gain */
+    int CDECL lame_set_subblock_gain(lame_global_flags *, int);
+    int CDECL lame_get_subblock_gain(const lame_global_flags *);
+
+
+
+/*presets*/
+    int     apply_preset(lame_global_flags *, int preset, int enforce);
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/libmp3lame/tables.c b/libmp3lame/tables.c
new file mode 100644
index 0000000..81edb3f
--- /dev/null
+++ b/libmp3lame/tables.c
@@ -0,0 +1,545 @@
+/*
+ *	MPEG layer 3 tables source file
+ *
+ *	Copyright (c) 1999 Albert L Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: tables.c,v 1.25 2008/04/12 18:18:07 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "tables.h"
+
+
+static const short t1HB[] = {
+    1, 1,
+    1, 0
+};
+
+static const short t2HB[] = {
+    1, 2, 1,
+    3, 1, 1,
+    3, 2, 0
+};
+
+static const short t3HB[] = {
+    3, 2, 1,
+    1, 1, 1,
+    3, 2, 0
+};
+
+static const short t5HB[] = {
+    1, 2, 6, 5,
+    3, 1, 4, 4,
+    7, 5, 7, 1,
+    6, 1, 1, 0
+};
+
+static const short t6HB[] = {
+    7, 3, 5, 1,
+    6, 2, 3, 2,
+    5, 4, 4, 1,
+    3, 3, 2, 0
+};
+
+static const short t7HB[] = {
+    1, 2, 10, 19, 16, 10,
+    3, 3, 7, 10, 5, 3,
+    11, 4, 13, 17, 8, 4,
+    12, 11, 18, 15, 11, 2,
+    7, 6, 9, 14, 3, 1,
+    6, 4, 5, 3, 2, 0
+};
+
+static const short t8HB[] = {
+    3, 4, 6, 18, 12, 5,
+    5, 1, 2, 16, 9, 3,
+    7, 3, 5, 14, 7, 3,
+    19, 17, 15, 13, 10, 4,
+    13, 5, 8, 11, 5, 1,
+    12, 4, 4, 1, 1, 0
+};
+
+static const short t9HB[] = {
+    7, 5, 9, 14, 15, 7,
+    6, 4, 5, 5, 6, 7,
+    7, 6, 8, 8, 8, 5,
+    15, 6, 9, 10, 5, 1,
+    11, 7, 9, 6, 4, 1,
+    14, 4, 6, 2, 6, 0
+};
+
+static const short t10HB[] = {
+    1, 2, 10, 23, 35, 30, 12, 17,
+    3, 3, 8, 12, 18, 21, 12, 7,
+    11, 9, 15, 21, 32, 40, 19, 6,
+    14, 13, 22, 34, 46, 23, 18, 7,
+    20, 19, 33, 47, 27, 22, 9, 3,
+    31, 22, 41, 26, 21, 20, 5, 3,
+    14, 13, 10, 11, 16, 6, 5, 1,
+    9, 8, 7, 8, 4, 4, 2, 0
+};
+
+static const short t11HB[] = {
+    3, 4, 10, 24, 34, 33, 21, 15,
+    5, 3, 4, 10, 32, 17, 11, 10,
+    11, 7, 13, 18, 30, 31, 20, 5,
+    25, 11, 19, 59, 27, 18, 12, 5,
+    35, 33, 31, 58, 30, 16, 7, 5,
+    28, 26, 32, 19, 17, 15, 8, 14,
+    14, 12, 9, 13, 14, 9, 4, 1,
+    11, 4, 6, 6, 6, 3, 2, 0
+};
+
+static const short t12HB[] = {
+    9, 6, 16, 33, 41, 39, 38, 26,
+    7, 5, 6, 9, 23, 16, 26, 11,
+    17, 7, 11, 14, 21, 30, 10, 7,
+    17, 10, 15, 12, 18, 28, 14, 5,
+    32, 13, 22, 19, 18, 16, 9, 5,
+    40, 17, 31, 29, 17, 13, 4, 2,
+    27, 12, 11, 15, 10, 7, 4, 1,
+    27, 12, 8, 12, 6, 3, 1, 0
+};
+
+static const short t13HB[] = {
+    1, 5, 14, 21, 34, 51, 46, 71, 42, 52, 68, 52, 67, 44, 43, 19,
+    3, 4, 12, 19, 31, 26, 44, 33, 31, 24, 32, 24, 31, 35, 22, 14,
+    15, 13, 23, 36, 59, 49, 77, 65, 29, 40, 30, 40, 27, 33, 42, 16,
+    22, 20, 37, 61, 56, 79, 73, 64, 43, 76, 56, 37, 26, 31, 25, 14,
+    35, 16, 60, 57, 97, 75, 114, 91, 54, 73, 55, 41, 48, 53, 23, 24,
+    58, 27, 50, 96, 76, 70, 93, 84, 77, 58, 79, 29, 74, 49, 41, 17,
+    47, 45, 78, 74, 115, 94, 90, 79, 69, 83, 71, 50, 59, 38, 36, 15,
+    72, 34, 56, 95, 92, 85, 91, 90, 86, 73, 77, 65, 51, 44, 43, 42,
+    43, 20, 30, 44, 55, 78, 72, 87, 78, 61, 46, 54, 37, 30, 20, 16,
+    53, 25, 41, 37, 44, 59, 54, 81, 66, 76, 57, 54, 37, 18, 39, 11,
+    35, 33, 31, 57, 42, 82, 72, 80, 47, 58, 55, 21, 22, 26, 38, 22,
+    53, 25, 23, 38, 70, 60, 51, 36, 55, 26, 34, 23, 27, 14, 9, 7,
+    34, 32, 28, 39, 49, 75, 30, 52, 48, 40, 52, 28, 18, 17, 9, 5,
+    45, 21, 34, 64, 56, 50, 49, 45, 31, 19, 12, 15, 10, 7, 6, 3,
+    48, 23, 20, 39, 36, 35, 53, 21, 16, 23, 13, 10, 6, 1, 4, 2,
+    16, 15, 17, 27, 25, 20, 29, 11, 17, 12, 16, 8, 1, 1, 0, 1
+};
+
+static const short t15HB[] = {
+    7, 12, 18, 53, 47, 76, 124, 108, 89, 123, 108, 119, 107, 81, 122, 63,
+    13, 5, 16, 27, 46, 36, 61, 51, 42, 70, 52, 83, 65, 41, 59, 36,
+    19, 17, 15, 24, 41, 34, 59, 48, 40, 64, 50, 78, 62, 80, 56, 33,
+    29, 28, 25, 43, 39, 63, 55, 93, 76, 59, 93, 72, 54, 75, 50, 29,
+    52, 22, 42, 40, 67, 57, 95, 79, 72, 57, 89, 69, 49, 66, 46, 27,
+    77, 37, 35, 66, 58, 52, 91, 74, 62, 48, 79, 63, 90, 62, 40, 38,
+    125, 32, 60, 56, 50, 92, 78, 65, 55, 87, 71, 51, 73, 51, 70, 30,
+    109, 53, 49, 94, 88, 75, 66, 122, 91, 73, 56, 42, 64, 44, 21, 25,
+    90, 43, 41, 77, 73, 63, 56, 92, 77, 66, 47, 67, 48, 53, 36, 20,
+    71, 34, 67, 60, 58, 49, 88, 76, 67, 106, 71, 54, 38, 39, 23, 15,
+    109, 53, 51, 47, 90, 82, 58, 57, 48, 72, 57, 41, 23, 27, 62, 9,
+    86, 42, 40, 37, 70, 64, 52, 43, 70, 55, 42, 25, 29, 18, 11, 11,
+    118, 68, 30, 55, 50, 46, 74, 65, 49, 39, 24, 16, 22, 13, 14, 7,
+    91, 44, 39, 38, 34, 63, 52, 45, 31, 52, 28, 19, 14, 8, 9, 3,
+    123, 60, 58, 53, 47, 43, 32, 22, 37, 24, 17, 12, 15, 10, 2, 1,
+    71, 37, 34, 30, 28, 20, 17, 26, 21, 16, 10, 6, 8, 6, 2, 0
+};
+
+static const short t16HB[] = {
+    1, 5, 14, 44, 74, 63, 110, 93, 172, 149, 138, 242, 225, 195, 376, 17,
+    3, 4, 12, 20, 35, 62, 53, 47, 83, 75, 68, 119, 201, 107, 207, 9,
+    15, 13, 23, 38, 67, 58, 103, 90, 161, 72, 127, 117, 110, 209, 206, 16,
+    45, 21, 39, 69, 64, 114, 99, 87, 158, 140, 252, 212, 199, 387, 365, 26,
+    75, 36, 68, 65, 115, 101, 179, 164, 155, 264, 246, 226, 395, 382, 362, 9,
+    66, 30, 59, 56, 102, 185, 173, 265, 142, 253, 232, 400, 388, 378, 445, 16,
+    111, 54, 52, 100, 184, 178, 160, 133, 257, 244, 228, 217, 385, 366, 715, 10,
+    98, 48, 91, 88, 165, 157, 148, 261, 248, 407, 397, 372, 380, 889, 884, 8,
+    85, 84, 81, 159, 156, 143, 260, 249, 427, 401, 392, 383, 727, 713, 708, 7,
+    154, 76, 73, 141, 131, 256, 245, 426, 406, 394, 384, 735, 359, 710, 352, 11,
+    139, 129, 67, 125, 247, 233, 229, 219, 393, 743, 737, 720, 885, 882, 439, 4,
+    243, 120, 118, 115, 227, 223, 396, 746, 742, 736, 721, 712, 706, 223, 436, 6,
+    202, 224, 222, 218, 216, 389, 386, 381, 364, 888, 443, 707, 440, 437, 1728, 4,
+    747, 211, 210, 208, 370, 379, 734, 723, 714, 1735, 883, 877, 876, 3459, 865, 2,
+    377, 369, 102, 187, 726, 722, 358, 711, 709, 866, 1734, 871, 3458, 870, 434, 0,
+    12, 10, 7, 11, 10, 17, 11, 9, 13, 12, 10, 7, 5, 3, 1, 3
+};
+
+static const short t24HB[] = {
+    15, 13, 46, 80, 146, 262, 248, 434, 426, 669, 653, 649, 621, 517, 1032, 88,
+    14, 12, 21, 38, 71, 130, 122, 216, 209, 198, 327, 345, 319, 297, 279, 42,
+    47, 22, 41, 74, 68, 128, 120, 221, 207, 194, 182, 340, 315, 295, 541, 18,
+    81, 39, 75, 70, 134, 125, 116, 220, 204, 190, 178, 325, 311, 293, 271, 16,
+    147, 72, 69, 135, 127, 118, 112, 210, 200, 188, 352, 323, 306, 285, 540, 14,
+    263, 66, 129, 126, 119, 114, 214, 202, 192, 180, 341, 317, 301, 281, 262, 12,
+    249, 123, 121, 117, 113, 215, 206, 195, 185, 347, 330, 308, 291, 272, 520, 10,
+    435, 115, 111, 109, 211, 203, 196, 187, 353, 332, 313, 298, 283, 531, 381, 17,
+    427, 212, 208, 205, 201, 193, 186, 177, 169, 320, 303, 286, 268, 514, 377, 16,
+    335, 199, 197, 191, 189, 181, 174, 333, 321, 305, 289, 275, 521, 379, 371, 11,
+    668, 184, 183, 179, 175, 344, 331, 314, 304, 290, 277, 530, 383, 373, 366, 10,
+    652, 346, 171, 168, 164, 318, 309, 299, 287, 276, 263, 513, 375, 368, 362, 6,
+    648, 322, 316, 312, 307, 302, 292, 284, 269, 261, 512, 376, 370, 364, 359, 4,
+    620, 300, 296, 294, 288, 282, 273, 266, 515, 380, 374, 369, 365, 361, 357, 2,
+    1033, 280, 278, 274, 267, 264, 259, 382, 378, 372, 367, 363, 360, 358, 356, 0,
+    43, 20, 19, 17, 15, 13, 11, 9, 7, 6, 4, 7, 5, 3, 1, 3
+};
+
+static const short t32HB[] = {
+    1 << 0, 5 << 1, 4 << 1, 5 << 2, 6 << 1, 5 << 2, 4 << 2, 4 << 3,
+    7 << 1, 3 << 2, 6 << 2, 0 << 3, 7 << 2, 2 << 3, 3 << 3, 1 << 4
+};
+
+static const short t33HB[] = {
+    15 << 0, 14 << 1, 13 << 1, 12 << 2, 11 << 1, 10 << 2, 9 << 2, 8 << 3,
+    7 << 1, 6 << 2, 5 << 2, 4 << 3, 3 << 2, 2 << 3, 1 << 3, 0 << 4
+};
+
+
+const char t1l[] = {
+    1, 4,
+    3, 5
+};
+
+const char t2l[] = {
+    1, 4, 7,
+    4, 5, 7,
+    6, 7, 8
+};
+
+const char t3l[] = {
+    2, 3, 7,
+    4, 4, 7,
+    6, 7, 8
+};
+
+const char t5l[] = {
+    1, 4, 7, 8,
+    4, 5, 8, 9,
+    7, 8, 9, 10,
+    8, 8, 9, 10
+};
+
+const char t6l[] = {
+    3, 4, 6, 8,
+    4, 4, 6, 7,
+    5, 6, 7, 8,
+    7, 7, 8, 9
+};
+
+const char t7l[] = {
+    1, 4, 7, 9, 9, 10,
+    4, 6, 8, 9, 9, 10,
+    7, 7, 9, 10, 10, 11,
+    8, 9, 10, 11, 11, 11,
+    8, 9, 10, 11, 11, 12,
+    9, 10, 11, 12, 12, 12
+};
+
+const char t8l[] = {
+    2, 4, 7, 9, 9, 10,
+    4, 4, 6, 10, 10, 10,
+    7, 6, 8, 10, 10, 11,
+    9, 10, 10, 11, 11, 12,
+    9, 9, 10, 11, 12, 12,
+    10, 10, 11, 11, 13, 13
+};
+
+const char t9l[] = {
+    3, 4, 6, 7, 9, 10,
+    4, 5, 6, 7, 8, 10,
+    5, 6, 7, 8, 9, 10,
+    7, 7, 8, 9, 9, 10,
+    8, 8, 9, 9, 10, 11,
+    9, 9, 10, 10, 11, 11
+};
+
+const char t10l[] = {
+    1, 4, 7, 9, 10, 10, 10, 11,
+    4, 6, 8, 9, 10, 11, 10, 10,
+    7, 8, 9, 10, 11, 12, 11, 11,
+    8, 9, 10, 11, 12, 12, 11, 12,
+    9, 10, 11, 12, 12, 12, 12, 12,
+    10, 11, 12, 12, 13, 13, 12, 13,
+    9, 10, 11, 12, 12, 12, 13, 13,
+    10, 10, 11, 12, 12, 13, 13, 13
+};
+
+const char t11l[] = {
+    2, 4, 6, 8, 9, 10, 9, 10,
+    4, 5, 6, 8, 10, 10, 9, 10,
+    6, 7, 8, 9, 10, 11, 10, 10,
+    8, 8, 9, 11, 10, 12, 10, 11,
+    9, 10, 10, 11, 11, 12, 11, 12,
+    9, 10, 11, 12, 12, 13, 12, 13,
+    9, 9, 9, 10, 11, 12, 12, 12,
+    9, 9, 10, 11, 12, 12, 12, 12
+};
+
+const char t12l[] = {
+    4, 4, 6, 8, 9, 10, 10, 10,
+    4, 5, 6, 7, 9, 9, 10, 10,
+    6, 6, 7, 8, 9, 10, 9, 10,
+    7, 7, 8, 8, 9, 10, 10, 10,
+    8, 8, 9, 9, 10, 10, 10, 11,
+    9, 9, 10, 10, 10, 11, 10, 11,
+    9, 9, 9, 10, 10, 11, 11, 12,
+    10, 10, 10, 11, 11, 11, 11, 12
+};
+
+const char t13l[] = {
+    1, 5, 7, 8, 9, 10, 10, 11, 10, 11, 12, 12, 13, 13, 14, 14,
+    4, 6, 8, 9, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, 14,
+    7, 8, 9, 10, 11, 11, 12, 12, 11, 12, 12, 13, 13, 14, 15, 15,
+    8, 9, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 15, 15,
+    9, 9, 11, 11, 12, 12, 13, 13, 12, 13, 13, 14, 14, 15, 15, 16,
+    10, 10, 11, 12, 12, 12, 13, 13, 13, 13, 14, 13, 15, 15, 16, 16,
+    10, 11, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16,
+    11, 11, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 18, 18,
+    10, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 16, 17, 17,
+    11, 11, 12, 12, 13, 13, 13, 15, 14, 15, 15, 16, 16, 16, 18, 17,
+    11, 12, 12, 13, 13, 14, 14, 15, 14, 15, 16, 15, 16, 17, 18, 19,
+    12, 12, 12, 13, 14, 14, 14, 14, 15, 15, 15, 16, 17, 17, 17, 18,
+    12, 13, 13, 14, 14, 15, 14, 15, 16, 16, 17, 17, 17, 18, 18, 18,
+    13, 13, 14, 15, 15, 15, 16, 16, 16, 16, 16, 17, 18, 17, 18, 18,
+    14, 14, 14, 15, 15, 15, 17, 16, 16, 19, 17, 17, 17, 19, 18, 18,
+    13, 14, 15, 16, 16, 16, 17, 16, 17, 17, 18, 18, 21, 20, 21, 18
+};
+
+const char t15l[] = {
+    3, 5, 6, 8, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 14,
+    5, 5, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13,
+    6, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13,
+    7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13,
+    8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13,
+    9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 14,
+    10, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14,
+    10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 14,
+    10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14,
+    10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14,
+    11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 15, 14,
+    11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15,
+    12, 12, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 15, 15,
+    12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15,
+    13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 14, 15,
+    13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15
+};
+
+const char t16_5l[] = {
+    1, 5, 7, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 11,
+    4, 6, 8, 9, 10, 11, 11, 11, 12, 12, 12, 13, 14, 13, 14, 11,
+    7, 8, 9, 10, 11, 11, 12, 12, 13, 12, 13, 13, 13, 14, 14, 12,
+    9, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 13,
+    10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 12,
+    10, 10, 11, 11, 12, 13, 13, 14, 13, 14, 14, 15, 15, 15, 16, 13,
+    11, 11, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 13,
+    11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 17, 17, 13,
+    11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 13,
+    12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 15, 16, 15, 14,
+    12, 13, 12, 13, 14, 14, 14, 14, 15, 16, 16, 16, 17, 17, 16, 13,
+    13, 13, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 14,
+    13, 14, 14, 14, 14, 15, 15, 15, 15, 17, 16, 16, 16, 16, 18, 14,
+    15, 14, 14, 14, 15, 15, 16, 16, 16, 18, 17, 17, 17, 19, 17, 14,
+    14, 15, 13, 14, 16, 16, 15, 16, 16, 17, 18, 17, 19, 17, 16, 14,
+    11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 12
+};
+
+const char t16l[] = {
+    1, 5, 7, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 10,
+    4, 6, 8, 9, 10, 11, 11, 11, 12, 12, 12, 13, 14, 13, 14, 10,
+    7, 8, 9, 10, 11, 11, 12, 12, 13, 12, 13, 13, 13, 14, 14, 11,
+    9, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 12,
+    10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 11,
+    10, 10, 11, 11, 12, 13, 13, 14, 13, 14, 14, 15, 15, 15, 16, 12,
+    11, 11, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 12,
+    11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 17, 17, 12,
+    11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 12,
+    12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 15, 16, 15, 13,
+    12, 13, 12, 13, 14, 14, 14, 14, 15, 16, 16, 16, 17, 17, 16, 12,
+    13, 13, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 13,
+    13, 14, 14, 14, 14, 15, 15, 15, 15, 17, 16, 16, 16, 16, 18, 13,
+    15, 14, 14, 14, 15, 15, 16, 16, 16, 18, 17, 17, 17, 19, 17, 13,
+    14, 15, 13, 14, 16, 16, 15, 16, 16, 17, 18, 17, 19, 17, 16, 13,
+    10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 10
+};
+
+const char t24l[] = {
+    4, 5, 7, 8, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 13, 10,
+    5, 6, 7, 8, 9, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 10,
+    7, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 9,
+    8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 9,
+    9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 9,
+    10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 9,
+    10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 9,
+    11, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 10,
+    11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 10,
+    11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 10,
+    12, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 10,
+    12, 12, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 10,
+    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 10,
+    12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 10,
+    13, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 10,
+    9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 6
+};
+
+const char t32l[] = {
+    1 + 0, 4 + 1, 4 + 1, 5 + 2, 4 + 1, 6 + 2, 5 + 2, 6 + 3,
+    4 + 1, 5 + 2, 5 + 2, 6 + 3, 5 + 2, 6 + 3, 6 + 3, 6 + 4
+};
+
+const char t33l[] = {
+    4 + 0, 4 + 1, 4 + 1, 4 + 2, 4 + 1, 4 + 2, 4 + 2, 4 + 3,
+    4 + 1, 4 + 2, 4 + 2, 4 + 3, 4 + 2, 4 + 3, 4 + 3, 4 + 4
+};
+
+
+const struct huffcodetab ht[HTN] = {
+    /* xlen, linmax, table, hlen */
+    {0, 0, NULL, NULL},
+    {2, 0, t1HB, t1l},
+    {3, 0, t2HB, t2l},
+    {3, 0, t3HB, t3l},
+    {0, 0, NULL, NULL}, /* Apparently not used */
+    {4, 0, t5HB, t5l},
+    {4, 0, t6HB, t6l},
+    {6, 0, t7HB, t7l},
+    {6, 0, t8HB, t8l},
+    {6, 0, t9HB, t9l},
+    {8, 0, t10HB, t10l},
+    {8, 0, t11HB, t11l},
+    {8, 0, t12HB, t12l},
+    {16, 0, t13HB, t13l},
+    {0, 0, NULL, t16_5l}, /* Apparently not used */
+    {16, 0, t15HB, t15l},
+
+    {1, 1, t16HB, t16l},
+    {2, 3, t16HB, t16l},
+    {3, 7, t16HB, t16l},
+    {4, 15, t16HB, t16l},
+    {6, 63, t16HB, t16l},
+    {8, 255, t16HB, t16l},
+    {10, 1023, t16HB, t16l},
+    {13, 8191, t16HB, t16l},
+
+    {4, 15, t24HB, t24l},
+    {5, 31, t24HB, t24l},
+    {6, 63, t24HB, t24l},
+    {7, 127, t24HB, t24l},
+    {8, 255, t24HB, t24l},
+    {9, 511, t24HB, t24l},
+    {11, 2047, t24HB, t24l},
+    {13, 8191, t24HB, t24l},
+
+    {0, 0, t32HB, t32l},
+    {0, 0, t33HB, t33l},
+};
+
+
+
+
+
+/*  for (i = 0; i < 16*16; i++) {
+ *      largetbl[i] = ((ht[16].hlen[i]) << 16) + ht[24].hlen[i];
+ *  }
+ */
+const unsigned int largetbl[16 * 16] = {
+    0x010004, 0x050005, 0x070007, 0x090008, 0x0a0009, 0x0a000a, 0x0b000a, 0x0b000b,
+    0x0c000b, 0x0c000c, 0x0c000c, 0x0d000c, 0x0d000c, 0x0d000c, 0x0e000d, 0x0a000a,
+    0x040005, 0x060006, 0x080007, 0x090008, 0x0a0009, 0x0b000a, 0x0b000a, 0x0b000b,
+    0x0c000b, 0x0c000b, 0x0c000c, 0x0d000c, 0x0e000c, 0x0d000c, 0x0e000c, 0x0a000a,
+    0x070007, 0x080007, 0x090008, 0x0a0009, 0x0b0009, 0x0b000a, 0x0c000a, 0x0c000b,
+    0x0d000b, 0x0c000b, 0x0d000b, 0x0d000c, 0x0d000c, 0x0e000c, 0x0e000d, 0x0b0009,
+    0x090008, 0x090008, 0x0a0009, 0x0b0009, 0x0b000a, 0x0c000a, 0x0c000a, 0x0c000b,
+    0x0d000b, 0x0d000b, 0x0e000b, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x0c0009,
+    0x0a0009, 0x0a0009, 0x0b0009, 0x0b000a, 0x0c000a, 0x0c000a, 0x0d000a, 0x0d000b,
+    0x0d000b, 0x0e000b, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000d, 0x0b0009,
+    0x0a000a, 0x0a0009, 0x0b000a, 0x0b000a, 0x0c000a, 0x0d000a, 0x0d000b, 0x0e000b,
+    0x0d000b, 0x0e000b, 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000c, 0x10000c, 0x0c0009,
+    0x0b000a, 0x0b000a, 0x0b000a, 0x0c000a, 0x0d000a, 0x0d000b, 0x0d000b, 0x0d000b,
+    0x0e000b, 0x0e000c, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x10000d, 0x0c0009,
+    0x0b000b, 0x0b000a, 0x0c000a, 0x0c000a, 0x0d000b, 0x0d000b, 0x0d000b, 0x0e000b,
+    0x0e000c, 0x0f000c, 0x0f000c, 0x0f000c, 0x0f000c, 0x11000d, 0x11000d, 0x0c000a,
+    0x0b000b, 0x0c000b, 0x0c000b, 0x0d000b, 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000b,
+    0x0f000b, 0x0f000c, 0x0f000c, 0x0f000c, 0x10000c, 0x10000d, 0x10000d, 0x0c000a,
+    0x0c000b, 0x0c000b, 0x0c000b, 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000b, 0x0f000c,
+    0x0f000c, 0x0f000c, 0x0f000c, 0x10000c, 0x0f000d, 0x10000d, 0x0f000d, 0x0d000a,
+    0x0c000c, 0x0d000b, 0x0c000b, 0x0d000b, 0x0e000b, 0x0e000c, 0x0e000c, 0x0e000c,
+    0x0f000c, 0x10000c, 0x10000c, 0x10000d, 0x11000d, 0x11000d, 0x10000d, 0x0c000a,
+    0x0d000c, 0x0d000c, 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000c, 0x0f000c, 0x10000c,
+    0x10000c, 0x10000c, 0x10000c, 0x10000d, 0x10000d, 0x0f000d, 0x10000d, 0x0d000a,
+    0x0d000c, 0x0e000c, 0x0e000c, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000c,
+    0x0f000c, 0x11000c, 0x10000d, 0x10000d, 0x10000d, 0x10000d, 0x12000d, 0x0d000a,
+    0x0f000c, 0x0e000c, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x10000c, 0x10000c,
+    0x10000d, 0x12000d, 0x11000d, 0x11000d, 0x11000d, 0x13000d, 0x11000d, 0x0d000a,
+    0x0e000d, 0x0f000c, 0x0d000c, 0x0e000c, 0x10000c, 0x10000c, 0x0f000c, 0x10000d,
+    0x10000d, 0x11000d, 0x12000d, 0x11000d, 0x13000d, 0x11000d, 0x10000d, 0x0d000a,
+    0x0a0009, 0x0a0009, 0x0a0009, 0x0b0009, 0x0b0009, 0x0c0009, 0x0c0009, 0x0c0009,
+    0x0d0009, 0x0d0009, 0x0d0009, 0x0d000a, 0x0d000a, 0x0d000a, 0x0d000a, 0x0a0006
+};
+
+/*  for (i = 0; i < 3*3; i++) {
+ *      table23[i] = ((ht[2].hlen[i]) << 16) + ht[3].hlen[i];
+ *  }
+ */
+const unsigned int table23[3 * 3] = {
+    0x010002, 0x040003, 0x070007,
+    0x040004, 0x050004, 0x070007,
+    0x060006, 0x070007, 0x080008
+};
+
+/*   for (i = 0; i < 4*4; i++) {
+ *       table56[i] = ((ht[5].hlen[i]) << 16) + ht[6].hlen[i];
+ *   }
+ */
+const unsigned int table56[4 * 4] = {
+    0x010003, 0x040004, 0x070006, 0x080008, 0x040004, 0x050004, 0x080006, 0x090007,
+    0x070005, 0x080006, 0x090007, 0x0a0008, 0x080007, 0x080007, 0x090008, 0x0a0009
+};
+
+
+
+/* 
+ * 0: MPEG-2 LSF
+ * 1: MPEG-1
+ * 2: MPEG-2.5 LSF FhG extention                  (1995-07-11 shn)
+ */
+
+typedef enum {
+    MPEG_2 = 0,
+    MPEG_1 = 1,
+    MPEG_25 = 2
+} MPEG_t;
+
+const int bitrate_table[3][16] = {
+    {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1}, /* MPEG 2 */
+    {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1}, /* MPEG 1 */
+    {0, 8, 16, 24, 32, 40, 48, 56, 64, -1, -1, -1, -1, -1, -1, -1}, /* MPEG 2.5 */
+};
+
+const int samplerate_table[3][4] = {
+    {22050, 24000, 16000, -1}, /* MPEG 2 */
+    {44100, 48000, 32000, -1}, /* MPEG 1 */
+    {11025, 12000, 8000, -1}, /* MPEG 2.5 */
+};
+
+const char *version_string[3] = { "2", "1", "2.5" };
+
+const unsigned header_word[3] = { 0xFFF00000, 0xFFF80000, 0xFFE00000 };
+
+/* This is the scfsi_band table from 2.4.2.7 of the IS */
+const int scfsi_band[5] = { 0, 6, 11, 16, 21 };
+
+/* end of tables.c */
diff --git a/libmp3lame/tables.h b/libmp3lame/tables.h
new file mode 100644
index 0000000..b057f0c
--- /dev/null
+++ b/libmp3lame/tables.h
@@ -0,0 +1,92 @@
+/*
+ *	MPEG layer 3 tables include file
+ *
+ *	Copyright (c) 1999 Albert L Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_TABLES_H
+#define LAME_TABLES_H
+
+
+typedef struct {
+    unsigned char no;
+    unsigned char width;
+    unsigned char minval_2;
+    float   quiet_thr;
+    float   norm;
+    float   bark;
+} type1_t;
+
+typedef struct {
+    unsigned char no;
+    unsigned char width;
+    float   quiet_thr;
+    float   norm;
+    float   SNR;
+    float   bark;
+} type2_t;
+
+typedef struct {
+    unsigned int no:5;
+    unsigned int cbw:3;
+    unsigned int bu:6;
+    unsigned int bo:6;
+    unsigned int w1_576:10;
+    unsigned int w2_576:10;
+} type34_t;
+
+typedef struct {
+    size_t  len1;
+    const type1_t *const tab1;
+    size_t  len2;
+    const type2_t *const tab2;
+    size_t  len3;
+    const type34_t *const tab3;
+    size_t  len4;
+    const type34_t *const tab4;
+} type5_t;
+
+extern const type5_t table5[6];
+
+
+
+#define HTN	34
+
+struct huffcodetab {
+    const int xlen;          /* max. x-index+   */
+    const int linmax;        /* max number to be stored in linbits */
+    const short *table;      /* pointer to array[xlen][ylen]  */
+    const char *hlen;        /* pointer to array[xlen][ylen]  */
+};
+
+extern const struct huffcodetab ht[HTN];
+    /* global memory block   */
+    /* array of all huffcodtable headers */
+    /* 0..31 Huffman code table 0..31  */
+    /* 32,33 count1-tables   */
+
+extern const char t32l[];
+extern const char t33l[];
+
+extern const unsigned int largetbl[16 * 16];
+extern const unsigned int table23[3 * 3];
+extern const unsigned int table56[4 * 4];
+
+extern const int scfsi_band[5];
+
+#endif /* LAME_TABLES_H */
diff --git a/libmp3lame/takehiro.c b/libmp3lame/takehiro.c
new file mode 100644
index 0000000..aa24823
--- /dev/null
+++ b/libmp3lame/takehiro.c
@@ -0,0 +1,1356 @@
+/*
+ *	MP3 huffman table selecting and bit counting
+ *
+ *	Copyright (c) 1999-2005 Takehiro TOMINAGA
+ *	Copyright (c) 2002-2005 Gabriel Bouvigne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: takehiro.c,v 1.71.2.2 2008/09/22 20:21:39 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "quantize_pvt.h"
+#include "tables.h"
+
+
+static const struct {
+    const int region0_count;
+    const int region1_count;
+} subdv_table[23] = {
+    {
+    0, 0},              /* 0 bands */
+    {
+    0, 0},              /* 1 bands */
+    {
+    0, 0},              /* 2 bands */
+    {
+    0, 0},              /* 3 bands */
+    {
+    0, 0},              /* 4 bands */
+    {
+    0, 1},              /* 5 bands */
+    {
+    1, 1},              /* 6 bands */
+    {
+    1, 1},              /* 7 bands */
+    {
+    1, 2},              /* 8 bands */
+    {
+    2, 2},              /* 9 bands */
+    {
+    2, 3},              /* 10 bands */
+    {
+    2, 3},              /* 11 bands */
+    {
+    3, 4},              /* 12 bands */
+    {
+    3, 4},              /* 13 bands */
+    {
+    3, 4},              /* 14 bands */
+    {
+    4, 5},              /* 15 bands */
+    {
+    4, 5},              /* 16 bands */
+    {
+    4, 6},              /* 17 bands */
+    {
+    5, 6},              /* 18 bands */
+    {
+    5, 6},              /* 19 bands */
+    {
+    5, 7},              /* 20 bands */
+    {
+    6, 7},              /* 21 bands */
+    {
+    6, 7},              /* 22 bands */
+};
+
+
+
+
+
+/*********************************************************************
+ * nonlinear quantization of xr 
+ * More accurate formula than the ISO formula.  Takes into account
+ * the fact that we are quantizing xr -> ix, but we want ix^4/3 to be 
+ * as close as possible to x^4/3.  (taking the nearest int would mean
+ * ix is as close as possible to xr, which is different.)
+ *
+ * From Segher Boessenkool <segher@eastsite.nl>  11/1999
+ *
+ * 09/2000: ASM code removed in favor of IEEE754 hack by Takehiro
+ * Tominaga. If you need the ASM code, check CVS circa Aug 2000.
+ *
+ * 01/2004: Optimizations by Gabriel Bouvigne
+ *********************************************************************/
+
+
+
+
+
+static void
+quantize_lines_xrpow_01(int l, FLOAT istep, const FLOAT * xr, int *ix)
+{
+    const FLOAT compareval0 = (1.0 - 0.4054) / istep;
+
+    assert(l > 0);
+    l = l >> 1;
+    while (l--) {
+        *(ix++) = (compareval0 > *xr++) ? 0 : 1;
+        *(ix++) = (compareval0 > *xr++) ? 0 : 1;
+    }
+}
+
+
+
+#ifdef TAKEHIRO_IEEE754_HACK
+
+typedef union {
+    float   f;
+    int     i;
+} fi_union;
+
+#define MAGIC_FLOAT (65536*(128))
+#define MAGIC_INT 0x4b000000
+
+
+static void
+quantize_lines_xrpow(int l, FLOAT istep, const FLOAT * xp, int *pi)
+{
+    fi_union *fi;
+    int     remaining;
+
+    assert(l > 0);
+
+    fi = (fi_union *) pi;
+
+    l = l >> 1;
+    remaining = l % 2;
+    l = l >> 1;
+    while (l--) {
+        double  x0 = istep * xp[0];
+        double  x1 = istep * xp[1];
+        double  x2 = istep * xp[2];
+        double  x3 = istep * xp[3];
+
+        x0 += MAGIC_FLOAT;
+        fi[0].f = x0;
+        x1 += MAGIC_FLOAT;
+        fi[1].f = x1;
+        x2 += MAGIC_FLOAT;
+        fi[2].f = x2;
+        x3 += MAGIC_FLOAT;
+        fi[3].f = x3;
+
+        fi[0].f = x0 + adj43asm[fi[0].i - MAGIC_INT];
+        fi[1].f = x1 + adj43asm[fi[1].i - MAGIC_INT];
+        fi[2].f = x2 + adj43asm[fi[2].i - MAGIC_INT];
+        fi[3].f = x3 + adj43asm[fi[3].i - MAGIC_INT];
+
+        fi[0].i -= MAGIC_INT;
+        fi[1].i -= MAGIC_INT;
+        fi[2].i -= MAGIC_INT;
+        fi[3].i -= MAGIC_INT;
+        fi += 4;
+        xp += 4;
+    };
+    if (remaining) {
+        double  x0 = istep * xp[0];
+        double  x1 = istep * xp[1];
+
+        x0 += MAGIC_FLOAT;
+        fi[0].f = x0;
+        x1 += MAGIC_FLOAT;
+        fi[1].f = x1;
+
+        fi[0].f = x0 + adj43asm[fi[0].i - MAGIC_INT];
+        fi[1].f = x1 + adj43asm[fi[1].i - MAGIC_INT];
+
+        fi[0].i -= MAGIC_INT;
+        fi[1].i -= MAGIC_INT;
+    }
+
+}
+
+
+#else
+
+/*********************************************************************
+ * XRPOW_FTOI is a macro to convert floats to ints.  
+ * if XRPOW_FTOI(x) = nearest_int(x), then QUANTFAC(x)=adj43asm[x]
+ *                                         ROUNDFAC= -0.0946
+ *
+ * if XRPOW_FTOI(x) = floor(x), then QUANTFAC(x)=asj43[x]   
+ *                                   ROUNDFAC=0.4054
+ *
+ * Note: using floor() or (int) is extremely slow. On machines where
+ * the TAKEHIRO_IEEE754_HACK code above does not work, it is worthwile
+ * to write some ASM for XRPOW_FTOI().  
+ *********************************************************************/
+#define XRPOW_FTOI(src,dest) ((dest) = (int)(src))
+#define QUANTFAC(rx)  adj43[rx]
+#define ROUNDFAC 0.4054
+
+
+static void
+quantize_lines_xrpow(int l, FLOAT istep, const FLOAT * xr, int *ix)
+{
+    int     remaining;
+
+    assert(l > 0);
+
+    l = l >> 1;
+    remaining = l % 2;
+    l = l >> 1;
+    while (l--) {
+        FLOAT   x0, x1, x2, x3;
+        int     rx0, rx1, rx2, rx3;
+
+        x0 = *xr++ * istep;
+        x1 = *xr++ * istep;
+        XRPOW_FTOI(x0, rx0);
+        x2 = *xr++ * istep;
+        XRPOW_FTOI(x1, rx1);
+        x3 = *xr++ * istep;
+        XRPOW_FTOI(x2, rx2);
+        x0 += QUANTFAC(rx0);
+        XRPOW_FTOI(x3, rx3);
+        x1 += QUANTFAC(rx1);
+        XRPOW_FTOI(x0, *ix++);
+        x2 += QUANTFAC(rx2);
+        XRPOW_FTOI(x1, *ix++);
+        x3 += QUANTFAC(rx3);
+        XRPOW_FTOI(x2, *ix++);
+        XRPOW_FTOI(x3, *ix++);
+    };
+    if (remaining) {
+        FLOAT   x0, x1;
+        int     rx0, rx1;
+
+        x0 = *xr++ * istep;
+        x1 = *xr++ * istep;
+        XRPOW_FTOI(x0, rx0);
+        XRPOW_FTOI(x1, rx1);
+        x0 += QUANTFAC(rx0);
+        x1 += QUANTFAC(rx1);
+        XRPOW_FTOI(x0, *ix++);
+        XRPOW_FTOI(x1, *ix++);
+    }
+
+}
+
+
+
+#endif
+
+
+
+/*********************************************************************
+ * Quantization function
+ * This function will select which lines to quantize and call the
+ * proper quantization function
+ *********************************************************************/
+
+static void
+quantize_xrpow(const FLOAT * xp, int *pi, FLOAT istep, gr_info const *const cod_info,
+               calc_noise_data const *prev_noise)
+{
+    /* quantize on xr^(3/4) instead of xr */
+    int     sfb;
+    int     sfbmax;
+    int     j = 0;
+    int     prev_data_use;
+    int    *iData;
+    int     accumulate = 0;
+    int     accumulate01 = 0;
+    int    *acc_iData;
+    const FLOAT *acc_xp;
+
+    iData = pi;
+    acc_xp = xp;
+    acc_iData = iData;
+
+
+    /* Reusing previously computed data does not seems to work if global gain
+       is changed. Finding why it behaves this way would allow to use a cache of 
+       previously computed values (let's 10 cached values per sfb) that would 
+       probably provide a noticeable speedup */
+    prev_data_use = (prev_noise && (cod_info->global_gain == prev_noise->global_gain));
+
+    if (cod_info->block_type == SHORT_TYPE)
+        sfbmax = 38;
+    else
+        sfbmax = 21;
+
+    for (sfb = 0; sfb <= sfbmax; sfb++) {
+        int     step = -1;
+
+        if (prev_data_use || cod_info->block_type == NORM_TYPE) {
+            step =
+                cod_info->global_gain
+                - ((cod_info->scalefac[sfb] + (cod_info->preflag ? pretab[sfb] : 0))
+                   << (cod_info->scalefac_scale + 1))
+                - cod_info->subblock_gain[cod_info->window[sfb]] * 8;
+        }
+        assert(cod_info->width[sfb] >= 0);
+        if (prev_data_use && (prev_noise->step[sfb] == step)) {
+            /* do not recompute this part,
+               but compute accumulated lines */
+            if (accumulate) {
+                quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData);
+                accumulate = 0;
+            }
+            if (accumulate01) {
+                quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData);
+                accumulate01 = 0;
+            }
+        }
+        else {          /*should compute this part */
+            int     l;
+            l = cod_info->width[sfb];
+
+            if ((j + cod_info->width[sfb]) > cod_info->max_nonzero_coeff) {
+                /*do not compute upper zero part */
+                int     usefullsize;
+                usefullsize = cod_info->max_nonzero_coeff - j + 1;
+                memset(&pi[cod_info->max_nonzero_coeff], 0,
+                       sizeof(int) * (576 - cod_info->max_nonzero_coeff));
+                l = usefullsize;
+
+                if (l < 0) {
+                    l = 0;
+                }
+
+                /* no need to compute higher sfb values */
+                sfb = sfbmax + 1;
+            }
+
+            /*accumulate lines to quantize */
+            if (!accumulate && !accumulate01) {
+                acc_iData = iData;
+                acc_xp = xp;
+            }
+            if (prev_noise &&
+                prev_noise->sfb_count1 > 0 &&
+                sfb >= prev_noise->sfb_count1 &&
+                prev_noise->step[sfb] > 0 && step >= prev_noise->step[sfb]) {
+
+                if (accumulate) {
+                    quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData);
+                    accumulate = 0;
+                    acc_iData = iData;
+                    acc_xp = xp;
+                }
+                accumulate01 += l;
+            }
+            else {
+                if (accumulate01) {
+                    quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData);
+                    accumulate01 = 0;
+                    acc_iData = iData;
+                    acc_xp = xp;
+                }
+                accumulate += l;
+            }
+
+            if (l <= 0) {
+                /*  rh: 20040215
+                 *  may happen due to "prev_data_use" optimization 
+                 */
+                if (accumulate01) {
+                    quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData);
+                    accumulate01 = 0;
+                }
+                if (accumulate) {
+                    quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData);
+                    accumulate = 0;
+                }
+
+                break;  /* ends for-loop */
+            }
+        }
+        if (sfb <= sfbmax) {
+            iData += cod_info->width[sfb];
+            xp += cod_info->width[sfb];
+            j += cod_info->width[sfb];
+        }
+    }
+    if (accumulate) {   /*last data part */
+        quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData);
+        accumulate = 0;
+    }
+    if (accumulate01) { /*last data part */
+        quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData);
+        accumulate01 = 0;
+    }
+
+}
+
+
+
+
+/*************************************************************************/
+/*	      ix_max							 */
+/*************************************************************************/
+
+static int
+ix_max(const int *ix, const int *end)
+{
+    int     max1 = 0, max2 = 0;
+
+    do {
+        int const x1 = *ix++;
+        int const x2 = *ix++;
+        if (max1 < x1)
+            max1 = x1;
+
+        if (max2 < x2)
+            max2 = x2;
+    } while (ix < end);
+    if (max1 < max2)
+        max1 = max2;
+    return max1;
+}
+
+
+
+
+
+
+
+
+static int
+count_bit_ESC(const int *ix, const int *const end, int t1, const int t2, int *const s)
+{
+    /* ESC-table is used */
+    int const linbits = ht[t1].xlen * 65536 + ht[t2].xlen;
+    int     sum = 0, sum2;
+
+    do {
+        int     x = *ix++;
+        int     y = *ix++;
+
+        if (x != 0) {
+            if (x > 14) {
+                x = 15;
+                sum += linbits;
+            }
+            x *= 16;
+        }
+
+        if (y != 0) {
+            if (y > 14) {
+                y = 15;
+                sum += linbits;
+            }
+            x += y;
+        }
+
+        sum += largetbl[x];
+    } while (ix < end);
+
+    sum2 = sum & 0xffff;
+    sum >>= 16;
+
+    if (sum > sum2) {
+        sum = sum2;
+        t1 = t2;
+    }
+
+    *s += sum;
+    return t1;
+}
+
+
+inline static int
+count_bit_noESC(const int *ix, const int *const end, int *const s)
+{
+    /* No ESC-words */
+    int     sum1 = 0;
+    const char *const hlen1 = ht[1].hlen;
+
+    do {
+        int const x = ix[0] * 2 + ix[1];
+        ix += 2;
+        sum1 += hlen1[x];
+    } while (ix < end);
+
+    *s += sum1;
+    return 1;
+}
+
+
+
+inline static int
+count_bit_noESC_from2(const int *ix, const int *const end, int t1, int *const s)
+{
+    /* No ESC-words */
+    unsigned int sum = 0, sum2;
+    const int xlen = ht[t1].xlen;
+    const unsigned int *hlen;
+    if (t1 == 2)
+        hlen = table23;
+    else
+        hlen = table56;
+
+    do {
+        int const x = ix[0] * xlen + ix[1];
+        ix += 2;
+        sum += hlen[x];
+    } while (ix < end);
+
+    sum2 = sum & 0xffff;
+    sum >>= 16;
+
+    if (sum > sum2) {
+        sum = sum2;
+        t1++;
+    }
+
+    *s += sum;
+    return t1;
+}
+
+
+inline static int
+count_bit_noESC_from3(const int *ix, const int *const end, int t1, int *const s)
+{
+    /* No ESC-words */
+    int     sum1 = 0;
+    int     sum2 = 0;
+    int     sum3 = 0;
+    const int xlen = ht[t1].xlen;
+    const char *const hlen1 = ht[t1].hlen;
+    const char *const hlen2 = ht[t1 + 1].hlen;
+    const char *const hlen3 = ht[t1 + 2].hlen;
+    int     t;
+
+    do {
+        int const x = ix[0] * xlen + ix[1];
+        ix += 2;
+        sum1 += hlen1[x];
+        sum2 += hlen2[x];
+        sum3 += hlen3[x];
+    } while (ix < end);
+
+    t = t1;
+    if (sum1 > sum2) {
+        sum1 = sum2;
+        t++;
+    }
+    if (sum1 > sum3) {
+        sum1 = sum3;
+        t = t1 + 2;
+    }
+    *s += sum1;
+
+    return t;
+}
+
+
+/*************************************************************************/
+/*	      choose table						 */
+/*************************************************************************/
+
+/*
+  Choose the Huffman table that will encode ix[begin..end] with
+  the fewest bits.
+
+  Note: This code contains knowledge about the sizes and characteristics
+  of the Huffman tables as defined in the IS (Table B.7), and will not work
+  with any arbitrary tables.
+*/
+
+static int
+choose_table_nonMMX(const int *ix, const int *const end, int *const s)
+{
+    int     max;
+    int     choice, choice2;
+    static const int huf_tbl_noESC[] = {
+        1, 2, 5, 7, 7, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13
+    };
+
+    max = ix_max(ix, end);
+
+    switch (max) {
+    case 0:
+        return max;
+
+    case 1:
+        return count_bit_noESC(ix, end, s);
+
+    case 2:
+    case 3:
+        return count_bit_noESC_from2(ix, end, huf_tbl_noESC[max - 1], s);
+
+    case 4:
+    case 5:
+    case 6:
+    case 7:
+    case 8:
+    case 9:
+    case 10:
+    case 11:
+    case 12:
+    case 13:
+    case 14:
+    case 15:
+        return count_bit_noESC_from3(ix, end, huf_tbl_noESC[max - 1], s);
+
+    default:
+        /* try tables with linbits */
+        if (max > IXMAX_VAL) {
+            *s = LARGE_BITS;
+            return -1;
+        }
+        max -= 15;
+        for (choice2 = 24; choice2 < 32; choice2++) {
+            if (ht[choice2].linmax >= max) {
+                break;
+            }
+        }
+
+        for (choice = choice2 - 8; choice < 24; choice++) {
+            if (ht[choice].linmax >= max) {
+                break;
+            }
+        }
+        return count_bit_ESC(ix, end, choice, choice2, s);
+    }
+}
+
+
+
+/*************************************************************************/
+/*	      count_bit							 */
+/*************************************************************************/
+int
+noquant_count_bits(lame_internal_flags const *const gfc,
+                   gr_info * const gi, calc_noise_data * prev_noise)
+{
+    int     bits = 0;
+    int     i, a1, a2;
+    int const *const ix = gi->l3_enc;
+
+    i = Min(576, ((gi->max_nonzero_coeff + 2) >> 1) << 1);
+
+    if (prev_noise)
+        prev_noise->sfb_count1 = 0;
+
+    /* Determine count1 region */
+    for (; i > 1; i -= 2)
+        if (ix[i - 1] | ix[i - 2])
+            break;
+    gi->count1 = i;
+
+    /* Determines the number of bits to encode the quadruples. */
+    a1 = a2 = 0;
+    for (; i > 3; i -= 4) {
+        int     p;
+        /* hack to check if all values <= 1 */
+        if ((unsigned int) (ix[i - 1] | ix[i - 2] | ix[i - 3] | ix[i - 4]) > 1)
+            break;
+
+        p = ((ix[i - 4] * 2 + ix[i - 3]) * 2 + ix[i - 2]) * 2 + ix[i - 1];
+        a1 += t32l[p];
+        a2 += t33l[p];
+    }
+
+    bits = a1;
+    gi->count1table_select = 0;
+    if (a1 > a2) {
+        bits = a2;
+        gi->count1table_select = 1;
+    }
+
+    gi->count1bits = bits;
+    gi->big_values = i;
+    if (i == 0)
+        return bits;
+
+    if (gi->block_type == SHORT_TYPE) {
+        a1 = 3 * gfc->scalefac_band.s[3];
+        if (a1 > gi->big_values)
+            a1 = gi->big_values;
+        a2 = gi->big_values;
+
+    }
+    else if (gi->block_type == NORM_TYPE) {
+        assert(i <= 576); /* bv_scf has 576 entries (0..575) */
+        a1 = gi->region0_count = gfc->bv_scf[i - 2];
+        a2 = gi->region1_count = gfc->bv_scf[i - 1];
+
+        assert(a1 + a2 + 2 < SBPSY_l);
+        a2 = gfc->scalefac_band.l[a1 + a2 + 2];
+        a1 = gfc->scalefac_band.l[a1 + 1];
+        if (a2 < i)
+            gi->table_select[2] = gfc->choose_table(ix + a2, ix + i, &bits);
+
+    }
+    else {
+        gi->region0_count = 7;
+        /*gi->region1_count = SBPSY_l - 7 - 1; */
+        gi->region1_count = SBMAX_l - 1 - 7 - 1;
+        a1 = gfc->scalefac_band.l[7 + 1];
+        a2 = i;
+        if (a1 > a2) {
+            a1 = a2;
+        }
+    }
+
+
+    /* have to allow for the case when bigvalues < region0 < region1 */
+    /* (and region0, region1 are ignored) */
+    a1 = Min(a1, i);
+    a2 = Min(a2, i);
+
+    assert(a1 >= 0);
+    assert(a2 >= 0);
+
+    /* Count the number of bits necessary to code the bigvalues region. */
+    if (0 < a1)
+        gi->table_select[0] = gfc->choose_table(ix, ix + a1, &bits);
+    if (a1 < a2)
+        gi->table_select[1] = gfc->choose_table(ix + a1, ix + a2, &bits);
+    if (gfc->use_best_huffman == 2) {
+        gi->part2_3_length = bits;
+        best_huffman_divide(gfc, gi);
+        bits = gi->part2_3_length;
+    }
+
+
+    if (prev_noise) {
+        if (gi->block_type == NORM_TYPE) {
+            int     sfb = 0;
+            while (gfc->scalefac_band.l[sfb] < gi->big_values) {
+                sfb++;
+            }
+            prev_noise->sfb_count1 = sfb;
+        }
+    }
+
+    return bits;
+}
+
+int
+count_bits(lame_internal_flags const *const gfc,
+           const FLOAT * const xr, gr_info * const gi, calc_noise_data * prev_noise)
+{
+    int    *const ix = gi->l3_enc;
+
+    /* since quantize_xrpow uses table lookup, we need to check this first: */
+    FLOAT const w = (IXMAX_VAL) / IPOW20(gi->global_gain);
+
+    if (gi->xrpow_max > w)
+        return LARGE_BITS;
+
+    quantize_xrpow(xr, ix, IPOW20(gi->global_gain), gi, prev_noise);
+
+    if (gfc->substep_shaping & 2) {
+        int     sfb, j = 0;
+        /* 0.634521682242439 = 0.5946*2**(.5*0.1875) */
+        int const gain = gi->global_gain + gi->scalefac_scale;
+        const FLOAT roundfac = 0.634521682242439 / IPOW20(gain);
+        for (sfb = 0; sfb < gi->sfbmax; sfb++) {
+            int const width = gi->width[sfb];
+            assert(width >= 0);
+            if (!gfc->pseudohalf[sfb]) {
+                j += width;
+            }
+            else {
+                int     k;
+                for (k = j, j += width; k < j; ++k) {
+                    ix[k] = (xr[k] >= roundfac) ? ix[k] : 0;
+                }
+            }
+        }
+    }
+    return noquant_count_bits(gfc, gi, prev_noise);
+}
+
+/***********************************************************************
+  re-calculate the best scalefac_compress using scfsi
+  the saved bits are kept in the bit reservoir.
+ **********************************************************************/
+
+
+inline static void
+recalc_divide_init(const lame_internal_flags * const gfc,
+                   gr_info const *cod_info,
+                   int const *const ix, int r01_bits[], int r01_div[], int r0_tbl[], int r1_tbl[])
+{
+    int     r0, r1, bigv, r0t, r1t, bits;
+
+    bigv = cod_info->big_values;
+
+    for (r0 = 0; r0 <= 7 + 15; r0++) {
+        r01_bits[r0] = LARGE_BITS;
+    }
+
+    for (r0 = 0; r0 < 16; r0++) {
+        int const a1 = gfc->scalefac_band.l[r0 + 1];
+        int     r0bits;
+        if (a1 >= bigv)
+            break;
+        r0bits = 0;
+        r0t = gfc->choose_table(ix, ix + a1, &r0bits);
+
+        for (r1 = 0; r1 < 8; r1++) {
+            int const a2 = gfc->scalefac_band.l[r0 + r1 + 2];
+            if (a2 >= bigv)
+                break;
+
+            bits = r0bits;
+            r1t = gfc->choose_table(ix + a1, ix + a2, &bits);
+            if (r01_bits[r0 + r1] > bits) {
+                r01_bits[r0 + r1] = bits;
+                r01_div[r0 + r1] = r0;
+                r0_tbl[r0 + r1] = r0t;
+                r1_tbl[r0 + r1] = r1t;
+            }
+        }
+    }
+}
+
+inline static void
+recalc_divide_sub(const lame_internal_flags * const gfc,
+                  const gr_info * cod_info2,
+                  gr_info * const gi,
+                  const int *const ix,
+                  const int r01_bits[], const int r01_div[], const int r0_tbl[], const int r1_tbl[])
+{
+    int     bits, r2, a2, bigv, r2t;
+
+    bigv = cod_info2->big_values;
+
+    for (r2 = 2; r2 < SBMAX_l + 1; r2++) {
+        a2 = gfc->scalefac_band.l[r2];
+        if (a2 >= bigv)
+            break;
+
+        bits = r01_bits[r2 - 2] + cod_info2->count1bits;
+        if (gi->part2_3_length <= bits)
+            break;
+
+        r2t = gfc->choose_table(ix + a2, ix + bigv, &bits);
+        if (gi->part2_3_length <= bits)
+            continue;
+
+        memcpy(gi, cod_info2, sizeof(gr_info));
+        gi->part2_3_length = bits;
+        gi->region0_count = r01_div[r2 - 2];
+        gi->region1_count = r2 - 2 - r01_div[r2 - 2];
+        gi->table_select[0] = r0_tbl[r2 - 2];
+        gi->table_select[1] = r1_tbl[r2 - 2];
+        gi->table_select[2] = r2t;
+    }
+}
+
+
+
+
+void
+best_huffman_divide(const lame_internal_flags * const gfc, gr_info * const gi)
+{
+    int     i, a1, a2;
+    gr_info cod_info2;
+    int const *const ix = gi->l3_enc;
+
+    int     r01_bits[7 + 15 + 1];
+    int     r01_div[7 + 15 + 1];
+    int     r0_tbl[7 + 15 + 1];
+    int     r1_tbl[7 + 15 + 1];
+
+
+    /* SHORT BLOCK stuff fails for MPEG2 */
+    if (gi->block_type == SHORT_TYPE && gfc->mode_gr == 1)
+        return;
+
+
+    memcpy(&cod_info2, gi, sizeof(gr_info));
+    if (gi->block_type == NORM_TYPE) {
+        recalc_divide_init(gfc, gi, ix, r01_bits, r01_div, r0_tbl, r1_tbl);
+        recalc_divide_sub(gfc, &cod_info2, gi, ix, r01_bits, r01_div, r0_tbl, r1_tbl);
+    }
+
+    i = cod_info2.big_values;
+    if (i == 0 || (unsigned int) (ix[i - 2] | ix[i - 1]) > 1)
+        return;
+
+    i = gi->count1 + 2;
+    if (i > 576)
+        return;
+
+    /* Determines the number of bits to encode the quadruples. */
+    memcpy(&cod_info2, gi, sizeof(gr_info));
+    cod_info2.count1 = i;
+    a1 = a2 = 0;
+
+    assert(i <= 576);
+
+    for (; i > cod_info2.big_values; i -= 4) {
+        int const p = ((ix[i - 4] * 2 + ix[i - 3]) * 2 + ix[i - 2]) * 2 + ix[i - 1];
+        a1 += t32l[p];
+        a2 += t33l[p];
+    }
+    cod_info2.big_values = i;
+
+    cod_info2.count1table_select = 0;
+    if (a1 > a2) {
+        a1 = a2;
+        cod_info2.count1table_select = 1;
+    }
+
+    cod_info2.count1bits = a1;
+
+    if (cod_info2.block_type == NORM_TYPE)
+        recalc_divide_sub(gfc, &cod_info2, gi, ix, r01_bits, r01_div, r0_tbl, r1_tbl);
+    else {
+        /* Count the number of bits necessary to code the bigvalues region. */
+        cod_info2.part2_3_length = a1;
+        a1 = gfc->scalefac_band.l[7 + 1];
+        if (a1 > i) {
+            a1 = i;
+        }
+        if (a1 > 0)
+            cod_info2.table_select[0] =
+                gfc->choose_table(ix, ix + a1, (int *) &cod_info2.part2_3_length);
+        if (i > a1)
+            cod_info2.table_select[1] =
+                gfc->choose_table(ix + a1, ix + i, (int *) &cod_info2.part2_3_length);
+        if (gi->part2_3_length > cod_info2.part2_3_length)
+            memcpy(gi, &cod_info2, sizeof(gr_info));
+    }
+}
+
+static const int slen1_n[16] = { 1, 1, 1, 1, 8, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16 };
+static const int slen2_n[16] = { 1, 2, 4, 8, 1, 2, 4, 8, 2, 4, 8, 2, 4, 8, 4, 8 };
+const int slen1_tab[16] = { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 };
+const int slen2_tab[16] = { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 };
+
+static void
+scfsi_calc(int ch, III_side_info_t * l3_side)
+{
+    unsigned int i;
+    int     s1, s2, c1, c2;
+    int     sfb;
+    gr_info *const gi = &l3_side->tt[1][ch];
+    gr_info const *const g0 = &l3_side->tt[0][ch];
+
+    for (i = 0; i < (sizeof(scfsi_band) / sizeof(int)) - 1; i++) {
+        for (sfb = scfsi_band[i]; sfb < scfsi_band[i + 1]; sfb++) {
+            if (g0->scalefac[sfb] != gi->scalefac[sfb]
+                && gi->scalefac[sfb] >= 0)
+                break;
+        }
+        if (sfb == scfsi_band[i + 1]) {
+            for (sfb = scfsi_band[i]; sfb < scfsi_band[i + 1]; sfb++) {
+                gi->scalefac[sfb] = -1;
+            }
+            l3_side->scfsi[ch][i] = 1;
+        }
+    }
+
+    s1 = c1 = 0;
+    for (sfb = 0; sfb < 11; sfb++) {
+        if (gi->scalefac[sfb] == -1)
+            continue;
+        c1++;
+        if (s1 < gi->scalefac[sfb])
+            s1 = gi->scalefac[sfb];
+    }
+
+    s2 = c2 = 0;
+    for (; sfb < SBPSY_l; sfb++) {
+        if (gi->scalefac[sfb] == -1)
+            continue;
+        c2++;
+        if (s2 < gi->scalefac[sfb])
+            s2 = gi->scalefac[sfb];
+    }
+
+    for (i = 0; i < 16; i++) {
+        if (s1 < slen1_n[i] && s2 < slen2_n[i]) {
+            int const c = slen1_tab[i] * c1 + slen2_tab[i] * c2;
+            if (gi->part2_length > c) {
+                gi->part2_length = c;
+                gi->scalefac_compress = i;
+            }
+        }
+    }
+}
+
+/*
+Find the optimal way to store the scalefactors.
+Only call this routine after final scalefactors have been
+chosen and the channel/granule will not be re-encoded.
+ */
+void
+best_scalefac_store(const lame_internal_flags * gfc,
+                    const int gr, const int ch, III_side_info_t * const l3_side)
+{
+    /* use scalefac_scale if we can */
+    gr_info *const gi = &l3_side->tt[gr][ch];
+    int     sfb, i, j, l;
+    int     recalc = 0;
+
+    /* remove scalefacs from bands with ix=0.  This idea comes
+     * from the AAC ISO docs.  added mt 3/00 */
+    /* check if l3_enc=0 */
+    j = 0;
+    for (sfb = 0; sfb < gi->sfbmax; sfb++) {
+        int const width = gi->width[sfb];
+        assert(width >= 0);
+        j += width;
+        for (l = -width; l < 0; l++) {
+            if (gi->l3_enc[l + j] != 0)
+                break;
+        }
+        if (l == 0)
+            gi->scalefac[sfb] = recalc = -2; /* anything goes. */
+        /*  only best_scalefac_store and calc_scfsi 
+         *  know--and only they should know--about the magic number -2. 
+         */
+    }
+
+    if (!gi->scalefac_scale && !gi->preflag) {
+        int     s = 0;
+        for (sfb = 0; sfb < gi->sfbmax; sfb++)
+            if (gi->scalefac[sfb] > 0)
+                s |= gi->scalefac[sfb];
+
+        if (!(s & 1) && s != 0) {
+            for (sfb = 0; sfb < gi->sfbmax; sfb++)
+                if (gi->scalefac[sfb] > 0)
+                    gi->scalefac[sfb] >>= 1;
+
+            gi->scalefac_scale = recalc = 1;
+        }
+    }
+
+    if (!gi->preflag && gi->block_type != SHORT_TYPE && gfc->mode_gr == 2) {
+        for (sfb = 11; sfb < SBPSY_l; sfb++)
+            if (gi->scalefac[sfb] < pretab[sfb] && gi->scalefac[sfb] != -2)
+                break;
+        if (sfb == SBPSY_l) {
+            for (sfb = 11; sfb < SBPSY_l; sfb++)
+                if (gi->scalefac[sfb] > 0)
+                    gi->scalefac[sfb] -= pretab[sfb];
+
+            gi->preflag = recalc = 1;
+        }
+    }
+
+    for (i = 0; i < 4; i++)
+        l3_side->scfsi[ch][i] = 0;
+
+    if (gfc->mode_gr == 2 && gr == 1
+        && l3_side->tt[0][ch].block_type != SHORT_TYPE
+        && l3_side->tt[1][ch].block_type != SHORT_TYPE) {
+        scfsi_calc(ch, l3_side);
+        recalc = 0;
+    }
+    for (sfb = 0; sfb < gi->sfbmax; sfb++) {
+        if (gi->scalefac[sfb] == -2) {
+            gi->scalefac[sfb] = 0; /* if anything goes, then 0 is a good choice */
+        }
+    }
+    if (recalc) {
+        if (gfc->mode_gr == 2) {
+            (void) scale_bitcount(gi);
+        }
+        else {
+            (void) scale_bitcount_lsf(gfc, gi);
+        }
+    }
+}
+
+
+#ifndef NDEBUG
+static int
+all_scalefactors_not_negative(int const *scalefac, int n)
+{
+    int     i;
+    for (i = 0; i < n; ++i) {
+        if (scalefac[i] < 0)
+            return 0;
+    }
+    return 1;
+}
+#endif
+
+
+/* number of bits used to encode scalefacs */
+
+/* 18*slen1_tab[i] + 18*slen2_tab[i] */
+static const int scale_short[16] = {
+    0, 18, 36, 54, 54, 36, 54, 72, 54, 72, 90, 72, 90, 108, 108, 126
+};
+
+/* 17*slen1_tab[i] + 18*slen2_tab[i] */
+static const int scale_mixed[16] = {
+    0, 18, 36, 54, 51, 35, 53, 71, 52, 70, 88, 69, 87, 105, 104, 122
+};
+
+/* 11*slen1_tab[i] + 10*slen2_tab[i] */
+static const int scale_long[16] = {
+    0, 10, 20, 30, 33, 21, 31, 41, 32, 42, 52, 43, 53, 63, 64, 74
+};
+
+
+/*************************************************************************/
+/*            scale_bitcount                                             */
+/*************************************************************************/
+
+/* Also calculates the number of bits necessary to code the scalefactors. */
+
+int
+scale_bitcount(gr_info * const cod_info)
+{
+    int     k, sfb, max_slen1 = 0, max_slen2 = 0;
+
+    /* maximum values */
+    const int *tab;
+    int    *const scalefac = cod_info->scalefac;
+
+    assert(all_scalefactors_not_negative(scalefac, cod_info->sfbmax));
+
+    if (cod_info->block_type == SHORT_TYPE) {
+        tab = scale_short;
+        if (cod_info->mixed_block_flag)
+            tab = scale_mixed;
+    }
+    else {              /* block_type == 1,2,or 3 */
+        tab = scale_long;
+        if (!cod_info->preflag) {
+            for (sfb = 11; sfb < SBPSY_l; sfb++)
+                if (scalefac[sfb] < pretab[sfb])
+                    break;
+
+            if (sfb == SBPSY_l) {
+                cod_info->preflag = 1;
+                for (sfb = 11; sfb < SBPSY_l; sfb++)
+                    scalefac[sfb] -= pretab[sfb];
+            }
+        }
+    }
+
+    for (sfb = 0; sfb < cod_info->sfbdivide; sfb++)
+        if (max_slen1 < scalefac[sfb])
+            max_slen1 = scalefac[sfb];
+
+    for (; sfb < cod_info->sfbmax; sfb++)
+        if (max_slen2 < scalefac[sfb])
+            max_slen2 = scalefac[sfb];
+
+    /* from Takehiro TOMINAGA <tominaga@isoternet.org> 10/99
+     * loop over *all* posible values of scalefac_compress to find the
+     * one which uses the smallest number of bits.  ISO would stop
+     * at first valid index */
+    cod_info->part2_length = LARGE_BITS;
+    for (k = 0; k < 16; k++) {
+        if (max_slen1 < slen1_n[k] && max_slen2 < slen2_n[k]
+            && cod_info->part2_length > tab[k]) {
+            cod_info->part2_length = tab[k];
+            cod_info->scalefac_compress = k;
+        }
+    }
+    return cod_info->part2_length == LARGE_BITS;
+}
+
+
+
+/*
+  table of largest scalefactor values for MPEG2
+*/
+static const int max_range_sfac_tab[6][4] = {
+    {15, 15, 7, 7},
+    {15, 15, 7, 0},
+    {7, 3, 0, 0},
+    {15, 31, 31, 0},
+    {7, 7, 7, 0},
+    {3, 3, 0, 0}
+};
+
+
+
+
+/*************************************************************************/
+/*            scale_bitcount_lsf                                         */
+/*************************************************************************/
+
+/* Also counts the number of bits to encode the scalefacs but for MPEG 2 */
+/* Lower sampling frequencies  (24, 22.05 and 16 kHz.)                   */
+
+/*  This is reverse-engineered from section 2.4.3.2 of the MPEG2 IS,     */
+/* "Audio Decoding Layer III"                                            */
+
+int
+scale_bitcount_lsf(const lame_internal_flags * gfc, gr_info * const cod_info)
+{
+    int     table_number, row_in_table, partition, nr_sfb, window, over;
+    int     i, sfb, max_sfac[4];
+    const int *partition_table;
+    int const *const scalefac = cod_info->scalefac;
+
+    /*
+       Set partition table. Note that should try to use table one,
+       but do not yet...
+     */
+    if (cod_info->preflag)
+        table_number = 2;
+    else
+        table_number = 0;
+
+    for (i = 0; i < 4; i++)
+        max_sfac[i] = 0;
+
+    if (cod_info->block_type == SHORT_TYPE) {
+        row_in_table = 1;
+        partition_table = &nr_of_sfb_block[table_number][row_in_table][0];
+        for (sfb = 0, partition = 0; partition < 4; partition++) {
+            nr_sfb = partition_table[partition] / 3;
+            for (i = 0; i < nr_sfb; i++, sfb++)
+                for (window = 0; window < 3; window++)
+                    if (scalefac[sfb * 3 + window] > max_sfac[partition])
+                        max_sfac[partition] = scalefac[sfb * 3 + window];
+        }
+    }
+    else {
+        row_in_table = 0;
+        partition_table = &nr_of_sfb_block[table_number][row_in_table][0];
+        for (sfb = 0, partition = 0; partition < 4; partition++) {
+            nr_sfb = partition_table[partition];
+            for (i = 0; i < nr_sfb; i++, sfb++)
+                if (scalefac[sfb] > max_sfac[partition])
+                    max_sfac[partition] = scalefac[sfb];
+        }
+    }
+
+    for (over = 0, partition = 0; partition < 4; partition++) {
+        if (max_sfac[partition] > max_range_sfac_tab[table_number][partition])
+            over++;
+    }
+    if (!over) {
+        /*
+           Since no bands have been over-amplified, we can set scalefac_compress
+           and slen[] for the formatter
+         */
+        static const int log2tab[] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 };
+
+        int     slen1, slen2, slen3, slen4;
+
+        cod_info->sfb_partition_table = nr_of_sfb_block[table_number][row_in_table];
+        for (partition = 0; partition < 4; partition++)
+            cod_info->slen[partition] = log2tab[max_sfac[partition]];
+
+        /* set scalefac_compress */
+        slen1 = cod_info->slen[0];
+        slen2 = cod_info->slen[1];
+        slen3 = cod_info->slen[2];
+        slen4 = cod_info->slen[3];
+
+        switch (table_number) {
+        case 0:
+            cod_info->scalefac_compress = (((slen1 * 5) + slen2) << 4)
+                + (slen3 << 2)
+                + slen4;
+            break;
+
+        case 1:
+            cod_info->scalefac_compress = 400 + (((slen1 * 5) + slen2) << 2)
+                + slen3;
+            break;
+
+        case 2:
+            cod_info->scalefac_compress = 500 + (slen1 * 3) + slen2;
+            break;
+
+        default:
+            ERRORF(gfc, "intensity stereo not implemented yet\n");
+            break;
+        }
+    }
+#ifdef DEBUG
+    if (over)
+        ERRORF(gfc, "---WARNING !! Amplification of some bands over limits\n");
+#endif
+    if (!over) {
+        assert(cod_info->sfb_partition_table);
+        cod_info->part2_length = 0;
+        for (partition = 0; partition < 4; partition++)
+            cod_info->part2_length +=
+                cod_info->slen[partition] * cod_info->sfb_partition_table[partition];
+    }
+    return over;
+}
+
+
+#ifdef MMX_choose_table
+extern int choose_table_MMX(const int *ix, const int *const end, int *const s);
+#endif
+
+void
+huffman_init(lame_internal_flags * const gfc)
+{
+    int     i;
+
+    gfc->choose_table = choose_table_nonMMX;
+
+#ifdef MMX_choose_table
+    if (gfc->CPU_features.MMX) {
+        gfc->choose_table = choose_table_MMX;
+    }
+#endif
+
+    for (i = 2; i <= 576; i += 2) {
+        int     scfb_anz = 0, bv_index;
+        while (gfc->scalefac_band.l[++scfb_anz] < i);
+
+        bv_index = subdv_table[scfb_anz].region0_count;
+        while (gfc->scalefac_band.l[bv_index + 1] > i)
+            bv_index--;
+
+        if (bv_index < 0) {
+            /* this is an indication that everything is going to
+               be encoded as region0:  bigvalues < region0 < region1
+               so lets set region0, region1 to some value larger
+               than bigvalues */
+            bv_index = subdv_table[scfb_anz].region0_count;
+        }
+
+        gfc->bv_scf[i - 2] = bv_index;
+
+        bv_index = subdv_table[scfb_anz].region1_count;
+        while (gfc->scalefac_band.l[bv_index + gfc->bv_scf[i - 2] + 2] > i)
+            bv_index--;
+
+        if (bv_index < 0) {
+            bv_index = subdv_table[scfb_anz].region1_count;
+        }
+
+        gfc->bv_scf[i - 1] = bv_index;
+    }
+}
diff --git a/libmp3lame/util.c b/libmp3lame/util.c
new file mode 100644
index 0000000..da95db1
--- /dev/null
+++ b/libmp3lame/util.c
@@ -0,0 +1,992 @@
+/*
+ *	lame utility library source file
+ *
+ *	Copyright (c) 1999 Albert L Faber
+ *	Copyright (c) 2000-2005 Alexander Leidinger
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: util.c,v 1.140.2.4 2010/03/21 12:15:56 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "lame_global_flags.h"
+
+#define PRECOMPUTE
+#if defined(__FreeBSD__) && !defined(__alpha__)
+# include <machine/floatingpoint.h>
+#endif
+
+
+/***********************************************************************
+*
+*  Global Function Definitions
+*
+***********************************************************************/
+/*empty and close mallocs in gfc */
+
+void
+free_id3tag(lame_internal_flags * const gfc)
+{
+    if (gfc->tag_spec.title != 0) {
+        free(gfc->tag_spec.title);
+        gfc->tag_spec.title = 0;
+    }
+    if (gfc->tag_spec.artist != 0) {
+        free(gfc->tag_spec.artist);
+        gfc->tag_spec.artist = 0;
+    }
+    if (gfc->tag_spec.album != 0) {
+        free(gfc->tag_spec.album);
+        gfc->tag_spec.album = 0;
+    }
+    if (gfc->tag_spec.comment != 0) {
+        free(gfc->tag_spec.comment);
+        gfc->tag_spec.comment = 0;
+    }
+
+    if (gfc->tag_spec.albumart != 0) {
+        free(gfc->tag_spec.albumart);
+        gfc->tag_spec.albumart = 0;
+        gfc->tag_spec.albumart_size = 0;
+        gfc->tag_spec.albumart_mimetype = MIMETYPE_NONE;
+    }
+    if (gfc->tag_spec.values != 0) {
+        unsigned int i;
+        for (i = 0; i < gfc->tag_spec.num_values; ++i) {
+            free(gfc->tag_spec.values[i]);
+        }
+        free(gfc->tag_spec.values);
+        gfc->tag_spec.values = 0;
+        gfc->tag_spec.num_values = 0;
+    }
+    if (gfc->tag_spec.v2_head != 0) {
+        FrameDataNode *node = gfc->tag_spec.v2_head;
+        do {
+            void   *p = node->dsc.ptr.b;
+            void   *q = node->txt.ptr.b;
+            void   *r = node;
+            node = node->nxt;
+            free(p);
+            free(q);
+            free(r);
+        } while (node != 0);
+        gfc->tag_spec.v2_head = 0;
+        gfc->tag_spec.v2_tail = 0;
+    }
+}
+
+
+void
+freegfc(lame_internal_flags * const gfc)
+{                       /* bit stream structure */
+    int     i;
+
+
+    for (i = 0; i <= 2 * BPC; i++)
+        if (gfc->blackfilt[i] != NULL) {
+            free(gfc->blackfilt[i]);
+            gfc->blackfilt[i] = NULL;
+        }
+    if (gfc->inbuf_old[0]) {
+        free(gfc->inbuf_old[0]);
+        gfc->inbuf_old[0] = NULL;
+    }
+    if (gfc->inbuf_old[1]) {
+        free(gfc->inbuf_old[1]);
+        gfc->inbuf_old[1] = NULL;
+    }
+
+    if (gfc->bs.buf != NULL) {
+        free(gfc->bs.buf);
+        gfc->bs.buf = NULL;
+    }
+
+    if (gfc->VBR_seek_table.bag) {
+        free(gfc->VBR_seek_table.bag);
+        gfc->VBR_seek_table.bag = NULL;
+        gfc->VBR_seek_table.size = 0;
+    }
+    if (gfc->ATH) {
+        free(gfc->ATH);
+    }
+    if (gfc->PSY) {
+        free(gfc->PSY);
+    }
+    if (gfc->rgdata) {
+        free(gfc->rgdata);
+    }
+    if (gfc->s3_ll) {
+        /* XXX allocated in psymodel_init() */
+        free(gfc->s3_ll);
+    }
+    if (gfc->s3_ss) {
+        /* XXX allocated in psymodel_init() */
+        free(gfc->s3_ss);
+    }
+    if (gfc->in_buffer_0) {
+        free(gfc->in_buffer_0);
+    }
+    if (gfc->in_buffer_1) {
+        free(gfc->in_buffer_1);
+    }
+    free_id3tag(gfc);
+#ifdef DECODE_ON_THE_FLY
+    if (gfc->hip) {
+        hip_decode_exit(gfc->hip);
+        gfc->hip = 0;
+    }
+#endif
+    free(gfc);
+}
+
+void
+malloc_aligned(aligned_pointer_t * ptr, unsigned int size, unsigned int bytes)
+{
+    if (ptr) {
+        if (!ptr->pointer) {
+            ptr->pointer = malloc(size + bytes);
+            if (bytes > 0) {
+                ptr->aligned = (void *) ((((size_t) ptr->pointer + bytes - 1) / bytes) * bytes);
+            }
+            else {
+                ptr->aligned = ptr->pointer;
+            }
+        }
+    }
+}
+
+void
+free_aligned(aligned_pointer_t * ptr)
+{
+    if (ptr) {
+        if (ptr->pointer) {
+            free(ptr->pointer);
+            ptr->pointer = 0;
+            ptr->aligned = 0;
+        }
+    }
+}
+
+/*those ATH formulas are returning
+their minimum value for input = -1*/
+
+static  FLOAT
+ATHformula_GB(FLOAT f, FLOAT value)
+{
+    /* from Painter & Spanias
+       modified by Gabriel Bouvigne to better fit the reality
+       ath =    3.640 * pow(f,-0.8)
+       - 6.800 * exp(-0.6*pow(f-3.4,2.0))
+       + 6.000 * exp(-0.15*pow(f-8.7,2.0))
+       + 0.6* 0.001 * pow(f,4.0);
+
+
+       In the past LAME was using the Painter &Spanias formula.
+       But we had some recurrent problems with HF content.
+       We measured real ATH values, and found the older formula
+       to be inacurate in the higher part. So we made this new
+       formula and this solved most of HF problematic testcases.
+       The tradeoff is that in VBR mode it increases a lot the
+       bitrate. */
+
+
+/*this curve can be udjusted according to the VBR scale:
+it adjusts from something close to Painter & Spanias
+on V9 up to Bouvigne's formula for V0. This way the VBR
+bitrate is more balanced according to the -V value.*/
+
+    FLOAT   ath;
+
+    /* the following Hack allows to ask for the lowest value */
+    if (f < -.3)
+        f = 3410;
+
+    f /= 1000;          /* convert to khz */
+    f = Max(0.1, f);
+/*  f  = Min(21.0, f);
+*/
+    ath = 3.640 * pow(f, -0.8)
+        - 6.800 * exp(-0.6 * pow(f - 3.4, 2.0))
+        + 6.000 * exp(-0.15 * pow(f - 8.7, 2.0))
+        + (0.6 + 0.04 * value) * 0.001 * pow(f, 4.0);
+    return ath;
+}
+
+
+
+FLOAT
+ATHformula(FLOAT f, lame_global_flags const *gfp)
+{
+    FLOAT   ath;
+    switch (gfp->ATHtype) {
+    case 0:
+        ath = ATHformula_GB(f, 9);
+        break;
+    case 1:
+        ath = ATHformula_GB(f, -1); /*over sensitive, should probably be removed */
+        break;
+    case 2:
+        ath = ATHformula_GB(f, 0);
+        break;
+    case 3:
+        ath = ATHformula_GB(f, 1) + 6; /*modification of GB formula by Roel */
+        break;
+    case 4:
+        ath = ATHformula_GB(f, gfp->ATHcurve);
+        break;
+    default:
+        ath = ATHformula_GB(f, 0);
+        break;
+    }
+    return ath;
+}
+
+/* see for example "Zwicker: Psychoakustik, 1982; ISBN 3-540-11401-7 */
+FLOAT
+freq2bark(FLOAT freq)
+{
+    /* input: freq in hz  output: barks */
+    if (freq < 0)
+        freq = 0;
+    freq = freq * 0.001;
+    return 13.0 * atan(.76 * freq) + 3.5 * atan(freq * freq / (7.5 * 7.5));
+}
+
+/* see for example "Zwicker: Psychoakustik, 1982; ISBN 3-540-11401-7 */
+FLOAT
+freq2cbw(FLOAT freq)
+{
+    /* input: freq in hz  output: critical band width */
+    freq = freq * 0.001;
+    return 25 + 75 * pow(1 + 1.4 * (freq * freq), 0.69);
+}
+
+
+
+
+
+
+#define ABS(A) (((A)>0) ? (A) : -(A))
+
+int
+FindNearestBitrate(int bRate, /* legal rates from 8 to 320 */
+                   int version, int samplerate)
+{                       /* MPEG-1 or MPEG-2 LSF */
+    int     bitrate;
+    int     i;
+
+    if (samplerate < 16000)
+        version = 2;
+
+    bitrate = bitrate_table[version][1];
+
+    for (i = 2; i <= 14; i++) {
+        if (bitrate_table[version][i] > 0) {
+            if (ABS(bitrate_table[version][i] - bRate) < ABS(bitrate - bRate))
+                bitrate = bitrate_table[version][i];
+        }
+    }
+    return bitrate;
+}
+
+
+
+
+
+#ifndef Min
+#define         Min(A, B)       ((A) < (B) ? (A) : (B))
+#endif
+#ifndef Max
+#define         Max(A, B)       ((A) > (B) ? (A) : (B))
+#endif
+
+
+/* Used to find table index when
+ * we need bitrate-based values
+ * determined using tables
+ *
+ * bitrate in kbps
+ *
+ * Gabriel Bouvigne 2002-11-03
+ */
+int
+nearestBitrateFullIndex(const int bitrate)
+{
+    /* borrowed from DM abr presets */
+
+    const int full_bitrate_table[] =
+        { 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 };
+
+
+    int     lower_range = 0, lower_range_kbps = 0, upper_range = 0, upper_range_kbps = 0;
+
+
+    int     b;
+
+
+    /* We assume specified bitrate will be 320kbps */
+    upper_range_kbps = full_bitrate_table[16];
+    upper_range = 16;
+    lower_range_kbps = full_bitrate_table[16];
+    lower_range = 16;
+
+    /* Determine which significant bitrates the value specified falls between,
+     * if loop ends without breaking then we were correct above that the value was 320
+     */
+    for (b = 0; b < 16; b++) {
+        if ((Max(bitrate, full_bitrate_table[b + 1])) != bitrate) {
+            upper_range_kbps = full_bitrate_table[b + 1];
+            upper_range = b + 1;
+            lower_range_kbps = full_bitrate_table[b];
+            lower_range = (b);
+            break;      /* We found upper range */
+        }
+    }
+
+    /* Determine which range the value specified is closer to */
+    if ((upper_range_kbps - bitrate) > (bitrate - lower_range_kbps)) {
+        return lower_range;
+    }
+    return upper_range;
+}
+
+
+
+
+
+/* map frequency to a valid MP3 sample frequency
+ *
+ * Robert Hegemann 2000-07-01
+ */
+int
+map2MP3Frequency(int freq)
+{
+    if (freq <= 8000)
+        return 8000;
+    if (freq <= 11025)
+        return 11025;
+    if (freq <= 12000)
+        return 12000;
+    if (freq <= 16000)
+        return 16000;
+    if (freq <= 22050)
+        return 22050;
+    if (freq <= 24000)
+        return 24000;
+    if (freq <= 32000)
+        return 32000;
+    if (freq <= 44100)
+        return 44100;
+
+    return 48000;
+}
+
+int
+BitrateIndex(int bRate,      /* legal rates from 32 to 448 kbps */
+             int version,    /* MPEG-1 or MPEG-2/2.5 LSF */
+             int samplerate)
+{                       /* convert bitrate in kbps to index */
+    int     i;
+    if (samplerate < 16000)
+        version = 2;
+    for (i = 0; i <= 14; i++) {
+        if (bitrate_table[version][i] > 0) {
+            if (bitrate_table[version][i] == bRate) {
+                return i;
+            }
+        }
+    }
+    return -1;
+}
+
+/* convert samp freq in Hz to index */
+
+int
+SmpFrqIndex(int sample_freq, int *const version)
+{
+    switch (sample_freq) {
+    case 44100:
+        *version = 1;
+        return 0;
+    case 48000:
+        *version = 1;
+        return 1;
+    case 32000:
+        *version = 1;
+        return 2;
+    case 22050:
+        *version = 0;
+        return 0;
+    case 24000:
+        *version = 0;
+        return 1;
+    case 16000:
+        *version = 0;
+        return 2;
+    case 11025:
+        *version = 0;
+        return 0;
+    case 12000:
+        *version = 0;
+        return 1;
+    case 8000:
+        *version = 0;
+        return 2;
+    default:
+        *version = 0;
+        return -1;
+    }
+}
+
+
+/*****************************************************************************
+*
+*  End of bit_stream.c package
+*
+*****************************************************************************/
+
+
+
+
+
+
+
+
+
+
+/* resampling via FIR filter, blackman window */
+inline static FLOAT
+blackman(FLOAT x, FLOAT fcn, int l)
+{
+    /* This algorithm from:
+       SIGNAL PROCESSING ALGORITHMS IN FORTRAN AND C
+       S.D. Stearns and R.A. David, Prentice-Hall, 1992
+     */
+    FLOAT   bkwn, x2;
+    FLOAT const wcn = (PI * fcn);
+
+    x /= l;
+    if (x < 0)
+        x = 0;
+    if (x > 1)
+        x = 1;
+    x2 = x - .5;
+
+    bkwn = 0.42 - 0.5 * cos(2 * x * PI) + 0.08 * cos(4 * x * PI);
+    if (fabs(x2) < 1e-9)
+        return wcn / PI;
+    else
+        return (bkwn * sin(l * wcn * x2) / (PI * l * x2));
+
+
+}
+
+/* gcd - greatest common divisor */
+/* Joint work of Euclid and M. Hendry */
+
+static int
+gcd(int i, int j)
+{
+/*    assert ( i > 0  &&  j > 0 ); */
+    return j ? gcd(j, i % j) : i;
+}
+
+
+
+/* copy in new samples from in_buffer into mfbuf, with resampling
+   if necessary.  n_in = number of samples from the input buffer that
+   were used.  n_out = number of samples copied into mfbuf  */
+
+void
+fill_buffer(lame_global_flags const *gfp,
+            sample_t * mfbuf[2], sample_t const *in_buffer[2], int nsamples, int *n_in, int *n_out)
+{
+    lame_internal_flags const *const gfc = gfp->internal_flags;
+    int     ch, i;
+
+    /* copy in new samples into mfbuf, with resampling if necessary */
+    if ((gfc->resample_ratio < .9999) || (gfc->resample_ratio > 1.0001)) {
+        for (ch = 0; ch < gfc->channels_out; ch++) {
+            *n_out =
+                fill_buffer_resample(gfp, &mfbuf[ch][gfc->mf_size],
+                                     gfp->framesize, in_buffer[ch], nsamples, n_in, ch);
+        }
+    }
+    else {
+        *n_out = Min(gfp->framesize, nsamples);
+        *n_in = *n_out;
+        for (i = 0; i < *n_out; ++i) {
+            mfbuf[0][gfc->mf_size + i] = in_buffer[0][i];
+            if (gfc->channels_out == 2)
+                mfbuf[1][gfc->mf_size + i] = in_buffer[1][i];
+        }
+    }
+}
+
+
+
+
+int
+fill_buffer_resample(lame_global_flags const *gfp,
+                     sample_t * outbuf,
+                     int desired_len, sample_t const *inbuf, int len, int *num_used, int ch)
+{
+
+
+    lame_internal_flags *const gfc = gfp->internal_flags;
+    int     BLACKSIZE;
+    FLOAT   offset, xvalue;
+    int     i, j = 0, k;
+    int     filter_l;
+    FLOAT   fcn, intratio;
+    FLOAT  *inbuf_old;
+    int     bpc;             /* number of convolution functions to pre-compute */
+    bpc = gfp->out_samplerate / gcd(gfp->out_samplerate, gfp->in_samplerate);
+    if (bpc > BPC)
+        bpc = BPC;
+
+    intratio = (fabs(gfc->resample_ratio - floor(.5 + gfc->resample_ratio)) < .0001);
+    fcn = 1.00 / gfc->resample_ratio;
+    if (fcn > 1.00)
+        fcn = 1.00;
+    filter_l = 31;
+    if (0 == filter_l % 2)
+        --filter_l;     /* must be odd */
+    filter_l += intratio; /* unless resample_ratio=int, it must be even */
+
+
+    BLACKSIZE = filter_l + 1; /* size of data needed for FIR */
+
+    if (gfc->fill_buffer_resample_init == 0) {
+        gfc->inbuf_old[0] = calloc(BLACKSIZE, sizeof(gfc->inbuf_old[0][0]));
+        gfc->inbuf_old[1] = calloc(BLACKSIZE, sizeof(gfc->inbuf_old[0][0]));
+        for (i = 0; i <= 2 * bpc; ++i)
+            gfc->blackfilt[i] = calloc(BLACKSIZE, sizeof(gfc->blackfilt[0][0]));
+
+        gfc->itime[0] = 0;
+        gfc->itime[1] = 0;
+
+        /* precompute blackman filter coefficients */
+        for (j = 0; j <= 2 * bpc; j++) {
+            FLOAT   sum = 0.;
+            offset = (j - bpc) / (2. * bpc);
+            for (i = 0; i <= filter_l; i++)
+                sum += gfc->blackfilt[j][i] = blackman(i - offset, fcn, filter_l);
+            for (i = 0; i <= filter_l; i++)
+                gfc->blackfilt[j][i] /= sum;
+        }
+        gfc->fill_buffer_resample_init = 1;
+    }
+
+    inbuf_old = gfc->inbuf_old[ch];
+
+    /* time of j'th element in inbuf = itime + j/ifreq; */
+    /* time of k'th element in outbuf   =  j/ofreq */
+    for (k = 0; k < desired_len; k++) {
+        double  time0;
+        int     joff;
+
+        time0 = k * gfc->resample_ratio; /* time of k'th output sample */
+        j = floor(time0 - gfc->itime[ch]);
+
+        /* check if we need more input data */
+        if ((filter_l + j - filter_l / 2) >= len)
+            break;
+
+        /* blackman filter.  by default, window centered at j+.5(filter_l%2) */
+        /* but we want a window centered at time0.   */
+        offset = (time0 - gfc->itime[ch] - (j + .5 * (filter_l % 2)));
+        assert(fabs(offset) <= .501);
+
+        /* find the closest precomputed window for this offset: */
+        joff = floor((offset * 2 * bpc) + bpc + .5);
+
+        xvalue = 0.;
+        for (i = 0; i <= filter_l; ++i) {
+            int const j2 = i + j - filter_l / 2;
+            sample_t y;
+            assert(j2 < len);
+            assert(j2 + BLACKSIZE >= 0);
+            y = (j2 < 0) ? inbuf_old[BLACKSIZE + j2] : inbuf[j2];
+#ifdef PRECOMPUTE
+            xvalue += y * gfc->blackfilt[joff][i];
+#else
+            xvalue += y * blackman(i - offset, fcn, filter_l); /* very slow! */
+#endif
+        }
+        outbuf[k] = xvalue;
+    }
+
+
+    /* k = number of samples added to outbuf */
+    /* last k sample used data from [j-filter_l/2,j+filter_l-filter_l/2]  */
+
+    /* how many samples of input data were used:  */
+    *num_used = Min(len, filter_l + j - filter_l / 2);
+
+    /* adjust our input time counter.  Incriment by the number of samples used,
+     * then normalize so that next output sample is at time 0, next
+     * input buffer is at time itime[ch] */
+    gfc->itime[ch] += *num_used - k * gfc->resample_ratio;
+
+    /* save the last BLACKSIZE samples into the inbuf_old buffer */
+    if (*num_used >= BLACKSIZE) {
+        for (i = 0; i < BLACKSIZE; i++)
+            inbuf_old[i] = inbuf[*num_used + i - BLACKSIZE];
+    }
+    else {
+        /* shift in *num_used samples into inbuf_old  */
+        int const n_shift = BLACKSIZE - *num_used; /* number of samples to shift */
+
+        /* shift n_shift samples by *num_used, to make room for the
+         * num_used new samples */
+        for (i = 0; i < n_shift; ++i)
+            inbuf_old[i] = inbuf_old[i + *num_used];
+
+        /* shift in the *num_used samples */
+        for (j = 0; i < BLACKSIZE; ++i, ++j)
+            inbuf_old[i] = inbuf[j];
+
+        assert(j == *num_used);
+    }
+    return k;           /* return the number samples created at the new samplerate */
+}
+
+
+
+
+
+/***********************************************************************
+*
+*  Message Output
+*
+***********************************************************************/
+void
+lame_debugf(const lame_internal_flags * gfc, const char *format, ...)
+{
+    va_list args;
+
+    va_start(args, format);
+
+    if (gfc->report.debugf != NULL) {
+        gfc->report.debugf(format, args);
+    }
+    else {
+        (void) vfprintf(stderr, format, args);
+        fflush(stderr); /* an debug function should flush immediately */
+    }
+
+    va_end(args);
+}
+
+
+void
+lame_msgf(const lame_internal_flags * gfc, const char *format, ...)
+{
+    va_list args;
+
+    va_start(args, format);
+
+    if (gfc->report.msgf != NULL) {
+        gfc->report.msgf(format, args);
+    }
+    else {
+        (void) vfprintf(stderr, format, args);
+        fflush(stderr); /* we print to stderr, so me may want to flush */
+    }
+
+    va_end(args);
+}
+
+
+void
+lame_errorf(const lame_internal_flags * gfc, const char *format, ...)
+{
+    va_list args;
+
+    va_start(args, format);
+
+    if (gfc->report.errorf != NULL) {
+        gfc->report.errorf(format, args);
+    }
+    else {
+        (void) vfprintf(stderr, format, args);
+        fflush(stderr); /* an error function should flush immediately */
+    }
+
+    va_end(args);
+}
+
+
+
+/***********************************************************************
+ *
+ *      routines to detect CPU specific features like 3DNow, MMX, SSE
+ *
+ *  donated by Frank Klemm
+ *  added Robert Hegemann 2000-10-10
+ *
+ ***********************************************************************/
+
+#ifdef HAVE_NASM
+extern int has_MMX_nasm(void);
+extern int has_3DNow_nasm(void);
+extern int has_SSE_nasm(void);
+extern int has_SSE2_nasm(void);
+#endif
+
+int
+has_MMX(void)
+{
+#ifdef HAVE_NASM
+    return has_MMX_nasm();
+#else
+    return 0;           /* don't know, assume not */
+#endif
+}
+
+int
+has_3DNow(void)
+{
+#ifdef HAVE_NASM
+    return has_3DNow_nasm();
+#else
+    return 0;           /* don't know, assume not */
+#endif
+}
+
+int
+has_SSE(void)
+{
+#ifdef HAVE_NASM
+    return has_SSE_nasm();
+#else
+#ifdef _M_X64
+    return 1;
+#else
+    return 0;           /* don't know, assume not */
+#endif
+#endif
+}
+
+int
+has_SSE2(void)
+{
+#ifdef HAVE_NASM
+    return has_SSE2_nasm();
+#else
+#ifdef _M_X64
+    return 1;
+#else
+    return 0;           /* don't know, assume not */
+#endif
+#endif
+}
+
+void
+disable_FPE(void)
+{
+/* extremly system dependent stuff, move to a lib to make the code readable */
+/*==========================================================================*/
+
+
+
+    /*
+     *  Disable floating point exceptions
+     */
+
+
+
+
+#if defined(__FreeBSD__) && !defined(__alpha__)
+    {
+        /* seet floating point mask to the Linux default */
+        fp_except_t mask;
+        mask = fpgetmask();
+        /* if bit is set, we get SIGFPE on that error! */
+        fpsetmask(mask & ~(FP_X_INV | FP_X_DZ));
+        /*  DEBUGF("FreeBSD mask is 0x%x\n",mask); */
+    }
+#endif
+
+#if defined(__riscos__) && !defined(ABORTFP)
+    /* Disable FPE's under RISC OS */
+    /* if bit is set, we disable trapping that error! */
+    /*   _FPE_IVO : invalid operation */
+    /*   _FPE_DVZ : divide by zero */
+    /*   _FPE_OFL : overflow */
+    /*   _FPE_UFL : underflow */
+    /*   _FPE_INX : inexact */
+    DisableFPETraps(_FPE_IVO | _FPE_DVZ | _FPE_OFL);
+#endif
+
+    /*
+     *  Debugging stuff
+     *  The default is to ignore FPE's, unless compiled with -DABORTFP
+     *  so add code below to ENABLE FPE's.
+     */
+
+#if defined(ABORTFP)
+#if defined(_MSC_VER)
+    {
+#if 0
+        /* rh 061207
+           the following fix seems to be a workaround for a problem in the
+           parent process calling LAME. It would be better to fix the broken
+           application => code disabled.
+         */
+
+        /* set affinity to a single CPU.  Fix for EAC/lame on SMP systems from
+           "Todd Richmond" <todd.richmond@openwave.com> */
+        SYSTEM_INFO si;
+        GetSystemInfo(&si);
+        SetProcessAffinityMask(GetCurrentProcess(), si.dwActiveProcessorMask);
+#endif
+#include <float.h>
+        unsigned int mask;
+        mask = _controlfp(0, 0);
+        mask &= ~(_EM_OVERFLOW | _EM_UNDERFLOW | _EM_ZERODIVIDE | _EM_INVALID);
+        mask = _controlfp(mask, _MCW_EM);
+    }
+#elif defined(__CYGWIN__)
+#  define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
+#  define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
+
+#  define _EM_INEXACT     0x00000020 /* inexact (precision) */
+#  define _EM_UNDERFLOW   0x00000010 /* underflow */
+#  define _EM_OVERFLOW    0x00000008 /* overflow */
+#  define _EM_ZERODIVIDE  0x00000004 /* zero divide */
+#  define _EM_INVALID     0x00000001 /* invalid */
+    {
+        unsigned int mask;
+        _FPU_GETCW(mask);
+        /* Set the FPU control word to abort on most FPEs */
+        mask &= ~(_EM_OVERFLOW | _EM_ZERODIVIDE | _EM_INVALID);
+        _FPU_SETCW(mask);
+    }
+# elif defined(__linux__)
+    {
+
+#  include <fpu_control.h>
+#  ifndef _FPU_GETCW
+#  define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
+#  endif
+#  ifndef _FPU_SETCW
+#  define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
+#  endif
+
+        /* 
+         * Set the Linux mask to abort on most FPE's
+         * if bit is set, we _mask_ SIGFPE on that error!
+         *  mask &= ~( _FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM | _FPU_MASK_UM );
+         */
+
+        unsigned int mask;
+        _FPU_GETCW(mask);
+        mask &= ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM);
+        _FPU_SETCW(mask);
+    }
+#endif
+#endif /* ABORTFP */
+}
+
+
+
+
+
+#ifdef USE_FAST_LOG
+/***********************************************************************
+ *
+ * Fast Log Approximation for log2, used to approximate every other log
+ * (log10 and log)
+ * maximum absolute error for log10 is around 10-6
+ * maximum *relative* error can be high when x is almost 1 because error/log10(x) tends toward x/e
+ *
+ * use it if typical RESULT values are > 1e-5 (for example if x>1.00001 or x<0.99999)
+ * or if the relative precision in the domain around 1 is not important (result in 1 is exact and 0)
+ *
+ ***********************************************************************/
+
+
+#define LOG2_SIZE       (512)
+#define LOG2_SIZE_L2    (9)
+
+static ieee754_float32_t log_table[LOG2_SIZE + 1];
+
+
+
+void
+init_log_table(void)
+{
+    int     j;
+    static int init = 0;
+
+    /* Range for log2(x) over [1,2[ is [0,1[ */
+    assert((1 << LOG2_SIZE_L2) == LOG2_SIZE);
+
+    if (!init) {
+        for (j = 0; j < LOG2_SIZE + 1; j++)
+            log_table[j] = log(1.0f + j / (ieee754_float32_t) LOG2_SIZE) / log(2.0f);
+    }
+    init = 1;
+}
+
+
+
+ieee754_float32_t
+fast_log2(ieee754_float32_t x)
+{
+    ieee754_float32_t log2val, partial;
+    union {
+        ieee754_float32_t f;
+        int     i;
+    } fi;
+    int     mantisse;
+    fi.f = x;
+    mantisse = fi.i & 0x7fffff;
+    log2val = ((fi.i >> 23) & 0xFF) - 0x7f;
+    partial = (mantisse & ((1 << (23 - LOG2_SIZE_L2)) - 1));
+    partial *= 1.0f / ((1 << (23 - LOG2_SIZE_L2)));
+
+
+    mantisse >>= (23 - LOG2_SIZE_L2);
+
+    /* log2val += log_table[mantisse];  without interpolation the results are not good */
+    log2val += log_table[mantisse] * (1.0f - partial) + log_table[mantisse + 1] * partial;
+
+    return log2val;
+}
+
+#else /* Don't use FAST_LOG */
+
+
+void
+init_log_table(void)
+{
+}
+
+
+#endif
+
+/* end of util.c */
diff --git a/libmp3lame/util.h b/libmp3lame/util.h
new file mode 100644
index 0000000..fc80951
--- /dev/null
+++ b/libmp3lame/util.h
@@ -0,0 +1,546 @@
+/*
+ *      lame utility library include file
+ *
+ *      Copyright (c) 1999 Albert L Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_UTIL_H
+#define LAME_UTIL_H
+
+#include "l3side.h"
+#include "id3tag.h"
+
+#ifdef __cplusplus
+extern  "C" {
+#endif
+
+/***********************************************************************
+*
+*  Global Definitions
+*
+***********************************************************************/
+
+#ifndef FALSE
+#define         FALSE                   0
+#endif
+
+#ifndef TRUE
+#define         TRUE                    (!FALSE)
+#endif
+
+#ifdef UINT_MAX
+# define         MAX_U_32_NUM            UINT_MAX
+#else
+# define         MAX_U_32_NUM            0xFFFFFFFF
+#endif
+
+#ifndef PI
+# ifdef M_PI
+#  define       PI                      M_PI
+# else
+#  define       PI                      3.14159265358979323846
+# endif
+#endif
+
+
+#ifdef M_LN2
+# define        LOG2                    M_LN2
+#else
+# define        LOG2                    0.69314718055994530942
+#endif
+
+#ifdef M_LN10
+# define        LOG10                   M_LN10
+#else
+# define        LOG10                   2.30258509299404568402
+#endif
+
+
+#ifdef M_SQRT2
+# define        SQRT2                   M_SQRT2
+#else
+# define        SQRT2                   1.41421356237309504880
+#endif
+
+
+#define         HAN_SIZE                512
+#define         CRC16_POLYNOMIAL        0x8005
+    
+#define MAX_BITS_PER_CHANNEL 4095
+#define MAX_BITS_PER_GRANULE 7680
+
+/* "bit_stream.h" Definitions */
+#define         BUFFER_SIZE     LAME_MAXMP3BUFFER
+
+#define         Min(A, B)       ((A) < (B) ? (A) : (B))
+#define         Max(A, B)       ((A) > (B) ? (A) : (B))
+
+/* log/log10 approximations */
+#ifdef USE_FAST_LOG
+#define         FAST_LOG10(x)       (fast_log2(x)*(LOG2/LOG10))
+#define         FAST_LOG(x)         (fast_log2(x)*LOG2)
+#define         FAST_LOG10_X(x,y)   (fast_log2(x)*(LOG2/LOG10*(y)))
+#define         FAST_LOG_X(x,y)     (fast_log2(x)*(LOG2*(y)))
+#else
+#define         FAST_LOG10(x)       log10(x)
+#define         FAST_LOG(x)         log(x)
+#define         FAST_LOG10_X(x,y)   (log10(x)*(y))
+#define         FAST_LOG_X(x,y)     (log(x)*(y))
+#endif
+
+
+    struct replaygain_data;
+#ifndef replaygain_data_defined
+#define replaygain_data_defined
+    typedef struct replaygain_data replaygain_t;
+#endif
+    struct plotting_data;
+#ifndef plotting_data_defined
+#define plotting_data_defined
+    typedef struct plotting_data plotting_data;
+#endif
+
+/***********************************************************************
+*
+*  Global Type Definitions
+*
+***********************************************************************/
+
+    typedef struct {
+        void   *aligned;     /* pointer to ie. 128 bit aligned memory */
+        void   *pointer;     /* to use with malloc/free */
+    } aligned_pointer_t;
+
+    void    malloc_aligned(aligned_pointer_t * ptr, unsigned int size, unsigned int bytes);
+    void    free_aligned(aligned_pointer_t * ptr);
+
+
+
+    typedef void (*iteration_loop_t) (lame_global_flags const * gfp,
+                                      FLOAT pe[2][2], FLOAT ms_ratio[2],
+                                      III_psy_ratio ratio[2][2]);
+
+
+    /* "bit_stream.h" Type Definitions */
+
+    typedef struct bit_stream_struc {
+        unsigned char *buf;  /* bit stream buffer */
+        int     buf_size;    /* size of buffer (in number of bytes) */
+        int     totbit;      /* bit counter of bit stream */
+        int     buf_byte_idx; /* pointer to top byte in buffer */
+        int     buf_bit_idx; /* pointer to top bit of top byte in buffer */
+
+        /* format of file in rd mode (BINARY/ASCII) */
+    } Bit_stream_struc;
+
+
+
+    /* variables used for --nspsytune */
+    typedef struct {
+        /* variables for nspsytune */
+        FLOAT   last_en_subshort[4][9];
+        int     last_attacks[4];
+        FLOAT   pefirbuf[19];
+        FLOAT   longfact[SBMAX_l];
+        FLOAT   shortfact[SBMAX_s];
+
+        /* short block tuning */
+        FLOAT   attackthre;
+        FLOAT   attackthre_s;
+    } nsPsy_t;
+
+
+    typedef struct {
+        int     sum;         /* what we have seen so far */
+        int     seen;        /* how many frames we have seen in this chunk */
+        int     want;        /* how many frames we want to collect into one chunk */
+        int     pos;         /* actual position in our bag */
+        int     size;        /* size of our bag */
+        int    *bag;         /* pointer to our bag */
+    	unsigned int nVbrNumFrames;
+	unsigned long nBytesWritten;
+        /* VBR tag data */
+        unsigned int TotalFrameSize;
+    } VBR_seek_info_t;
+
+
+    /**
+     *  ATH related stuff, if something new ATH related has to be added,
+     *  please plugg it here into the ATH_t struct
+     */
+    typedef struct {
+        int     use_adjust;  /* method for the auto adjustment  */
+        FLOAT   aa_sensitivity_p; /* factor for tuning the (sample power)
+                                     point below which adaptive threshold
+                                     of hearing adjustment occurs */
+        FLOAT   adjust;      /* lowering based on peak volume, 1 = no lowering */
+        FLOAT   adjust_limit; /* limit for dynamic ATH adjust */
+        FLOAT   decay;       /* determined to lower x dB each second */
+        FLOAT   floor;       /* lowest ATH value */
+        FLOAT   l[SBMAX_l];  /* ATH for sfbs in long blocks */
+        FLOAT   s[SBMAX_s];  /* ATH for sfbs in short blocks */
+        FLOAT   psfb21[PSFB21]; /* ATH for partitionned sfb21 in long blocks */
+        FLOAT   psfb12[PSFB12]; /* ATH for partitionned sfb12 in short blocks */
+        FLOAT   cb_l[CBANDS]; /* ATH for long block convolution bands */
+        FLOAT   cb_s[CBANDS]; /* ATH for short block convolution bands */
+        FLOAT   eql_w[BLKSIZE / 2]; /* equal loudness weights (based on ATH) */
+    } ATH_t;
+
+    /**
+     *  PSY Model related stuff
+     */
+    typedef struct {
+        FLOAT   mask_adjust; /* the dbQ stuff */
+        FLOAT   mask_adjust_short; /* the dbQ stuff */        
+        /* at transition from one scalefactor band to next */
+        FLOAT   bo_l_weight[SBMAX_l]; /* band weight long scalefactor bands */
+        FLOAT   bo_s_weight[SBMAX_s]; /* band weight short scalefactor bands */
+    } PSY_t;
+
+
+#define MAX_CHANNELS  2
+
+
+
+    struct lame_internal_flags {
+
+  /********************************************************************
+   * internal variables NOT set by calling program, and should not be *
+   * modified by the calling program                                  *
+   ********************************************************************/
+
+        /*
+         * Some remarks to the Class_ID field:
+         * The Class ID is an Identifier for a pointer to this struct.
+         * It is very unlikely that a pointer to lame_global_flags has the same 32 bits
+         * in it's structure (large and other special properties, for instance prime).
+         *
+         * To test that the structure is right and initialized, use:
+         *     if ( gfc -> Class_ID == LAME_ID ) ...
+         * Other remark:
+         *     If you set a flag to 0 for uninit data and 1 for init data, the right test
+         *     should be "if (flag == 1)" and NOT "if (flag)". Unintended modification
+         *     of this element will be otherwise misinterpreted as an init.
+         */
+#  define  LAME_ID   0xFFF88E3B
+        unsigned long Class_ID;
+
+        int     lame_encode_frame_init;
+        int     iteration_init_init;
+        int     fill_buffer_resample_init;
+
+#ifndef  MFSIZE
+# define MFSIZE  ( 3*1152 + ENCDELAY - MDCTDELAY )
+#endif
+        sample_t mfbuf[2][MFSIZE];
+
+
+        struct {
+            void    (*msgf) (const char *format, va_list ap);
+            void    (*debugf) (const char *format, va_list ap);
+            void    (*errorf) (const char *format, va_list ap);
+        } report;
+
+        int     mode_gr;     /* granules per frame */
+        int     channels_in; /* number of channels in the input data stream (PCM or decoded PCM) */
+        int     channels_out; /* number of channels in the output data stream (not used for decoding) */
+        double  resample_ratio; /* input_samp_rate/output_samp_rate */
+
+        int     mf_samples_to_encode;
+        int     mf_size;
+        int     VBR_min_bitrate; /* min bitrate index */
+        int     VBR_max_bitrate; /* max bitrate index */
+        int     bitrate_index;
+        int     samplerate_index;
+        int     mode_ext;
+
+
+        /* lowpass and highpass filter control */
+        FLOAT   lowpass1, lowpass2; /* normalized frequency bounds of passband */
+        FLOAT   highpass1, highpass2; /* normalized frequency bounds of passband */
+
+        int     noise_shaping; /* 0 = none
+                                  1 = ISO AAC model
+                                  2 = allow scalefac_select=1
+                                */
+
+        int     noise_shaping_amp; /*  0 = ISO model: amplify all distorted bands
+                                      1 = amplify within 50% of max (on db scale)
+                                      2 = amplify only most distorted band
+                                      3 = method 1 and refine with method 2
+                                    */
+        int     substep_shaping; /* 0 = no substep
+                                    1 = use substep shaping at last step(VBR only)
+                                    (not implemented yet)
+                                    2 = use substep inside loop
+                                    3 = use substep inside loop and last step
+                                  */
+
+        int     psymodel;    /* 1 = gpsycho. 0 = none */
+        int     noise_shaping_stop; /* 0 = stop at over=0, all scalefacs amplified or
+                                       a scalefac has reached max value
+                                       1 = stop when all scalefacs amplified or
+                                       a scalefac has reached max value
+                                       2 = stop when all scalefacs amplified
+                                     */
+
+        int     subblock_gain; /*  0 = no, 1 = yes */
+        int     use_best_huffman; /* 0 = no.  1=outside loop  2=inside loop(slow) */
+
+        int     full_outer_loop; /* 0 = stop early after 0 distortion found. 1 = full search */
+
+
+        /* variables used by lame.c */
+        Bit_stream_struc bs;
+        III_side_info_t l3_side;
+        FLOAT   ms_ratio[2];
+
+        /* used for padding */
+        int     padding;     /* padding for the current frame? */
+        int     frac_SpF;
+        int     slot_lag;
+
+
+        /* optional ID3 tags, used in id3tag.c  */
+        struct id3tag_spec tag_spec;
+        uint16_t nMusicCRC;
+
+
+        /* variables used by quantize.c */
+        int     OldValue[2];
+        int     CurrentStep[2];
+
+        FLOAT   masking_lower;
+        char    bv_scf[576];
+        int     pseudohalf[SFBMAX];
+
+        int     sfb21_extra; /* will be set in lame_init_params */
+
+        /* variables used by util.c */
+        /* BPC = maximum number of filter convolution windows to precompute */
+#define BPC 320
+        sample_t *inbuf_old[2];
+        sample_t *blackfilt[2 * BPC + 1];
+        double  itime[2];
+        int     sideinfo_len;
+
+        /* variables for newmdct.c */
+        FLOAT   sb_sample[2][2][18][SBLIMIT];
+        FLOAT   amp_filter[32];
+
+        /* variables for bitstream.c */
+        /* mpeg1: buffer=511 bytes  smallest frame: 96-38(sideinfo)=58
+         * max number of frames in reservoir:  8
+         * mpeg2: buffer=255 bytes.  smallest frame: 24-23bytes=1
+         * with VBR, if you are encoding all silence, it is possible to
+         * have 8kbs/24khz frames with 1byte of data each, which means we need
+         * to buffer up to 255 headers! */
+        /* also, max_header_buf has to be a power of two */
+#define MAX_HEADER_BUF 256
+#define MAX_HEADER_LEN 40    /* max size of header is 38 */
+        struct {
+            int     write_timing;
+            int     ptr;
+            char    buf[MAX_HEADER_LEN];
+        } header[MAX_HEADER_BUF];
+
+        int     h_ptr;
+        int     w_ptr;
+        int     ancillary_flag;
+
+        /* variables for reservoir.c */
+        int     ResvSize;    /* in bits */
+        int     ResvMax;     /* in bits */
+
+        scalefac_struct scalefac_band;
+
+        /* DATA FROM PSYMODEL.C */
+/* The static variables "r", "phi_sav", "new", "old" and "oldest" have    */
+/* to be remembered for the unpredictability measure.  For "r" and        */
+/* "phi_sav", the first index from the left is the channel select and     */
+/* the second index is the "age" of the data.                             */
+        FLOAT   minval_l[CBANDS];
+        FLOAT   minval_s[CBANDS];
+        FLOAT   nb_1[4][CBANDS], nb_2[4][CBANDS];
+        FLOAT   nb_s1[4][CBANDS], nb_s2[4][CBANDS];
+        FLOAT  *s3_ss;
+        FLOAT  *s3_ll;
+        FLOAT   decay;
+
+        III_psy_xmin thm[4];
+        III_psy_xmin en[4];
+
+        /* fft and energy calculation    */
+        FLOAT   tot_ener[4];
+
+        /* loudness calculation (for adaptive threshold of hearing) */
+        FLOAT   loudness_sq[2][2]; /* loudness^2 approx. per granule and channel */
+        FLOAT   loudness_sq_save[2]; /* account for granule delay of L3psycho_anal */
+
+
+        /* Scale Factor Bands    */
+        FLOAT   mld_l[SBMAX_l], mld_s[SBMAX_s];
+        int     bm_l[SBMAX_l], bo_l[SBMAX_l];
+        int     bm_s[SBMAX_s], bo_s[SBMAX_s];
+        int     npart_l, npart_s;
+
+        int     s3ind[CBANDS][2];
+        int     s3ind_s[CBANDS][2];
+
+        int     numlines_s[CBANDS];
+        int     numlines_l[CBANDS];
+        FLOAT   rnumlines_l[CBANDS];
+        FLOAT   mld_cb_l[CBANDS], mld_cb_s[CBANDS];
+        int     numlines_s_num1;
+        int     numlines_l_num1;
+
+        /* ratios  */
+        FLOAT   pe[4];
+        FLOAT   ms_ratio_s_old, ms_ratio_l_old;
+        FLOAT   ms_ener_ratio_old;
+
+        /* block type */
+        int     blocktype_old[2];
+
+        /* CPU features */
+        struct {
+            unsigned int MMX:1; /* Pentium MMX, Pentium II...IV, K6, K6-2,
+                                   K6-III, Athlon */
+            unsigned int AMD_3DNow:1; /* K6-2, K6-III, Athlon      */
+            unsigned int SSE:1; /* Pentium III, Pentium 4    */
+            unsigned int SSE2:1; /* Pentium 4, K8             */
+        } CPU_features;
+
+        /* functions to replace with CPU feature optimized versions in takehiro.c */
+        int     (*choose_table) (const int *ix, const int *const end, int *const s);
+        void    (*fft_fht) (FLOAT *, int);
+        void    (*init_xrpow_core) (gr_info * const cod_info, FLOAT xrpow[576], int upper,
+                                    FLOAT * sum);
+
+
+
+        nsPsy_t nsPsy;       /* variables used for --nspsytune */
+
+        VBR_seek_info_t VBR_seek_table; /* used for Xing VBR header */
+
+        ATH_t  *ATH;         /* all ATH related stuff */
+        PSY_t  *PSY;
+
+        int     nogap_total;
+        int     nogap_current;
+
+
+        /* ReplayGain */
+        unsigned int decode_on_the_fly:1;
+        unsigned int findReplayGain:1;
+        unsigned int findPeakSample:1;
+        sample_t PeakSample;
+        int     RadioGain;
+        int     AudiophileGain;
+        replaygain_t *rgdata;
+
+        int     noclipGainChange; /* gain change required for preventing clipping */
+        FLOAT   noclipScale; /* user-specified scale factor required for preventing clipping */
+
+
+        /* simple statistics */
+        int     bitrate_stereoMode_Hist[16][4 + 1];
+        int     bitrate_blockType_Hist[16][4 + 1 + 1]; /*norm/start/short/stop/mixed(short)/sum */
+
+        /* used by the frame analyzer */
+        plotting_data *pinfo;
+        hip_t hip;
+
+        int     in_buffer_nsamples;
+        sample_t *in_buffer_0;
+        sample_t *in_buffer_1;
+
+        iteration_loop_t iteration_loop;
+    };
+
+#ifndef lame_internal_flags_defined
+#define lame_internal_flags_defined
+    typedef struct lame_internal_flags lame_internal_flags;
+#endif
+
+
+/***********************************************************************
+*
+*  Global Function Prototype Declarations
+*
+***********************************************************************/
+    void    freegfc(lame_internal_flags * const gfc);
+    void    free_id3tag(lame_internal_flags * const gfc);
+    extern int BitrateIndex(int, int, int);
+    extern int FindNearestBitrate(int, int, int);
+    extern int map2MP3Frequency(int freq);
+    extern int SmpFrqIndex(int, int *const);
+    extern int nearestBitrateFullIndex(const int brate);
+    extern FLOAT ATHformula(FLOAT freq, lame_global_flags const *gfp);
+    extern FLOAT freq2bark(FLOAT freq);
+    extern FLOAT freq2cbw(FLOAT freq);
+    void    disable_FPE(void);
+
+/* log/log10 approximations */
+    extern void init_log_table(void);
+    extern ieee754_float32_t fast_log2(ieee754_float32_t x);
+
+
+    void    fill_buffer(lame_global_flags const *gfp,
+                        sample_t * mfbuf[2],
+                        sample_t const *in_buffer[2], int nsamples, int *n_in, int *n_out);
+
+    int     fill_buffer_resample(lame_global_flags const *gfp,
+                                 sample_t * outbuf,
+                                 int desired_len,
+                                 sample_t const *inbuf, int len, int *num_used, int channels);
+
+/* same as hip_decode1 (look in lame.h), but returns
+   unclipped raw floating-point samples. It is declared
+   here, not in lame.h, because it returns LAME's
+   internal type sample_t. No more than 1152 samples
+   per channel are allowed. */
+    int     hip_decode1_unclipped(hip_t hip, unsigned char *buffer,
+                                  size_t len, sample_t pcm_l[], sample_t pcm_r[]);
+
+
+    extern int has_MMX(void);
+    extern int has_3DNow(void);
+    extern int has_SSE(void);
+    extern int has_SSE2(void);
+
+
+
+/***********************************************************************
+*
+*  Macros about Message Printing and Exit
+*
+***********************************************************************/
+    extern void lame_errorf(const lame_internal_flags * gfc, const char *, ...);
+    extern void lame_debugf(const lame_internal_flags * gfc, const char *, ...);
+    extern void lame_msgf(const lame_internal_flags * gfc, const char *, ...);
+#define DEBUGF  lame_debugf
+#define ERRORF  lame_errorf
+#define MSGF    lame_msgf
+
+    extern void hip_set_pinfo(hip_t hip, plotting_data* pinfo);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                       /* LAME_UTIL_H */
diff --git a/libmp3lame/vbrquantize.c b/libmp3lame/vbrquantize.c
new file mode 100644
index 0000000..1face09
--- /dev/null
+++ b/libmp3lame/vbrquantize.c
@@ -0,0 +1,1592 @@
+/*
+ *	MP3 quantization
+ *
+ *	Copyright (c) 1999-2000 Mark Taylor
+ *	Copyright (c) 2000-2007 Robert Hegemann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: vbrquantize.c,v 1.132.2.1 2008/08/05 14:16:07 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "vbrquantize.h"
+#include "quantize_pvt.h"
+
+
+
+
+struct algo_s;
+typedef struct algo_s algo_t;
+
+typedef void (*alloc_sf_f) (const algo_t *, const int *, const int *, int);
+
+struct algo_s {
+    alloc_sf_f alloc;
+    const FLOAT *xr34orig;
+    lame_internal_flags *gfc;
+    gr_info *cod_info;
+    int     mingain_l;
+    int     mingain_s[3];
+};
+
+
+
+/*  Remarks on optimizing compilers:
+ *
+ *  the MSVC compiler may get into aliasing problems when accessing
+ *  memory through the fi_union. declaring it volatile does the trick here
+ *
+ *  the calc_sfb_noise_* functions are not inlined because the intel compiler
+ *  optimized executeables won't work as expected anymore
+ */
+
+#ifdef _MSC_VER
+#  define VOLATILE volatile
+#else
+#  define VOLATILE
+#endif
+
+typedef VOLATILE union {
+    float   f;
+    int     i;
+} fi_union;
+
+
+
+#define DOUBLEX double
+
+#define MAGIC_FLOAT_def (65536*(128))
+#define MAGIC_INT_def    0x4b000000
+
+#ifdef TAKEHIRO_IEEE754_HACK
+#  define ROUNDFAC_def -0.0946f
+#else
+/*********************************************************************
+ * XRPOW_FTOI is a macro to convert floats to ints.
+ * if XRPOW_FTOI(x) = nearest_int(x), then QUANTFAC(x)=adj43asm[x]
+ *                                         ROUNDFAC= -0.0946
+ *
+ * if XRPOW_FTOI(x) = floor(x), then QUANTFAC(x)=asj43[x]
+ *                                   ROUNDFAC=0.4054
+ *********************************************************************/
+#  define QUANTFAC(rx)  adj43[rx]
+#  define ROUNDFAC_def 0.4054f
+#  define XRPOW_FTOI(src,dest) ((dest) = (int)(src))
+#endif
+
+static int const MAGIC_INT = MAGIC_INT_def;
+#ifndef TAKEHIRO_IEEE754_HACK
+static DOUBLEX const ROUNDFAC = ROUNDFAC_def;
+#endif
+static DOUBLEX const MAGIC_FLOAT = MAGIC_FLOAT_def;
+
+
+
+
+static  FLOAT
+max_x34(const FLOAT * xr34, unsigned int bw)
+{
+    FLOAT   xfsf = 0;
+    unsigned int j = bw >> 1;
+    unsigned int const remaining = (j & 0x01u);
+
+    for (j >>= 1; j > 0; --j) {
+        if (xfsf < xr34[0]) {
+            xfsf = xr34[0];
+        }
+        if (xfsf < xr34[1]) {
+            xfsf = xr34[1];
+        }
+        if (xfsf < xr34[2]) {
+            xfsf = xr34[2];
+        }
+        if (xfsf < xr34[3]) {
+            xfsf = xr34[3];
+        }
+        xr34 += 4;
+    }
+    if (remaining) {
+        if (xfsf < xr34[0]) {
+            xfsf = xr34[0];
+        }
+        if (xfsf < xr34[1]) {
+            xfsf = xr34[1];
+        }
+    }
+    return xfsf;
+}
+
+
+
+static  uint8_t
+find_lowest_scalefac(const FLOAT xr34)
+{
+    uint8_t sf_ok = 255;
+    uint8_t sf = 128, delsf = 64;
+    uint8_t i;
+    for (i = 0; i < 8; ++i) {
+        FLOAT const xfsf = ipow20[sf] * xr34;
+        if (xfsf <= IXMAX_VAL) {
+            sf_ok = sf;
+            sf -= delsf;
+        }
+        else {
+            sf += delsf;
+        }
+        delsf >>= 1;
+    }
+    return sf_ok;
+}
+
+
+static int
+below_noise_floor(const FLOAT * xr, FLOAT l3xmin, unsigned int bw)
+{
+    FLOAT   sum = 0.0;
+    unsigned int i, j;
+    for (i = 0, j = bw; j > 0; ++i, --j) {
+        FLOAT const x = xr[i];
+        sum += x * x;
+    }
+    return (l3xmin - sum) >= -1E-20 ? 1 : 0;
+}
+
+
+static void
+k_34_4(DOUBLEX x[4], int l3[4])
+{
+#ifdef TAKEHIRO_IEEE754_HACK
+    fi_union fi[4];
+
+    assert(x[0] <= IXMAX_VAL && x[1] <= IXMAX_VAL && x[2] <= IXMAX_VAL && x[3] <= IXMAX_VAL);
+    x[0] += MAGIC_FLOAT;
+    fi[0].f = x[0];
+    x[1] += MAGIC_FLOAT;
+    fi[1].f = x[1];
+    x[2] += MAGIC_FLOAT;
+    fi[2].f = x[2];
+    x[3] += MAGIC_FLOAT;
+    fi[3].f = x[3];
+    fi[0].f = x[0] + adj43asm[fi[0].i - MAGIC_INT];
+    fi[1].f = x[1] + adj43asm[fi[1].i - MAGIC_INT];
+    fi[2].f = x[2] + adj43asm[fi[2].i - MAGIC_INT];
+    fi[3].f = x[3] + adj43asm[fi[3].i - MAGIC_INT];
+    l3[0] = fi[0].i - MAGIC_INT;
+    l3[1] = fi[1].i - MAGIC_INT;
+    l3[2] = fi[2].i - MAGIC_INT;
+    l3[3] = fi[3].i - MAGIC_INT;
+#else
+    assert(x[0] <= IXMAX_VAL && x[1] <= IXMAX_VAL && x[2] <= IXMAX_VAL && x[3] <= IXMAX_VAL);
+    XRPOW_FTOI(x[0], l3[0]);
+    XRPOW_FTOI(x[1], l3[1]);
+    XRPOW_FTOI(x[2], l3[2]);
+    XRPOW_FTOI(x[3], l3[3]);
+    x[0] += QUANTFAC(l3[0]);
+    x[1] += QUANTFAC(l3[1]);
+    x[2] += QUANTFAC(l3[2]);
+    x[3] += QUANTFAC(l3[3]);
+    XRPOW_FTOI(x[0], l3[0]);
+    XRPOW_FTOI(x[1], l3[1]);
+    XRPOW_FTOI(x[2], l3[2]);
+    XRPOW_FTOI(x[3], l3[3]);
+#endif
+}
+
+
+
+static void
+k_34_2(DOUBLEX x[2], int l3[2])
+{
+#ifdef TAKEHIRO_IEEE754_HACK
+    fi_union fi[2];
+
+    assert(x[0] <= IXMAX_VAL && x[1] <= IXMAX_VAL);
+    x[0] += MAGIC_FLOAT;
+    fi[0].f = x[0];
+    x[1] += MAGIC_FLOAT;
+    fi[1].f = x[1];
+    fi[0].f = x[0] + adj43asm[fi[0].i - MAGIC_INT];
+    fi[1].f = x[1] + adj43asm[fi[1].i - MAGIC_INT];
+    l3[0] = fi[0].i - MAGIC_INT;
+    l3[1] = fi[1].i - MAGIC_INT;
+#else
+    assert(x[0] <= IXMAX_VAL && x[1] <= IXMAX_VAL);
+    XRPOW_FTOI(x[0], l3[0]);
+    XRPOW_FTOI(x[1], l3[1]);
+    x[0] += QUANTFAC(l3[0]);
+    x[1] += QUANTFAC(l3[1]);
+    XRPOW_FTOI(x[0], l3[0]);
+    XRPOW_FTOI(x[1], l3[1]);
+#endif
+}
+
+
+
+/*  do call the calc_sfb_noise_* functions only with sf values
+ *  for which holds: sfpow34*xr34 <= IXMAX_VAL
+ */
+
+static  FLOAT
+calc_sfb_noise_x34(const FLOAT * xr, const FLOAT * xr34, unsigned int bw, uint8_t sf)
+{
+    DOUBLEX x[4];
+    int     l3[4];
+    const FLOAT sfpow = pow20[sf + Q_MAX2]; /*pow(2.0,sf/4.0); */
+    const FLOAT sfpow34 = ipow20[sf]; /*pow(sfpow,-3.0/4.0); */
+
+    FLOAT   xfsf = 0;
+    unsigned int j = bw >> 1;
+    unsigned int const remaining = (j & 0x01u);
+
+    for (j >>= 1; j > 0; --j) {
+        x[0] = sfpow34 * xr34[0];
+        x[1] = sfpow34 * xr34[1];
+        x[2] = sfpow34 * xr34[2];
+        x[3] = sfpow34 * xr34[3];
+
+        k_34_4(x, l3);
+
+        x[0] = fabs(xr[0]) - sfpow * pow43[l3[0]];
+        x[1] = fabs(xr[1]) - sfpow * pow43[l3[1]];
+        x[2] = fabs(xr[2]) - sfpow * pow43[l3[2]];
+        x[3] = fabs(xr[3]) - sfpow * pow43[l3[3]];
+        xfsf += (x[0] * x[0] + x[1] * x[1]) + (x[2] * x[2] + x[3] * x[3]);
+
+        xr += 4;
+        xr34 += 4;
+    }
+    if (remaining) {
+        x[0] = sfpow34 * xr34[0];
+        x[1] = sfpow34 * xr34[1];
+
+        k_34_2(x, l3);
+
+        x[0] = fabs(xr[0]) - sfpow * pow43[l3[0]];
+        x[1] = fabs(xr[1]) - sfpow * pow43[l3[1]];
+        xfsf += x[0] * x[0] + x[1] * x[1];
+    }
+    return xfsf;
+}
+
+
+
+struct calc_noise_cache {
+    int     valid;
+    FLOAT   value;
+};
+
+typedef struct calc_noise_cache calc_noise_cache_t;
+
+
+static  uint8_t
+tri_calc_sfb_noise_x34(const FLOAT * xr, const FLOAT * xr34, FLOAT l3_xmin, unsigned int bw,
+                       uint8_t sf, calc_noise_cache_t * did_it)
+{
+    if (did_it[sf].valid == 0) {
+        did_it[sf].valid = 1;
+        did_it[sf].value = calc_sfb_noise_x34(xr, xr34, bw, sf);
+    }
+    if (l3_xmin < did_it[sf].value) {
+        return 1;
+    }
+    if (sf < 255) {
+        uint8_t const sf_x = sf + 1;
+        if (did_it[sf_x].valid == 0) {
+            did_it[sf_x].valid = 1;
+            did_it[sf_x].value = calc_sfb_noise_x34(xr, xr34, bw, sf_x);
+        }
+        if (l3_xmin < did_it[sf_x].value) {
+            return 1;
+        }
+    }
+    if (sf > 0) {
+        uint8_t const sf_x = sf - 1;
+        if (did_it[sf_x].valid == 0) {
+            did_it[sf_x].valid = 1;
+            did_it[sf_x].value = calc_sfb_noise_x34(xr, xr34, bw, sf_x);
+        }
+        if (l3_xmin < did_it[sf_x].value) {
+            return 1;
+        }
+    }
+    return 0;
+}
+
+#if 0
+/**
+ *  Robert Hegemann 2001-05-01
+ *  calculates quantization step size determined by allowed masking
+ */
+static int
+calc_scalefac(FLOAT8 l3_xmin, int bw)
+{
+    FLOAT8 const c = 5.799142446; /* 10 * 10^(2/3) * log10(4/3) */
+    return 210 + (int) (c * log10(l3_xmin / bw) - .5);
+}
+#endif
+
+/* the find_scalefac* routines calculate
+ * a quantization step size which would
+ * introduce as much noise as is allowed.
+ * The larger the step size the more
+ * quantization noise we'll get. The
+ * scalefactors are there to lower the
+ * global step size, allowing limited
+ * differences in quantization step sizes
+ * per band (shaping the noise).
+ */
+
+static  uint8_t
+find_scalefac_x34(const FLOAT * xr, const FLOAT * xr34, FLOAT l3_xmin, unsigned int bw,
+                  uint8_t sf_min)
+{
+    calc_noise_cache_t did_it[256];
+    uint8_t sf = 128, sf_ok = 255, delsf = 128, seen_good_one = 0, i;
+    memset(did_it, 0, sizeof(did_it));
+    for (i = 0; i < 8; ++i) {
+        delsf >>= 1;
+        if (sf <= sf_min) {
+            sf += delsf;
+        }
+        else {
+            uint8_t const bad = tri_calc_sfb_noise_x34(xr, xr34, l3_xmin, bw, sf, did_it);
+            if (bad) {  /* distortion.  try a smaller scalefactor */
+                sf -= delsf;
+            }
+            else {
+                sf_ok = sf;
+                sf += delsf;
+                seen_good_one = 1;
+            }
+        }
+    }
+    /*  returning a scalefac without distortion, if possible
+     */
+    if (seen_good_one > 0) {
+        return sf_ok;
+    }
+    if (sf <= sf_min) {
+        return sf_min;
+    }
+    return sf;
+}
+
+
+
+/***********************************************************************
+ *
+ *      calc_short_block_vbr_sf()
+ *      calc_long_block_vbr_sf()
+ *
+ *  Mark Taylor 2000-??-??
+ *  Robert Hegemann 2000-10-25 made functions of it
+ *
+ ***********************************************************************/
+
+/* a variation for vbr-mtrh */
+static int
+block_sf(algo_t * that, const FLOAT l3_xmin[SFBMAX], int vbrsf[SFBMAX], int vbrsfmin[SFBMAX])
+{
+    FLOAT   max_xr34;
+    const FLOAT *const xr = &that->cod_info->xr[0];
+    const FLOAT *const xr34_orig = &that->xr34orig[0];
+    const int *const width = &that->cod_info->width[0];
+    unsigned int const max_nonzero_coeff = (unsigned int) that->cod_info->max_nonzero_coeff;
+    uint8_t maxsf = 0;
+    int     sfb = 0;
+    unsigned int j = 0, i = 0;
+    int const psymax = that->cod_info->psymax;
+
+    assert(that->cod_info->max_nonzero_coeff >= 0);
+
+    that->mingain_l = 0;
+    that->mingain_s[0] = 0;
+    that->mingain_s[1] = 0;
+    that->mingain_s[2] = 0;
+    while (j <= max_nonzero_coeff) {
+        unsigned int const w = (unsigned int) width[sfb];
+        unsigned int const m = (unsigned int) (max_nonzero_coeff - j + 1);
+        unsigned int l = w;
+        uint8_t m1, m2;
+        if (l > m) {
+            l = m;
+        }
+        max_xr34 = max_x34(&xr34_orig[j], l);
+
+        m1 = find_lowest_scalefac(max_xr34);
+        vbrsfmin[sfb] = m1;
+        if (that->mingain_l < m1) {
+            that->mingain_l = m1;
+        }
+        if (that->mingain_s[i] < m1) {
+            that->mingain_s[i] = m1;
+        }
+        if (++i > 2) {
+            i = 0;
+        }
+        if (sfb < psymax) {
+            if (below_noise_floor(&xr[j], l3_xmin[sfb], l) == 0) {
+                m2 = find_scalefac_x34(&xr[j], &xr34_orig[j], l3_xmin[sfb], l, m1);
+#if 0
+                if (0) {
+                    /** Robert Hegemann 2007-09-29:
+                     *  It seems here is some more potential for speed improvements.
+                     *  Current find method does 11-18 quantization calculations.
+                     *  Using a "good guess" may help to reduce this amount.
+                     */
+                    int     guess = calc_scalefac(l3_xmin[sfb], l);
+                    DEBUGF(that->gfc, "sfb=%3d guess=%3d found=%3d diff=%3d\n", sfb, guess, m2,
+                           m2 - guess);
+                }
+#endif
+                if (maxsf < m2) {
+                    maxsf = m2;
+                }
+            }
+            else {
+                m2 = 255;
+                maxsf = 255;
+            }
+        }
+        else {
+            if (maxsf < m1) {
+                maxsf = m1;
+            }
+            m2 = maxsf;
+        }
+        vbrsf[sfb] = m2;
+        ++sfb;
+        j += w;
+    }
+    for (; sfb < SFBMAX; ++sfb) {
+        vbrsf[sfb] = maxsf;
+        vbrsfmin[sfb] = 0;
+    }
+    return maxsf;
+}
+
+
+
+/***********************************************************************
+ *
+ *  quantize xr34 based on scalefactors
+ *
+ *  block_xr34
+ *
+ *  Mark Taylor 2000-??-??
+ *  Robert Hegemann 2000-10-20 made functions of them
+ *
+ ***********************************************************************/
+
+static void
+quantize_x34(const algo_t * that)
+{
+    DOUBLEX x[4];
+    const FLOAT *xr34_orig = that->xr34orig;
+    gr_info *const cod_info = that->cod_info;
+    int const ifqstep = (cod_info->scalefac_scale == 0) ? 2 : 4;
+    int    *l3 = cod_info->l3_enc;
+    unsigned int j = 0, sfb = 0;
+    unsigned int const max_nonzero_coeff = (unsigned int) cod_info->max_nonzero_coeff;
+
+    assert(cod_info->max_nonzero_coeff >= 0);
+    assert(cod_info->max_nonzero_coeff < 576);
+
+    while (j <= max_nonzero_coeff) {
+        int const s =
+            (cod_info->scalefac[sfb] + (cod_info->preflag ? pretab[sfb] : 0)) * ifqstep
+            + cod_info->subblock_gain[cod_info->window[sfb]] * 8;
+        uint8_t const sfac = (uint8_t) (cod_info->global_gain - s);
+        FLOAT const sfpow34 = ipow20[sfac];
+        unsigned int const w = (unsigned int) cod_info->width[sfb];
+        unsigned int const m = (unsigned int) (max_nonzero_coeff - j + 1);
+        unsigned int l = w;
+        unsigned int remaining;
+
+        assert((cod_info->global_gain - s) >= 0);
+        assert(cod_info->width[sfb] >= 0);
+
+        if (l > m) {
+            l = m;
+        }
+        j += w;
+        ++sfb;
+        l >>= 1;
+        remaining = (l & 1);
+
+        for (l >>= 1; l > 0; --l) {
+            x[0] = sfpow34 * xr34_orig[0];
+            x[1] = sfpow34 * xr34_orig[1];
+            x[2] = sfpow34 * xr34_orig[2];
+            x[3] = sfpow34 * xr34_orig[3];
+
+            k_34_4(x, l3);
+
+            l3 += 4;
+            xr34_orig += 4;
+        }
+        if (remaining) {
+            x[0] = sfpow34 * xr34_orig[0];
+            x[1] = sfpow34 * xr34_orig[1];
+
+            k_34_2(x, l3);
+
+            l3 += 2;
+            xr34_orig += 2;
+        }
+    }
+}
+
+
+
+static const uint8_t max_range_short[SBMAX_s * 3] = {
+    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+    0, 0, 0
+};
+
+static const uint8_t max_range_long[SBMAX_l] = {
+    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0
+};
+
+static const uint8_t max_range_long_lsf_pretab[SBMAX_l] = {
+    7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+
+
+/*
+    sfb=0..5  scalefac < 16
+    sfb>5     scalefac < 8
+
+    ifqstep = ( cod_info->scalefac_scale == 0 ) ? 2 : 4;
+    ol_sf =  (cod_info->global_gain-210.0);
+    ol_sf -= 8*cod_info->subblock_gain[i];
+    ol_sf -= ifqstep*scalefac[gr][ch].s[sfb][i];
+*/
+
+static void
+set_subblock_gain(gr_info * cod_info, const int mingain_s[3], int sf[])
+{
+    const int maxrange1 = 15, maxrange2 = 7;
+    const int ifqstepShift = (cod_info->scalefac_scale == 0) ? 1 : 2;
+    int    *const sbg = cod_info->subblock_gain;
+    unsigned int const psymax = (unsigned int) cod_info->psymax;
+    unsigned int psydiv = 18;
+    int     sbg0, sbg1, sbg2;
+    unsigned int sfb, i;
+    int     min_sbg = 7;
+
+    if (psydiv > psymax) {
+        psydiv = psymax;
+    }
+    for (i = 0; i < 3; ++i) {
+        int     maxsf1 = 0, maxsf2 = 0, minsf = 1000;
+        /* see if we should use subblock gain */
+        for (sfb = i; sfb < psydiv; sfb += 3) { /* part 1 */
+            int const v = -sf[sfb];
+            if (maxsf1 < v) {
+                maxsf1 = v;
+            }
+            if (minsf > v) {
+                minsf = v;
+            }
+        }
+        for (; sfb < SFBMAX; sfb += 3) { /* part 2 */
+            int const v = -sf[sfb];
+            if (maxsf2 < v) {
+                maxsf2 = v;
+            }
+            if (minsf > v) {
+                minsf = v;
+            }
+        }
+
+        /* boost subblock gain as little as possible so we can
+         * reach maxsf1 with scalefactors
+         * 8*sbg >= maxsf1
+         */
+        {
+            int const m1 = maxsf1 - (maxrange1 << ifqstepShift);
+            int const m2 = maxsf2 - (maxrange2 << ifqstepShift);
+
+            maxsf1 = Max(m1, m2);
+        }
+        if (minsf > 0) {
+            sbg[i] = minsf >> 3;
+        }
+        else {
+            sbg[i] = 0;
+        }
+        if (maxsf1 > 0) {
+            int const m1 = sbg[i];
+            int const m2 = (maxsf1 + 7) >> 3;
+            sbg[i] = Max(m1, m2);
+        }
+        if (sbg[i] > 0 && mingain_s[i] > (cod_info->global_gain - sbg[i] * 8)) {
+            sbg[i] = (cod_info->global_gain - mingain_s[i]) >> 3;
+        }
+        if (sbg[i] > 7) {
+            sbg[i] = 7;
+        }
+        if (min_sbg > sbg[i]) {
+            min_sbg = sbg[i];
+        }
+    }
+    sbg0 = sbg[0] * 8;
+    sbg1 = sbg[1] * 8;
+    sbg2 = sbg[2] * 8;
+    for (sfb = 0; sfb < SFBMAX; sfb += 3) {
+        sf[sfb + 0] += sbg0;
+        sf[sfb + 1] += sbg1;
+        sf[sfb + 2] += sbg2;
+    }
+    if (min_sbg > 0) {
+        for (i = 0; i < 3; ++i) {
+            sbg[i] -= min_sbg;
+        }
+        cod_info->global_gain -= min_sbg * 8;
+    }
+}
+
+
+
+/*
+	  ifqstep = ( cod_info->scalefac_scale == 0 ) ? 2 : 4;
+	  ol_sf =  (cod_info->global_gain-210.0);
+	  ol_sf -= ifqstep*scalefac[gr][ch].l[sfb];
+	  if (cod_info->preflag && sfb>=11)
+	  ol_sf -= ifqstep*pretab[sfb];
+*/
+static void
+set_scalefacs(gr_info * cod_info, const int *vbrsfmin, int sf[], const uint8_t * max_range)
+{
+    const int ifqstep = (cod_info->scalefac_scale == 0) ? 2 : 4;
+    const int ifqstepShift = (cod_info->scalefac_scale == 0) ? 1 : 2;
+    int    *const scalefac = cod_info->scalefac;
+    int const sfbmax = cod_info->sfbmax;
+    int     sfb;
+    int const *const sbg = cod_info->subblock_gain;
+    int const *const window = cod_info->window;
+    int const preflag = cod_info->preflag;
+
+    if (preflag) {
+        for (sfb = 11; sfb < sfbmax; ++sfb) {
+            sf[sfb] += pretab[sfb] * ifqstep;
+        }
+    }
+    for (sfb = 0; sfb < sfbmax; ++sfb) {
+        int const gain = cod_info->global_gain - (sbg[window[sfb]] * 8)
+            - ((preflag ? pretab[sfb] : 0) * ifqstep);
+
+        if (sf[sfb] < 0) {
+            int const m = gain - vbrsfmin[sfb];
+            /* ifqstep*scalefac >= -sf[sfb], so round UP */
+            scalefac[sfb] = (ifqstep - 1 - sf[sfb]) >> ifqstepShift;
+
+            if (scalefac[sfb] > max_range[sfb]) {
+                scalefac[sfb] = max_range[sfb];
+            }
+            if (scalefac[sfb] > 0 && (scalefac[sfb] << ifqstepShift) > m) {
+                scalefac[sfb] = m >> ifqstepShift;
+            }
+        }
+        else {
+            scalefac[sfb] = 0;
+        }
+    }
+    for (; sfb < SFBMAX; ++sfb) {
+        scalefac[sfb] = 0; /* sfb21 */
+    }
+}
+
+
+#ifndef NDEBUG
+static int
+checkScalefactor(const gr_info * cod_info, const int vbrsfmin[SFBMAX])
+{
+    int const ifqstep = cod_info->scalefac_scale == 0 ? 2 : 4;
+    int     sfb;
+    for (sfb = 0; sfb < cod_info->psymax; ++sfb) {
+        const int s =
+            ((cod_info->scalefac[sfb] +
+              (cod_info->preflag ? pretab[sfb] : 0)) * ifqstep) +
+            cod_info->subblock_gain[cod_info->window[sfb]] * 8;
+
+        if ((cod_info->global_gain - s) < vbrsfmin[sfb]) {
+            /*
+               fprintf( stdout, "sf %d\n", sfb );
+               fprintf( stdout, "min %d\n", vbrsfmin[sfb] );
+               fprintf( stdout, "ggain %d\n", cod_info->global_gain );
+               fprintf( stdout, "scalefac %d\n", cod_info->scalefac[sfb] );
+               fprintf( stdout, "pretab %d\n", (cod_info->preflag ? pretab[sfb] : 0) );
+               fprintf( stdout, "scale %d\n", (cod_info->scalefac_scale + 1) );
+               fprintf( stdout, "subgain %d\n", cod_info->subblock_gain[cod_info->window[sfb]] * 8 );
+               fflush( stdout );
+               exit(-1);
+             */
+            return 0;
+        }
+    }
+    return 1;
+}
+#endif
+
+
+/******************************************************************
+ *
+ *  short block scalefacs
+ *
+ ******************************************************************/
+
+static void
+short_block_constrain(const algo_t * that, const int vbrsf[SFBMAX],
+                      const int vbrsfmin[SFBMAX], int vbrmax)
+{
+    gr_info *const cod_info = that->cod_info;
+    lame_internal_flags const *const gfc = that->gfc;
+    int const maxminsfb = that->mingain_l;
+    int     mover, maxover0 = 0, maxover1 = 0, delta = 0;
+    int     v, v0, v1;
+    int     sfb;
+    int const psymax = cod_info->psymax;
+
+    for (sfb = 0; sfb < psymax; ++sfb) {
+        assert(vbrsf[sfb] >= vbrsfmin[sfb]);
+        v = vbrmax - vbrsf[sfb];
+        if (delta < v) {
+            delta = v;
+        }
+        v0 = v - (4 * 14 + 2 * max_range_short[sfb]);
+        v1 = v - (4 * 14 + 4 * max_range_short[sfb]);
+        if (maxover0 < v0) {
+            maxover0 = v0;
+        }
+        if (maxover1 < v1) {
+            maxover1 = v1;
+        }
+    }
+    if (gfc->noise_shaping == 2) {
+        /* allow scalefac_scale=1 */
+        mover = Min(maxover0, maxover1);
+    }
+    else {
+        mover = maxover0;
+    }
+    if (delta > mover) {
+        delta = mover;
+    }
+    vbrmax -= delta;
+    maxover0 -= mover;
+    maxover1 -= mover;
+
+    if (maxover0 == 0) {
+        cod_info->scalefac_scale = 0;
+    }
+    else if (maxover1 == 0) {
+        cod_info->scalefac_scale = 1;
+    }
+    if (vbrmax < maxminsfb) {
+        vbrmax = maxminsfb;
+    }
+    cod_info->global_gain = vbrmax;
+
+    if (cod_info->global_gain < 0) {
+        cod_info->global_gain = 0;
+    }
+    else if (cod_info->global_gain > 255) {
+        cod_info->global_gain = 255;
+    }
+    {
+        int     sf_temp[SFBMAX];
+        for (sfb = 0; sfb < SFBMAX; ++sfb) {
+            sf_temp[sfb] = vbrsf[sfb] - vbrmax;
+        }
+        set_subblock_gain(cod_info, &that->mingain_s[0], sf_temp);
+        set_scalefacs(cod_info, vbrsfmin, sf_temp, max_range_short);
+    }
+    assert(checkScalefactor(cod_info, vbrsfmin));
+}
+
+
+
+/******************************************************************
+ *
+ *  long block scalefacs
+ *
+ ******************************************************************/
+
+static void
+long_block_constrain(const algo_t * that, const int vbrsf[SFBMAX], const int vbrsfmin[SFBMAX],
+                     int vbrmax)
+{
+    gr_info *const cod_info = that->cod_info;
+    lame_internal_flags const *const gfc = that->gfc;
+    uint8_t const *max_rangep;
+    int const maxminsfb = that->mingain_l;
+    int     sfb;
+    int     maxover0, maxover1, maxover0p, maxover1p, mover, delta = 0;
+    int     v, v0, v1, v0p, v1p, vm0p = 1, vm1p = 1;
+    int const psymax = cod_info->psymax;
+
+    max_rangep = gfc->mode_gr == 2 ? max_range_long : max_range_long_lsf_pretab;
+
+    maxover0 = 0;
+    maxover1 = 0;
+    maxover0p = 0;      /* pretab */
+    maxover1p = 0;      /* pretab */
+
+    for (sfb = 0; sfb < psymax; ++sfb) {
+        assert(vbrsf[sfb] >= vbrsfmin[sfb]);
+        v = vbrmax - vbrsf[sfb];
+        if (delta < v) {
+            delta = v;
+        }
+        v0 = v - 2 * max_range_long[sfb];
+        v1 = v - 4 * max_range_long[sfb];
+        v0p = v - 2 * (max_rangep[sfb] + pretab[sfb]);
+        v1p = v - 4 * (max_rangep[sfb] + pretab[sfb]);
+        if (maxover0 < v0) {
+            maxover0 = v0;
+        }
+        if (maxover1 < v1) {
+            maxover1 = v1;
+        }
+        if (maxover0p < v0p) {
+            maxover0p = v0p;
+        }
+        if (maxover1p < v1p) {
+            maxover1p = v1p;
+        }
+    }
+    if (vm0p == 1) {
+        int     gain = vbrmax - maxover0p;
+        if (gain < maxminsfb) {
+            gain = maxminsfb;
+        }
+        for (sfb = 0; sfb < psymax; ++sfb) {
+            int const a = (gain - vbrsfmin[sfb]) - 2 * pretab[sfb];
+            if (a <= 0) {
+                vm0p = 0;
+                vm1p = 0;
+                break;
+            }
+        }
+    }
+    if (vm1p == 1) {
+        int     gain = vbrmax - maxover1p;
+        if (gain < maxminsfb) {
+            gain = maxminsfb;
+        }
+        for (sfb = 0; sfb < psymax; ++sfb) {
+            int const b = (gain - vbrsfmin[sfb]) - 4 * pretab[sfb];
+            if (b <= 0) {
+                vm1p = 0;
+                break;
+            }
+        }
+    }
+    if (vm0p == 0) {
+        maxover0p = maxover0;
+    }
+    if (vm1p == 0) {
+        maxover1p = maxover1;
+    }
+    if (gfc->noise_shaping != 2) {
+        maxover1 = maxover0;
+        maxover1p = maxover0p;
+    }
+    mover = Min(maxover0, maxover0p);
+    mover = Min(mover, maxover1);
+    mover = Min(mover, maxover1p);
+
+    if (delta > mover) {
+        delta = mover;
+    }
+    vbrmax -= delta;
+    if (vbrmax < maxminsfb) {
+        vbrmax = maxminsfb;
+    }
+    maxover0 -= mover;
+    maxover0p -= mover;
+    maxover1 -= mover;
+    maxover1p -= mover;
+
+    if (maxover0 == 0) {
+        cod_info->scalefac_scale = 0;
+        cod_info->preflag = 0;
+        max_rangep = max_range_long;
+    }
+    else if (maxover0p == 0) {
+        cod_info->scalefac_scale = 0;
+        cod_info->preflag = 1;
+    }
+    else if (maxover1 == 0) {
+        cod_info->scalefac_scale = 1;
+        cod_info->preflag = 0;
+        max_rangep = max_range_long;
+    }
+    else if (maxover1p == 0) {
+        cod_info->scalefac_scale = 1;
+        cod_info->preflag = 1;
+    }
+    else {
+        assert(0);      /* this should not happen */
+    }
+    cod_info->global_gain = vbrmax;
+    if (cod_info->global_gain < 0) {
+        cod_info->global_gain = 0;
+    }
+    else if (cod_info->global_gain > 255) {
+        cod_info->global_gain = 255;
+    }
+    {
+        int     sf_temp[SFBMAX];
+        for (sfb = 0; sfb < SFBMAX; ++sfb) {
+            sf_temp[sfb] = vbrsf[sfb] - vbrmax;
+        }
+        set_scalefacs(cod_info, vbrsfmin, sf_temp, max_rangep);
+    }
+    assert(checkScalefactor(cod_info, vbrsfmin));
+}
+
+
+
+static void
+bitcount(const algo_t * that)
+{
+    int     rc;
+
+    if (that->gfc->mode_gr == 2) {
+        rc = scale_bitcount(that->cod_info);
+    }
+    else {
+        rc = scale_bitcount_lsf(that->gfc, that->cod_info);
+    }
+    if (rc == 0) {
+        return;
+    }
+    /*  this should not happen due to the way the scalefactors are selected  */
+    ERRORF(that->gfc, "INTERNAL ERROR IN VBR NEW CODE (986), please send bug report\n");
+    exit(-1);
+}
+
+
+
+static int
+quantizeAndCountBits(const algo_t * that)
+{
+    quantize_x34(that);
+    that->cod_info->part2_3_length = noquant_count_bits(that->gfc, that->cod_info, 0);
+    return that->cod_info->part2_3_length;
+}
+
+
+
+
+
+static int
+tryGlobalStepsize(const algo_t * that, const int sfwork[SFBMAX],
+                  const int vbrsfmin[SFBMAX], int delta)
+{
+    FLOAT const xrpow_max = that->cod_info->xrpow_max;
+    int     sftemp[SFBMAX], i, nbits;
+    int     gain, vbrmax = 0;
+    for (i = 0; i < SFBMAX; ++i) {
+        gain = sfwork[i] + delta;
+        if (gain < vbrsfmin[i]) {
+            gain = vbrsfmin[i];
+        }
+        if (gain > 255) {
+            gain = 255;
+        }
+        if (vbrmax < gain) {
+            vbrmax = gain;
+        }
+        sftemp[i] = gain;
+    }
+    that->alloc(that, sftemp, vbrsfmin, vbrmax);
+    bitcount(that);
+    nbits = quantizeAndCountBits(that);
+    that->cod_info->xrpow_max = xrpow_max;
+    return nbits;
+}
+
+
+
+static void
+searchGlobalStepsizeMax(const algo_t * that, const int sfwork[SFBMAX],
+                        const int vbrsfmin[SFBMAX], int target)
+{
+    gr_info const *const cod_info = that->cod_info;
+    const int gain = cod_info->global_gain;
+    int     curr = gain;
+    int     gain_ok = 1024;
+    int     nbits = LARGE_BITS;
+    int     l = gain, r = 512;
+
+    assert(gain >= 0);
+    while (l <= r) {
+        curr = (l + r) >> 1;
+        nbits = tryGlobalStepsize(that, sfwork, vbrsfmin, curr - gain);
+        if (nbits == 0 || (nbits + cod_info->part2_length) < target) {
+            r = curr - 1;
+            gain_ok = curr;
+        }
+        else {
+            l = curr + 1;
+            if (gain_ok == 1024) {
+                gain_ok = curr;
+            }
+        }
+    }
+    if (gain_ok != curr) {
+        curr = gain_ok;
+        nbits = tryGlobalStepsize(that, sfwork, vbrsfmin, curr - gain);
+    }
+}
+
+
+
+static int
+sfDepth(const int sfwork[SFBMAX])
+{
+    int     m = 0;
+    unsigned int i, j;
+    for (j = SFBMAX, i = 0; j > 0; --j, ++i) {
+        int const di = 255 - sfwork[i];
+        if (m < di) {
+            m = di;
+        }
+        assert(sfwork[i] >= 0);
+        assert(sfwork[i] <= 255);
+    }
+    assert(m >= 0);
+    assert(m <= 255);
+    return m;
+}
+
+
+static void
+cutDistribution(const int sfwork[SFBMAX], int sf_out[SFBMAX], int cut)
+{
+    unsigned int i, j;
+    for (j = SFBMAX, i = 0; j > 0; --j, ++i) {
+        int const x = sfwork[i];
+        sf_out[i] = x < cut ? x : cut;
+    }
+}
+
+
+static int
+flattenDistribution(const int sfwork[SFBMAX], int sf_out[SFBMAX], int dm, int k, int p)
+{
+    unsigned int i, j;
+    int     x, sfmax = 0;
+    if (dm > 0) {
+        for (j = SFBMAX, i = 0; j > 0; --j, ++i) {
+            int const di = p - sfwork[i];
+            x = sfwork[i] + (k * di) / dm;
+            if (x < 0) {
+                x = 0;
+            }
+            else {
+                if (x > 255) {
+                    x = 255;
+                }
+            }
+            sf_out[i] = x;
+            if (sfmax < x) {
+                sfmax = x;
+            }
+        }
+    }
+    else {
+        for (j = SFBMAX, i = 0; j > 0; --j, ++i) {
+            x = sfwork[i];
+            sf_out[i] = x;
+            if (sfmax < x) {
+                sfmax = x;
+            }
+        }
+    }
+    return sfmax;
+}
+
+
+static int
+tryThatOne(algo_t * that, int sftemp[SFBMAX], const int vbrsfmin[SFBMAX], int vbrmax)
+{
+    FLOAT const xrpow_max = that->cod_info->xrpow_max;
+    int     nbits = LARGE_BITS;
+    that->alloc(that, sftemp, vbrsfmin, vbrmax);
+    bitcount(that);
+    nbits = quantizeAndCountBits(that);
+    nbits += that->cod_info->part2_length;
+    that->cod_info->xrpow_max = xrpow_max;
+    return nbits;
+}
+
+
+static void
+outOfBitsStrategy(algo_t * that, const int sfwork[SFBMAX], const int vbrsfmin[SFBMAX], int target)
+{
+    int     wrk[SFBMAX];
+    int const dm = sfDepth(sfwork);
+    int const p = that->cod_info->global_gain;
+    int     nbits;
+
+    /* PART 1 */
+    {
+        int     bi = dm / 2;
+        int     bi_ok = -1;
+        int     bu = 0;
+        int     bo = dm;
+        for (;;) {
+            int const sfmax = flattenDistribution(sfwork, wrk, dm, bi, p);
+            nbits = tryThatOne(that, wrk, vbrsfmin, sfmax);
+            if (nbits <= target) {
+                bi_ok = bi;
+                bo = bi - 1;
+            }
+            else {
+                bu = bi + 1;
+            }
+            if (bu <= bo) {
+                bi = (bu + bo) / 2;
+            }
+            else {
+                break;
+            }
+        }
+        if (bi_ok >= 0) {
+            if (bi != bi_ok) {
+                int const sfmax = flattenDistribution(sfwork, wrk, dm, bi_ok, p);
+                nbits = tryThatOne(that, wrk, vbrsfmin, sfmax);
+            }
+            return;
+        }
+    }
+
+    /* PART 2: */
+    {
+        int     bi = (255 + p) / 2;
+        int     bi_ok = -1;
+        int     bu = p;
+        int     bo = 255;
+        for (;;) {
+            int const sfmax = flattenDistribution(sfwork, wrk, dm, dm, bi);
+            nbits = tryThatOne(that, wrk, vbrsfmin, sfmax);
+            if (nbits <= target) {
+                bi_ok = bi;
+                bo = bi - 1;
+            }
+            else {
+                bu = bi + 1;
+            }
+            if (bu <= bo) {
+                bi = (bu + bo) / 2;
+            }
+            else {
+                break;
+            }
+        }
+        if (bi_ok >= 0) {
+            if (bi != bi_ok) {
+                int const sfmax = flattenDistribution(sfwork, wrk, dm, dm, bi_ok);
+                nbits = tryThatOne(that, wrk, vbrsfmin, sfmax);
+            }
+            return;
+        }
+    }
+
+    /* fall back to old code, likely to be never called */
+    searchGlobalStepsizeMax(that, wrk, vbrsfmin, target);
+}
+
+
+static int
+reduce_bit_usage(lame_internal_flags * gfc, int gr, int ch
+#if 0
+                 , const FLOAT xr34orig[576], const FLOAT l3_xmin[SFBMAX], int maxbits
+#endif
+    )
+{
+    gr_info *const cod_info = &gfc->l3_side.tt[gr][ch];
+    /*  try some better scalefac storage
+     */
+    best_scalefac_store(gfc, gr, ch, &gfc->l3_side);
+
+    /*  best huffman_divide may save some bits too
+     */
+    if (gfc->use_best_huffman == 1)
+        best_huffman_divide(gfc, cod_info);
+#if 0
+    /* truncate small spectrum seems to introduce pops, disabled(RH 050918) */
+    if (gfc->substep_shaping & 1) {
+        trancate_smallspectrums(gfc, cod_info, l3_xmin, xr34orig);
+    }
+    else if (cod_info->part2_3_length > maxbits - cod_info->part2_length) {
+        trancate_smallspectrums(gfc, cod_info, l3_xmin, xr34orig);
+    }
+#endif
+    return cod_info->part2_3_length + cod_info->part2_length;
+}
+
+
+
+
+int
+VBR_encode_frame(lame_internal_flags * gfc, FLOAT xr34orig[2][2][576],
+                 FLOAT l3_xmin[2][2][SFBMAX], int max_bits[2][2])
+{
+    int     sfwork_[2][2][SFBMAX];
+    int     vbrsfmin_[2][2][SFBMAX];
+    algo_t  that_[2][2];
+    int const ngr = gfc->mode_gr;
+    int const nch = gfc->channels_out;
+    int     max_nbits_ch[2][2];
+    int     max_nbits_gr[2];
+    int     max_nbits_fr = 0;
+    int     use_nbits_ch[2][2];
+    int     use_nbits_gr[2];
+    int     use_nbits_fr = 0;
+    int     gr, ch;
+    int     ok, sum_fr;
+
+    /* set up some encoding parameters
+     */
+    for (gr = 0; gr < ngr; ++gr) {
+        max_nbits_gr[gr] = 0;
+        for (ch = 0; ch < nch; ++ch) {
+            max_nbits_ch[gr][ch] = max_bits[gr][ch];
+            use_nbits_ch[gr][ch] = 0;
+            max_nbits_gr[gr] += max_bits[gr][ch];
+            max_nbits_fr += max_bits[gr][ch];
+            that_[gr][ch].gfc = gfc;
+            that_[gr][ch].cod_info = &gfc->l3_side.tt[gr][ch];
+            that_[gr][ch].xr34orig = xr34orig[gr][ch];
+            if (that_[gr][ch].cod_info->block_type == SHORT_TYPE) {
+                that_[gr][ch].alloc = short_block_constrain;
+            }
+            else {
+                that_[gr][ch].alloc = long_block_constrain;
+            }
+        }               /* for ch */
+    }
+
+    /* searches scalefactors
+     */
+    for (gr = 0; gr < ngr; ++gr) {
+        for (ch = 0; ch < nch; ++ch) {
+            if (max_bits[gr][ch] > 0) {
+                algo_t *that = &that_[gr][ch];
+                int    *sfwork = sfwork_[gr][ch];
+                int    *vbrsfmin = vbrsfmin_[gr][ch];
+                int     vbrmax;
+
+                vbrmax = block_sf(that, l3_xmin[gr][ch], sfwork, vbrsfmin);
+                that->alloc(that, sfwork, vbrsfmin, vbrmax);
+                bitcount(that);
+            }
+            else {
+                /*  xr contains no energy 
+                 *  l3_enc, our encoding data, will be quantized to zero
+                 *  continue with next channel
+                 */
+            }
+        }               /* for ch */
+    }
+
+    /* encode 'as is'
+     */
+    use_nbits_fr = 0;
+    for (gr = 0; gr < ngr; ++gr) {
+        use_nbits_gr[gr] = 0;
+        for (ch = 0; ch < nch; ++ch) {
+            algo_t *that = &that_[gr][ch];
+            if (max_bits[gr][ch] > 0) {
+                unsigned int const max_nonzero_coeff =
+                    (unsigned int) that->cod_info->max_nonzero_coeff;
+
+                assert(max_nonzero_coeff < 576);
+                memset(&that->cod_info->l3_enc[max_nonzero_coeff], 0,
+                       (576u - max_nonzero_coeff) * sizeof(that->cod_info->l3_enc[0]));
+
+                (void) quantizeAndCountBits(that);
+            }
+            else {
+                /*  xr contains no energy 
+                 *  l3_enc, our encoding data, will be quantized to zero
+                 *  continue with next channel
+                 */
+            }
+            use_nbits_ch[gr][ch] = reduce_bit_usage(gfc, gr, ch);
+            use_nbits_gr[gr] += use_nbits_ch[gr][ch];
+        }               /* for ch */
+        use_nbits_fr += use_nbits_gr[gr];
+    }
+
+    /* check bit constrains
+     */
+    if (use_nbits_fr <= max_nbits_fr) {
+        ok = 1;
+        for (gr = 0; gr < ngr; ++gr) {
+            if (use_nbits_gr[gr] > MAX_BITS_PER_GRANULE) {
+                /* violates the rule that every granule has to use no more
+                 * bits than MAX_BITS_PER_GRANULE
+                 */
+                ok = 0;
+            }
+            for (ch = 0; ch < nch; ++ch) {
+                if (use_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) {
+                    /* violates the rule that every gr_ch has to use no more
+                     * bits than MAX_BITS_PER_CHANNEL
+                     *
+                     * This isn't explicitly stated in the ISO docs, but the
+                     * part2_3_length field has only 12 bits, that makes it
+                     * up to a maximum size of 4095 bits!!!
+                     */
+                    ok = 0;
+                }
+            }
+        }
+        if (ok) {
+            return use_nbits_fr;
+        }
+    }
+
+    /* OK, we are in trouble and have to define how many bits are
+     * to be used for each granule
+     */
+    {
+        ok = 1;
+        sum_fr = 0;
+
+        for (gr = 0; gr < ngr; ++gr) {
+            max_nbits_gr[gr] = 0;
+            for (ch = 0; ch < nch; ++ch) {
+                if (use_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) {
+                    max_nbits_ch[gr][ch] = MAX_BITS_PER_CHANNEL;
+                }
+                else {
+                    max_nbits_ch[gr][ch] = use_nbits_ch[gr][ch];
+                }
+                max_nbits_gr[gr] += max_nbits_ch[gr][ch];
+            }
+            if (max_nbits_gr[gr] > MAX_BITS_PER_GRANULE) {
+                float   f[2], s = 0;
+                for (ch = 0; ch < nch; ++ch) {
+                    if (max_nbits_ch[gr][ch] > 0) {
+                        f[ch] = sqrt(sqrt(max_nbits_ch[gr][ch]));
+                        s += f[ch];
+                    }
+                    else {
+                        f[ch] = 0;
+                    }
+                }
+                for (ch = 0; ch < nch; ++ch) {
+                    if (s > 0) {
+                        max_nbits_ch[gr][ch] = MAX_BITS_PER_GRANULE * f[ch] / s;
+                    }
+                    else {
+                        max_nbits_ch[gr][ch] = 0;
+                    }
+                }
+                if (nch > 1) {
+                    if (max_nbits_ch[gr][0] > use_nbits_ch[gr][0] + 32) {
+                        max_nbits_ch[gr][1] += max_nbits_ch[gr][0];
+                        max_nbits_ch[gr][1] -= use_nbits_ch[gr][0] + 32;
+                        max_nbits_ch[gr][0] = use_nbits_ch[gr][0] + 32;
+                    }
+                    if (max_nbits_ch[gr][1] > use_nbits_ch[gr][1] + 32) {
+                        max_nbits_ch[gr][0] += max_nbits_ch[gr][1];
+                        max_nbits_ch[gr][0] -= use_nbits_ch[gr][1] + 32;
+                        max_nbits_ch[gr][1] = use_nbits_ch[gr][1] + 32;
+                    }
+                    if (max_nbits_ch[gr][0] > MAX_BITS_PER_CHANNEL) {
+                        max_nbits_ch[gr][0] = MAX_BITS_PER_CHANNEL;
+                    }
+                    if (max_nbits_ch[gr][1] > MAX_BITS_PER_CHANNEL) {
+                        max_nbits_ch[gr][1] = MAX_BITS_PER_CHANNEL;
+                    }
+                }
+                max_nbits_gr[gr] = 0;
+                for (ch = 0; ch < nch; ++ch) {
+                    max_nbits_gr[gr] += max_nbits_ch[gr][ch];
+                }
+            }
+            sum_fr += max_nbits_gr[gr];
+        }
+        if (sum_fr > max_nbits_fr) {
+            {
+                float   f[2], s = 0;
+                for (gr = 0; gr < ngr; ++gr) {
+                    if (max_nbits_gr[gr] > 0) {
+                        f[gr] = sqrt(max_nbits_gr[gr]);
+                        s += f[gr];
+                    }
+                    else {
+                        f[gr] = 0;
+                    }
+                }
+                for (gr = 0; gr < ngr; ++gr) {
+                    if (s > 0) {
+                        max_nbits_gr[gr] = max_nbits_fr * f[gr] / s;
+                    }
+                    else {
+                        max_nbits_gr[gr] = 0;
+                    }
+                }
+            }
+            if (ngr > 1) {
+                if (max_nbits_gr[0] > use_nbits_gr[0] + 125) {
+                    max_nbits_gr[1] += max_nbits_gr[0];
+                    max_nbits_gr[1] -= use_nbits_gr[0] + 125;
+                    max_nbits_gr[0] = use_nbits_gr[0] + 125;
+                }
+                if (max_nbits_gr[1] > use_nbits_gr[1] + 125) {
+                    max_nbits_gr[0] += max_nbits_gr[1];
+                    max_nbits_gr[0] -= use_nbits_gr[1] + 125;
+                    max_nbits_gr[1] = use_nbits_gr[1] + 125;
+                }
+                for (gr = 0; gr < ngr; ++gr) {
+                    if (max_nbits_gr[gr] > MAX_BITS_PER_GRANULE) {
+                        max_nbits_gr[gr] = MAX_BITS_PER_GRANULE;
+                    }
+                }
+            }
+            for (gr = 0; gr < ngr; ++gr) {
+                float   f[2], s = 0;
+                for (ch = 0; ch < nch; ++ch) {
+                    if (max_nbits_ch[gr][ch] > 0) {
+                        f[ch] = sqrt(max_nbits_ch[gr][ch]);
+                        s += f[ch];
+                    }
+                    else {
+                        f[ch] = 0;
+                    }
+                }
+                for (ch = 0; ch < nch; ++ch) {
+                    if (s > 0) {
+                        max_nbits_ch[gr][ch] = max_nbits_gr[gr] * f[ch] / s;
+                    }
+                    else {
+                        max_nbits_ch[gr][ch] = 0;
+                    }
+                }
+                if (nch > 1) {
+                    if (max_nbits_ch[gr][0] > use_nbits_ch[gr][0] + 32) {
+                        max_nbits_ch[gr][1] += max_nbits_ch[gr][0];
+                        max_nbits_ch[gr][1] -= use_nbits_ch[gr][0] + 32;
+                        max_nbits_ch[gr][0] = use_nbits_ch[gr][0] + 32;
+                    }
+                    if (max_nbits_ch[gr][1] > use_nbits_ch[gr][1] + 32) {
+                        max_nbits_ch[gr][0] += max_nbits_ch[gr][1];
+                        max_nbits_ch[gr][0] -= use_nbits_ch[gr][1] + 32;
+                        max_nbits_ch[gr][1] = use_nbits_ch[gr][1] + 32;
+                    }
+                    for (ch = 0; ch < nch; ++ch) {
+                        if (max_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) {
+                            max_nbits_ch[gr][ch] = MAX_BITS_PER_CHANNEL;
+                        }
+                    }
+                }
+            }
+        }
+        /* sanity check */
+        sum_fr = 0;
+        for (gr = 0; gr < ngr; ++gr) {
+            int     sum_gr = 0;
+            for (ch = 0; ch < nch; ++ch) {
+                sum_gr += max_nbits_ch[gr][ch];
+                if (max_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) {
+                    ok = 0;
+                }
+            }
+            sum_fr += sum_gr;
+            if (sum_gr > MAX_BITS_PER_GRANULE) {
+                ok = 0;
+            }
+        }
+        if (sum_fr > max_nbits_fr) {
+            ok = 0;
+        }
+        if (!ok) {
+            /* we must have done something wrong, fallback to 'on_pe' based constrain */
+            for (gr = 0; gr < ngr; ++gr) {
+                for (ch = 0; ch < nch; ++ch) {
+                    max_nbits_ch[gr][ch] = max_bits[gr][ch];
+                }
+            }
+        }
+    }
+
+    /* we already called the 'best_scalefac_store' function, so we need to reset some
+     * variables before we can do it again.
+     */
+    for (ch = 0; ch < nch; ++ch) {
+        gfc->l3_side.scfsi[ch][0] = 0;
+        gfc->l3_side.scfsi[ch][1] = 0;
+        gfc->l3_side.scfsi[ch][2] = 0;
+        gfc->l3_side.scfsi[ch][3] = 0;
+    }
+    for (gr = 0; gr < ngr; ++gr) {
+        for (ch = 0; ch < nch; ++ch) {
+            gfc->l3_side.tt[gr][ch].scalefac_compress = 0;
+        }
+    }
+
+    /* alter our encoded data, until it fits into the target bitrate
+     */
+    use_nbits_fr = 0;
+    for (gr = 0; gr < ngr; ++gr) {
+        use_nbits_gr[gr] = 0;
+        for (ch = 0; ch < nch; ++ch) {
+            algo_t *that = &that_[gr][ch];
+            use_nbits_ch[gr][ch] = 0;
+            if (max_bits[gr][ch] > 0) {
+                int    *sfwork = sfwork_[gr][ch];
+                int    *vbrsfmin = vbrsfmin_[gr][ch];
+                cutDistribution(sfwork, sfwork, that->cod_info->global_gain);
+                outOfBitsStrategy(that, sfwork, vbrsfmin, max_nbits_ch[gr][ch]);
+            }
+            use_nbits_ch[gr][ch] = reduce_bit_usage(gfc, gr, ch);
+            assert(use_nbits_ch[gr][ch] <= max_nbits_ch[gr][ch]);
+            use_nbits_gr[gr] += use_nbits_ch[gr][ch];
+        }               /* for ch */
+        use_nbits_fr += use_nbits_gr[gr];
+    }
+
+    /* check bit constrains, but it should always be ok, iff there are no bugs ;-)
+     */
+    if (use_nbits_fr <= max_nbits_fr) {
+        return use_nbits_fr;
+    }
+
+    ERRORF(gfc, "INTERNAL ERROR IN VBR NEW CODE (1313), please send bug report\n"
+           "maxbits=%d usedbits=%d\n", max_nbits_fr, use_nbits_fr);
+    exit(-1);
+}
diff --git a/libmp3lame/vbrquantize.h b/libmp3lame/vbrquantize.h
new file mode 100644
index 0000000..938ee64
--- /dev/null
+++ b/libmp3lame/vbrquantize.h
@@ -0,0 +1,28 @@
+/*
+ * MP3 VBR quantization
+ *
+ * Copyright (c) 1999 Mark Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_VBRQUANTIZE_H
+#define LAME_VBRQUANTIZE_H
+
+int     VBR_encode_frame(lame_internal_flags * gfc, FLOAT xr34orig[2][2][576],
+                         FLOAT l3_xmin[2][2][SFBMAX], int maxbits[2][2]);
+
+#endif /* LAME_VBRQUANTIZE_H */
diff --git a/libmp3lame/vector/Makefile.am b/libmp3lame/vector/Makefile.am
new file mode 100644
index 0000000..ac595b1
--- /dev/null
+++ b/libmp3lame/vector/Makefile.am
@@ -0,0 +1,49 @@
+## $Id: Makefile.am,v 1.1 2007/01/09 10:15:53 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+if WITH_XMM
+noinst_LTLIBRARIES = liblamevectorroutines.la
+endif
+
+##liblamecpuroutines_la_LIBADD = 
+##liblamecpuroutines_la_LDFLAGS =
+
+INCLUDES = @INCLUDES@ \
+	-I$(top_srcdir)/libmp3lame \
+	-I$(top_srcdir)/mpglib \
+	-I$(top_builddir)
+
+DEFS = @DEFS@ @CONFIG_DEFS@
+
+xmm_sources = xmm_quantize_sub.c
+
+if WITH_XMM
+liblamevectorroutines_la_SOURCES = $(xmm_sources)
+endif
+
+noinst_HEADERS = lame_intrin.h
+
+EXTRA_liblamevectorroutines_la_SOURCES = $(xmm_sources)
+
+CLEANFILES = lclint.txt
+
+LCLINTFLAGS= \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+lclint.txt: ${liblamecpuroutines_la_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${liblamecpuroutines_la_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
diff --git a/libmp3lame/vector/Makefile.in b/libmp3lame/vector/Makefile.in
new file mode 100644
index 0000000..f8505ca
--- /dev/null
+++ b/libmp3lame/vector/Makefile.in
@@ -0,0 +1,513 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ANSI2KNR = $(top_srcdir)/ansi2knr
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/Makefile.am.global
+subdir = libmp3lame/vector
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+liblamevectorroutines_la_LIBADD =
+am__liblamevectorroutines_la_SOURCES_DIST = xmm_quantize_sub.c
+am__objects_1 = xmm_quantize_sub$U.lo
+@WITH_XMM_TRUE@am_liblamevectorroutines_la_OBJECTS = $(am__objects_1)
+liblamevectorroutines_la_OBJECTS =  \
+	$(am_liblamevectorroutines_la_OBJECTS)
+@WITH_XMM_TRUE@am_liblamevectorroutines_la_rpath =
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(liblamevectorroutines_la_SOURCES) \
+	$(EXTRA_liblamevectorroutines_la_SOURCES)
+DIST_SOURCES = $(am__liblamevectorroutines_la_SOURCES_DIST) \
+	$(EXTRA_liblamevectorroutines_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@ @CONFIG_DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@ \
+	-I$(top_srcdir)/libmp3lame \
+	-I$(top_srcdir)/mpglib \
+	-I$(top_builddir)
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+@WITH_XMM_TRUE@noinst_LTLIBRARIES = liblamevectorroutines.la
+xmm_sources = xmm_quantize_sub.c
+@WITH_XMM_TRUE@liblamevectorroutines_la_SOURCES = $(xmm_sources)
+noinst_HEADERS = lame_intrin.h
+EXTRA_liblamevectorroutines_la_SOURCES = $(xmm_sources)
+CLEANFILES = lclint.txt
+LCLINTFLAGS = \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  libmp3lame/vector/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  libmp3lame/vector/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+liblamevectorroutines.la: $(liblamevectorroutines_la_OBJECTS) $(liblamevectorroutines_la_DEPENDENCIES) 
+	$(LINK) $(am_liblamevectorroutines_la_rpath) $(liblamevectorroutines_la_OBJECTS) $(liblamevectorroutines_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+$(top_srcdir)/ansi2knr:
+	cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
+
+mostlyclean-kr:
+	-test "$U" = "" || rm -f *_.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmm_quantize_sub$U.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+xmm_quantize_sub_.c: xmm_quantize_sub.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xmm_quantize_sub.c; then echo $(srcdir)/xmm_quantize_sub.c; else echo xmm_quantize_sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+xmm_quantize_sub_.$(OBJEXT) xmm_quantize_sub_.lo : $(ANSI2KNR)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am
+
+
+# end global section
+
+lclint.txt: ${liblamecpuroutines_la_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${liblamecpuroutines_la_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libmp3lame/vector/lame_intrin.h b/libmp3lame/vector/lame_intrin.h
new file mode 100644
index 0000000..4100a23
--- /dev/null
+++ b/libmp3lame/vector/lame_intrin.h
@@ -0,0 +1,32 @@
+/*
+ *      lame_intrin.h include file
+ *
+ *      Copyright (c) 2006 Gabriel Bouvigne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef LAME_INTRIN_H
+#define LAME_INTRIN_H
+
+
+void
+init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum);
+
+
+
+#endif
diff --git a/libmp3lame/vector/xmm_quantize_sub.c b/libmp3lame/vector/xmm_quantize_sub.c
new file mode 100644
index 0000000..74442c6
--- /dev/null
+++ b/libmp3lame/vector/xmm_quantize_sub.c
@@ -0,0 +1,98 @@
+/*
+ * MP3 quantization, intrinsics functions
+ *
+ *      Copyright (c) 2005-2006 Gabriel Bouvigne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "util.h"
+#include "lame_intrin.h"
+
+
+
+#ifdef HAVE_XMMINTRIN_H
+
+#include <xmmintrin.h>
+
+typedef union {
+    __m128  _m128;
+    float   _float[4];
+} vecfloat_union;
+
+
+
+void
+init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum)
+{
+    int     i;
+    FLOAT   tmp;
+    int     upper4 = (upper / 4) * 4;
+
+
+    const int fabs_mask[4] = { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF };
+    const __m128 vec_fabs_mask = _mm_loadu_ps((float const*) &fabs_mask[0]);
+    vecfloat_union vec_xrpow_max;
+    vecfloat_union vec_sum;
+
+    _mm_prefetch((char *) cod_info->xr, _MM_HINT_T0);
+    _mm_prefetch((char *) xrpow, _MM_HINT_T0);
+
+    vec_xrpow_max._m128 = _mm_set_ps1(0);
+    vec_sum._m128 = _mm_set_ps1(0);
+
+    for (i = 0; i < upper4; i += 4) {
+        __m128  vec_tmp;
+
+        vec_tmp = _mm_loadu_ps(&(cod_info->xr[i])); /* load */
+        vec_tmp = _mm_and_ps(vec_tmp, vec_fabs_mask); /* fabs */
+
+        vec_sum._m128 = _mm_add_ps(vec_sum._m128, vec_tmp);
+
+        vec_tmp = _mm_sqrt_ps(_mm_mul_ps(vec_tmp, _mm_sqrt_ps(vec_tmp)));
+
+        _mm_storeu_ps(&(xrpow[i]), vec_tmp); /* store into xrpow[] */
+
+        vec_xrpow_max._m128 = _mm_max_ps(vec_xrpow_max._m128, vec_tmp); /* retrieve max */
+    }
+
+    *sum = vec_sum._float[0] + vec_sum._float[1] + vec_sum._float[2] + vec_sum._float[3];
+    cod_info->xrpow_max = Max(vec_xrpow_max._float[0],
+                              Max(vec_xrpow_max._float[1],
+                                  Max(vec_xrpow_max._float[2], vec_xrpow_max._float[3])));
+
+
+
+    for (i = upper4; i <= upper; ++i) {
+        tmp = fabs(cod_info->xr[i]);
+        *sum += tmp;
+        xrpow[i] = sqrt(tmp * sqrt(tmp));
+
+        if (xrpow[i] > cod_info->xrpow_max)
+            cod_info->xrpow_max = xrpow[i];
+    }
+}
+
+#endif	/* HAVE_XMMINTRIN_H */
+
diff --git a/libmp3lame/version.c b/libmp3lame/version.c
new file mode 100644
index 0000000..ed9fe19
--- /dev/null
+++ b/libmp3lame/version.c
@@ -0,0 +1,235 @@
+/*
+ *      Version numbering for LAME.
+ *
+ *      Copyright (c) 1999 A.L. Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*!
+  \file   version.c
+  \brief  Version numbering for LAME.
+
+  Contains functions which describe the version of LAME.
+
+  \author A.L. Faber
+  \version \$Id: version.c,v 1.29.2.1 2008/10/12 19:33:09 robert Exp $
+  \ingroup libmp3lame
+*/
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#include "lame.h"
+#include "machine.h"
+
+#include "version.h"    /* macros of version numbers */
+
+
+
+
+
+/*! Get the LAME version string. */
+/*!
+  \param void
+  \return a pointer to a string which describes the version of LAME.
+*/
+const char *
+get_lame_version(void)
+{                       /* primary to write screen reports */
+    /* Here we can also add informations about compile time configurations */
+
+#if   LAME_ALPHA_VERSION
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " "
+        "(alpha " STR(LAME_PATCH_VERSION) ", " __DATE__ " " __TIME__ ")";
+#elif LAME_BETA_VERSION
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " "
+        "(beta " STR(LAME_PATCH_VERSION) ", " __DATE__ ")";
+#elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION);
+#else
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION);
+#endif
+
+    return str;
+}
+
+
+/*! Get the short LAME version string. */
+/*!
+  It's mainly for inclusion into the MP3 stream.
+
+  \param void   
+  \return a pointer to the short version of the LAME version string.
+*/
+const char *
+get_lame_short_version(void)
+{
+    /* adding date and time to version string makes it harder for output
+       validation */
+
+#if   LAME_ALPHA_VERSION
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (alpha)";
+#elif LAME_BETA_VERSION
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (beta)";
+#elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION);
+#else
+    static /*@observer@ */ const char *const str =
+        STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION);
+#endif
+
+    return str;
+}
+
+/*! Get the _very_ short LAME version string. */
+/*!
+  It's used in the LAME VBR tag only.
+
+  \param void   
+  \return a pointer to the short version of the LAME version string.
+*/
+const char *
+get_lame_very_short_version(void)
+{
+    /* adding date and time to version string makes it harder for output
+       validation */
+
+#if   LAME_ALPHA_VERSION
+    static /*@observer@ */ const char *const str =
+        "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "a";
+#elif LAME_BETA_VERSION
+    static /*@observer@ */ const char *const str =
+        "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "b";
+#elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
+    static /*@observer@ */ const char *const str =
+        "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "r";
+#else
+    static /*@observer@ */ const char *const str =
+        "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " ";
+#endif
+
+    return str;
+}
+
+/*! Get the version string for GPSYCHO. */
+/*!
+  \param void
+  \return a pointer to a string which describes the version of GPSYCHO.
+*/
+const char *
+get_psy_version(void)
+{
+#if   PSY_ALPHA_VERSION > 0
+    static /*@observer@ */ const char *const str =
+        STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION)
+        " (alpha " STR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
+#elif PSY_BETA_VERSION > 0
+    static /*@observer@ */ const char *const str =
+        STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION)
+        " (beta " STR(PSY_BETA_VERSION) ", " __DATE__ ")";
+#else
+    static /*@observer@ */ const char *const str =
+        STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION);
+#endif
+
+    return str;
+}
+
+
+/*! Get the URL for the LAME website. */
+/*!
+  \param void
+  \return a pointer to a string which is a URL for the LAME website.
+*/
+const char *
+get_lame_url(void)
+{
+    static /*@observer@ */ const char *const str = LAME_URL;
+
+    return str;
+}
+
+
+/*! Get the numerical representation of the version. */
+/*!
+  Writes the numerical representation of the version of LAME and
+  GPSYCHO into lvp.
+
+  \param lvp    
+*/
+void
+get_lame_version_numerical(lame_version_t * lvp)
+{
+    static /*@observer@ */ const char *const features = ""; /* obsolete */
+
+    /* generic version */
+    lvp->major = LAME_MAJOR_VERSION;
+    lvp->minor = LAME_MINOR_VERSION;
+#if LAME_ALPHA_VERSION
+    lvp->alpha = LAME_PATCH_VERSION;
+    lvp->beta = 0;
+#elif LAME_BETA_VERSION
+    lvp->alpha = 0;
+    lvp->beta = LAME_PATCH_VERSION;
+#else
+    lvp->alpha = 0;
+    lvp->beta = 0;
+#endif
+
+    /* psy version */
+    lvp->psy_major = PSY_MAJOR_VERSION;
+    lvp->psy_minor = PSY_MINOR_VERSION;
+    lvp->psy_alpha = PSY_ALPHA_VERSION;
+    lvp->psy_beta = PSY_BETA_VERSION;
+
+    /* compile time features */
+    /*@-mustfree@ */
+    lvp->features = features;
+    /*@=mustfree@ */
+}
+
+
+const char *
+get_lame_os_bitness(void)
+{
+    static /*@observer@ */ const char *const strXX = "";
+    static /*@observer@ */ const char *const str32 = "32bits";
+    static /*@observer@ */ const char *const str64 = "64bits";
+
+    switch (sizeof(void *)) {
+    case 4:
+        return str32;
+
+    case 8:
+        return str64;
+
+    default:
+        return strXX;
+    }
+}
+
+/* end of version.c */
diff --git a/libmp3lame/version.h b/libmp3lame/version.h
new file mode 100644
index 0000000..91cc7d0
--- /dev/null
+++ b/libmp3lame/version.h
@@ -0,0 +1,68 @@
+/*
+ *      Version numbering for LAME.
+ *
+ *      Copyright (c) 1999 A.L. Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAME_VERSION_H
+#define LAME_VERSION_H
+
+
+/*
+ * To make a string from a token, use the # operator:
+ */
+#ifndef STR
+# define __STR(x)  #x
+# define STR(x)    __STR(x)
+#endif
+
+# define LAME_URL              "http://www.mp3dev.org/"
+
+
+# define LAME_MAJOR_VERSION      3 /* Major version number */
+# define LAME_MINOR_VERSION     98 /* Minor version number */
+# define LAME_TYPE_VERSION       2 /* 0:alpha 1:beta 2:release */
+# define LAME_PATCH_VERSION      4 /* Patch level */
+# define LAME_ALPHA_VERSION     (LAME_TYPE_VERSION==0)
+# define LAME_BETA_VERSION      (LAME_TYPE_VERSION==1)
+# define LAME_RELEASE_VERSION   (LAME_TYPE_VERSION==2)
+
+# define PSY_MAJOR_VERSION       0 /* Major version number */
+# define PSY_MINOR_VERSION      93 /* Minor version number */
+# define PSY_ALPHA_VERSION       0 /* Set number if this is an alpha version, otherwise zero */
+# define PSY_BETA_VERSION        0 /* Set number if this is a beta version, otherwise zero */
+
+#if LAME_ALPHA_VERSION
+#define LAME_PATCH_LEVEL_STRING " alpha " STR(LAME_PATCH_VERSION)
+#endif
+#if LAME_BETA_VERSION
+#define LAME_PATCH_LEVEL_STRING " beta " STR(LAME_PATCH_VERSION)
+#endif
+#if LAME_RELEASE_VERSION
+#if LAME_PATCH_VERSION
+#define LAME_PATCH_LEVEL_STRING " release " STR(LAME_PATCH_VERSION)
+#else
+#define LAME_PATCH_LEVEL_STRING ""
+#endif
+#endif
+
+# define LAME_VERSION_STRING STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) LAME_PATCH_LEVEL_STRING
+
+#endif /* LAME_VERSION_H */
+
+/* End of version.h */
diff --git a/ltmain.sh b/ltmain.sh
new file mode 100644
index 0000000..c9698e7
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,6986 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007  Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.24
+TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
+
+# Be Bourne compatible (taken from Autoconf:_AS_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
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  SP2NL='tr \040 \012'
+  NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  SP2NL='tr \100 \n'
+  NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+	  save_$lt_var=\$$lt_var
+	  $lt_var=C
+	  export $lt_var
+	fi"
+done
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+	# Failing that, at least try and use $RANDOM to avoid a race
+	my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+	save_mktempdir_umask=`umask`
+	umask 0077
+	$mkdir "$my_tmpdir"
+	umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || {
+        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+	exit $EXIT_FAILURE
+      }
+    fi
+
+    $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+	$SED -n -e '1,100{
+		/ I /{
+			s,.*,import,
+			p
+			q
+			}
+		}'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    # FreeBSD-specific: where we install compilers with non-standard names
+    tag_compilers_CC="*cc cc* *gcc gcc*"
+    tag_compilers_CXX="*c++ c++* *g++ g++*"
+    base_compiler=`set -- "$@"; echo $1`
+
+    # If $tagname isn't set, then try to infer if the default "CC" tag applies
+    if test -z "$tagname"; then
+      for zp in $tag_compilers_CC; do
+        case $base_compiler in
+	 $zp) tagname="CC"; break;;
+	esac
+      done
+    fi
+
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	case $arg in
+	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	    # Double-quote args containing other shell metacharacters.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    CC_quoted="$CC_quoted $arg"
+	  done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+
+	    # FreeBSD-specific: try compilers based on inferred tag
+	    if test -z "$tagname"; then
+	      eval "tag_compilers=\$tag_compilers_${z}"
+	      if test -n "$tag_compilers"; then
+		for zp in $tag_compilers; do
+		  case $base_compiler in   
+		    $zp) tagname=$z; break;;
+		  esac
+		done
+		if test -n "$tagname"; then
+		  break
+		fi
+	      fi
+            fi
+          fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+
+    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+      exit $EXIT_FAILURE
+    fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  extracted_serial=`expr $extracted_serial + 1`
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+	exit $exit_status
+      fi
+      case $host in
+      *-darwin*)
+	$show "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	if test -z "$run"; then
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+	  if test -n "$darwin_arches"; then 
+	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      lipo -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    ${rm}r unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd "$darwin_orig_dir"
+ 	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	fi # $run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+        ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+	$echo "$progname: invalid tag name: $tagname" 1>&2
+	exit $EXIT_FAILURE
+	;;
+      esac
+
+      case $tagname in
+      CC)
+	# Don't test for the "default" C tag, as we know, it's there, but
+	# not specially marked.
+	;;
+      *)
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	  taglist="$taglist $tagname"
+	  # Evaluate the configuration.
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	else
+	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
+	fi
+	;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+
+Copyright (C) 2007  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."
+    exit $?
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $?
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $?
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag)
+    prevopt="--tag"
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no) 
+  ;;
+shared)
+  build_libtool_libs=no
+  build_old_libs=yes
+  ;;
+static)
+  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+  ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  if test -n "$libobj" ; then
+	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+ 	  for arg in $args; do
+	    IFS="$save_ifs"
+
+	    # Double-quote args containing other shell metacharacters.
+	    # Many Bourne shells cannot handle close brackets correctly
+	    # in scan sets, so we specify it separately.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    lastarg="$lastarg $arg"
+	  done
+	  IFS="$save_ifs"
+	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	* )
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, and some SunOS ksh mistreat backslash-escaping
+      # in scan sets (worked around with variable expansion),
+      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
+      # at all, so we specify them separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.[fF][09]?) xform=[fF][09]. ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    *.obj) xform=obj ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+    case $qlibobj in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qlibobj="\"$qlibobj\"" ;;
+    esac
+    test "X$libobj" != "X$qlibobj" \
+	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
+	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+      $echo "$srcfile" > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+    case $qsrcfile in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+      qsrcfile="\"$qsrcfile\"" ;;
+    esac
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	exit_status=$?
+	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+	  exit $exit_status
+	fi
+      fi
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    notinst_path= # paths that contain not-installed libtool libraries
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat $save_arg`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		# If there is no directory component, then add one.
+		case $arg in
+		*/* | *\\*) . $arg ;;
+		*) . ./$arg ;;
+		esac
+
+		if test -z "$pic_object" || \
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none && \
+		   test "$non_pic_object" = none; then
+		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+
+		# Extract subdirectory from the argument.
+		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		if test "X$xdir" = "X$arg"; then
+		  xdir=
+		else
+		  xdir="$xdir/"
+		fi
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  libobjs="$libobjs $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if test -z "$run"; then
+		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+		  exit $EXIT_FAILURE
+		else
+		  # Dry-run case.
+
+		  # Extract subdirectory from the argument.
+		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		  if test "X$xdir" = "X$arg"; then
+		    xdir=
+		  else
+		    xdir="$xdir/"
+		  fi
+
+		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+		  libobjs="$libobjs $pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      fi
+	    done
+	  else
+	    $echo "$modename: link input file \`$save_arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	shrext)
+  	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	darwin_framework|darwin_framework_skip)
+	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  prev=
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit $EXIT_FAILURE
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework|-arch|-isysroot)
+	case " $CC " in
+	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
+		prev=darwin_framework_skip ;;
+	  *) compiler_flags="$compiler_flags $arg"
+	     prev=darwin_framework ;;
+	esac
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    absdir="$dir"
+	    notinst_path="$notinst_path $dir"
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs -framework System"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      -model)
+	compile_command="$compile_command $arg"
+	compiler_flags="$compiler_flags $arg"
+	finalize_command="$finalize_command $arg"
+	prev=xcompiler
+	continue
+	;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m* pass through architecture-specific compiler args for GCC
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  # If there is no directory component, then add one.
+	  case $arg in
+	  */* | *\\*) . $arg ;;
+	  *) . ./$arg ;;
+	  esac
+
+	  if test -z "$pic_object" || \
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none && \
+	     test "$non_pic_object" = none; then
+	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$arg"; then
+	    xdir=
+ 	  else
+	    xdir="$xdir/"
+	  fi
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if test -z "$run"; then
+	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+	    exit $EXIT_FAILURE
+	  else
+	    # Dry-run case.
+
+	    # Extract subdirectory from the argument.
+	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$arg"; then
+	      xdir=
+	    else
+	      xdir="$xdir/"
+	    fi
+
+	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+	exit $exit_status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    compiler_flags="$compiler_flags $deplib"
+	  fi
+
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    ;;
+	  *)
+	    ;;
+	  esac # linkmode
+
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		  library_names=
+		  old_library=
+		  case $lib in
+		  */* | *\\*) . $lib ;;
+		  *) . ./$lib ;;
+		  esac
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+		    test "X$ladir" = "X$lib" && ladir="."
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+	        ;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    valid_a_lib=no
+	    case $deplibs_check_method in
+	      match_pattern*)
+		set dummy $deplibs_check_method
+	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+		if eval $echo \"$deplib\" 2>/dev/null \
+		    | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		  valid_a_lib=yes
+		fi
+		;;
+	      pass_all)
+		valid_a_lib=yes
+		;;
+            esac
+	    if test "$valid_a_lib" != yes; then
+	      $echo
+	      $echo "*** Warning: Trying to link with static lib archive $deplib."
+	      $echo "*** I have the capability to make that library automatically link in when"
+	      $echo "*** you link to this library.  But I can only do this if you have a"
+	      $echo "*** shared version of the library, which you do not appear to have"
+	      $echo "*** because the file extensions .$libext of this argument makes me believe"
+	      $echo "*** that it is just a static archive that I should not used here."
+	    else
+	      $echo
+	      $echo "*** Warning: Linking the shared library $output against the"
+	      $echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit $EXIT_FAILURE
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *" $dir "*) ;;
+	      *" $absdir "*) ;;
+	      *) temp_rpath="$temp_rpath $absdir" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes ; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on
+	  # some systems (darwin)
+	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
+	    $echo
+	    if test "$linkmode" = prog; then
+	      $echo "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $echo "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $echo "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$extract_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$old_archive_from_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a module then we can not link against
+		    # it, someone is ignoring the new warnings I added
+		    if /usr/bin/file -L $add 2> /dev/null |
+                      $EGREP ": [^:]* bundle" >/dev/null ; then
+		      $echo "** Warning, lib $linklib is a module, not a shared library"
+		      if test -z "$old_library" ; then
+		        $echo
+		        $echo "** And there doesn't seem to be a static archive available"
+		        $echo "** The link will probably fail, sorry"
+		      else
+		        add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit $EXIT_FAILURE
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+	        add="$inst_prefix_dir$libdir/$linklib"
+	      else
+	        add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $echo
+	    $echo "*** Warning: This system can not link to static lib archive $lib."
+	    $echo "*** I have the capability to make that library automatically link in when"
+	    $echo "*** you link to this library.  But I can only do this if you have a"
+	    $echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $echo "*** But as you try to build a module library, libtool will still create "
+	      $echo "*** a static module, that should work as long as the dlopening application"
+	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$echo
+		$echo "*** However, this would only work if libtool was able to extract symbol"
+		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$echo "*** not find such a program.  So, this module is probably useless."
+		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit $EXIT_FAILURE
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="$absdir"
+		fi
+		depdepl=
+		case $host in
+		*-*-darwin*)
+		  # we do not want to link against static libs,
+		  # but need to link against shared
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$path/$depdepl" ; then
+		      depdepl="$path/$depdepl"
+		    fi
+		    # do not add paths which are already there
+		    case " $newlib_search_path " in
+		    *" $path "*) ;;
+		    *) newlib_search_path="$newlib_search_path $path";;
+		    esac
+		  fi
+		  path=""
+		  ;;
+		*)
+		  path="-L$path"
+		  ;;
+		esac
+		;;
+	      -l*)
+		case $host in
+		*-*-darwin*)
+		  # Again, we only want to link against shared libraries
+		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+		  for tmp in $newlib_search_path ; do
+		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
+		      eval depdepl="$tmp/lib$tmp_libs.dylib"
+		      break
+		    fi
+		  done
+		  path=""
+		  ;;
+		*) continue ;;
+		esac
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	      case " $deplibs " in
+	      *" $depdepl "*) ;;
+	      *) deplibs="$depdepl $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit $EXIT_FAILURE
+	else
+	  $echo
+	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  $echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$2"
+	  number_minor="$3"
+	  number_revision="$4"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows|none)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$2"
+	  revision="$3"
+	  age="$4"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    major=`expr $current - $age`
+	  else
+	    major=`expr $current - $age + 1`
+	  fi
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$echo "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+	         then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	if test -n "$removelist"; then
+	  $show "${rm}r $removelist"
+	  $run ${rm}r $removelist
+	fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+ 	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+	        fi
+		if test -n "$i" ; then
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $echo
+		    $echo "*** Warning: dynamic linker does not accept needed library $i."
+		    $echo "*** I have the capability to make that library automatically link in when"
+		    $echo "*** you link to this library.  But I can only do this if you have a"
+		    $echo "*** shared version of the library, which I believe you do not have"
+		    $echo "*** because a test_compile did reveal that the linker did not use it for"
+		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		$rm conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval \\$echo \"$libname_spec\"`
+		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		    set dummy $deplib_matches
+		    deplib_match=$2
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $echo
+		      $echo "*** Warning: dynamic linker does not accept needed library $i."
+		      $echo "*** I have the capability to make that library automatically link in when"
+		      $echo "*** you link to this library.  But I can only do this if you have a"
+		      $echo "*** shared version of the library, which you do not appear to have"
+		      $echo "*** because a test_compile did reveal that the linker did not use this one"
+		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $echo
+		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $echo "*** make it link in!  You will probably need to install it or some"
+		  $echo "*** library that it depends on before this library will be fully"
+		  $echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval $echo \"$potent_lib\" 2>/dev/null \
+		        | ${SED} 10q \
+		        | $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	    -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+	    done
+	  fi
+	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
+	    | grep . >/dev/null; then
+	    $echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $echo
+	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $echo "*** a static module, that should work as long as the dlopening"
+	    $echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $echo
+	      $echo "*** However, this would only work if libtool was able to extract symbol"
+	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $echo "*** not find such a program.  So, this module is probably useless."
+	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $echo "*** The inter-library dependencies that have been dropped here will be"
+	    $echo "*** automatically added whenever a program is linked with this library"
+	    $echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $echo
+	      $echo "*** Since this library must not contain undefined symbols,"
+	      $echo "*** because either the platform does not support them or"
+	      $echo "*** it was explicitly requested with -no-undefined,"
+	      $echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      case $archive_cmds in
+	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+	      esac
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      if len=`expr "X$cmd" : ".*"` &&
+	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	        $show "$cmd"
+	        $run eval "$cmd" || exit $?
+	        skipped_export=false
+	      else
+	        # The command line is too long to execute in one step.
+	        $show "using reloadable object file for export list..."
+	        skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+		case " $convenience " in
+		*" $test_deplib "*) ;;
+		*)
+			tmp_deplibs="$tmp_deplibs $test_deplib"
+			;;
+		esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	  fi
+	fi
+	
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval test_cmds=\"$archive_expsym_cmds\"
+	  cmds=$archive_expsym_cmds
+	else
+	  eval test_cmds=\"$archive_cmds\"
+	  cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise.
+	  $echo "creating reloadable object files..."
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  delfiles=
+	  last_robj=
+	  k=1
+	  output=$output_objdir/$output_la-${k}.$objext
+	  # Loop over the list of objects to be linked.
+	  for obj in $save_libobjs
+	  do
+	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+	    if test "X$objlist" = X ||
+	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+		 test "$len" -le "$max_cmd_len"; }; then
+	      objlist="$objlist $obj"
+	    else
+	      # The command $test_cmds is almost too long, add a
+	      # command to the queue.
+	      if test "$k" -eq 1 ; then
+		# The first file doesn't have a previous command to add.
+		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+	      else
+		# All subsequent reloadable object files will link in
+		# the last one created.
+		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+	      fi
+	      last_robj=$output_objdir/$output_la-${k}.$objext
+	      k=`expr $k + 1`
+	      output=$output_objdir/$output_la-${k}.$objext
+	      objlist=$obj
+	      len=1
+	    fi
+	  done
+	  # Handle the remaining objects by creating one last
+	  # reloadable object file.  All subsequent reloadable object
+	  # files will link in the last one created.
+	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+	  if ${skipped_export-false}; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    libobjs=$output
+	    # Append the command to create the export file.
+	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+	  # Set up a command to remove the reloadable object files
+	  # after they are used.
+	  i=0
+	  while test "$i" -lt "$k"
+	  do
+	    i=`expr $i + 1`
+	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+	  done
+
+	  $echo "creating a temporary reloadable object file: $output"
+
+	  # Loop through the commands generated above and execute them.
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $concat_cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    cmds=$archive_expsym_cmds
+	  else
+	    cmds=$archive_cmds
+	    fi
+	  fi
+
+	  # Append the command to remove the reloadable object files
+	  # to the just-reset $cmds.
+	  eval cmds=\"\$cmds~\$rm $delfiles\"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$mode" = relink; then
+	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      $show "${rm}r $gentop"
+	      $run ${rm}r "$gentop"
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $run eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	cmds=$reload_cmds
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$outputname.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+              case $host in
+              *cygwin* | *mingw* )
+	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+	    else
+	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+              case $host in
+              *cygwin* | *mingw* )
+	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval '$echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+	    case $host in
+	    *cygwin* | *mingw* )
+	  $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs */
+struct {
+"
+	      ;;
+	    * )
+	  $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+	      ;;
+	    esac
+
+
+	  $echo >> "$output_objdir/$dlsyms" "\
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+          case $host in
+          *cygwin* | *mingw* )
+            if test -f "$output_objdir/${outputname}.def" ; then
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            else
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+             fi
+            ;;
+          * )
+            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            ;;
+          esac
+	  ;;
+	*-*-freebsd*)
+	  # FreeBSD doesn't need this...
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	exit_status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+            output_name=`basename $output`
+            output_path=`dirname $output`
+            cwrappersource="$output_path/$objdir/lt-$output_name.c"
+            cwrapper="$output_path/$output_name.exe"
+            $rm $cwrappersource $cwrapper
+            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS.  */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int    check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  DEBUG("(main) argv[0]      : %s\n",argv[0]);
+  DEBUG("(main) program_name : %s\n",program_name);
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+            cat >> $cwrappersource <<EOF
+  newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+            cat >> $cwrappersource <<"EOF"
+  newargz[1] = find_executable(argv[0]);
+  if (newargz[1] == NULL)
+    lt_fatal("Couldn't find %s", argv[0]);
+  DEBUG("(main) found exe at : %s\n",newargz[1]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+
+  for (i=0; i<argc+1; i++)
+  {
+    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
+    ;
+  }
+
+EOF
+
+            case $host_os in
+              mingw*)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",(char const **)newargz);
+EOF
+              ;;
+              *)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+              ;;
+            esac
+
+            cat >> $cwrappersource <<"EOF"
+  return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable(const char * path)
+{
+  struct stat st;
+
+  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0) &&
+      (
+        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+       ((st.st_mode & S_IXUSR) == S_IXUSR))
+      )
+    return 1;
+  else
+    return 0;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+  int has_slash = 0;
+  const char* p;
+  const char* p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char* concat_name;
+
+  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+  {
+    concat_name = xstrdup (wrapper);
+    if (check_executable(concat_name))
+      return concat_name;
+    XFREE(concat_name);
+  }
+  else
+  {
+#endif
+    if (IS_DIR_SEPARATOR (wrapper[0]))
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable(concat_name))
+        return concat_name;
+      XFREE(concat_name);
+    }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+    {
+      has_slash = 1;
+      break;
+    }
+  if (!has_slash)
+  {
+    /* no slashes; search PATH */
+    const char* path = getenv ("PATH");
+    if (path != NULL)
+    {
+      for (p = path; *p; p = p_next)
+      {
+        const char* q;
+        size_t p_len;
+        for (q = p; *q; q++)
+          if (IS_PATH_SEPARATOR(*q))
+            break;
+        p_len = q - p;
+        p_next = (*q == '\0' ? q : q + 1);
+        if (p_len == 0)
+        {
+          /* empty path: current directory */
+          if (getcwd (tmp, LT_PATHMAX) == NULL)
+            lt_fatal ("getcwd failed");
+          tmp_len = strlen(tmp);
+          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, tmp, tmp_len);
+          concat_name[tmp_len] = '/';
+          strcpy (concat_name + tmp_len + 1, wrapper);
+        }
+        else
+        {
+          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, p, p_len);
+          concat_name[p_len] = '/';
+          strcpy (concat_name + p_len + 1, wrapper);
+        }
+        if (check_executable(concat_name))
+          return concat_name;
+        XFREE(concat_name);
+      }
+    }
+    /* not found in PATH; assume curdir */
+  }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen(tmp);
+  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable(concat_name))
+    return concat_name;
+  XFREE(concat_name);
+  return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+          # we should really use a build-platform specific compiler
+          # here, but OTOH, the wrappers (shell script and this C one)
+          # are only useful if you want to execute the "real" binary.
+          # Since the "real" binary is built for $host, then this
+          # wrapper might as well be built for $host, too.
+          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+          ;;
+        esac
+        $rm $output
+        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \$*\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $echo "copying selected object files to avoid basename conflicts..."
+
+	  if test -z "$gentop"; then
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "$mkdir $gentop"
+	    $run $mkdir "$gentop"
+	    exit_status=$?
+	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+	      exit $exit_status
+	    fi
+	  fi
+
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		counter=`expr $counter + 1`
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      $run ln "$obj" "$gentop/$newobj" ||
+	      $run cp "$obj" "$gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
+	      ;;
+	    *) oldobjs="$oldobjs $obj" ;;
+	    esac
+	  done
+	fi
+
+	eval cmds=\"$old_archive_cmds\"
+
+	if len=`expr "X$cmds" : ".*"` &&
+	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  $echo "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  for obj in $save_oldobjs
+	  do
+	    oldobjs="$objlist $obj"
+	    objlist="$objlist $obj"
+	    eval test_cmds=\"$old_archive_cmds\"
+	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	       test "$len" -le "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+	        RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) 
+      	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
+	;;
+      -g | -m | -o) prev=$arg ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  if test "$inst_prefix_dir" = "$destdir"; then
+	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
+	  else
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
+	  fi
+
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  cmds=$postinstall_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || {
+	      lt_exit=$?
+
+	      # Restore the uninstalled library and exit
+	      if test "$mode" = relink; then
+		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+	      fi
+
+	      exit $lt_exit
+	    }
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      file=`$echo $file|${SED} 's,.exe$,,'`
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # Note that it is not necessary on cygwin/mingw to append a dot to
+	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
+	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+	  # `FILE.' does not work on cygwin managed mounts.
+	  #
+	  # If there is no directory component, then add one.
+	  case $wrapper in
+	  */* | *\\*) . ${wrapper} ;;
+	  *) . ./${wrapper} ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # Note that it is not necessary on cygwin/mingw to append a dot to
+	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
+	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+	  # `FILE.' does not work on cygwin managed mounts.
+	  #
+	  # If there is no directory component, then add one.
+	  case $wrapper in
+	  */* | *\\*) . ${wrapper} ;;
+	  *) . ./${wrapper} ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir=`func_mktempdir`
+	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway 
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  cmds=$finish_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+		$lt_var=\$save_$lt_var; export $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+	  case "$mode" in
+	  clean)
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
+	    *" $dlname "*) ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    esac
+	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      cmds=$postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      cmds=$old_postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+	  # Read the .lo file
+	  . $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" \
+	     && test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" \
+	     && test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    file=`$echo $file|${SED} 's,.exe$,,'`
+	    noexename=`$echo $name|${SED} 's,.exe$,,'`
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	    relink_command=
+	    . $dir/$noexename
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/mac/LAME.mcp b/mac/LAME.mcp
new file mode 100755
index 0000000..cfe1c2c
--- /dev/null
+++ b/mac/LAME.mcp
Binary files differ
diff --git a/mac/LAME_Carbon_Debug.pch b/mac/LAME_Carbon_Debug.pch
new file mode 100755
index 0000000..3e9dc29
--- /dev/null
+++ b/mac/LAME_Carbon_Debug.pch
Binary files differ
diff --git a/mac/LAME_Carbon_Final.pch b/mac/LAME_Carbon_Final.pch
new file mode 100755
index 0000000..78650cb
--- /dev/null
+++ b/mac/LAME_Carbon_Final.pch
Binary files differ
diff --git a/mac/LAME_Classic_Debug.pch b/mac/LAME_Classic_Debug.pch
new file mode 100755
index 0000000..c400d3f
--- /dev/null
+++ b/mac/LAME_Classic_Debug.pch
Binary files differ
diff --git a/mac/LAME_Classic_Final.pch b/mac/LAME_Classic_Final.pch
new file mode 100755
index 0000000..326285e
--- /dev/null
+++ b/mac/LAME_Classic_Final.pch
Binary files differ
diff --git a/mac/MacDLLMain.c b/mac/MacDLLMain.c
new file mode 100755
index 0000000..8654265
--- /dev/null
+++ b/mac/MacDLLMain.c
Binary files differ
diff --git a/mac/Makefile.am b/mac/Makefile.am
new file mode 100644
index 0000000..e1382cd
--- /dev/null
+++ b/mac/Makefile.am
@@ -0,0 +1,13 @@
+## $Id: Makefile.am,v 1.1 2002/05/28 07:52:10 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	.DS_Store \
+	LAME.mcp \
+	LAME_Carbon_Debug.pch \
+	LAME_Carbon_Final.pch \
+	LAME_Classic_Debug.pch \
+	LAME_Classic_Final.pch \
+	MacDLLMain.c \
+	Precompile_Common.h
diff --git a/mac/Makefile.in b/mac/Makefile.in
new file mode 100644
index 0000000..be33578
--- /dev/null
+++ b/mac/Makefile.in
@@ -0,0 +1,365 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = mac
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	.DS_Store \
+	LAME.mcp \
+	LAME_Carbon_Debug.pch \
+	LAME_Carbon_Final.pch \
+	LAME_Classic_Debug.pch \
+	LAME_Classic_Final.pch \
+	MacDLLMain.c \
+	Precompile_Common.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  mac/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  mac/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mac/Precompile_Common.h b/mac/Precompile_Common.h
new file mode 100755
index 0000000..5d5bf2e
--- /dev/null
+++ b/mac/Precompile_Common.h
Binary files differ
diff --git a/macosx/English.lproj/InfoPlist.strings b/macosx/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..f8ed77a
--- /dev/null
+++ b/macosx/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/macosx/English.lproj/Makefile.am b/macosx/English.lproj/Makefile.am
new file mode 100644
index 0000000..a08152e
--- /dev/null
+++ b/macosx/English.lproj/Makefile.am
@@ -0,0 +1,7 @@
+## $Id: Makefile.am,v 1.1 2008/05/24 08:28:58 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	InfoPlist.strings
+
diff --git a/macosx/English.lproj/Makefile.in b/macosx/English.lproj/Makefile.in
new file mode 100644
index 0000000..2712d15
--- /dev/null
+++ b/macosx/English.lproj/Makefile.in
@@ -0,0 +1,358 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = macosx/English.lproj
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	InfoPlist.strings
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  macosx/English.lproj/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  macosx/English.lproj/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/macosx/Info.plist b/macosx/Info.plist
new file mode 100644
index 0000000..1a18a9b
--- /dev/null
+++ b/macosx/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>LAME</string>
+	<key>CFBundleIdentifier</key>
+	<string>net.sourceforge.LAMEframework</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleSignature</key>
+	<string>LAMh</string>
+	<key>CFBundleVersion</key>
+	<string>1.0</string>
+</dict>
+</plist>
diff --git a/macosx/LAME.xcodeproj/Makefile.am b/macosx/LAME.xcodeproj/Makefile.am
new file mode 100644
index 0000000..509529c
--- /dev/null
+++ b/macosx/LAME.xcodeproj/Makefile.am
@@ -0,0 +1,7 @@
+## $Id: Makefile.am,v 1.1 2008/05/24 08:28:58 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = \
+	project.pbxproj
+
diff --git a/macosx/LAME.xcodeproj/Makefile.in b/macosx/LAME.xcodeproj/Makefile.in
new file mode 100644
index 0000000..9ba8962
--- /dev/null
+++ b/macosx/LAME.xcodeproj/Makefile.in
@@ -0,0 +1,358 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = macosx/LAME.xcodeproj
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	project.pbxproj
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  macosx/LAME.xcodeproj/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  macosx/LAME.xcodeproj/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/macosx/LAME.xcodeproj/project.pbxproj b/macosx/LAME.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..d234d19
--- /dev/null
+++ b/macosx/LAME.xcodeproj/project.pbxproj
@@ -0,0 +1,520 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		8D07F2BE0486CC7A007CD1D0 /* LAME_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32BAE0B70371A74B00C91783 /* LAME_Prefix.pch */; };
+		8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
+		EA0A6AD40BB84E38003C87B1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA0A6AC20BB84D93003C87B1 /* Cocoa.framework */; };
+		EA498C8D0DE5E37B00250F0E /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = EA498C8C0DE5E37B00250F0E /* config.h */; };
+		EA8CC08809A39A49001379B8 /* lame.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC08709A39A49001379B8 /* lame.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		EA8CC0A509A39A55001379B8 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC08A09A39A55001379B8 /* common.c */; };
+		EA8CC0A609A39A55001379B8 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC08B09A39A55001379B8 /* common.h */; };
+		EA8CC0A709A39A55001379B8 /* dct64_i386.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC08C09A39A55001379B8 /* dct64_i386.c */; };
+		EA8CC0A809A39A55001379B8 /* dct64_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC08D09A39A55001379B8 /* dct64_i386.h */; };
+		EA8CC0A909A39A55001379B8 /* decode_i386.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC08E09A39A55001379B8 /* decode_i386.c */; };
+		EA8CC0AA09A39A55001379B8 /* decode_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC08F09A39A55001379B8 /* decode_i386.h */; };
+		EA8CC0AC09A39A55001379B8 /* huffman.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09109A39A55001379B8 /* huffman.h */; };
+		EA8CC0AD09A39A55001379B8 /* interface.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC09209A39A55001379B8 /* interface.c */; };
+		EA8CC0AE09A39A55001379B8 /* interface.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09309A39A55001379B8 /* interface.h */; };
+		EA8CC0AF09A39A55001379B8 /* l2tables.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09409A39A55001379B8 /* l2tables.h */; };
+		EA8CC0B009A39A55001379B8 /* layer1.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC09509A39A55001379B8 /* layer1.c */; };
+		EA8CC0B109A39A55001379B8 /* layer1.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09609A39A55001379B8 /* layer1.h */; };
+		EA8CC0B209A39A55001379B8 /* layer2.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC09709A39A55001379B8 /* layer2.c */; };
+		EA8CC0B309A39A55001379B8 /* layer2.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09809A39A55001379B8 /* layer2.h */; };
+		EA8CC0B409A39A55001379B8 /* layer3.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC09909A39A55001379B8 /* layer3.c */; };
+		EA8CC0B509A39A55001379B8 /* layer3.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09A09A39A55001379B8 /* layer3.h */; };
+		EA8CC0B809A39A55001379B8 /* mpg123.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09D09A39A55001379B8 /* mpg123.h */; };
+		EA8CC0B909A39A55001379B8 /* mpglib.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC09E09A39A55001379B8 /* mpglib.h */; };
+		EA8CC0BD09A39A55001379B8 /* tabinit.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0A209A39A55001379B8 /* tabinit.c */; };
+		EA8CC0BE09A39A55001379B8 /* tabinit.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0A309A39A55001379B8 /* tabinit.h */; };
+		EA8CC0F909A39A5E001379B8 /* bitstream.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0C109A39A5E001379B8 /* bitstream.c */; };
+		EA8CC0FA09A39A5E001379B8 /* bitstream.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0C209A39A5E001379B8 /* bitstream.h */; };
+		EA8CC0FC09A39A5E001379B8 /* encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0C409A39A5E001379B8 /* encoder.c */; };
+		EA8CC0FD09A39A5E001379B8 /* encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0C509A39A5E001379B8 /* encoder.h */; };
+		EA8CC0FE09A39A5E001379B8 /* fft.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0C609A39A5E001379B8 /* fft.c */; };
+		EA8CC0FF09A39A5E001379B8 /* fft.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0C709A39A5E001379B8 /* fft.h */; };
+		EA8CC10009A39A5E001379B8 /* gain_analysis.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0C809A39A5E001379B8 /* gain_analysis.c */; };
+		EA8CC10109A39A5E001379B8 /* gain_analysis.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0C909A39A5E001379B8 /* gain_analysis.h */; };
+		EA8CC10C09A39A5E001379B8 /* id3tag.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0D509A39A5E001379B8 /* id3tag.c */; };
+		EA8CC10D09A39A5E001379B8 /* id3tag.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0D609A39A5E001379B8 /* id3tag.h */; };
+		EA8CC10E09A39A5E001379B8 /* l3side.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0D709A39A5E001379B8 /* l3side.h */; };
+		EA8CC10F09A39A5E001379B8 /* lame-analysis.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0D809A39A5E001379B8 /* lame-analysis.h */; };
+		EA8CC11009A39A5E001379B8 /* lame.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0D909A39A5E001379B8 /* lame.c */; };
+		EA8CC11109A39A5E001379B8 /* lame_global_flags.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0DA09A39A5E001379B8 /* lame_global_flags.h */; };
+		EA8CC11409A39A5E001379B8 /* machine.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0DD09A39A5E001379B8 /* machine.h */; };
+		EA8CC11709A39A5E001379B8 /* mpglib_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0E009A39A5E001379B8 /* mpglib_interface.c */; };
+		EA8CC11809A39A5E001379B8 /* newmdct.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0E109A39A5E001379B8 /* newmdct.c */; };
+		EA8CC11909A39A5E001379B8 /* newmdct.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0E209A39A5E001379B8 /* newmdct.h */; };
+		EA8CC11A09A39A5E001379B8 /* presets.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0E309A39A5E001379B8 /* presets.c */; };
+		EA8CC11B09A39A5E001379B8 /* psymodel.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0E409A39A5E001379B8 /* psymodel.c */; };
+		EA8CC11C09A39A5E001379B8 /* psymodel.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0E509A39A5E001379B8 /* psymodel.h */; };
+		EA8CC11D09A39A5E001379B8 /* quantize.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0E609A39A5E001379B8 /* quantize.c */; };
+		EA8CC11E09A39A5E001379B8 /* quantize.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0E709A39A5E001379B8 /* quantize.h */; };
+		EA8CC11F09A39A5E001379B8 /* quantize_pvt.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0E809A39A5E001379B8 /* quantize_pvt.c */; };
+		EA8CC12009A39A5E001379B8 /* quantize_pvt.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0E909A39A5E001379B8 /* quantize_pvt.h */; };
+		EA8CC12109A39A5E001379B8 /* reservoir.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0EA09A39A5E001379B8 /* reservoir.c */; };
+		EA8CC12209A39A5E001379B8 /* reservoir.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0EB09A39A5E001379B8 /* reservoir.h */; };
+		EA8CC12309A39A5E001379B8 /* set_get.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0EC09A39A5E001379B8 /* set_get.c */; };
+		EA8CC12409A39A5E001379B8 /* set_get.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0ED09A39A5E001379B8 /* set_get.h */; };
+		EA8CC12509A39A5E001379B8 /* tables.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0EE09A39A5E001379B8 /* tables.c */; };
+		EA8CC12609A39A5E001379B8 /* tables.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0EF09A39A5E001379B8 /* tables.h */; };
+		EA8CC12709A39A5E001379B8 /* takehiro.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0F009A39A5E001379B8 /* takehiro.c */; };
+		EA8CC12809A39A5E001379B8 /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0F109A39A5E001379B8 /* util.c */; };
+		EA8CC12909A39A5E001379B8 /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0F209A39A5E001379B8 /* util.h */; };
+		EA8CC12A09A39A5E001379B8 /* vbrquantize.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0F309A39A5E001379B8 /* vbrquantize.c */; };
+		EA8CC12B09A39A5E001379B8 /* vbrquantize.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0F409A39A5E001379B8 /* vbrquantize.h */; };
+		EA8CC12C09A39A5E001379B8 /* VbrTag.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0F509A39A5E001379B8 /* VbrTag.c */; };
+		EA8CC12D09A39A5E001379B8 /* VbrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0F609A39A5E001379B8 /* VbrTag.h */; };
+		EA8CC12E09A39A5E001379B8 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = EA8CC0F709A39A5E001379B8 /* version.c */; };
+		EA8CC12F09A39A5E001379B8 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8CC0F809A39A5E001379B8 /* version.h */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		32BAE0B70371A74B00C91783 /* LAME_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAME_Prefix.pch; sourceTree = "<group>"; };
+		8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+		8D07F2C80486CC7A007CD1D0 /* LAME.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LAME.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		EA0A6AC20BB84D93003C87B1 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+		EA498C8C0DE5E37B00250F0E /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
+		EA8CC08709A39A49001379B8 /* lame.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = lame.h; path = ../include/lame.h; sourceTree = "<group>"; };
+		EA8CC08A09A39A55001379B8 /* common.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = common.c; sourceTree = "<group>"; };
+		EA8CC08B09A39A55001379B8 /* common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
+		EA8CC08C09A39A55001379B8 /* dct64_i386.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = dct64_i386.c; sourceTree = "<group>"; };
+		EA8CC08D09A39A55001379B8 /* dct64_i386.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dct64_i386.h; sourceTree = "<group>"; };
+		EA8CC08E09A39A55001379B8 /* decode_i386.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = decode_i386.c; sourceTree = "<group>"; };
+		EA8CC08F09A39A55001379B8 /* decode_i386.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = decode_i386.h; sourceTree = "<group>"; };
+		EA8CC09109A39A55001379B8 /* huffman.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = huffman.h; sourceTree = "<group>"; };
+		EA8CC09209A39A55001379B8 /* interface.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = interface.c; sourceTree = "<group>"; };
+		EA8CC09309A39A55001379B8 /* interface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = interface.h; sourceTree = "<group>"; };
+		EA8CC09409A39A55001379B8 /* l2tables.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = l2tables.h; sourceTree = "<group>"; };
+		EA8CC09509A39A55001379B8 /* layer1.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = layer1.c; sourceTree = "<group>"; };
+		EA8CC09609A39A55001379B8 /* layer1.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = layer1.h; sourceTree = "<group>"; };
+		EA8CC09709A39A55001379B8 /* layer2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = layer2.c; sourceTree = "<group>"; };
+		EA8CC09809A39A55001379B8 /* layer2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = layer2.h; sourceTree = "<group>"; };
+		EA8CC09909A39A55001379B8 /* layer3.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = layer3.c; sourceTree = "<group>"; };
+		EA8CC09A09A39A55001379B8 /* layer3.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = layer3.h; sourceTree = "<group>"; };
+		EA8CC09D09A39A55001379B8 /* mpg123.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mpg123.h; sourceTree = "<group>"; };
+		EA8CC09E09A39A55001379B8 /* mpglib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mpglib.h; sourceTree = "<group>"; };
+		EA8CC0A209A39A55001379B8 /* tabinit.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tabinit.c; sourceTree = "<group>"; };
+		EA8CC0A309A39A55001379B8 /* tabinit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = tabinit.h; sourceTree = "<group>"; };
+		EA8CC0C109A39A5E001379B8 /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = "<group>"; };
+		EA8CC0C209A39A5E001379B8 /* bitstream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = bitstream.h; sourceTree = "<group>"; };
+		EA8CC0C409A39A5E001379B8 /* encoder.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = encoder.c; sourceTree = "<group>"; };
+		EA8CC0C509A39A5E001379B8 /* encoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = encoder.h; sourceTree = "<group>"; };
+		EA8CC0C609A39A5E001379B8 /* fft.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = fft.c; sourceTree = "<group>"; };
+		EA8CC0C709A39A5E001379B8 /* fft.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = fft.h; sourceTree = "<group>"; };
+		EA8CC0C809A39A5E001379B8 /* gain_analysis.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gain_analysis.c; sourceTree = "<group>"; };
+		EA8CC0C909A39A5E001379B8 /* gain_analysis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gain_analysis.h; sourceTree = "<group>"; };
+		EA8CC0D509A39A5E001379B8 /* id3tag.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = id3tag.c; sourceTree = "<group>"; };
+		EA8CC0D609A39A5E001379B8 /* id3tag.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = id3tag.h; sourceTree = "<group>"; };
+		EA8CC0D709A39A5E001379B8 /* l3side.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = l3side.h; sourceTree = "<group>"; };
+		EA8CC0D809A39A5E001379B8 /* lame-analysis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "lame-analysis.h"; sourceTree = "<group>"; };
+		EA8CC0D909A39A5E001379B8 /* lame.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = lame.c; sourceTree = "<group>"; };
+		EA8CC0DA09A39A5E001379B8 /* lame_global_flags.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = lame_global_flags.h; sourceTree = "<group>"; };
+		EA8CC0DD09A39A5E001379B8 /* machine.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = machine.h; sourceTree = "<group>"; };
+		EA8CC0E009A39A5E001379B8 /* mpglib_interface.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mpglib_interface.c; sourceTree = "<group>"; };
+		EA8CC0E109A39A5E001379B8 /* newmdct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = newmdct.c; sourceTree = "<group>"; };
+		EA8CC0E209A39A5E001379B8 /* newmdct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = newmdct.h; sourceTree = "<group>"; };
+		EA8CC0E309A39A5E001379B8 /* presets.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = presets.c; sourceTree = "<group>"; };
+		EA8CC0E409A39A5E001379B8 /* psymodel.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = psymodel.c; sourceTree = "<group>"; };
+		EA8CC0E509A39A5E001379B8 /* psymodel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = psymodel.h; sourceTree = "<group>"; };
+		EA8CC0E609A39A5E001379B8 /* quantize.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = quantize.c; sourceTree = "<group>"; };
+		EA8CC0E709A39A5E001379B8 /* quantize.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = quantize.h; sourceTree = "<group>"; };
+		EA8CC0E809A39A5E001379B8 /* quantize_pvt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = quantize_pvt.c; sourceTree = "<group>"; };
+		EA8CC0E909A39A5E001379B8 /* quantize_pvt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = quantize_pvt.h; sourceTree = "<group>"; };
+		EA8CC0EA09A39A5E001379B8 /* reservoir.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = reservoir.c; sourceTree = "<group>"; };
+		EA8CC0EB09A39A5E001379B8 /* reservoir.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = reservoir.h; sourceTree = "<group>"; };
+		EA8CC0EC09A39A5E001379B8 /* set_get.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = set_get.c; sourceTree = "<group>"; };
+		EA8CC0ED09A39A5E001379B8 /* set_get.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = set_get.h; sourceTree = "<group>"; };
+		EA8CC0EE09A39A5E001379B8 /* tables.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tables.c; sourceTree = "<group>"; };
+		EA8CC0EF09A39A5E001379B8 /* tables.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = tables.h; sourceTree = "<group>"; };
+		EA8CC0F009A39A5E001379B8 /* takehiro.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = takehiro.c; sourceTree = "<group>"; };
+		EA8CC0F109A39A5E001379B8 /* util.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = "<group>"; };
+		EA8CC0F209A39A5E001379B8 /* util.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
+		EA8CC0F309A39A5E001379B8 /* vbrquantize.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = vbrquantize.c; sourceTree = "<group>"; };
+		EA8CC0F409A39A5E001379B8 /* vbrquantize.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = vbrquantize.h; sourceTree = "<group>"; };
+		EA8CC0F509A39A5E001379B8 /* VbrTag.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = VbrTag.c; sourceTree = "<group>"; };
+		EA8CC0F609A39A5E001379B8 /* VbrTag.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VbrTag.h; sourceTree = "<group>"; };
+		EA8CC0F709A39A5E001379B8 /* version.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
+		EA8CC0F809A39A5E001379B8 /* version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		EA0A6AD20BB84E32003C87B1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				EA0A6AD40BB84E38003C87B1 /* Cocoa.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		034768DDFF38A45A11DB9C8B /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				8D07F2C80486CC7A007CD1D0 /* LAME.framework */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		0867D691FE84028FC02AAC07 /* LAME */ = {
+			isa = PBXGroup;
+			children = (
+				08FB77ACFE841707C02AAC07 /* Source */,
+				089C1665FE841158C02AAC07 /* Resources */,
+				0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
+				034768DDFF38A45A11DB9C8B /* Products */,
+			);
+			name = LAME;
+			sourceTree = "<group>";
+		};
+		0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				EA0A6AC20BB84D93003C87B1 /* Cocoa.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+		089C1665FE841158C02AAC07 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				8D07F2C70486CC7A007CD1D0 /* Info.plist */,
+				089C1666FE841158C02AAC07 /* InfoPlist.strings */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		08FB77ACFE841707C02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				32BAE0B70371A74B00C91783 /* LAME_Prefix.pch */,
+				EA8CC08709A39A49001379B8 /* lame.h */,
+				EA498C8C0DE5E37B00250F0E /* config.h */,
+				EA8CC0C009A39A5E001379B8 /* libmp3lame */,
+				EA8CC08909A39A55001379B8 /* mpglib */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		EA8CC08909A39A55001379B8 /* mpglib */ = {
+			isa = PBXGroup;
+			children = (
+				EA8CC08A09A39A55001379B8 /* common.c */,
+				EA8CC08B09A39A55001379B8 /* common.h */,
+				EA8CC08C09A39A55001379B8 /* dct64_i386.c */,
+				EA8CC08D09A39A55001379B8 /* dct64_i386.h */,
+				EA8CC08E09A39A55001379B8 /* decode_i386.c */,
+				EA8CC08F09A39A55001379B8 /* decode_i386.h */,
+				EA8CC09109A39A55001379B8 /* huffman.h */,
+				EA8CC09209A39A55001379B8 /* interface.c */,
+				EA8CC09309A39A55001379B8 /* interface.h */,
+				EA8CC09409A39A55001379B8 /* l2tables.h */,
+				EA8CC09509A39A55001379B8 /* layer1.c */,
+				EA8CC09609A39A55001379B8 /* layer1.h */,
+				EA8CC09709A39A55001379B8 /* layer2.c */,
+				EA8CC09809A39A55001379B8 /* layer2.h */,
+				EA8CC09909A39A55001379B8 /* layer3.c */,
+				EA8CC09A09A39A55001379B8 /* layer3.h */,
+				EA8CC09D09A39A55001379B8 /* mpg123.h */,
+				EA8CC09E09A39A55001379B8 /* mpglib.h */,
+				EA8CC0A209A39A55001379B8 /* tabinit.c */,
+				EA8CC0A309A39A55001379B8 /* tabinit.h */,
+			);
+			name = mpglib;
+			path = ../mpglib;
+			sourceTree = "<group>";
+		};
+		EA8CC0C009A39A5E001379B8 /* libmp3lame */ = {
+			isa = PBXGroup;
+			children = (
+				EA8CC0C109A39A5E001379B8 /* bitstream.c */,
+				EA8CC0C209A39A5E001379B8 /* bitstream.h */,
+				EA8CC0C409A39A5E001379B8 /* encoder.c */,
+				EA8CC0C509A39A5E001379B8 /* encoder.h */,
+				EA8CC0C609A39A5E001379B8 /* fft.c */,
+				EA8CC0C709A39A5E001379B8 /* fft.h */,
+				EA8CC0C809A39A5E001379B8 /* gain_analysis.c */,
+				EA8CC0C909A39A5E001379B8 /* gain_analysis.h */,
+				EA8CC0D509A39A5E001379B8 /* id3tag.c */,
+				EA8CC0D609A39A5E001379B8 /* id3tag.h */,
+				EA8CC0D709A39A5E001379B8 /* l3side.h */,
+				EA8CC0D809A39A5E001379B8 /* lame-analysis.h */,
+				EA8CC0D909A39A5E001379B8 /* lame.c */,
+				EA8CC0DA09A39A5E001379B8 /* lame_global_flags.h */,
+				EA8CC0DD09A39A5E001379B8 /* machine.h */,
+				EA8CC0E009A39A5E001379B8 /* mpglib_interface.c */,
+				EA8CC0E109A39A5E001379B8 /* newmdct.c */,
+				EA8CC0E209A39A5E001379B8 /* newmdct.h */,
+				EA8CC0E309A39A5E001379B8 /* presets.c */,
+				EA8CC0E409A39A5E001379B8 /* psymodel.c */,
+				EA8CC0E509A39A5E001379B8 /* psymodel.h */,
+				EA8CC0E609A39A5E001379B8 /* quantize.c */,
+				EA8CC0E709A39A5E001379B8 /* quantize.h */,
+				EA8CC0E809A39A5E001379B8 /* quantize_pvt.c */,
+				EA8CC0E909A39A5E001379B8 /* quantize_pvt.h */,
+				EA8CC0EA09A39A5E001379B8 /* reservoir.c */,
+				EA8CC0EB09A39A5E001379B8 /* reservoir.h */,
+				EA8CC0EC09A39A5E001379B8 /* set_get.c */,
+				EA8CC0ED09A39A5E001379B8 /* set_get.h */,
+				EA8CC0EE09A39A5E001379B8 /* tables.c */,
+				EA8CC0EF09A39A5E001379B8 /* tables.h */,
+				EA8CC0F009A39A5E001379B8 /* takehiro.c */,
+				EA8CC0F109A39A5E001379B8 /* util.c */,
+				EA8CC0F209A39A5E001379B8 /* util.h */,
+				EA8CC0F309A39A5E001379B8 /* vbrquantize.c */,
+				EA8CC0F409A39A5E001379B8 /* vbrquantize.h */,
+				EA8CC0F509A39A5E001379B8 /* VbrTag.c */,
+				EA8CC0F609A39A5E001379B8 /* VbrTag.h */,
+				EA8CC0F709A39A5E001379B8 /* version.c */,
+				EA8CC0F809A39A5E001379B8 /* version.h */,
+			);
+			name = libmp3lame;
+			path = ../libmp3lame;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		8D07F2BD0486CC7A007CD1D0 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D07F2BE0486CC7A007CD1D0 /* LAME_Prefix.pch in Headers */,
+				EA8CC08809A39A49001379B8 /* lame.h in Headers */,
+				EA8CC0A609A39A55001379B8 /* common.h in Headers */,
+				EA8CC0A809A39A55001379B8 /* dct64_i386.h in Headers */,
+				EA8CC0AA09A39A55001379B8 /* decode_i386.h in Headers */,
+				EA8CC0AC09A39A55001379B8 /* huffman.h in Headers */,
+				EA8CC0AE09A39A55001379B8 /* interface.h in Headers */,
+				EA8CC0AF09A39A55001379B8 /* l2tables.h in Headers */,
+				EA8CC0B109A39A55001379B8 /* layer1.h in Headers */,
+				EA8CC0B309A39A55001379B8 /* layer2.h in Headers */,
+				EA8CC0B509A39A55001379B8 /* layer3.h in Headers */,
+				EA8CC0B809A39A55001379B8 /* mpg123.h in Headers */,
+				EA8CC0B909A39A55001379B8 /* mpglib.h in Headers */,
+				EA8CC0BE09A39A55001379B8 /* tabinit.h in Headers */,
+				EA8CC0FA09A39A5E001379B8 /* bitstream.h in Headers */,
+				EA8CC0FD09A39A5E001379B8 /* encoder.h in Headers */,
+				EA8CC0FF09A39A5E001379B8 /* fft.h in Headers */,
+				EA8CC10109A39A5E001379B8 /* gain_analysis.h in Headers */,
+				EA8CC10D09A39A5E001379B8 /* id3tag.h in Headers */,
+				EA8CC10E09A39A5E001379B8 /* l3side.h in Headers */,
+				EA8CC10F09A39A5E001379B8 /* lame-analysis.h in Headers */,
+				EA8CC11109A39A5E001379B8 /* lame_global_flags.h in Headers */,
+				EA8CC11409A39A5E001379B8 /* machine.h in Headers */,
+				EA8CC11909A39A5E001379B8 /* newmdct.h in Headers */,
+				EA8CC11C09A39A5E001379B8 /* psymodel.h in Headers */,
+				EA8CC11E09A39A5E001379B8 /* quantize.h in Headers */,
+				EA8CC12009A39A5E001379B8 /* quantize_pvt.h in Headers */,
+				EA8CC12209A39A5E001379B8 /* reservoir.h in Headers */,
+				EA8CC12409A39A5E001379B8 /* set_get.h in Headers */,
+				EA8CC12609A39A5E001379B8 /* tables.h in Headers */,
+				EA8CC12909A39A5E001379B8 /* util.h in Headers */,
+				EA8CC12B09A39A5E001379B8 /* vbrquantize.h in Headers */,
+				EA8CC12D09A39A5E001379B8 /* VbrTag.h in Headers */,
+				EA8CC12F09A39A5E001379B8 /* version.h in Headers */,
+				EA498C8D0DE5E37B00250F0E /* config.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		8D07F2BC0486CC7A007CD1D0 /* LAME */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "LAME" */;
+			buildPhases = (
+				8D07F2BD0486CC7A007CD1D0 /* Headers */,
+				8D07F2BF0486CC7A007CD1D0 /* Resources */,
+				8D07F2C10486CC7A007CD1D0 /* Sources */,
+				EA0A6AD20BB84E32003C87B1 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = LAME;
+			productInstallPath = "$(HOME)/Library/Frameworks";
+			productName = LAME;
+			productReference = 8D07F2C80486CC7A007CD1D0 /* LAME.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		0867D690FE84028FC02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "LAME" */;
+			compatibilityVersion = "Xcode 2.4";
+			hasScannedForEncodings = 1;
+			mainGroup = 0867D691FE84028FC02AAC07 /* LAME */;
+			productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				8D07F2BC0486CC7A007CD1D0 /* LAME */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		8D07F2BF0486CC7A007CD1D0 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		8D07F2C10486CC7A007CD1D0 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				EA8CC0A509A39A55001379B8 /* common.c in Sources */,
+				EA8CC0A709A39A55001379B8 /* dct64_i386.c in Sources */,
+				EA8CC0A909A39A55001379B8 /* decode_i386.c in Sources */,
+				EA8CC0AD09A39A55001379B8 /* interface.c in Sources */,
+				EA8CC0B009A39A55001379B8 /* layer1.c in Sources */,
+				EA8CC0B209A39A55001379B8 /* layer2.c in Sources */,
+				EA8CC0B409A39A55001379B8 /* layer3.c in Sources */,
+				EA8CC0BD09A39A55001379B8 /* tabinit.c in Sources */,
+				EA8CC0F909A39A5E001379B8 /* bitstream.c in Sources */,
+				EA8CC0FC09A39A5E001379B8 /* encoder.c in Sources */,
+				EA8CC0FE09A39A5E001379B8 /* fft.c in Sources */,
+				EA8CC10009A39A5E001379B8 /* gain_analysis.c in Sources */,
+				EA8CC10C09A39A5E001379B8 /* id3tag.c in Sources */,
+				EA8CC11009A39A5E001379B8 /* lame.c in Sources */,
+				EA8CC11709A39A5E001379B8 /* mpglib_interface.c in Sources */,
+				EA8CC11809A39A5E001379B8 /* newmdct.c in Sources */,
+				EA8CC11A09A39A5E001379B8 /* presets.c in Sources */,
+				EA8CC11B09A39A5E001379B8 /* psymodel.c in Sources */,
+				EA8CC11D09A39A5E001379B8 /* quantize.c in Sources */,
+				EA8CC11F09A39A5E001379B8 /* quantize_pvt.c in Sources */,
+				EA8CC12109A39A5E001379B8 /* reservoir.c in Sources */,
+				EA8CC12309A39A5E001379B8 /* set_get.c in Sources */,
+				EA8CC12509A39A5E001379B8 /* tables.c in Sources */,
+				EA8CC12709A39A5E001379B8 /* takehiro.c in Sources */,
+				EA8CC12809A39A5E001379B8 /* util.c in Sources */,
+				EA8CC12A09A39A5E001379B8 /* vbrquantize.c in Sources */,
+				EA8CC12C09A39A5E001379B8 /* VbrTag.c in Sources */,
+				EA8CC12E09A39A5E001379B8 /* version.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		089C1666FE841158C02AAC07 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				089C1667FE841158C02AAC07 /* English */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		4FADC24308B4156D00ABE55E /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = LAME_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "@executable_path/../Frameworks/";
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				PRODUCT_NAME = LAME;
+				WRAPPER_EXTENSION = framework;
+				ZERO_LINK = NO;
+			};
+			name = Debug;
+		};
+		4FADC24408B4156D00ABE55E /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G5;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = LAME_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "@executable_path/../Frameworks/";
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				PRODUCT_NAME = LAME;
+				WRAPPER_EXTENSION = framework;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		4FADC24708B4156D00ABE55E /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				PREBINDING = NO;
+				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+			};
+			name = Debug;
+		};
+		4FADC24808B4156D00ABE55E /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				PREBINDING = NO;
+				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "LAME" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4FADC24308B4156D00ABE55E /* Debug */,
+				4FADC24408B4156D00ABE55E /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "LAME" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4FADC24708B4156D00ABE55E /* Debug */,
+				4FADC24808B4156D00ABE55E /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+}
diff --git a/macosx/LAME_Prefix.pch b/macosx/LAME_Prefix.pch
new file mode 100644
index 0000000..aa1089d
--- /dev/null
+++ b/macosx/LAME_Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'LAME' target in the 'LAME' project.
+//
+
+#include <Carbon/Carbon.h>
+
+#define HAVE_CONFIG_H
diff --git a/macosx/Makefile.am b/macosx/Makefile.am
new file mode 100644
index 0000000..4ef0d27
--- /dev/null
+++ b/macosx/Makefile.am
@@ -0,0 +1,10 @@
+## $Id: Makefile.am,v 1.2 2008/05/24 08:28:58 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+SUBDIRS = English.lproj LAME.xcodeproj
+
+
+EXTRA_DIST = \
+	Info.plist \
+	LAME_Prefix.pch
diff --git a/macosx/Makefile.in b/macosx/Makefile.in
new file mode 100644
index 0000000..5a12d4b
--- /dev/null
+++ b/macosx/Makefile.in
@@ -0,0 +1,519 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = macosx
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+SUBDIRS = English.lproj LAME.xcodeproj
+EXTRA_DIST = \
+	Info.plist \
+	LAME_Prefix.pch
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  macosx/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  macosx/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/misc/.indent.pro b/misc/.indent.pro
new file mode 100644
index 0000000..51639a1
--- /dev/null
+++ b/misc/.indent.pro
@@ -0,0 +1,32 @@
+// INDENT setup file:
+//	basically the GNU-style of coding
+// 
+--no-blank-lines-after-declarations
+--blank-lines-after-procedures
+--no-blank-lines-after-commas
+--break-before-boolean-operator
+--braces-on-if-line                               // after
+--brace-indent2                                   // 2 <-
+--braces-on-struct-decl-line                      //
+--comment-indentation25                           // 32
+--declaration-comment-column30                    // 1?
+--no-comment-delimiters-on-blank-lines
+--dont-cuddle-else
+--else-endif-column1
+--space-after-cast
+--declaration-indentation8                        // 2
+-ndj                                              // what does this mean?
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4                                   // 2
+--parameter-indentation6                          // 5
+--continue-at-parentheses
+--space-after-procedure-calls
+--procnames-start-lines
+--dont-star-comments
+--leave-optional-blank-lines 
+
+
+--tab-size0
+--line-length80
diff --git a/misc/Lame.vbs b/misc/Lame.vbs
new file mode 100644
index 0000000..4e42002
--- /dev/null
+++ b/misc/Lame.vbs
@@ -0,0 +1,158 @@
+' lame.vbs WindowsScript wrapper v0.5, 06/15/2001
+' $id$
+'
+' *Purpose*
+' Use this WindowsScript to encode WAVs using drag&drop:
+' 0.  make sure you have windows script host v5.1 on your system
+'     (enter 'cscript' in a DOS-Box and compare version number)
+' 1.  adjust the path settings below to fit your needs
+' 2a. put this file somewhere on the desktop
+' 3a. drag one or more wav-files on the icon and watch them being lamed.
+'
+' 2b. start->execute, enter "sendto", drag the script or a link to it in
+'     sendto window (adjust names and icon as you like)
+' 3b. select wave-file(s) and send it via the send-to menu to LAME!
+'
+' You may wish to create copies of this file with different options set.
+'
+' If you would like a GUI: try to enable the HTML UI (see below)
+'
+' Ralf Kempkens, ralf.kempkens@epost.de
+'
+'
+' *History*
+' V0.5 * lame.vbs will automatically decode if the file has a .mp3 extension
+'      * now explicitly refuses to accept folders
+' V0.4 * creates single .mp3 extensions, now ID3 options in HTML interface
+' V0.3 * fixed bug that prevented lame.exe to be located in a path that 
+'        contained a space
+'      * experimental HTML UI support (disabled by default)
+' V0.2 added multiple file support
+' V0.1 initial release
+
+' *** change path to your needs ***
+    path = "D:\Audio\Lame\Lame386\"   '!!! must end with a backslash !!!
+    lame = "lame.exe"
+
+' *** change default options to your needs ***
+    opts = "--preset hifi"
+
+' *** HTML GUI (experimental) ***
+    useGUI = False
+' it set to True, opens file lameGUI.html residing in the same path as lame.exe
+' to choose options. Please look at the example HTML-file for further information.
+
+' no changes needed below this line
+' ##########################################################################
+Dim wsh, args, infile, fs
+title="LAME Script"
+
+' get input files
+Set wsh = WScript.CreateObject("WScript.Shell")
+Set args = WScript.Arguments
+If args.Count = 0 Then
+  MsgBox "LAME mp3 encoder/decoder frontend script." & vbCR & _ 
+	"Please use drag & drop to specify input files.", vbInformation, title
+  WScript.Quit
+End If
+
+' check path
+Set fso = CreateObject("Scripting.FileSystemObject")
+If Not fso.FileExists(path & lame) Then
+  MsgBox "Could not find LAME!" & vbCR & "(looked for '" & path & lame & "')", vbCritical, title
+  WScript.Quit
+End If
+
+' start GUI
+if useGUI Then
+  set ie=WScript.CreateObject("InternetExplorer.Application", "ie_")
+  ie.navigate(path & "lameGUI.html")
+  do 
+    WScript.Sleep 100 
+  loop until ie.ReadyState=4 'wait for GUI
+
+  ie.Width=640
+  ie.Height=600
+  ie.Toolbar=false
+  ie.Statusbar=false
+  ie.visible=true
+
+  'link to GUI
+  set document=ie.document
+  document.forms.lameform.okbutton.onClick=GetRef("okbutton")
+
+  'wait for user pressing ok...
+  do 
+    WScript.Sleep 300 
+  loop until process
+end if
+
+'process files
+For i = 0 To args.Count-1
+  infile = args(i)
+  ' check input file
+  If fso.FolderExists(infile) Then
+    MsgBox "'" & infile & "' is a folder!" & vbCR & _
+	title & " only handles proper files.", vbInformation, title
+  Else
+   If Not fso.FileExists(infile) Then
+      MsgBox "Error opening input-file" & vbCR & "'" & infile & "'", vbCritical , title
+    Else
+    ' run lame
+    If(LCase(getExtension(infile))="mp3") Then 'decode
+      ret = wsh.Run(Chr(34) & path & lame & CHR(34) & " --decode " & _
+          Chr(34) & infile & Chr(34) & Chr(32) & Chr(34) & _
+          getBasename(infile) & ".wav" & Chr(34), 1, True)
+    Else ' encode
+      ret = wsh.Run(Chr(34) & path & lame & CHR(34) & Chr(32) & opts & Chr(32) & _
+          Chr(34) & infile & Chr(34) & Chr(32) & Chr(34) & _
+          getBasename(infile) & ".mp3" & Chr(34), 1, True)
+    End If
+    ' diagnostics
+    Select Case ret
+    Case (0) 'okeydokey
+    Case (-1)
+      MsgBox "LAME aborted by user!", vbExclamation, title
+    Case (1)
+      MsgBox "Error returned by LAME!" & vbCR & "(Check LAME options and input file formats.)" & vbCR & "Used Options: " & opts, vbCritical, title
+    Case Else
+      MsgBox "Received unknown LAME return-code: " & ret, vbCritical, title
+    End Select
+   End If
+  End If
+Next
+
+WScript.Quit
+' *******************************************************************
+' utility functions
+
+Function getBasename(filespec)
+  Dim fso
+  Set fso = CreateObject("Scripting.FileSystemObject")
+  Set f = fso.GetFile(filespec)
+  
+  getBasename = f.ParentFolder & "\" & fso.GetBaseName(filespec)
+End Function
+
+Function getExtension(filespec)
+  Dim fso
+  Set fso = CreateObject("Scripting.FileSystemObject")
+  Set f = fso.GetFile(filespec)
+  
+  getExtension = fso.GetExtensionName(filespec) 
+End Function
+
+' *******************************************************************
+' manage link to IE HTML-interface
+
+sub okbutton
+  'process inputs
+  opts=document.all.lameoptions.Value
+  ie.Quit
+  MsgBox "LAME options:" & vbCR & opts, vbInformation, title
+end sub
+
+sub ie_onQuit
+  process=True
+end sub
+'eof
diff --git a/misc/Makefile.am b/misc/Makefile.am
new file mode 100644
index 0000000..fc13a49
--- /dev/null
+++ b/misc/Makefile.am
@@ -0,0 +1,27 @@
+## $Id: Makefile.am,v 1.10 2002/01/25 11:23:23 aleidinger Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_PROGRAMS = abx ath scalartest
+
+CLEANFILES = $(EXTRA_PROGRAMS)
+
+EXTRA_SCRIPTS = \
+	auenc \
+	lameid3.pl \
+	mugeco.sh \
+	mlame
+
+EXTRA_DIST = \
+	$(EXTRA_SCRIPTS) \
+	Lame.vbs \
+	lameGUI.html \
+	lame4dos.bat \
+	mlame_corr.c
+
+abx_SOURCES = abx.c
+
+ath_SOURCES = ath.c
+
+scalartest_SOURCES = scalartest.c
+
diff --git a/misc/Makefile.in b/misc/Makefile.in
new file mode 100644
index 0000000..8727ac0
--- /dev/null
+++ b/misc/Makefile.in
@@ -0,0 +1,503 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ANSI2KNR = $(top_srcdir)/ansi2knr
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global depcomp
+EXTRA_PROGRAMS = abx$(EXEEXT) ath$(EXEEXT) scalartest$(EXEEXT)
+subdir = misc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am_abx_OBJECTS = abx$U.$(OBJEXT)
+abx_OBJECTS = $(am_abx_OBJECTS)
+abx_LDADD = $(LDADD)
+abx_DEPENDENCIES =
+am_ath_OBJECTS = ath$U.$(OBJEXT)
+ath_OBJECTS = $(am_ath_OBJECTS)
+ath_LDADD = $(LDADD)
+ath_DEPENDENCIES =
+am_scalartest_OBJECTS = scalartest$U.$(OBJEXT)
+scalartest_OBJECTS = $(am_scalartest_OBJECTS)
+scalartest_LDADD = $(LDADD)
+scalartest_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(abx_SOURCES) $(ath_SOURCES) $(scalartest_SOURCES)
+DIST_SOURCES = $(abx_SOURCES) $(ath_SOURCES) $(scalartest_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+CLEANFILES = $(EXTRA_PROGRAMS)
+EXTRA_SCRIPTS = \
+	auenc \
+	lameid3.pl \
+	mugeco.sh \
+	mlame
+
+EXTRA_DIST = \
+	$(EXTRA_SCRIPTS) \
+	Lame.vbs \
+	lameGUI.html \
+	lame4dos.bat \
+	mlame_corr.c
+
+abx_SOURCES = abx.c
+ath_SOURCES = ath.c
+scalartest_SOURCES = scalartest.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  misc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  misc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+abx$(EXEEXT): $(abx_OBJECTS) $(abx_DEPENDENCIES) 
+	@rm -f abx$(EXEEXT)
+	$(LINK) $(abx_OBJECTS) $(abx_LDADD) $(LIBS)
+ath$(EXEEXT): $(ath_OBJECTS) $(ath_DEPENDENCIES) 
+	@rm -f ath$(EXEEXT)
+	$(LINK) $(ath_OBJECTS) $(ath_LDADD) $(LIBS)
+scalartest$(EXEEXT): $(scalartest_OBJECTS) $(scalartest_DEPENDENCIES) 
+	@rm -f scalartest$(EXEEXT)
+	$(LINK) $(scalartest_OBJECTS) $(scalartest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+$(top_srcdir)/ansi2knr:
+	cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
+
+mostlyclean-kr:
+	-test "$U" = "" || rm -f *_.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abx$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalartest$U.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+abx_.c: abx.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abx.c; then echo $(srcdir)/abx.c; else echo abx.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ath_.c: ath.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ath.c; then echo $(srcdir)/ath.c; else echo ath.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+scalartest_.c: scalartest.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scalartest.c; then echo $(srcdir)/scalartest.c; else echo scalartest.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+abx_.$(OBJEXT) abx_.lo ath_.$(OBJEXT) ath_.lo scalartest_.$(OBJEXT) \
+scalartest_.lo : $(ANSI2KNR)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/misc/abx.c b/misc/abx.c
new file mode 100644
index 0000000..c06364d
--- /dev/null
+++ b/misc/abx.c
@@ -0,0 +1,1323 @@
+/*
+ *  Usage: abx original_file test_file
+ *
+ *  Ask you as long as the probability is below the given percentage that
+ *  you recognize differences
+ *
+ *  Example: abx music.wav music.mp3
+ *           abx music.wav music.mp3 --help
+ *
+ *  Note: several 'decoding' utilites must be on the 'right' place
+ *
+ *  Bugs:
+ *      fix path of decoding utilities
+ *      only 16 bit support
+ *      only support of the same sample frequency
+ *      no exact WAV file header analysis
+ *      no mouse or joystick support
+ *      don't uses functionality of ath.c
+ *      only 2 files are comparable
+ *      worse user interface
+ *      quick & dirty hack
+ *      wastes memory
+ *      compile time warnings
+ *      buffer overruns possible
+ *      no dithering if recalcs are necessary
+ *      correlation only done with one channel (2 channels, sum, what is better?)
+ *      lowpass+highpass filtering (300 Hz+2*5 kHz) before delay+amplitude corr
+ *      cross fade at start/stop
+ *      non portable keyboard
+ *      fade out on quit, fade in on start
+ *      level/delay ajustment should be switchable
+ *      pause key missing
+ *      problems with digital silence files (division by 0)
+ *      Gr��e cross corr fenster 2^16...18
+ *      Stellensuche, ab 0*len oder 0.1*len oder 0.25*len, nach Effektiv oder Spitzenwert
+ *      Absturz bei LPAC feeding, warum?
+ *      Als 'B' beim Ratespiel sollte auch '0'...'9' verwendbar sein
+ *      Oder mit einem Filter 300 Hz...3 kHz vorher filtern?
+ *      Multiple encoded differenziertes Signal
+ *      Amplitudenanpassung schaltbar machen?
+ *      Direkt auf der Kommandozeile kodieren:
+ *      abx "test.wav" "!lame -b128 test.wav -"
+ */
+
+// If the program should increase it priority while playing define USE_NICE.
+// Program must be installed SUID root. Decompressing phase is using NORMAL priority
+#define USE_NICE
+
+// Not only increase priority but change to relatime scheduling. Program must be installed SUID root
+#define USE_REALTIME
+
+// Path of the programs: mpg123, mppdec, faad, ac3dec, ogg123, lpac, shorten, MAC, flac
+//#define PATH_OF_EXTERNAL_TOOLS_FOR_UNCOMPRESSING   "/usr/local/bin/"
+#define PATH_OF_EXTERNAL_TOOLS_FOR_UNCOMPRESSING   ""
+
+
+#if defined HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <math.h>
+#include <memory.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#define  MAX  (1<<17)
+
+#if   defined HAVE_SYS_SOUNDCARD_H
+# include <sys/soundcard.h>
+#elif defined HAVE_LINUX_SOUNDCARD_H
+# include <linux/soundcard.h>
+#else
+# include <linux/soundcard.h>         /* stand alone compilable for my tests */
+#endif
+
+#if defined USE_NICE
+# include <sys/resource.h>
+#endif
+#if defined USE_REALTIME
+# include <sched.h>
+#endif
+
+#define  BF           ((freq)/25)
+#define  MAX_LEN      (210 * 44100)
+#define  DMA_SAMPLES  512	    	/* My Linux driver uses a DMA buffer of 65536*16 bit, which is 32768 samples in 16 bit stereo mode */
+
+void  Set_Realtime ( void )
+{
+#if defined USE_REALTIME
+    struct sched_param  sp;
+    int                 ret;
+
+    memset      ( &sp, 0, sizeof(sp) );
+    seteuid     ( 0 );
+    sp.sched_priority = sched_get_priority_min ( SCHED_FIFO );
+    ret               = sched_setscheduler ( 0, SCHED_RR, &sp );
+    seteuid     ( getuid() );
+#endif
+
+#if defined USE_NICE
+    seteuid     ( 0 );
+    setpriority ( PRIO_PROCESS, getpid(), -20 );
+    seteuid     ( getuid() );
+#endif
+}
+
+int verbose = 0;
+
+static struct termios stored_settings;
+
+
+void reset ( void )
+{
+    tcsetattr ( 0, TCSANOW, &stored_settings );
+}
+
+
+void set ( void )
+{
+    struct termios new_settings;
+
+    tcgetattr ( 0, &stored_settings );
+    new_settings = stored_settings;
+
+    new_settings.c_lflag    &= ~ECHO;
+    /* Disable canonical mode, and set buffer size to 1 byte */
+    new_settings.c_lflag    &= ~ICANON;
+    new_settings.c_cc[VTIME] = 0;
+    new_settings.c_cc[VMIN]  = 1;
+
+    tcsetattr(0,TCSANOW,&new_settings);
+    return;
+}
+
+
+int sel ( void )
+{
+    struct timeval  t;
+    fd_set          fd [1];
+    int             ret;
+    unsigned char   c;
+
+    FD_SET (0, fd);
+    t.tv_sec  = 0;
+    t.tv_usec = 0;
+
+    ret = select ( 1, fd, NULL, NULL, &t );
+
+    switch ( ret ) {
+    case  0:
+        return -1;
+    case  1:
+        ret = read (0, &c, 1);
+        return ret == 1  ?  c  :  -1;
+    default:
+        return -2;
+    }
+}
+
+#define FFT_ERR_OK      0               // no error
+#define FFT_ERR_LD      1               // len is not a power of 2
+#define FFT_ERR_MAX     2               // len too large
+
+typedef float   f_t;
+typedef f_t     compl [2];
+compl           root    [MAX >> 1];             // Sinus-/Kosinustabelle
+size_t          shuffle [MAX >> 1] [2];         // Shuffle-Tabelle
+size_t          shuffle_len;
+
+// Bitinversion
+
+size_t  swap ( size_t number, int bits )
+{
+    size_t  ret;
+    for ( ret = 0; bits--; number >>= 1 ) {
+        ret = ret + ret + (number & 1);
+    }
+    return ret;
+}
+
+// Bestimmen des Logarithmus dualis
+
+int  ld ( size_t number )
+{
+    size_t i;
+    for ( i = 0; i < sizeof(size_t)*CHAR_BIT; i++ )
+        if ( ((size_t)1 << i) == number )
+            return i;
+    return -1;
+}
+
+// Die eigentliche FFT
+
+int  fft ( compl* fn, const size_t newlen )
+{
+    static size_t  len  = 0;
+    static int     bits = 0;
+    size_t         i;
+    size_t         j;
+    size_t         k;
+    size_t         p;
+
+    /* Tabellen initialisieren */
+
+    if ( newlen != len ) {
+        len  = newlen;
+
+        if ( (bits=ld(len)) == -1 )
+            return FFT_ERR_LD;
+
+        for ( i = 0; i < len; i++ ) {
+            j = swap ( i, bits );
+            if ( i < j ) {
+                shuffle [shuffle_len] [0] = i;
+                shuffle [shuffle_len] [1] = j;
+                shuffle_len++;
+            }
+        }
+        for ( i = 0; i < (len>>1); i++ ) {
+            double x = (double) swap ( i+i, bits ) * 2*M_PI/len;
+            root [i] [0] = cos (x);
+            root [i] [1] = sin (x);
+        }
+    }
+
+    /* Eigentliche Transformation */
+
+    p = len >> 1;
+    do {
+        f_t*  bp = (f_t*) root;
+        f_t*  si = (f_t*) fn;
+        f_t*  di = (f_t*) fn+p+p;
+
+        do {
+            k = p;
+            do {
+                f_t  mulr = bp[0]*di[0] - bp[1]*di[1];
+                f_t  muli = bp[1]*di[0] + bp[0]*di[1];
+
+                di[0]  = si[0] - mulr;
+                di[1]  = si[1] - muli;
+                si[0] += mulr;
+                si[1] += muli;
+
+                si += 2, di += 2;
+            } while ( --k );
+            si += p+p, di += p+p, bp += 2;
+        } while ( si < &fn[len][0] );
+    } while (p >>= 1);
+
+    /* Bitinversion */
+
+    for ( k = 0; k < shuffle_len; k++ ) {
+        f_t  tmp;
+        i   = shuffle [k] [0];
+        j   = shuffle [k] [1];
+        tmp = fn [i][0]; fn [i][0] = fn [j][0]; fn [j][0] = tmp;
+        tmp = fn [i][1]; fn [i][1] = fn [j][1]; fn [j][1] = tmp;
+    }
+
+    return FFT_ERR_OK;
+}
+
+void  printnumber ( long double x )
+{
+    unsigned  exp = 0;
+
+    if      ( x < 9.999995  ) fprintf ( stderr, "%7.5f",  (double)x );
+    else if ( x < 99.99995  ) fprintf ( stderr, "%7.4f",  (double)x );
+    else if ( x < 999.9995  ) fprintf ( stderr, "%7.3f",  (double)x );
+    else if ( x < 9999.995  ) fprintf ( stderr, "%7.2f",  (double)x );
+    else if ( x < 99999.95  ) fprintf ( stderr, "%7.1f",  (double)x );
+    else if ( x < 999999.5  ) fprintf ( stderr, "%6.0f.", (double)x );
+    else if ( x < 9999999.5 ) fprintf ( stderr, "%7.0f",  (double)x );
+    else if ( x < 9.9995e9  ) {
+        while ( x >= 9.9995 ) exp++  , x /= 10;
+        fprintf ( stderr, "%5.3fe%01u", (double)x, exp );
+    } else if ( x < 9.995e99 ) {
+        while ( x >= 9.5e6  ) exp+=6 , x /= 1.e6;
+        while ( x >= 9.995  ) exp++  , x /= 10;
+        fprintf ( stderr, "%4.2fe%02u", (double)x, exp );
+    } else if ( x < 9.95e999L ) {
+        while ( x >= 9.5e18 ) exp+=18, x /= 1.e18;
+        while ( x >= 9.95   ) exp++  , x /= 10;
+        fprintf ( stderr, "%3.1fe%03u", (double)x, exp );
+    } else {
+        while ( x >= 9.5e48 ) exp+=48, x /= 1.e48;
+        while ( x >= 9.5    ) exp++  , x /= 10;
+        fprintf ( stderr, "%1.0f.e%04u", (double)x, exp );
+    }
+}
+
+double logdual ( long double x )
+{
+    unsigned exp = 0;
+
+    while ( x >= 18446744073709551616. )
+        x /= 18446744073709551616., exp += 64;
+    while ( x >= 256. )
+        x /= 256., exp += 8;
+    while ( x >= 2. )
+        x /= 2., exp += 1;
+    return exp + log (x)/log(2);
+}
+
+int  random_number ( void )
+{
+    struct timeval  t;
+    unsigned long   val;
+
+    gettimeofday ( &t, NULL );
+
+    val  = t.tv_sec ^ t.tv_usec ^ rand();
+    val ^= val >> 16;
+    val ^= val >>  8;
+    val ^= val >>  4;
+    val ^= val >>  2;
+    val ^= val >>  1;
+
+    return val & 1;
+}
+
+long double  prob ( int last, int total )
+{
+    long double  sum = 0.;
+    long double  tmp = 1.;
+    int          i;
+    int          j   = total;
+
+    if ( 2*last == total )
+        return 1.;
+    if ( 2*last > total )
+        last = total - last;
+
+    for ( i = 0; i <= last; i++ ) {
+        sum += tmp;
+        tmp  = tmp * (total-i) / (1+i);
+        while ( j > 0  &&  tmp > 1 )
+            j--, sum *= 0.5, tmp *= 0.5;
+    }
+    while ( j > 0 )
+        j--, sum *= 0.5;
+
+    return 2.*sum;
+}
+
+
+void  eval ( int right )
+{
+    static int   count = 0;
+    static int   okay  = 0;
+    long double  val;
+
+    count ++;
+    okay  += right;
+
+    val    = 1.L / prob ( okay, count );
+
+    fprintf (stderr, "   %s %5u/%-5u ", right ? "OK" : "- " , okay, count );
+    printnumber (val);
+    if ( count > 1 )
+        fprintf (stderr, "   %4.2f bit", 0.01 * (int)(logdual(val) / (count-1) * 100.) );
+    fprintf ( stderr, "\n" );
+}
+
+
+typedef signed short  sample_t;
+typedef sample_t      mono_t   [1];
+typedef sample_t      stereo_t [2];
+typedef struct {
+    unsigned long       n;
+    long double         x;
+    long double         x2;
+    long double         y;
+    long double         y2;
+    long double         xy;
+} korr_t;
+
+
+void  analyze_stereo ( const stereo_t* p1, const stereo_t* p2, size_t len, korr_t* const k )
+{
+    long double  _x = 0, _x2 = 0, _y = 0, _y2 = 0, _xy = 0;
+    double       t1;
+    double       t2;
+
+    k -> n  += 2*len;
+
+    for ( ; len--; p1++, p2++ ) {
+        _x  += (t1 = (*p1)[0]); _x2 += t1 * t1;
+        _y  += (t2 = (*p2)[0]); _y2 += t2 * t2;
+                                _xy += t1 * t2;
+        _x  += (t1 = (*p1)[1]); _x2 += t1 * t1;
+        _y  += (t2 = (*p2)[1]); _y2 += t2 * t2;
+                                _xy += t1 * t2;
+    }
+
+    k -> x  += _x ;
+    k -> x2 += _x2;
+    k -> y  += _y ;
+    k -> y2 += _y2;
+    k -> xy += _xy;
+}
+
+int  sgn ( double x )
+{
+    if ( x == 0 ) return 0;
+    if ( x <  0 ) return -1;
+    return +1;
+}
+
+long double  report ( const korr_t* const k )
+{
+    long double  r;
+    long double  sx;
+    long double  sy;
+    long double  x;
+    long double  y;
+    long double  b;
+
+    r  = (k->x2*k->n - k->x*k->x) * (k->y2*k->n - k->y*k->y);
+    r  = r  > 0.l  ?  (k->xy*k->n - k->x*k->y) / sqrt (r)  :  1.l;
+    sx = k->n > 1  ?  sqrt ( (k->x2 - k->x*k->x/k->n) / (k->n - 1) )  :  0.l;
+    sy = k->n > 1  ?  sqrt ( (k->y2 - k->y*k->y/k->n) / (k->n - 1) )  :  0.l;
+    x  = k->n > 0  ?  k->x/k->n  :  0.l;
+    y  = k->n > 0  ?  k->y/k->n  :  0.l;
+
+    b  = sx != 0   ?  sy/sx * sgn(r)  :  0.l;
+    if (verbose)
+        fprintf ( stderr, "r=%Lf  sx=%Lf  sy=%Lf  x=%Lf  y=%Lf  b=%Lf\n", r, sx, sy, x, y, b );
+    return b;
+}
+
+
+/* Input: an unsigned short n.
+ * Output: the swapped bytes of n if the arch is big-endian or n itself
+ *         if the arch is little-endian.
+ * Comment: should be replaced latter with a better solution than this
+ *          home-brewed hack (rbrito). The name should be better also.
+ */
+inline unsigned short be16_le(unsigned short n)
+{
+#ifdef _WORDS_BIGENDIAN
+     return (n << 8) | (n >> 8);
+#else
+     return n;
+#endif
+}
+
+
+int feed ( int fd, const stereo_t* p, int len )
+{
+     int i;
+     stereo_t tmp[30000];	/* An arbitrary size--to be changed latter */
+
+     if (len > sizeof(tmp)/sizeof(*tmp))
+	  len = sizeof(tmp)/sizeof(*tmp);
+
+     for (i = 0; i < len; i++) {
+	  tmp[i][0] = be16_le(p[i][0]);
+	  tmp[i][1] = be16_le(p[i][1]);
+     }
+
+     write ( fd, tmp, sizeof(stereo_t) * len );
+     return len;
+}
+
+
+short  round ( double f )
+{
+    long  x = (long) floor ( f + 0.5 );
+    return x == (short)x  ?  (short)x  :  (short) ((x >> 31) ^ 0x7FFF);
+}
+
+
+int  feed2 ( int fd, const stereo_t* p1, const stereo_t* p2, int len )
+{
+     stereo_t  tmp [30000];   /* An arbitrary size, hope that no overruns occure */
+     int       i;
+
+     if (len > sizeof(tmp)/sizeof(*tmp))
+	  len = sizeof(tmp)/sizeof(*tmp);
+     for ( i = 0; i < len; i++ ) {
+	  double f = cos ( M_PI/2*i/len );
+	  f *= f;
+	  tmp [i] [0] = be16_le(round ( p1 [i] [0] * f + p2 [i] [0] * (1. - f) ));
+	  tmp [i] [1] = be16_le(round ( p1 [i] [1] * f + p2 [i] [1] * (1. - f) ));
+     }
+
+     write ( fd, tmp, sizeof(stereo_t) * len );
+     return len;
+}
+
+
+int feedfac ( int fd, const stereo_t* p1, const stereo_t* p2, int len, double fac1, double fac2 )
+{
+     stereo_t  tmp [30000];   /* An arbitrary size, hope that no overruns occure */
+     int       i;
+
+     if (len > sizeof(tmp)/sizeof(*tmp))
+	  len = sizeof(tmp)/sizeof(*tmp);
+     for ( i = 0; i < len; i++ ) {
+	  tmp [i] [0] = be16_le(round ( p1 [i] [0] * fac1 + p2 [i] [0] * fac2 ));
+	  tmp [i] [1] = be16_le(round ( p1 [i] [1] * fac1 + p2 [i] [1] * fac2 ));
+    }
+
+    write ( fd, tmp, sizeof(stereo_t) * len );
+    return len;
+}
+
+
+void setup ( int fdd, int samples, long freq )
+{
+    int status, org, arg;
+
+    // Nach vorn verschoben
+    if ( -1 == (status = ioctl (fdd, SOUND_PCM_SYNC, 0)) )
+        perror ("SOUND_PCM_SYNC ioctl failed");
+
+    org = arg = 2;
+    if ( -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_CHANNELS, &arg)) )
+        perror ("SOUND_PCM_WRITE_CHANNELS ioctl failed");
+    if (arg != org)
+        perror ("unable to set number of channels");
+    fprintf (stderr, "%1u*", arg);
+
+    org = arg = AFMT_S16_LE;
+    if ( -1 == ioctl (fdd, SNDCTL_DSP_SETFMT, &arg) )
+        perror ("SNDCTL_DSP_SETFMT ioctl failed");
+    if ((arg & org) == 0)
+        perror ("unable to set data format");
+
+    org = arg = freq;
+    if ( -1 == (status = ioctl (fdd, SNDCTL_DSP_SPEED, &arg)) )
+        perror ("SNDCTL_DSP_SPEED ioctl failed");
+    fprintf (stderr, "%5u Hz*%.3f sec\n", arg, (double)samples/arg );
+
+}
+
+
+void Message ( const char* s, size_t index, long freq, size_t start, size_t stop )
+{
+    unsigned long  norm_index = 100lu * index / freq;
+    unsigned long  norm_start = 100lu * start / freq;
+    unsigned long  norm_stop  = 100lu * stop  / freq;
+
+    fprintf ( stderr, "\rListening %s  %2lu:%02lu.%02lu  (%1lu:%02lu.%02lu...%1lu:%02lu.%02lu)%*.*s\rListening %s",
+              s,
+              norm_index / 6000, norm_index / 100 % 60, norm_index % 100,
+              norm_start / 6000, norm_start / 100 % 60, norm_start % 100,
+              norm_stop  / 6000, norm_stop  / 100 % 60, norm_stop  % 100,
+              36 - (int)strlen(s), 36 - (int)strlen(s), "",
+              s );
+
+    fflush  ( stderr );
+}
+
+
+size_t  calc_true_index ( size_t index, size_t start, size_t stop )
+{
+    if ( start >= stop )
+        return start;
+    while ( index - start < DMA_SAMPLES )
+        index += stop - start;
+    return index - DMA_SAMPLES;
+}
+
+
+void testing ( const stereo_t* A, const stereo_t* B, size_t len, long freq )
+{
+    int     c;
+    int     fd    = open ( "/dev/dsp", O_WRONLY );
+    int     rnd   = random_number ();   /* Auswahl von X */
+    int     state = 0;                  /* derzeitiger F�ttungsmodus */
+    float   fac1  = 0.5;
+    float   fac2  = 0.5;
+    size_t  start = 0;
+    size_t  stop  = len;
+    size_t  index = start;                  /* derzeitiger Offset auf den Audiostr�men */
+    char    message [80] = "A  ";
+
+    setup ( fd, len, freq );
+
+    while ( 1 ) {
+        c = sel ();
+        if ( c == 27 )
+            c = sel () + 0x100;
+
+        switch ( c ) {
+        case 'A' :
+        case 'a' :
+            strcpy ( message, "A  " );
+            if ( state != 0 )
+                state = 2;
+            break;
+
+        case 0x100+'0' :
+        case '0' :
+        case 'B' :
+        case 'b' :
+            strcpy ( message, "  B" );
+            if ( state != 1 )
+                state = 3;
+            break;
+
+        case 'X' :
+        case 'x' :
+            strcpy ( message, " X " );
+            if ( state != rnd )
+                state = rnd + 2;
+            break;
+
+        case 'm' :
+            state = 8;
+            break;
+
+        case 'M' :
+            state = (state & 1) + 4;
+            break;
+
+        case 'x'&0x1F:
+            state = (state & 1) + 6;
+            break;
+
+        case ' ':
+            start = 0;
+            stop  = len;
+            break;
+
+        case 'o'  :
+	    start = calc_true_index ( index, start, stop);
+            break;
+        case 'p'  :
+	    stop  = calc_true_index ( index, start, stop);
+            break;
+        case 'h'  :
+            if ( start > freq/100 )
+                start -= freq/100;
+            else
+                start = 0;
+            index = start;
+            continue;
+        case 'j'  :
+            if ( start < stop-freq/100 )
+                start += freq/100;
+            else
+                start = stop;
+            index = start;
+            continue;
+        case 'k'  :
+            if ( stop > start+freq/100 )
+                stop -= freq/100;
+            else
+                stop = start;
+            continue;
+        case 'l'  :
+            if ( stop < len-freq/100 )
+                stop += freq/100;
+            else
+                stop = len;
+            continue;
+        case '\n':
+            index = start;
+            continue;
+
+        case 'D'+0x100:
+            strcpy ( message, "Difference (+40 dB)" );
+            state = 9;
+            fac1  = -100.;
+            fac2  = +100.;
+            break;
+
+        case 'd'+0x100:
+            strcpy ( message, "Difference (+30 dB)" );
+            state = 9;
+            fac1  = -32.;
+            fac2  = +32.;
+            break;
+
+        case 'D' & 0x1F :
+            strcpy ( message, "Difference (+20 dB)" );
+            state = 9;
+            fac1  = -10.;
+            fac2  = +10.;
+            break;
+
+        case 'D' :
+            strcpy ( message, "Difference (+10 dB)" );
+            state = 9;
+            fac1  = -3.;
+            fac2  = +3.;
+            break;
+
+        case 'd' :
+            strcpy ( message, "Difference (  0 dB)" );
+            state = 9;
+            fac1  = -1.;
+            fac2  = +1.;
+            break;
+
+        case 0x100+'1' :
+        case 0x100+'2' :
+        case 0x100+'3' :
+        case 0x100+'4' :
+        case 0x100+'5' :
+        case 0x100+'6' :
+        case 0x100+'7' :
+        case 0x100+'8' :
+        case 0x100+'9' :
+            sprintf ( message, "  B (Errors -%c dB)", (char)c );
+            state = 9;
+            fac2  = pow (10., -0.05*(c-0x100-'0') );
+            fac1  = 1. - fac2;
+            break;
+
+        case '1' :
+        case '2' :
+        case '3' :
+        case '4' :
+        case '5' :
+        case '6' :
+        case '7' :
+        case '8' :
+        case '9' :
+            sprintf ( message, "  B (Errors +%c dB)", c );
+            state = 9;
+            fac2  = pow (10., 0.05*(c-'0') );
+            fac1  = 1. - fac2;
+            break;
+
+        case 'A' & 0x1F:
+            fprintf (stderr, "   Vote for X:=A" );
+            eval ( rnd == 0 );
+            rnd   = random_number ();
+            if ( state == 6  &&  state == 7 )
+                state = 6 + rnd;
+            else if ( state != rnd )
+                state = rnd + 2;
+            strcpy ( message," X " );
+            break;
+
+        case 'B' & 0x1F:
+            fprintf (stderr, "   Vote for X:=B" );
+            eval ( rnd == 1 );
+            rnd   = random_number ();
+            if ( state == 6  &&  state == 7 )
+                state = 6 + rnd;
+            else if ( state != rnd )
+                state = rnd + 2;
+            strcpy ( message," X " );
+            break;
+
+        case -1:
+            break;
+
+        default:
+            fprintf (stderr, "\a" );
+            break;
+
+        case 'Q':
+        case 'q':
+            fprintf ( stderr, "\n%-79.79s\r", "Quit program" );
+            close (fd);
+            fprintf ( stderr, "\n\n");
+            return;
+        }
+
+        switch (state) {
+        case 0: /* A */
+            if ( index + BF >= stop )
+                index += feed (fd, A+index, stop-index );
+            else
+                index += feed (fd, A+index, BF );
+            break;
+
+        case 1: /* B */
+            if ( index + BF >= stop )
+                index += feed (fd, B+index, stop-index );
+            else
+                index += feed (fd, B+index, BF );
+            break;
+
+        case 2: /* B => A */
+            if ( index + BF >= stop )
+                index += feed2 (fd, B+index, A+index, stop-index );
+            else
+                index += feed2 (fd, B+index, A+index, BF );
+            state = 0;
+            break;
+
+        case 3: /* A => B */
+            if ( index + BF >= stop )
+                index += feed2 (fd, A+index, B+index, stop-index );
+            else
+                index += feed2 (fd, A+index, B+index, BF );
+            state = 1;
+            break;
+
+        case 4: /* A */
+            strcpy ( message, "A  " );
+            if ( index + BF >= stop )
+                index += feed (fd, A+index, stop-index ),
+                state++;
+            else
+                index += feed (fd, A+index, BF );
+            break;
+
+        case 5: /* B */
+            strcpy ( message, "  B" );
+            if ( index + BF >= stop )
+                index += feed (fd, B+index, stop-index ),
+                state--;
+            else
+                index += feed (fd, B+index, BF );
+            break;
+
+        case 6: /* X */
+            strcpy ( message, " X " );
+            if ( index + BF >= stop )
+                index += feed (fd, (rnd ? B : A)+index, stop-index ),
+                state++;
+            else
+                index += feed (fd, (rnd ? B : A)+index, BF );
+            break;
+
+        case 7: /* !X */
+            strcpy ( message, "!X " );
+            if ( index + BF >= stop )
+                index += feed (fd, (rnd ? A : B)+index, stop-index ),
+                state--;
+            else
+                index += feed (fd, (rnd ? A : B)+index, BF );
+            break;
+
+        case 8:
+            if ( index + BF/2 >= stop )
+                index += feed2 (fd, A+index, B+index, stop-index );
+            else
+                index += feed2 (fd, A+index, B+index, BF/2 );
+            Message ( "  B", index, freq, start, stop );
+            if ( index + BF >= stop )
+                index += feed (fd, B+index, stop-index );
+            else
+                index += feed (fd, B+index, BF );
+            if ( index + BF/2 >= stop )
+                index += feed2 (fd, B+index, A+index, stop-index );
+            else
+                index += feed2 (fd, B+index, A+index, BF/2 );
+            Message ( "A  ", index, freq, start, stop );
+            if ( index + BF >= stop )
+                index += feed (fd, A+index, stop-index );
+            else
+                index += feed (fd, A+index, BF );
+            break;
+
+        case 9: /* Liko */
+            if ( index + BF >= stop )
+                index += feedfac (fd, A+index, B+index, stop-index, fac1, fac2 );
+            else
+                index += feedfac (fd, A+index, B+index, BF        , fac1, fac2 );
+            break;
+
+        default:
+            assert (0);
+        }
+
+        if (index >= stop)
+            index = start;
+        Message ( message, calc_true_index ( index, start, stop), freq, start, stop );
+    }
+}
+
+
+int  has_ext ( const char* name, const char* ext )
+{
+    if ( strlen (name) < strlen (ext) )
+        return 0;
+    name += strlen (name) - strlen (ext);
+    return strcasecmp (name, ext)  ?  0  :  1;
+}
+
+
+typedef struct {
+    const char* const  extention;
+    const char* const  command;
+} decoder_t;
+
+
+#define REDIR     " 2> /dev/null"
+#define STDOUT    "/dev/fd/1"
+#define PATH      PATH_OF_EXTERNAL_TOOLS_FOR_UNCOMPRESSING
+
+const decoder_t  decoder [] = {
+    { ".mp1"    , PATH"mpg123 -w - %s"                         REDIR },  // MPEG Layer I         : www.iis.fhg.de, www.mpeg.org
+    { ".mp2"    , PATH"mpg123 -w - %s"                         REDIR },  // MPEG Layer II        : www.iis.fhg.de, www.uq.net.au/~zzmcheng, www.mpeg.org
+    { ".mp3"    , PATH"mpg123 -w - %s"                         REDIR },  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org, www.mpeg.org
+    { ".mp3pro" , PATH"mpg123 -w - %s"                         REDIR },  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org, www.mpeg.org
+    { ".mpt"    , PATH"mpg123 -w - %s"                         REDIR },  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org, www.mpeg.org
+    { ".mpp"    , PATH"mppdec %s -"                            REDIR },  // MPEGplus             : www.stud.uni-hannover.de/user/73884
+    { ".mpc"    , PATH"mppdec %s -"                            REDIR },  // MPEGplus             : www.stud.uni-hannover.de/user/73884
+    { ".mp+"    , PATH"mppdec %s -"                            REDIR },  // MPEGplus             : www.stud.uni-hannover.de/user/73884
+    { ".aac"    , PATH"faad -t.wav -w %s"                      REDIR },  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
+    { "aac.lqt" , PATH"faad -t.wav -w %s"                      REDIR },  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
+    { ".ac3"    , PATH"ac3dec %s"                              REDIR },  // Dolby AC3            : www.att.com
+    { "ac3.lqt" , PATH"ac3dec %s"                              REDIR },  // Dolby AC3            : www.att.com
+    { ".ogg"    , PATH"ogg123 -d wav -o file:"STDOUT" %s"      REDIR },  // Ogg Vorbis           : www.xiph.org/ogg/vorbis/index.html
+    { ".pac"    , PATH"lpac -x %s "STDOUT                      REDIR },  // Lossless predictive Audio Compression: www-ft.ee.tu-berlin.de/~liebchen/lpac.html (liebchen@ft.ee.tu-berlin.de)
+    { ".shn"    , PATH"shorten -x < %s"                        REDIR },  // Shorten              : shnutils.freeshell.org, www.softsound.com/Shorten.html (shnutils@freeshell.org, shorten@softsound.com)
+    { ".wav.gz" , PATH"gzip  -d < %s | sox -twav - -twav -sw -"REDIR },  // gziped WAV
+    { ".wav.sz" , PATH"szip  -d < %s | sox -twav - -twav -sw -"REDIR },  // sziped WAV
+    { ".wav.sz2", PATH"szip2 -d < %s | sox -twav - -twav -sw -"REDIR },  // sziped WAV
+    { ".raw"    , PATH"sox -r44100 -sw -c2 -traw %s -twav -sw -"REDIR },  // raw files are treated as CD like audio
+    { ".cdr"    , PATH"sox -r44100 -sw -c2 -traw %s -twav -sw -"REDIR },  // CD-DA files are treated as CD like audio, no preemphasis info available
+    { ".rm"     , "echo %s '???'"                              REDIR },  // Real Audio           : www.real.com
+    { ".epc"    , "echo %s '???'"                              REDIR },  // ePAC                 : www.audioveda.com, www.lucent.com/ldr
+    { ".mov"    , "echo %s '???'"                              REDIR },  // QDesign Music 2      : www.qdesign.com
+    { ".vqf"    , "echo %s '???'"                              REDIR },  // TwinVQ               : www.yamaha-xg.com/english/xg/SoundVQ, www.vqf.com, sound.splab.ecl.ntt.co.jp/twinvq-e
+    { ".wma"    , "echo %s '???'"                              REDIR },  // Microsoft Media Audio: www.windowsmedia.com, www.microsoft.com/windows/windowsmedia
+    { ".flac"   , PATH"flac -c -d %s"                          REDIR },  // Free Lossless Audio Coder: flac.sourceforge.net/
+    { ".fla"    , PATH"flac -c -d %s"                          REDIR },  // Free Lossless Audio Coder: flac.sourceforge.net/
+    { ".ape"    , "( "PATH"MAC %s _._.wav -d > /dev/null; cat _._.wav; rm _._.wav )"  REDIR },  // Monkey's Audio Codec : www.monkeysaudio.com (email@monkeysaudio.com)
+    { ".rka"    , "( "PATH"rkau %s _._.wav   > /dev/null; cat _._.wav; rm _._.wav )"  REDIR },  // RK Audio:
+    { ".rkau"   , "( "PATH"rkau %s _._.wav   > /dev/null; cat _._.wav; rm _._.wav )"  REDIR },  // RK Audio:
+    { ".mod"    , PATH"xmp -b16 -c -f44100 --stereo -o- %s | sox -r44100 -sw -c2 -traw - -twav -sw -"
+                                                               REDIR },  // Amiga's Music on Disk:
+    { ""        , PATH"sox %s -twav -sw -"                     REDIR },  // Rest, may be sox can handle it
+};
+
+#undef REDIR
+#undef STDOUT
+#undef PATH
+
+
+int  readwave ( stereo_t* buff, size_t maxlen, const char* name, size_t* len )
+{
+    char*           command = malloc (2*strlen(name) + 512);
+    char*           name_q  = malloc (2*strlen(name) + 128);
+    unsigned short  header [22];
+    FILE*           fp;
+    size_t          i;
+    size_t          j;
+
+    // The *nice* shell quoting
+    i = j = 0;
+    if ( name[i] == '-' )
+        name_q[j++] = '.',
+        name_q[j++] = '/';
+
+    while (name[i]) {
+        if ( !isalnum (name[i]) && name[i]!='-' && name[i]!='_' && name[i]!='.' )
+            name_q[j++] = '\\';
+        name_q[j++] = name[i++];
+    }
+    name_q[j] = '\0';
+
+    fprintf (stderr, "Reading %s", name );
+    for ( i = 0; i < sizeof(decoder)/sizeof(*decoder); i++ )
+        if ( has_ext (name, decoder[i].extention) ) {
+            sprintf ( command, decoder[i].command, name_q );
+            break;
+        }
+
+    free (name_q);
+    if ( (fp = popen (command, "r")) == NULL ) {
+        fprintf (stderr, "Can't exec:\n%s\n", command );
+        exit (1);
+    }
+    free (command);
+
+    fprintf (stderr, " ..." );
+    fread ( header, sizeof(*header), sizeof(header)/sizeof(*header), fp );
+
+    switch (be16_le(header[11])) {
+        case 2:
+            *len = fread ( buff, sizeof(stereo_t), maxlen, fp );
+	    for (i = 0; i < *len; i ++) {
+		 buff[i][0] = be16_le(buff[i][0]);
+		 buff[i][1] = be16_le(buff[i][1]);
+	    }
+            break;
+        case 1:
+            *len = fread ( buff, sizeof(sample_t), maxlen, fp );
+            for ( i = *len; i-- > 0; )
+                buff[i][0] = buff[i][1] = ((sample_t*)buff) [i];
+            break;
+        case 0:
+            fprintf (stderr, "\b\b\b\b, Standard Open Source Bug detected, try murksaround ..." );
+            *len = fread ( buff, sizeof(stereo_t), maxlen, fp );
+            header[11] =     2;
+            header[12] = 65534;  /* use that of the other channel */
+            break;
+        default:
+            fprintf (stderr, "Only 1 or 2 channels are supported, not %u\n", header[11] );
+            pclose (fp);
+            return -1;
+    }
+    pclose ( fp );
+    fprintf (stderr, "\n" );
+    return be16_le(header[12]) ? be16_le(header[12]) : 65534;
+}
+
+
+double  cross_analyze ( const stereo_t* p1, const stereo_t *p2, size_t len )
+{
+    float   P1 [MAX] [2];
+    float   P2 [MAX] [2];
+    int     i;
+    int     maxindex;
+    double  sum1;
+    double  sum2;
+    double  max;
+    double  y1;
+    double  y2;
+    double  y3;
+    double  yo;
+    double  xo;
+    double  tmp;
+    double  tmp1;
+    double  tmp2;
+    int     ret = 0;
+    int     cnt = 5;
+
+    // Calculating effective voltage
+    sum1 = sum2 = 0.;
+    for ( i = 0; i < len; i++ ) {
+        sum1 += (double)p1[i][0] * p1[i][0];
+        sum2 += (double)p2[i][0] * p2[i][0];
+    }
+    sum1 = sqrt ( sum1/len );
+    sum2 = sqrt ( sum2/len );
+
+    // Searching beginning of signal (not stable for pathological signals)
+    for ( i = 0; i < len; i++ )
+        if ( abs (p1[i][0]) >= sum1  &&  abs (p2[i][0]) >= sum2 )
+            break;
+    p1  += i;
+    p2  += i;
+    len -= i;
+
+    if ( len <= MAX )
+        return 0;
+
+    // Filling arrays for FFT
+    do {
+        sum1 = sum2 = 0.;
+        for ( i = 0; i < MAX; i++ ) {
+#ifdef USEDIFF
+            tmp1  = p1 [i][0] - p1 [i+1][0];
+            tmp2  = p2 [i+ret][0] - p2 [i+ret+1][0];
+#else
+            tmp1  = p1 [i][0];
+            tmp2  = p2 [i+ret][0];
+#endif
+            sum1 += tmp1*tmp1;
+            sum2 += tmp2*tmp2;
+            P1 [i][0] = tmp1;
+            P2 [i][0] = tmp2;
+            P1 [i][1] = 0.;
+            P2 [i][1] = 0.;
+        }
+
+        fft (P1, MAX);
+        fft (P2, MAX);
+
+        for ( i = 0; i < MAX; i++ ) {
+            double  a0 = P1 [i][0];
+            double  a1 = P1 [i][1];
+            double  b0 = P2 [(MAX-i)&(MAX-1)][0];
+            double  b1 = P2 [(MAX-i)&(MAX-1)][1];
+            P1 [i][0] = a0*b0 - a1*b1;
+            P1 [i][1] = a0*b1 + a1*b0;
+        }
+
+        fft (P1, MAX);
+
+        max = P1 [maxindex = 0][0];
+        for ( i = 1; i < MAX; i++ )
+            if ( P1[i][0] > max )
+                max = P1 [maxindex = i][0];
+
+        y2 = P1 [ maxindex           ][0];
+        y1 = P1 [(maxindex-1)&(MAX-1)][0] - y2;
+        y3 = P1 [(maxindex+1)&(MAX-1)][0] - y2;
+
+        xo = 0.5 * (y1-y3) / (y1+y3);
+        yo = 0.5 * ( (y1+y3)*xo + (y3-y1) ) * xo;
+
+        if (maxindex > MAX/2 )
+            maxindex -= MAX;
+
+        ret += maxindex;
+        tmp = 100./MAX/sqrt(sum1*sum2);
+        if (verbose)
+            printf ( "[%5d]%8.4f  [%5d]%8.4f  [%5d]%8.4f  [%10.4f]%8.4f\n",
+                     ret- 1, (y1+y2)*tmp,
+                     ret   ,     y2 *tmp,
+                     ret+ 1, (y3+y2)*tmp,
+                     ret+xo, (yo+y2)*tmp );
+
+    } while ( maxindex  &&  cnt-- );
+
+    return ret + xo;
+}
+
+
+short  to_short ( int x )
+{
+    return x == (short)x  ?  (short)x  :  (short) ((x >> 31) ^ 0x7FFF);
+}
+
+
+void  DC_cancel ( stereo_t* p, size_t len )
+{
+    double  sum1 = 0;
+    double  sum2 = 0;
+    size_t  i;
+    int     diff1;
+    int     diff2;
+
+    for (i = 0; i < len; i++ ) {
+        sum1 += p[i][0];
+        sum2 += p[i][1];
+    }
+    if ( fabs(sum1) < len  &&  fabs(sum2) < len )
+        return;
+
+    diff1 = round ( sum1 / len );
+    diff2 = round ( sum2 / len );
+    if (verbose)
+        fprintf (stderr, "Removing DC (left=%d, right=%d)\n", diff1, diff2 );
+
+    for (i = 0; i < len; i++ ) {
+        p[i][0] = to_short ( p[i][0] - diff1);
+        p[i][1] = to_short ( p[i][1] - diff2);
+    }
+}
+
+void  multiply ( char c, stereo_t* p, size_t len, double fact )
+{
+    size_t  i;
+
+    if ( fact == 1. )
+        return;
+    if (verbose)
+        fprintf (stderr, "Multiplying %c by %7.5f\n", c, fact );
+
+    for (i = 0; i < len; i++ ) {
+        p[i][0] = to_short ( p[i][0] * fact );
+        p[i][1] = to_short ( p[i][1] * fact );
+    }
+}
+
+
+int  maximum ( stereo_t* p, size_t len )
+{
+    int     max = 0;
+    size_t  i;
+
+    for (i = 0; i < len; i++ ) {
+        if (abs(p[i][0]) > max) max = abs(p[i][0]);
+        if (abs(p[i][1]) > max) max = abs(p[i][1]);
+    }
+    return max;
+}
+
+
+void  usage ( void )
+{
+    fprintf ( stderr,
+        "usage:  abx [-v] File_A File_B\n"
+        "\n"
+        "File_A and File_B loaded and played. File_A should be the better/reference\n"
+        "file, File_B the other. You can press the following keys:\n"
+        "\n"
+        "  a/A:    Listen to File A\n"
+        "  b/B:    Listen to File B\n"
+        "  x/X:    Listen to the randomly selected File X, which is A or B\n"
+        "  Ctrl-A: You vote for X=A\n"
+        "  Ctrl-B: You vote for X=B\n"
+        "  m:      Alternating playing A and B. Fast switching\n"
+        "  M:      Alternating playing A and B. Slow switching\n"
+        "  d/D/Ctrl-D/Alt-d/Alt-D:\n"
+        "          Listen to the difference A-B (+0 dB...+40 dB)\n"
+        "  o/p:    Chunk select\n"
+        "  hjkl:   Chunk fine adjust (hj: start, kl: stop)\n"
+        "  Space:  Chunk deselect\n"
+        "  0...9:  Listen to B, but difference A-B is amplified by 0-9 dB\n"
+        "  Q:      Quit the program\n"
+        "\n"
+    );
+}
+
+
+int  main ( int argc, char** argv )
+{
+    stereo_t*  _A = calloc ( MAX_LEN, sizeof(stereo_t) );
+    stereo_t*  _B = calloc ( MAX_LEN, sizeof(stereo_t) );
+    stereo_t*  A  = _A;
+    stereo_t*  B  = _B;
+    size_t     len_A;
+    size_t     len_B;
+    size_t     len;
+    int        max_A;
+    int        max_B;
+    int        max;
+    long       freq1;
+    long       freq2;
+    int        shift;
+    double     fshift;
+    double     ampl;
+    int        ampl_X;
+    korr_t     k;
+
+    if (argc > 1  &&  0 == strcmp (argv[1], "-v") ) {
+        verbose = 1;
+        argc--;
+        argv++;
+    }
+
+    switch ( argc ) {
+    case 0:
+    case 1:
+    case 2:
+    default:
+        usage ();
+        return 1;
+    case 3:
+        usage();
+        break;
+    }
+
+    freq1 = readwave ( A, MAX_LEN, argv[1], &len_A );
+    DC_cancel ( A, len_A );
+    freq2 = readwave ( B, MAX_LEN, argv[2], &len_B );
+    DC_cancel ( B, len_B );
+
+    if      ( freq1 == 65534  &&  freq2 != 65534 )
+        freq1 = freq2;
+    else if ( freq2 == 65534  &&  freq1 != 65534 )
+        freq2 = freq1;
+    else if ( freq1 == 65534  &&  freq2 == 65534 )
+        freq1 = freq2 = 44100;
+
+    if ( freq1 != freq2 ) {
+        fprintf ( stderr, "Different sample frequencies currently not supported\n");
+        fprintf ( stderr, "A: %ld, B: %ld\n", freq1, freq2 );
+        return 2;
+    }
+
+    len    = len_A < len_B  ?  len_A  :  len_B;
+    fshift = cross_analyze ( A, B, len );
+    shift  = floor ( fshift + 0.5 );
+
+    if ( verbose ) {
+        fprintf ( stderr, "Delay Ch1 is %.4f samples\n", fshift );
+	fprintf ( stderr, "Delay Ch2 is %.4f samples\n",
+	          cross_analyze ( (stereo_t*)(((sample_t*)A)+1), (stereo_t*)(((sample_t*)B)+1), len ) );
+    }
+
+    if (shift > 0) {
+        if (verbose)
+            fprintf ( stderr, "Delaying A by %d samples\n", +shift);
+        B     += shift;
+        len_B -= shift;
+    }
+    if (shift < 0) {
+        if (verbose)
+            fprintf ( stderr, "Delaying B by %d samples\n", -shift);
+        A     -= shift;
+        len_A += shift;
+    }
+
+    len    = len_A < len_B  ?  len_A  :  len_B;
+    memset ( &k, 0, sizeof(k) );
+    analyze_stereo ( A, B, len, &k );
+    ampl  = report (&k);
+    max_A = maximum ( A, len );
+    max_B = maximum ( B, len );
+
+    if ( ampl <= 0.98855 ) { /* < -0.05 dB */
+        max    = max_A*ampl < max_B  ?  max_B  :  max_A*ampl;
+        ampl_X = (int)(29203 / max);
+        if ( ampl_X < 2 ) ampl_X = 1;
+        multiply ( 'A', A, len, ampl*ampl_X );
+        multiply ( 'B', B, len,      ampl_X );
+    } else if ( ampl >= 1.01158 ) { /* > +0.05 dB */
+        max    = max_A < max_B/ampl  ?  max_B/ampl  :  max_A;
+        ampl_X = (int)(29203 / max);
+        if ( ampl_X < 2 ) ampl_X = 1;
+        multiply ( 'A', A, len,         ampl_X );
+        multiply ( 'B', B, len, 1./ampl*ampl_X );
+    } else {
+        max    = max_A < max_B ? max_B : max_A;
+        ampl_X = (int)(29203 / max);
+        if ( ampl_X < 2 ) ampl_X = 1;
+        multiply ( 'A', A, len, ampl_X );
+        multiply ( 'B', B, len, ampl_X );
+    }
+
+    set ();
+    Set_Realtime ();
+    testing ( A, B, len, freq1 );
+    reset ();
+
+    free (_A);
+    free (_B);
+    return 0;
+}
+
+/* end of abx.c */
diff --git a/misc/ath.c b/misc/ath.c
new file mode 100644
index 0000000..ee6cfda
--- /dev/null
+++ b/misc/ath.c
@@ -0,0 +1,839 @@
+/* $Id: ath.c,v 1.12 2000/12/05 15:37:26 aleidinger Exp $ */
+/*
+ * Known bugs (sorted by importance): 
+ *     - human delay (ca. 200 ms or more???) and buffering delay (341 ms @48 kHz/64 KByte)
+ *       should be subtracted
+ *     - error handling
+ *     - cos slope on direction changes
+ *     - calibration file of soundcard/amplifier/head phone
+ *     - worse handling
+ *     - +/- handling via mouse (do you have code?) in a dark room
+ *     - ENTER as direction change
+ *     - finer precalculated ATH for pre-emphasis
+ */
+
+/* 
+ * Suggested level ranges:
+ *     180 Hz...13.5 kHz:  50...70 dB
+ *     100 Hz...15.0 kHz:  40...70 dB
+ *      70 Hz...16.0 kHz:  30...70 dB
+ *      45 Hz...16.5 kHz:  20...70 dB
+ *      30 Hz...17.5 kHz:  10...70 dB
+ *      25 Hz...18.0 kHz:   5...75 dB
+ *      20 Hz...19.0 kHz:   0...80 dB
+ *      16 Hz...20.0 kHz: -10...80 dB
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <termios.h>
+#include <math.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_SOUNDCARD_H
+# include <sys/soundcard.h>
+#elif defined(HAVE_LINUX_SOUNDCARD_H)
+# include <linux/soundcard.h>
+#else
+# error no soundcard include
+#endif
+
+     
+
+#define AUDIO_DEVICE       "/dev/dsp"
+//#define COOLEDIT_FILE      "/mnt/dosd/cooledit.wav"
+#define DELAY_UNTIL_XCHG   2.5
+#define TURN_STEPS	   2400
+
+/******************************************************************************************************
+ *  soundcard stuff
+ ******************************************************************************************************/
+
+const double dither_coeff [] [16] = {
+    {  /* 48 kHz */ 3.35185352775391591311,  4.24914379295482032978,  1.78042251729150153086, -0.92601381419186201184, -1.37308596104182343645, -1.85951915999247704829, -3.28074437872632330526, -3.05496670185702990882, -1.22855462839450528837, -0.30291531959171267015, -0.18598486195652600770,  0.42010512205702003790,  0.92278786111368653452,  0.62102380451771775193,  0.14312897206650044828, -0.00454721508203927746 },
+    {  /* 56 kHz */ 3.86404134982280628749,  6.67195592701613291071,  5.90576195467245802046,  1.57589705921487261981, -2.10618201389737372178, -2.74191788822507184395, -2.62175070636849999396, -3.78505226463032808863, -4.45698848578010438284, -2.76825966243460536110, -0.26509931375584007312,  0.67853812028968716799,  0.17633528441477021892, -0.28511417191837823770, -0.21866605100975608470, -0.04751674094456833719 },
+    {  /* 64 kHz */ 4.09276938880098092172,  8.27424044674659812937, 10.11503162292146762880,  7.19159801569544317353,  1.39770070291739556523, -2.86595901981244688601, -3.76567274050094691362, -3.58051445684472378298, -4.78262917738758022539, -6.53075750894777650899, -6.31330514306857055627, -3.69971382767763534195, -0.78125094191744878298,  0.59027508113837267217,  0.53500264009607367648,  0.14860043567206217506 },
+    {  /* 72 kHz */ 4.13833553801985235465,  9.02461778089340082437, 12.93090366932740510782, 12.66372285767699051948,  7.76122176702274149630,  1.30617257555732278296, -2.92859120887121285358, -4.02438598495837830627, -4.16673068132491936262, -5.55618065300129916574, -7.82657788611231653103, -8.83055904466106668035, -7.34884789347713815672, -4.33977664906048314891, -1.67711310288611975398, -0.33086687044710235420 },
+    {  /* 80 kHz */ 4.22135293342667005517,  9.76639846582539722375, 15.46562682418357478290, 17.54378549927855248346, 13.29112084313158963396,  3.51512441998252657470, -7.51025671462502577300,-14.84164320864536219368,-16.10306907358826504148,-12.54775907691866414402, -7.40560667268782655149, -3.34708029482052565732, -1.19572214872925790860, -0.39582185216275086786, -0.14803160816846603424, -0.04292818488627011881 },
+    {  /* 88 kHz */ 4.18521467865996935325,  9.96765821475909556942, 16.91905760389390617551, 21.74016824668913557689, 20.96457146354060682367, 13.28640453421253890542,  0.85116933842171101587,-11.66054516261007127469,-19.62750656985581800169,-20.98831962473015904508,-16.95374072505042825458,-10.68848180295390154146, -5.17169792984369678908, -1.79975409439650319129, -0.38057073791415898674, -0.02672653932844656975 },
+    {  /* 96 kHz */ 4.09418877324899473189,  9.77977364010870211207, 17.10120082680385341159, 23.37356217615995036818, 25.27121942060722374276, 20.64059991613550174190,  9.99721445051475610371, -3.39833000550997938512,-15.03410054392933377278,-21.36704201000683067679,-21.40772859969388741685,-16.79355426136657673808,-10.48570200688141622163, -5.07642951516127438486, -1.75555240936989159436, -0.33817997298586054131 },
+};
+
+typedef struct {
+    const char*    device;
+    int            fd;
+    long double    sample_freq;
+    const double*  dither;
+    int            channels;
+    int            bits;
+} soundcard_t;
+
+typedef signed short  sample_t;
+typedef sample_t      stereo_t [2]; 
+
+int  open_soundcard ( 
+    soundcard_t* const  k, 
+    const char*         device, 
+    const int           channels,
+    const int           bits, 
+    const long double   freq )
+{
+    int  arg;
+    int  org;
+    int  index;
+    int  status;
+    
+    k->device = device;
+    if ( -1 == (k->fd = open ( k->device, O_WRONLY )) ) {
+        perror("opening of audio device failed");
+	return -1;
+    }
+    
+    if ( -1 == (status = ioctl (k->fd, SOUND_PCM_SYNC, 0))) {
+        fprintf ( stderr, "%s: SOUND_PCM_SYNC ioctl failed: %s\n", k->device, strerror (errno));
+        return -1;
+    }
+
+    org = arg = channels;
+    if ( -1 == (status = ioctl (k->fd, SOUND_PCM_WRITE_CHANNELS, &arg)) ) {
+	fprintf ( stderr, "%s: SOUND_PCM_WRITE_CHANNELS (%d) ioctl failed: %s\n" , k->device, channels, strerror (errno) );
+	return -1;
+    }
+    if (arg != org) {
+	fprintf ( stderr, "%s: unable to set number of channels: %d instead of %d\n", k->device, arg, org );
+	return -1;
+    }
+    k->channels = arg;
+    
+    org = arg = bits;
+    if ( -1 == (status = ioctl (k->fd, SOUND_PCM_WRITE_BITS, &arg)) ) {
+	fprintf ( stderr, "%s: SOUND_PCM_WRITE_BITS ioctl failed\n", k->device );
+	return -1;
+    }
+    if (arg != org) {
+	fprintf ( stderr, "%s: unable to set sample size: %d instead of %d\n", k->device, arg, org );
+	return -1;
+    }
+    k->bits = arg;
+
+    org = arg = k->bits <= 8  ?  AFMT_U8  :  AFMT_S16_LE;
+    if ( -1 == ioctl (k->fd, SNDCTL_DSP_SETFMT, &arg) ) {
+	fprintf ( stderr, "%s: SNDCTL_DSP_SETFMT ioctl failed\n", k->device );
+	return -1;
+    }
+    if ((arg & org) == 0) {
+	fprintf ( stderr, "%s: unable to set data format\n", k->device );
+	return -1;
+    }
+    
+    org = arg = (int) floor ( freq + 0.5 );
+    if ( -1 == (status = ioctl (k->fd, SOUND_PCM_WRITE_RATE, &arg)) ) {
+	fprintf ( stderr, "%s: SOUND_PCM_WRITE_WRITE ioctl failed\n", k->device );
+	return -1;
+    }
+    k->sample_freq = (long double)arg;
+    index          = (arg - 44000) / 8000;
+    if ( index <                                           0 ) index = 0;
+    if ( index >= sizeof(dither_coeff)/sizeof(*dither_coeff) ) index = sizeof(dither_coeff)/sizeof(*dither_coeff) - 1;
+    k->dither      = dither_coeff [ index ];
+    return 0;
+}
+
+int  play_soundcard    ( soundcard_t* const k, stereo_t* samples, size_t length )
+{
+    size_t  bytes = length * sizeof (*samples);
+    
+#ifdef COOLEDIT_FILE
+    static int fd = -1;
+    if ( fd < 0 ) fd = open ( COOLEDIT_FILE, O_WRONLY | O_CREAT );
+    write ( fd, samples, bytes );
+#endif    
+    
+    return write ( k->fd, samples, bytes ) == bytes  ?  0  :  -1;
+}
+
+int  close_soundcard   ( soundcard_t* const k )
+{
+    return close (k->fd);
+}
+
+
+/******************************************************************************************************
+ *  frequency stuff
+ ******************************************************************************************************/
+
+typedef enum {
+    linear    = 0,
+    logarithm = 1,
+    square    = 2,
+    cubic     = 3,
+    erb       = 4,
+    recip     = 5
+} genmode_t;
+
+static long double linear_f        ( long double x ) { return x > 0.L  ?  x             :  0.0L; }
+static long double logarithm_f     ( long double x ) { return x > 0.L  ?  log10 (x)     : -3.5L; }
+static long double square_f        ( long double x ) { return x > 0.L  ?  sqrt (x)      :  0.0L; }
+static long double cubic_f         ( long double x ) { return x > 0.L  ?  pow (x,1/3.)  :  0.0L; }
+static long double erb_f           ( long double x ) { return log (1. + 0.00437*x); }
+static long double recip_f         ( long double x ) { return x > 1.L  ?  1.L/x         :  1.0L; }
+
+static long double inv_linear_f    ( long double x ) { return x;  }
+static long double inv_logarithm_f ( long double x ) { return pow (10., x);  }
+static long double inv_square_f    ( long double x ) { return x*x;  }
+static long double inv_cubic_f     ( long double x ) { return x*x*x;  }
+static long double inv_erb_f       ( long double x ) { return (exp(x) - 1.) * (1./0.00437); }
+static long double inv_recip_f     ( long double x ) { return x > 1.L  ?  1.L/x         :  1.0L; }
+
+typedef long double (*converter_fn_t) ( long double );
+
+const converter_fn_t  func     [] = { linear_f,     logarithm_f,     square_f,     cubic_f    , erb_f    , recip_f     };
+const converter_fn_t  inv_func [] = { inv_linear_f, inv_logarithm_f, inv_square_f, inv_cubic_f, inv_erb_f, inv_recip_f };
+
+typedef struct {
+    genmode_t      genmode;
+    long double    start_freq;
+    long double    stop_freq;
+    long double    sample_freq;
+    unsigned long  duration;
+
+    long double    phase;
+    long double    param1;
+    long double    param2;
+    unsigned long  counter; 
+} generator_t;
+
+int  open_generator ( 
+    generator_t* const  g,
+    const soundcard_t*  const s,
+    const genmode_t     genmode, 
+    const long double   duration, 
+    const long double   start_freq, 
+    const long double   stop_freq )
+{
+    g->sample_freq = s->sample_freq;
+    g->genmode     = genmode;
+    g->start_freq  = start_freq;
+    g->stop_freq   = stop_freq;
+    g->duration    = (unsigned long) floor ( duration * g->sample_freq + 0.5 );
+    
+    if ( g->duration < 2 )
+	return -1;
+
+    if ( g->genmode >= sizeof (func)/sizeof(*func) )
+	return -1;
+    
+    g->param1 = func [g->genmode] ( g->start_freq / g->sample_freq );
+    g->param2 = ( func [ g->genmode ] ( g->stop_freq / g->sample_freq ) - g->param1 ) 
+	      / ( g->duration - 1 );
+    g->phase  = 0.L;
+    g->counter= 0;
+    
+    return 0;
+}
+
+long double  iterate_generator ( generator_t* const g )
+{
+    long double  freq;
+    
+    freq = inv_func [ g->genmode ] ( g->param1 + g->counter++ * g->param2 );
+	
+    g->phase += freq;
+    if (g->phase > 15.)
+	g->phase -= 16.;
+    return sin ( 2.*M_PI * g->phase );
+}
+
+long double  get_sine ( generator_t* const g )
+{
+    return sin ( 2.*M_PI * g->phase );
+}
+
+long double  get_cosine ( generator_t* const g )
+{
+    return cos ( 2.*M_PI * g->phase );
+}
+
+
+long double  frequency ( const generator_t* const g )
+{
+    return inv_func [ g->genmode ] ( g->param1 + g->counter * g->param2 ) * g->sample_freq;
+}
+
+int  close_generator ( generator_t* const g )
+{
+    return 0;
+}
+
+/******************************************************************************************************
+ *  amplitude stuff
+ ******************************************************************************************************/
+
+typedef enum {
+    up         = 0,
+    down       = 1,
+    turn_up    = 2,
+    turn_down  = 3,
+    still_up   = 4,
+    still_down = 5,
+    change     = 6
+} direction_t;
+	
+	
+typedef struct {
+    long double    sample_freq;
+    direction_t    direction;            // down, up, still_up, still_down, turn_down, turn_up
+    int            multiplier;           // -TURN_STEPS: down, +TURN_STEPS up
+    long double    amplitude;
+    long double    delta_amplitude;
+    long           direction_change;
+} amplitude_t;
+
+int  open_amplifier ( 
+    amplitude_t* const        a,
+    const soundcard_t* const  s,
+    const long double         start_ampl,
+    const double              dB_per_sec )
+{
+    a->sample_freq      = s->sample_freq;
+    a->direction        = up;
+    a->multiplier       = +TURN_STEPS;
+    a->amplitude        = start_ampl * 32767.;
+    a->delta_amplitude  = dB_per_sec * 0.1151292546497022842 / s->sample_freq / TURN_STEPS;
+    a->direction_change = 0;
+    
+    srand ( time (NULL) );
+    return 0;
+}
+
+long double iterate_amplifier ( amplitude_t* const a )
+{
+    switch ( a->direction ) {
+    case still_up:
+        assert (a->multiplier == +TURN_STEPS);
+        if (a->direction_change > 0 )
+	    a->direction_change--;
+	else
+	    a->direction = turn_down;
+	break;
+    case still_down:
+        assert (a->multiplier == -TURN_STEPS);
+        if (a->direction_change > 0 )
+	    a->direction_change--;
+	else
+	    a->direction = turn_up;
+	break;
+    case turn_up:
+        assert (a->direction_change == 0);
+	if ( a->multiplier < +TURN_STEPS )
+	    a->multiplier++;
+	else
+	    a->direction = up;
+	break;
+    case turn_down:
+        assert (a->direction_change == 0);
+	if ( a->multiplier > -TURN_STEPS )
+	    a->multiplier--;
+	else
+	    a->direction = down;
+	break;
+    case up:
+        assert (a->multiplier == +TURN_STEPS);
+        assert (a->direction_change == 0);
+	break;
+    case down:
+        assert (a->multiplier == -TURN_STEPS);
+        assert (a->direction_change == 0);
+	break;
+    default:
+	fprintf ( stderr, "\n\r*** Bug! ***\n");
+	break;
+    }
+
+    a->amplitude *= 1.L + a->delta_amplitude * a->multiplier;
+    return a->amplitude;         
+}
+
+long double amplitude ( const amplitude_t* const a )
+{
+    return a->amplitude / 32767.;
+}
+
+int change_direction ( amplitude_t* const a, direction_t new_direction )
+{
+    switch ( new_direction ) {
+    case up:
+        if (a->direction == down) {
+	    a->direction = still_down;
+	} else {
+	    fprintf ( stderr, "Direction not down, so ignored\n" );
+	    return -1;
+	}
+	break;
+    case down:
+        if (a->direction == up) {
+	    a->direction = still_up;
+	} else {
+	    fprintf ( stderr, "Direction not up, so ignored\n" );
+	    return -1;
+	}
+	break;
+    case change:
+        switch ( a->direction ) {
+        case up:
+	    a->direction = still_up;
+	    break;
+	case down:
+	    a->direction = still_down;
+	    break;
+	default:
+	    fprintf ( stderr, "Direction still changing, so ignored\n" );
+	    return -1;
+	}
+	break;
+    
+    default:
+	fprintf ( stderr, "Direction unknown, so ignored\n" );
+	return -1;
+    }
+
+    a->direction_change = 1 + rand () * (a->sample_freq * DELAY_UNTIL_XCHG / RAND_MAX);
+    return 0;
+}
+
+int  close_amplifier ( amplitude_t* const a )
+{
+    return 0;
+}
+
+
+double ATH ( double freq )
+{
+    static float tab [] = {
+        /*    10.0 */  96.69, 96.69, 96.26, 95.12,
+        /*    12.6 */  93.53, 91.13, 88.82, 86.76,
+        /*    15.8 */  84.69, 82.43, 79.97, 77.48,
+        /*    20.0 */  74.92, 72.39, 70.00, 67.62,
+        /*    25.1 */  65.29, 63.02, 60.84, 59.00,
+        /*    31.6 */  57.17, 55.34, 53.51, 51.67,
+        /*    39.8 */  50.04, 48.12, 46.38, 44.66,
+        /*    50.1 */  43.10, 41.73, 40.50, 39.22,
+        /*    63.1 */  37.23, 35.77, 34.51, 32.81,
+        /*    79.4 */  31.32, 30.36, 29.02, 27.60,
+        /*   100.0 */  26.58, 25.91, 24.41, 23.01,
+        /*   125.9 */  22.12, 21.25, 20.18, 19.00,
+        /*   158.5 */  17.70, 16.82, 15.94, 15.12,
+        /*   199.5 */  14.30, 13.41, 12.60, 11.98,
+        /*   251.2 */  11.36, 10.57,  9.98,  9.43,
+        /*   316.2 */   8.87,  8.46,  7.44,  7.12,
+        /*   398.1 */   6.93,  6.68,  6.37,  6.06,
+        /*   501.2 */   5.80,  5.55,  5.29,  5.02,
+        /*   631.0 */   4.75,  4.48,  4.22,  3.98,
+        /*   794.3 */   3.75,  3.51,  3.27,  3.22,
+        /*  1000.0 */   3.12,  3.01,  2.91,  2.68,
+        /*  1258.9 */   2.46,  2.15,  1.82,  1.46,
+        /*  1584.9 */   1.07,  0.61,  0.13, -0.35,
+        /*  1995.3 */  -0.96, -1.56, -1.79, -2.35,
+        /*  2511.9 */  -2.95, -3.50, -4.01, -4.21,
+        /*  3162.3 */  -4.46, -4.99, -5.32, -5.35,
+        /*  3981.1 */  -5.13, -4.76, -4.31, -3.13,
+        /*  5011.9 */  -1.79,  0.08,  2.03,  4.03,
+        /*  6309.6 */   5.80,  7.36,  8.81, 10.22,
+        /*  7943.3 */  11.54, 12.51, 13.48, 14.21,
+        /* 10000.0 */  14.79, 13.99, 12.85, 11.93,
+        /* 12589.3 */  12.87, 15.19, 19.14, 23.69,
+        /* 15848.9 */  33.52, 48.65, 59.42, 61.77,
+        /* 19952.6 */  63.85, 66.04, 68.33, 70.09,
+        /* 25118.9 */  70.66, 71.27, 71.91, 72.60,
+    };
+    double    freq_log;
+    double    dB;
+    unsigned  index;
+    
+    if ( freq <    10. ) freq =    10.;
+    if ( freq > 25000. ) freq = 25000.;
+    
+    freq_log = 40. * log10 (0.1 * freq);   /* 4 steps per third, starting at 10 Hz */
+    index    = (unsigned) freq_log;
+    assert ( index < sizeof(tab)/sizeof(*tab) );
+    dB = tab [index] * (1 + index - freq_log) + tab [index+1] * (freq_log - index);
+    return pow ( 10., 0.05*dB );
+}
+
+/******************************************************************************************************
+ *  keyboard stuff
+ ******************************************************************************************************/
+
+typedef struct {
+    int             init;
+    struct termios  stored_setting;
+    struct termios  current_setting;
+} keyboard_t;
+
+static keyboard_t* __k;
+
+/* Restore term-settings to those saved when term_init was called */
+
+static void  term_restore (void)
+{
+    tcsetattr ( 0, TCSANOW, &(__k->stored_setting) );
+}  /* term_restore */
+
+/* Clean up terminal; called on exit */
+
+static void  term_exit ( int sig )
+{
+    term_restore ();
+}  /* term_exit */
+
+/* Will be called when ctrl-Z is pressed, this correctly handles the terminal */
+
+static void  term_ctrl_z ( int sig )
+{
+    signal ( SIGTSTP, term_ctrl_z );
+    term_restore ();
+    kill ( getpid(), SIGSTOP );
+}  /* term_ctrl_z */
+
+/* Will be called when application is continued after having been stopped */
+
+static void  term_cont ( int sig )
+{
+    signal ( SIGCONT, term_cont );
+    tcsetattr ( 0, TCSANOW, &(__k->current_setting) );
+} /* term_cont() */
+
+int  open_keyboard    ( keyboard_t* const k )
+{
+    __k = k;
+    tcgetattr ( 0, &(k->stored_setting) );
+    tcgetattr ( 0, &(k->current_setting) );
+
+    signal ( SIGINT,  term_exit   );       /* We _must_ clean up when we exit */
+    signal ( SIGQUIT, term_exit   );
+    signal ( SIGTSTP, term_ctrl_z );       /* Ctrl-Z must also be handled     */
+    signal ( SIGCONT, term_cont   );
+//  atexit ( term_exit );
+
+    /* One or more characters are sufficient to cause a read to return */
+    cfmakeraw ( &(k->current_setting) );
+    k->current_setting.c_oflag     |= ONLCR | OPOST;  /* enables NL => CRLF on output */
+    
+    tcsetattr ( 0, TCSANOW, &(k->current_setting) );
+    return 0;
+}
+
+int  getchar_keyboard ( keyboard_t* const k )
+{
+    struct timeval  t;
+    fd_set          fd [1];
+    int             ret;
+    unsigned char   c;
+
+    FD_SET (0, fd);
+    t.tv_sec  = 0;
+    t.tv_usec = 0;
+
+    ret = select ( 1, fd, NULL, NULL, &t );
+    
+    switch ( ret ) {
+    case  0:
+        return -1;
+    case  1:
+        ret = read (0, &c, 1);
+        return ret == 1  ?  c  :  -1;
+    default:
+        return -2;
+    }
+}
+
+int  close_keyboard   ( keyboard_t* const k )
+{
+    term_restore ();
+    return 0;
+}
+
+
+/******************************************************************************************************
+ *  reporting stuff
+ ******************************************************************************************************/
+
+int  report_open ( void )
+{
+    static char buff [32767];
+    fflush  ( stdout );
+    setvbuf ( stdout, buff, _IOFBF, sizeof(buff) );
+    return 0;
+}
+
+int  report ( const generator_t* const g, const amplitude_t* const a )
+{
+    static double  last_freq  = -1.;
+    static double  last_level = -1.;
+    double         freq;
+    double         level;
+
+    freq  = frequency (g);
+    level = 20. * log10 (amplitude (a) * ATH (freq) ) + 80.;
+    
+    if ( last_freq >= 0 )
+        printf ( "%11.3f %8.2f\n", sqrt (freq*last_freq), 0.5 * (level+last_level) );
+    printf ( "# %9.3f %8.2f\n", freq, level );
+    
+    fflush ( stdout );
+    
+    last_freq  = freq;
+    last_level = level;
+    return 0;
+}
+
+int  report_close ( void )
+{
+    printf ( "%%%%\n\n" );
+    fflush  ( stdout );
+    close ( dup ( fileno(stdout) ) );
+    setvbuf ( stdout, NULL, _IONBF, 0 );
+    return 0;
+}
+
+
+/******************************************************************************************************
+ *  main stuff
+ ******************************************************************************************************/
+
+typedef enum { 
+    left     = 0, 
+    right    = 1, 
+    phase0   = 2, 
+    both     = 2,
+    phase90  = 3, 
+    phase180 = 4, 
+    phasemod = 5 
+} earmode_t;
+
+static long double scalar ( const double* a, const double* b )
+{
+    return  a[ 0]*b[ 0] + a[ 1]*b[ 1] + a[ 2]*b[ 2] + a[ 3]*b[ 3]
+           +a[ 4]*b[ 4] + a[ 5]*b[ 5] + a[ 6]*b[ 6] + a[ 7]*b[ 7]
+           +a[ 8]*b[ 8] + a[ 9]*b[ 9] + a[10]*b[10] + a[11]*b[11]
+           +a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15];
+}
+
+int experiment ( generator_t* const  g,
+		 amplitude_t* const  a,
+		 keyboard_t*  const  k,
+		 soundcard_t* const  s,
+		 earmode_t           earmode )
+{    
+    long           i;
+    int            j;
+    stereo_t       samples [512];
+    static double  quant_errors [2] [16];
+    long double    val;
+    double         ampl;
+    long           ival;
+    
+    fprintf ( stderr, "\r+++  up  +++" );
+    for ( i = 0; i < g->duration; i += sizeof(samples)/sizeof(*samples) ) {
+        fprintf ( stderr, "%3lu%%\b\b\b\b", i*100lu/g->duration );
+	
+	for (j = 0; j < sizeof(samples)/sizeof(*samples); j++ ) {
+	    ampl = iterate_amplifier (a) * ATH (frequency (g));
+	    val  = ampl * iterate_generator (g);
+	    ival = (long) floor ( val + 0.5 + scalar (quant_errors[0], s->dither) );
+	    
+	    if ( ival != (sample_t) ival ) {
+		report (g, a);
+		fprintf ( stderr, "\rOverrun     \n\n" );
+		return -1;
+	    }
+	    memmove ( & quant_errors [0] [1], & quant_errors [0] [0], 
+	              sizeof(quant_errors[0]) - sizeof(quant_errors[0][0]) );
+	    quant_errors [0] [0] = val - ival; 
+	    switch ( earmode ) {
+	    case both: 
+	        samples [j] [0] = samples [j] [1] = ival; 
+		break;
+	    case left: 
+	        samples [j] [0] = ival;
+		samples [j] [1] = 0; 
+		break;
+	    case right: 
+	        samples [j] [0] = 0;
+		samples [j] [1] = ival; 
+		break;
+	    case phase180: 
+	        samples [j] [0] = ival == -32768 ? 32767 : -ival;
+		samples [j] [1] = +ival; 
+		break;
+	    case phase90:
+	        samples [j] [0] = ival;
+	        val  = ampl * get_cosine (g);
+	        ival = (long) floor ( val + 0.5 + scalar (quant_errors[1], s->dither) );
+	        if ( ival != (sample_t) ival ) {
+		    report (g, a);
+		    fprintf ( stderr, "\rOverrun     \n\n" );
+		    return -1;
+	        }
+	        memmove ( & quant_errors [1] [1], & quant_errors [1] [0], 
+	              sizeof(quant_errors[1]) - sizeof(quant_errors[1][0]) );
+  	        quant_errors [1] [0] = val - ival; 
+	        samples [j] [1] = ival;
+		break;
+	    default:
+	        assert (0);
+		return -1;
+	    }
+	}
+	play_soundcard ( s, samples, sizeof(samples)/sizeof(*samples) );
+	if ( amplitude (a) * ATH (frequency (g)) <= 3.16227766e-6 ) {
+            report (g, a);
+	    fprintf ( stderr, "\rUnderrun      \n\n" );
+	    return -1;
+	}
+	
+	switch ( getchar_keyboard (k) ) {
+	case '+':
+	    fprintf ( stderr, "\r+++  up  +++" );
+	    report (g, a);
+	    change_direction ( a, up );
+	    break;
+	case '-':
+	    fprintf ( stderr, "\r--- down ---" );
+            report (g, a);
+	    change_direction ( a, down );
+	    break;
+	case '\r':
+	case '\n':
+	    fprintf ( stderr, "\r** change **" );
+            report (g, a);
+	    change_direction ( a, change );
+	    break;
+	case 'C'&0x1F:
+	case 'q':
+	case 'Q':
+	case 'x':
+	case 'X':
+	    fprintf ( stderr, "\rBreak       \n\n" );
+	    fflush  ( stderr );
+	    return -1;
+	default:
+	    fprintf ( stderr, "\a" );
+	    break;
+	case -1:
+	    break;
+	}
+    }
+	
+    fprintf ( stderr, "\rReady       \n\n" );
+    return 0;
+}
+
+static void usage ( void )
+{
+    static const char help[] = 
+        "'Absolute Threshold of Hearing' -- Version 0.07   (C) Frank Klemm 2000\n"
+	"\n"
+	"usage:\n" 
+	"    ath  type minfreq maxfreq duration ampl_speed [start_level [earmode] > reportfile\n"
+	"\n"
+	"         type:         linear, logarithm, square, cubic, erb, recip\n"
+	"         minfreq:      initial frequency [Hz]\n"
+	"         maxfreq:      end frequency [Hz]\n"
+	"         duration:     duration of the experiment [s]\n"
+	"         ampl_speed:   amplitude slope speed [phon/s]\n"
+	"         start_level:  absolute level at startup [0...1]\n"
+	"         earmode:      left, right, both, phase90, phase180\n"
+	"\n"
+	"example:\n"
+        "    ath  erb  700 22000 600 3 0.0001 > result1\n"
+	"    ath  erb 1400    16 360 3 0.0001 > result2\n"
+	"\n"
+	"handling:\n"
+	"    press '-' once when you start hearing a tone\n"
+	"    press '+' once when you stop hearing a tone\n"
+	"    press 'q' to early leave the program\n"
+	"    on errors the pressed key is ignored\n";
+    
+    fprintf ( stderr, "%s\n", help );
+}
+
+int main ( int argc, char** argv )
+{
+    generator_t  g;
+    amplitude_t  a;
+    soundcard_t  s;
+    keyboard_t   k;
+    genmode_t    genmode;
+    earmode_t    earmode;
+
+    if ( argc == 1 ) {
+        usage ();
+        system ( "./ath erb  700 22000 600 3 0.0001 > result1" );
+	system ( "./ath erb 1400    16 360 3 0.0001 > result2" );
+	system ( "xmgr result1 result2 &> /dev/null &" );
+	return 0;
+    }
+    
+    if ( argc < 6 ) {
+	usage ();
+	return 1;
+    }
+    
+    if      ( 0 == strncmp ( argv[1], "li" , 2) ) genmode = linear;
+    else if ( 0 == strncmp ( argv[1], "lo" , 2) ) genmode = logarithm;
+    else if ( 0 == strncmp ( argv[1], "sq" , 2) ) genmode = square;
+    else if ( 0 == strncmp ( argv[1], "cu" , 2) ) genmode = cubic;
+    else if ( 0 == strncmp ( argv[1], "er" , 2) ) genmode = erb;
+    else if ( 0 == strncmp ( argv[1], "re" , 2) ) genmode = recip;
+    else {
+	usage ();
+	return 1;
+    }
+
+    if      ( argc < 8 )                              earmode = both;
+    else if ( 0 == strncmp ( argv[7], "le"     , 2) ) earmode = left;
+    else if ( 0 == strncmp ( argv[7], "ri"     , 2) ) earmode = right;
+    else if ( 0 == strncmp ( argv[7], "bo"     , 2) ) earmode = both;
+    else if ( 0 == strncmp ( argv[7], "phase9" , 6) ) earmode = phase90;
+    else if ( 0 == strncmp ( argv[7], "phase1" , 6) ) earmode = phase180;
+    else {
+	usage ();
+	return 1;
+    }
+
+    
+    open_soundcard ( &s, AUDIO_DEVICE, sizeof(stereo_t)/sizeof(sample_t), CHAR_BIT*sizeof(sample_t), 96000.0 );
+    open_generator ( &g, &s, genmode, atof (argv[4]), atof (argv[2]), atof (argv[3]) );
+    open_amplifier ( &a, &s, argc > 6  ?  atof (argv[6])  :  0.0001, atof (argv[5]) );
+    open_keyboard  ( &k );
+
+    report_open    ( );
+    experiment     ( &g, &a, &k, &s, earmode );
+    report_close   ( );
+    
+    close_keyboard ( &k );
+    close_amplifier( &a );
+    close_generator( &g );
+    close_soundcard( &s );
+    
+    return 0;
+}
+
+/* end of ath.c */
+
+
diff --git a/misc/auenc b/misc/auenc
new file mode 100755
index 0000000..50d9c81
--- /dev/null
+++ b/misc/auenc
@@ -0,0 +1,39 @@
+#!/bin/sh
+# 
+# auenc -- version 0.1
+#
+# A wrapper for lame to encode multiple files.  By default, a .wav
+# extension is removed and replaced by .mp3 .
+#
+# (C) 1999 Gerhard Wesp <gwesp@cosy.sbg.ac.at> under the GPL.
+
+# set the variables below according to your taste
+LAME=lame
+LAME_OPTS="-S -h -v -V 0 -b 256" # high quality, silent operation
+
+if [ $# -lt 1 ] ; then
+  exec 1>&2
+  cat << _EOF_
+usage: $0 [options] file...
+options:
+  -d --delete: delete original file after successful encoding
+_EOF_
+  exit 1
+fi
+
+unset DELETE
+case "$1" in
+  -d | --delete ) DELETE=1 ; shift ;;
+esac
+
+for f
+do
+  $LAME $LAME_OPTS "$f" `basename "$f" .wav`.mp3 || {
+    exec 1>&2
+    echo "encoding of $f failed, aborting..."
+    exit 1
+  }
+  if [ -n "$DELETE" ] ; then
+    rm -f "$f"
+  fi
+done
diff --git a/misc/depcomp b/misc/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/misc/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/misc/lame4dos.bat b/misc/lame4dos.bat
new file mode 100644
index 0000000..b15cb3e
--- /dev/null
+++ b/misc/lame4dos.bat
@@ -0,0 +1,41 @@
+@echo off

+rem  ---------------------------------------------

+rem  PURPOSE:

+rem  - put this Batch-Command on your Desktop, 

+rem    so you can drag and drop wave files on it

+rem    and LAME will encode them to mp3 format.

+rem  - put this Batch-Command in a place mentioned

+rem    in your PATH environment, start the DOS-BOX

+rem    and change to a directory where your wave 

+rem    files are located. the following line will

+rem    encode all your wave files to mp3

+rem     "lame.bat *.wav"

+rem  ---------------------------------------------

+rem                         C2000  Robert Hegemann

+rem  ---------------------------------------------

+rem  Changes to support long filenames using 4DOS

+rem  by Alexander Stumpf <dropdachalupa@gmx.net>

+rem  ---------------------------------------------

+rem  please set LAME and LAMEOPTS

+rem  LAME - where the executeable is

+rem  OPTS - options you like LAME to use

+

+        set LAME=c:\progra~1\sound&~1\lame\lame.exe

+        set OPTS=-h --lowpass-width 2 --lowpass 20.5 -b 112 --abr 180

+

+rem  ---------------------------------------------

+

+	set thecmd=%LAME% %OPTS%

+        for %%f in (%&) do (%thecmd% %@sfn[%%f]^(ren %@sfn[%%f].mp3 "%@lfn[%%f].mp_">NUL))

+        ren *.mp3.mp_ *.new.mp3 >& NUL

+        ren *.wav.mp_ *.mp3 >& NUL

+        goto endmark

+:errormark

+	echo.

+	echo.

+	echo ERROR processing %1

+	echo. 

+:endmark

+rem

+rem	finished

+rem

diff --git a/misc/lameGUI.html b/misc/lameGUI.html
new file mode 100644
index 0000000..db90fd0
--- /dev/null
+++ b/misc/lameGUI.html
@@ -0,0 +1,403 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type"
+content="text/html; charset=iso-8859-1">
+<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
+<title>Lame</title>
+<!-- LAME HTML GUI V0.2 for LAME.VBS by Ralf Kempkens (ralf.kempkens@epost.de)
+  -- $ID$
+  --
+  -- purpose of this page is being a frontend for lame.vbs v0.3 or later
+  -- it is launched from lame.vbs if useGUI in lame.vbs is set to 'True'
+  -- automatically
+  -- lame will then use the options chosen
+  --
+  -- TODO: add other options, nicer layout...
+  -->
+</head>
+
+<body bgcolor="#FFFFFF" topmargin="4" leftmargin="4">
+<script>
+  function updateOptions() {
+  var f=document.forms.lameform;
+  var opts="";
+  opts+=f.bitrate.options[f.bitrate.selectedIndex].value + " " + 
+        f.mode.value;
+
+    if (f.high_quality.checked)
+      opts+= " " + f.high_quality.value;
+    
+    if (f.fast.checked)
+      opts+=" "+f.fast.value;
+    
+    if (f.vbr.checked){
+      opts+=" "+f.vbr.value+ " " + f.vbr_quality.value + " " + f.max_bitrate.value;
+      if (f.enforce_min_bitrate.checked)
+         opts+= " " + f.enforce_min_bitrate.value;
+    }
+        
+    if (f.copyright.checked)
+      opts+= " " + f.copyright.value;
+    
+    if (f.copy.checked)
+      opts+= " " + f.copy.value;
+    
+    if (f.no_filters.checked)
+      opts+= " " + f.no_filters.value;
+    
+    if (f.title.value != "")
+      opts+= " --tt \""+f.title.value+"\"";
+
+    if (f.artist.value != "")
+      opts+=" --ta \""+f.artist.value+"\"";
+
+    if (f.album.value != "")
+      opts+=" --tl \""+f.album.value+"\"";
+
+    if (f.year.value != "")
+      opts+=" --ty "+f.year.value;
+
+    if (f.track.value != "")
+      opts+=" --tn "+f.track.value;
+
+    if (f.genre.value >= 0)
+      opts+=" --tg "+f.genre.value;
+
+    if (f.comment.value != "")
+      opts+=" --tc \""+f.comment.value+"\"";
+
+    f.lameoptions.value=opts;;
+    return;
+  }
+</script>
+<noscript>
+<H1><font color="red">JavaScript must be activated in order to use this frontend. Currently it is not!</font></H1>
+</noscript>
+
+<form method="POST" name="lameform">
+    <input type="hidden" name="lameoptions" value="not processed"><h1><font
+    face="Arial">LAME Frontend</font></h1>
+    <table border="0">
+        <tr>
+            <td><font face="Arial"><strong>Fixed Bitrate</strong></font></td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial">bitrate (-b) <select
+            name="bitrate" size="1" onchange="updateOptions()">
+                <option value="-b 8">8 kbs</option>
+                <option value="-b 16">16 kbs</option>
+                <option value="-b 24">24 kbs</option>
+                <option value="-b 32">32 kbs</option>
+                <option value="-b 40">40 kbs</option>
+                <option value="-b 48">48 kbs</option>
+                <option value="-b 56">56 kbs</option>
+                <option value="-b 64">64 kbs</option>
+                <option value="-b 80">80 kbs</option>
+                <option value="-b 96">96 kbs</option>
+                <option selected value="-b 128">128 kbs</option>
+                <option value="-b 112">112 kbs</option>
+                <option value="-b 144">144 kbs</option>
+                <option value="-b 160">160 kbs</option>
+                <option value="-b 192">192 kbs</option>
+                <option value="-b 224">224 kbs</option>
+                <option value="-b 256">256 kbs</option>
+                <option value="-b 320">320 kbs</option>
+            </select></font></td>
+            <td colspan="2"><font face="Arial"><input
+            type="checkbox" checked name="high_quality"
+            value="-h" onchange="updateOptions()">high quality (-h)</font></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td colspan="2"><font face="Arial"><input
+            type="checkbox" name="fast" value="-f"
+            onchange="updateOptions()">fast (no noise shaping)</font></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial"><strong>Variable Bitrate</strong></font></td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial"><input type="checkbox"
+            name="vbr" value="-v" onchange="updateOptions()">variable
+            bitrate (-v)</font></td>
+            <td colspan="2"><font face="Arial">VBR quality (-V) <select
+            name="vbr_quality" size="1"
+            onchange="updateOptions()">
+                <option value="-V 0">0 (highest)</option>
+                <option value="-V 1">1</option>
+                <option value="-V 2">2</option>
+                <option value="-V 3">3</option>
+                <option value="-V 4">4</option>
+                <option selected value="-V 5">5 (medium)</option>
+                <option value="-V 6">6</option>
+                <option value="-V 7">7</option>
+                <option value="-V 8">8</option>
+                <option value="-V 9">9 (lowest)</option>
+            </select></font></td>
+        </tr>
+        <tr>
+            <td><font face="Arial">maximum bitrate (-B) <select
+            name="max_bitrate" size="1"
+            onchange="updateOptions()">
+                <option selected value>none</option>
+                <option value="-B 8">8 kbs</option>
+                <option value="-B 16">16 kbs</option>
+                <option value="-B 24">24 kbs</option>
+                <option value="-B 32">32 kbs</option>
+                <option value="-B 40">40 kbs</option>
+                <option value="-B 48">48 kbs</option>
+                <option value="-B 56">56 kbs</option>
+                <option value="-B 64">64 kbs</option>
+                <option value="-B 80">80 kbs</option>
+                <option value="-B 96">96 kbs</option>
+                <option value="-b 128">128 kbs</option>
+                <option value="-B 112">112 kbs</option>
+                <option value="-B 144">144 kbs</option>
+                <option value="-B 160">160 kbs</option>
+                <option value="-B 192">192 kbs</option>
+                <option value="-B 224">224 kbs</option>
+                <option value="-B 256">256 kbs</option>
+                <option value="-B 320">320 kbs</option>
+            </select></font></td>
+            <td colspan="2"><font face="Arial"><input
+            type="checkbox" name="enforce_min_bitrate" value="-F"
+            onchange="updateOptions()">enforce min. bitrate (-F)</font></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial"><strong>General</strong></font></td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial">mode (-m) <select name="mode"
+            size="1" onchange="updateOptions()">
+                <option value="-m m">mono</option>
+                <option value="-m s">stereo</option>
+                <option selected value="-m j">joint stereo</option>
+                <option value="-m f">mid/side stereo</option>
+            </select></font></td>
+            <td colspan="2"><font face="Arial"><input
+            type="checkbox" name="no_filters" value="-k"
+            onchange="updateOptions()">disable all filters (-k)</font></td>
+        </tr>
+        <tr>
+            <td><font face="Arial"><input type="checkbox"
+            name="copyright" value="-c"
+            onchange="updateOptions()">copyrighted (-c)</font></td>
+            <td colspan="2"><font face="Arial"><input
+            type="checkbox" name="copy" value="-o"
+            onchange="updateOptions()">non-original (-o)</font></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial"><strong>ID3-Tag</strong></font></td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><font face="Arial">title (--tt) <input
+            type="text" size="30" name="title" onChange="updateOptions()"></font></td>
+            <td colspan="2"><font face="Arial">artist (--ta) <input
+            type="text" size="30" name="artist" onChange="updateOptions()"></font></td>
+        </tr>
+        <tr>
+            <td><font face="Arial">album (--tl) <input
+            type="text" size="30" name="album" onChange="updateOptions()"></font></td>
+            <td><font face="Arial">year (--ty) <input type="text"
+            size="4" name="year" onChange="updateOptions()"></font></td>
+            <td><font face="Arial">track (--tn) <input
+            type="text" size="2" name="track" onChange="updateOptions()"></font></td>
+        </tr>
+        <tr>
+            <td><font face="Arial">comment (--tc) </font><input
+            type="text" size="30" name="comment" onChange="updateOptions()"></td>
+            <td colspan="2"><font face="Arial">genre (--tg) </font><select
+            name="genre" size="1" onChange="updateOptions()">
+                <option selected value="-1">none
+                <option value="123">A Cappella </option>
+                <option value="34">Acid </option>
+                <option value="74">Acid Jazz </option>
+                <option value="73">Acid Punk </option>
+                <option value="99">Acoustic </option>
+                <option value="20">Alternative </option>
+                <option value="40">Alt. Rock </option>
+                <option value="26">Ambient </option>
+                <option value="145">Anime </option>
+                <option value="90">Avantgarde </option>
+                <option value="116">Ballad </option>
+                <option value="41">Bass </option>
+                <option value="135">Beat </option>
+                <option value="85">Bebob </option>
+                <option value="96">Big Band </option>
+                <option value="138">Black Metal </option>
+                <option value="89">Bluegrass </option>
+                <option value="0">Blues </option>
+                <option value="107">Booty Bass </option>
+                <option value="132">BritPop </option>
+                <option value="65">Cabaret </option>
+                <option value="88">Celtic </option>
+                <option value="104">Chamber Music </option>
+                <option value="102">Chanson </option>
+                <option value="97">Chorus </option>
+                <option value="136">Christian Gangsta Rap </option>
+                <option value="61">Christian Rap </option>
+                <option value="141">Christian Rock </option>
+                <option value="32">Classical </option>
+                <option value="1">Classic Rock </option>
+                <option value="112">Club </option>
+                <option value="128">Club-House </option>
+                <option value="57">Comedy </option>
+                <option value="140">Contemporary Christian </option>
+                <option value="2">Country </option>
+                <option value="139">Crossover </option>
+                <option value="58">Cult </option>
+                <option value="3">Dance </option>
+                <option value="125">Dance Hall </option>
+                <option value="50">Darkwave </option>
+                <option value="22">Death Metal </option>
+                <option value="4">Disco </option>
+                <option value="55">Dream </option>
+                <option value="127">Drum &amp; Bass </option>
+                <option value="122">Drum Solo </option>
+                <option value="120">Duet </option>
+                <option value="98">Easy Listening </option>
+                <option value="52">Electronic </option>
+                <option value="48">Ethnic </option>
+                <option value="54">Eurodance </option>
+                <option value="124">Euro-House </option>
+                <option value="25">Euro-Techno </option>
+                <option value="84">Fast-Fusion </option>
+                <option value="80">Folk </option>
+                <option value="115">Folklore </option>
+                <option value="81">Folk/Rock </option>
+                <option value="119">Freestyle </option>
+                <option value="5">Funk </option>
+                <option value="30">Fusion </option>
+                <option value="36">Game </option>
+                <option value="59">Gangsta Rap </option>
+                <option value="126">Goa </option>
+                <option value="38">Gospel </option>
+                <option value="49">Gothic </option>
+                <option value="91">Gothic Rock </option>
+                <option value="6">Grunge </option>
+                <option value="129">Hardcore </option>
+                <option value="79">Hard Rock </option>
+                <option value="137">Heavy Metal </option>
+                <option value="7">Hip-Hop </option>
+                <option value="35">House </option>
+                <option value="100">Humour </option>
+                <option value="131">Indie </option>
+                <option value="19">Industrial </option>
+                <option value="33">Instrumental </option>
+                <option value="46">Instrumental Pop </option>
+                <option value="47">Instrumental Rock </option>
+                <option value="8">Jazz </option>
+                <option value="29">Jazz+Funk </option>
+                <option value="146">JPop </option>
+                <option value="63">Jungle </option>
+                <option value="86">Latin </option>
+                <option value="71">Lo-Fi </option>
+                <option value="45">Meditative </option>
+                <option value="142">Merengue </option>
+                <option value="9">Metal </option>
+                <option value="77">Musical </option>
+                <option value="82">National Folk </option>
+                <option value="64">Native American </option>
+                <option value="133">Negerpunk </option>
+                <option value="10">New Age </option>
+                <option value="66">New Wave </option>
+                <option value="39">Noise </option>
+                <option value="11">Oldies </option>
+                <option value="103">Opera </option>
+                <option value="12">Other </option>
+                <option value="75">Polka </option>
+                <option value="134">Polsk Punk </option>
+                <option value="13">Pop</option>
+                <option value="53">Pop-Folk </option>
+                <option value="62">Pop/Funk </option>
+                <option value="109">Porn Groove </option>
+                <option value="117">Power Ballad </option>
+                <option value="23">Pranks </option>
+                <option value="108">Primus </option>
+                <option value="92">Progressive Rock </option>
+                <option value="67">Psychedelic </option>
+                <option value="93">Psychedelic Rock </option>
+                <option value="43">Punk </option>
+                <option value="121">Punk Rock </option>
+                <option value="15">Rap </option>
+                <option value="68">Rave </option>
+                <option value="14">R&amp;B </option>
+                <option value="16">Reggae </option>
+                <option value="76">Retro </option>
+                <option value="87">Revival </option>
+                <option value="118">Rhythmic Soul </option>
+                <option value="17">Rock </option>
+                <option value="78">Rock &amp; Roll </option>
+                <option value="143">Salsa </option>
+                <option value="114">Samba </option>
+                <option value="110">Satire </option>
+                <option value="69">Showtunes </option>
+                <option value="21">Ska </option>
+                <option value="111">Slow Jam </option>
+                <option value="95">Slow Rock </option>
+                <option value="105">Sonata </option>
+                <option value="42">Soul </option>
+                <option value="37">Sound Clip </option>
+                <option value="24">Soundtrack </option>
+                <option value="56">Southern Rock </option>
+                <option value="44">Space </option>
+                <option value="101">Speech </option>
+                <option value="83">Swing </option>
+                <option value="94">Symphonic Rock </option>
+                <option value="106">Symphony </option>
+                <option value="147">Synthpop </option>
+                <option value="113">Tango </option>
+                <option value="18">Techno </option>
+                <option value="51">Techno-Industrial </option>
+                <option value="130">Terror </option>
+                <option value="144">Thrash Metal </option>
+                <option value="60">Top 40 </option>
+                <option value="70">Trailer </option>
+                <option value="31">Trance </option>
+                <option value="72">Tribal </option>
+                <option value="27">Trip-Hop </option>
+                <option value="28">Vocal </option>
+            </select></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td align="center" colspan="3"><font face="Arial"><input
+            type="button" name="okbutton" value="Start LAME"
+            </font></font></td>
+        </tr>
+    </table>
+</form>
+
+<table border="0">
+    <tr>
+        <td>[<a href="USAGE" target="_blank">LAME HELP</a>] [<a
+        href="README" target="_blank">LAME Readme</a>] [<a
+        href="history.html" target="_blank">LAME History</a>] [<a
+        href="http://www.mp3dev.org" target="_blank">LAME
+        Homepage</a>]</td>
+        <td>&nbsp;</td>
+    </tr>
+</table>
+</body>
+</html>
diff --git a/misc/lameid3.pl b/misc/lameid3.pl
new file mode 100644
index 0000000..5352877
--- /dev/null
+++ b/misc/lameid3.pl
@@ -0,0 +1,55 @@
+#
+#  From: Per Bolmstedt <tomten@kol14.com>
+# 
+#   AC> If someone has scripts that read input ID3 tags and convert
+#   AC> them to args for lame (which then encodes the tags into the
+#   AC> output files), let me know, too!
+#
+#  This is easy peasy using Perl.  Especially using Chris Nandor's excellent
+#  MP3::Info package (available on CPAN).  Here's a program I just wrote that
+#  I think does what you want.  Invoke it with "<program> <file> [options]"
+#  (where the options can include an output filename), like for example:
+#
+#          lameid3.pl HQ.mp3 LQ.mp3 -fv
+#
+#  (Note how the syntax differs from that of Lame's.)  The program will
+#  extract ID3 tags from the input file and invoke Lame with arguments for
+#  including them.  (This program has not undergone any real testing..)
+
+use MP3::Info;
+use strict;
+
+my %flds = ( 
+	TITLE => 'tt',
+	ARTIST => 'ta',
+	ALBUM => 'tl',
+	YEAR => 'ty',
+	COMMENT => 'tc',
+	GENRE => 'tg',
+	TRACKNUM => 'tn'
+	);
+
+my $f = shift @ARGV;
+my $s = "lame ${f} " . &makeid3args( $f ) . join ' ', @ARGV;
+print STDERR "[${s}]\n";
+system( $s );
+
+sub makeid3args( $ )
+{
+	my $s;
+	if ( my $tag = get_mp3tag( @_->[ 0 ] ) )
+	{
+		for ( keys %flds )
+		{
+			if ( $tag->{ $_ } )
+			{
+				$s .= sprintf(
+					"--%s \"%s\" ",
+					%flds->{ $_ },
+					$tag->{ $_ } );
+			}
+		}
+	}
+	return $s || "";
+}
+
diff --git a/misc/mlame b/misc/mlame
new file mode 100755
index 0000000..23beab5
--- /dev/null
+++ b/misc/mlame
@@ -0,0 +1,195 @@
+#!/bin/sh 
+
+############################################################################
+#   
+#  Run the LAME encoder on multiple files, with option to delete .wav files
+#  after encoding.  "mlame -?" will give instructions.
+#
+#  Robert Hegemann
+#  modified on request: Frank Klemm <pfk@uni-jena.de>
+#
+############################################################################
+
+# encoder path to use
+mp3coder="lame"
+mp3analyzer="mlame_corr"
+
+# default options to use
+options_low="-h -d -mj -b 128"
+options_high="-h -d -mj -V 1 -b 112 -B 320"
+options=$options_high
+
+# remove source?
+removesource=false
+
+# force overwrite of destination
+testoverwrite=true
+
+# waiting after error report n seconds
+errordelay=1 
+
+helptext="\n\
+This script runs the LAME mp3 encoder on multiple files: \n\n\
+    $0 [options] <file 1> ... <file n>\n\
+\n\
+  options:\n\
+    -?                  this help text\n\
+    -r                  remove files after encoding\n\
+    -f                  force overwrite of destination if exists\n\
+    -l                  low quality settings\n\
+    -h                  high quality settings\n\
+    -o \"<lame options>\" overrides script default options
+\n\
+  example:\n\
+    $0  -r  -f  -o \"-v -V 0 -b 112\" a*.wav z*.aif g*.mp?\n\
+\n\
+"
+
+#   process command-line options
+#   this could be extended to fake the 
+#   commandline interface of the mp3encoder
+
+while getopts ":o:r:h:l:f" optn; do
+    case $optn in
+    o ) options=$OPTARG 	# replace default options
+	echo New lame options are \'$options\'
+        ;; 
+    r ) removesource=true
+        echo Removing source files after successfully converting
+	;;
+    f ) testoverwrite=false
+        echo Force overwriting existing destination files
+	;;
+    h ) options=$options_high
+        ;;
+    l ) options=$options_low
+        ;;
+    \? ) printf "$helptext"
+	sleep $errordelay
+        exit 1  
+        ;;
+    esac
+done
+shift $(($OPTIND - 1))
+
+# no files remaining?
+
+if [ "$1" = "" ]; then
+    printf "$helptext"
+    sleep $errordelay
+    exit 1  
+fi
+
+#   process input-files
+
+for src in "$@"; do
+
+    case $src in
+    *[.][wW][aA][vV]  )
+        dst=${src%[.][wW][aA][vV]}.mp3
+        if [ -f "$src" ]; then
+            if [ $testoverwrite = true -a -f "$dst" ]; then
+                echo \'$dst\' already exists, skipping
+		sleep $errordelay
+            elif $mp3coder $options `$mp3analyzer "$src"` "$src" "$dst"; then
+                if [ $removesource = true ]; then
+                    rm -f "$src"
+                fi
+            else
+                echo converting of \'$src\' to \'$dst\' failed
+		sleep $errordelay
+            fi
+        else
+            echo No source file \'$src\' found.
+	    sleep $errordelay
+        fi
+        ;;
+
+    *[.][aA][iI][fF]  )
+        dst=${src%[.][aA][iI][fF]}.mp3
+        if [ -f "$src" ]; then
+            if [ $testoverwrite = true -a -f "$dst" ]; then
+                echo \'$dst\' already exists, skipping
+		sleep $errordelay
+            elif $mp3coder $options "$src" "$dst"; then
+                if [ $removesource = true ]; then
+                    rm -f "$src"
+                fi
+            else
+                echo converting of \'$src\' to \'$dst\' failed
+		sleep $errordelay
+            fi
+        else
+            echo No source file \'$src\' found.
+	    sleep $errordelay
+        fi
+        ;;
+
+    *[.][aA][iI][fF][fF] )
+        dst=${src%[.][aA][iI][fF][fF]}.mp3
+        if [ -f "$src" ]; then
+            if [ $testoverwrite = true -a -f "$dst" ]; then
+                echo \'$dst\' already exists, skipping
+		sleep $errordelay
+            elif $mp3coder $options "$src" "$dst"; then
+                if [ $removesource = true ]; then
+                    rm -f "$src"
+                fi
+            else
+                echo converting of \'$src\' to \'$dst\' failed
+		sleep $errordelay
+            fi
+        else
+            echo No source file \'$src\' found.
+	    sleep $errordelay
+        fi
+        ;;
+
+    *[.][mM][pP][gG12]  )
+        dst=${src%[.][mM][pP][gG12]}.mp3
+        if [ -f "$src" ]; then
+            if [ $testoverwrite = true -a -f "$dst" ]; then
+                echo \'$dst\' already exists, skipping
+		sleep $errordelay
+            elif $mp3coder $options "$src" "$dst"; then
+                if [ $removesource = true ]; then
+                    rm -f "$src"
+                fi
+            else
+                echo converting of \'$src\' to \'$dst\' failed
+		sleep $errordelay
+            fi
+        else
+            echo No source file \'$src\' found.
+	    sleep $errordelay
+        fi
+        ;;
+
+    *[.][mM][pP]3 )
+        dst=${src%[.][mM][pP]3}-new-converted-file.${src##*.}
+        if [ -f "$src" ]; then
+            if [ $testoverwrite = true -a -f "$dst" ]; then
+                echo \'$dst\' already exists, skipping
+		sleep $errordelay
+            elif $mp3coder $options "$src" "$dst"; then
+                if [ $removesource = true ]; then
+                    mv -f "$dst" "$src"
+                fi
+            else
+                echo converting of \'$src\' to \'$dst\' failed
+		sleep $errordelay
+            fi
+        else
+            echo No source file \'$src\' found.
+	    sleep $errordelay
+        fi
+        ;;
+
+    * ) # the rest
+        echo warning: File extention \'.${src##*.}\' not supported
+        sleep $errordelay
+        ;;
+
+    esac
+
+done
diff --git a/misc/mlame_corr.c b/misc/mlame_corr.c
new file mode 100644
index 0000000..4305b63
--- /dev/null
+++ b/misc/mlame_corr.c
@@ -0,0 +1,220 @@
+/*
+    Bug: 
+	- runs only on little endian machines for WAV files
+        - Not all WAV files are recognized
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <memory.h>
+
+typedef signed short stereo [2];
+typedef signed short mono;
+typedef struct {
+    unsigned long long  n;
+    long double         x;
+    long double         x2;
+    long double         y;
+    long double         y2;
+    long double         xy;
+} korr_t;
+
+void analyze_stereo ( const stereo* p, size_t len, korr_t* k )
+{
+    long double  _x = 0, _x2 = 0, _y = 0, _y2 = 0, _xy = 0;
+    double       t1;
+    double       t2;
+    
+    k -> n  += len;
+    
+    for ( ; len--; p++ ) {
+        _x  += (t1 = (*p)[0]); _x2 += t1 * t1;
+        _y  += (t2 = (*p)[1]); _y2 += t2 * t2;
+                               _xy += t1 * t2;
+    }
+    
+    k -> x  += _x ;
+    k -> x2 += _x2;
+    k -> y  += _y ;
+    k -> y2 += _y2;
+    k -> xy += _xy;
+}
+
+void analyze_dstereo ( const stereo* p, size_t len, korr_t* k )
+{
+    static double l0 = 0;
+    static double l1 = 0;
+    long double   _x = 0, _x2 = 0, _y = 0, _y2 = 0, _xy = 0;
+    double        t1;
+    double        t2;
+    
+    k -> n  += len;
+    
+    for ( ; len--; p++ ) {
+        _x  += (t1 = (*p)[0] - l0);  _x2 += t1 * t1;
+        _y  += (t2 = (*p)[1] - l1);  _y2 += t2 * t2;
+                                     _xy += t1 * t2;
+	l0   = (*p)[0];
+	l1   = (*p)[1];
+    }
+    
+    k -> x  += _x ;
+    k -> x2 += _x2;
+    k -> y  += _y ;
+    k -> y2 += _y2;
+    k -> xy += _xy;
+}
+
+
+void analyze_mono   ( const mono* p, size_t len, korr_t* k )
+{
+    long double   _x = 0, _x2 = 0;
+    double        t1;
+    
+    k -> n  += len;
+    
+    for ( ; len--; p++ ) {
+        _x  += (t1 = (*p)); _x2 += t1 * t1;
+    }
+    
+    k -> x  += _x ;
+    k -> x2 += _x2;
+    k -> y  += _x ;
+    k -> y2 += _x2;
+    k -> xy += _x2;
+}
+
+void analyze_dmono   ( const mono* p, size_t len, korr_t* k )
+{
+    static double l0 = 0;
+    long double   _x = 0, _x2 = 0;
+    double        t1;
+    
+    k -> n  += len;
+    
+    for ( ; len--; p++ ) {
+        _x  += (t1 = (*p) - l0); _x2 += t1 * t1;
+	l0   = *p;
+    }
+    
+    k -> x  += _x ;
+    k -> x2 += _x2;
+    k -> y  += _x ;
+    k -> y2 += _x2;
+    k -> xy += _x2;
+}
+
+int sgn ( long double x )
+{
+    if ( x > 0 ) return +1;
+    if ( x < 0 ) return -1;
+    return 0;
+}
+
+int report ( const korr_t* k )
+{
+    long double  scale = sqrt ( 1.e5 / (1<<29) ); // Sine Full Scale is +10 dB, 7327 = 100%
+    long double  r;
+    long double  rd;
+    long double  sx;
+    long double  sy;
+    long double  x;
+    long double  y;
+    long double  b;
+    
+    r  = (k->x2*k->n - k->x*k->x) * (k->y2*k->n - k->y*k->y);
+    r  = r  > 0.l  ?  (k->xy*k->n - k->x*k->y) / sqrt (r)  :  1.l;
+    sx = k->n > 1  ?  sqrt ( (k->x2 - k->x*k->x/k->n) / (k->n - 1) )  :  0.l;
+    sy = k->n > 1  ?  sqrt ( (k->y2 - k->y*k->y/k->n) / (k->n - 1) )  :  0.l;
+    x  = k->n > 0  ?  k->x/k->n  :  0.l;
+    y  = k->n > 0  ?  k->y/k->n  :  0.l;
+    
+    b  = atan2 ( sy, sx * sgn (r) ) * ( 8 / M_PI);
+   
+//    6       5        4        3        2
+//      _______________________________
+//      |\             |             /|
+//    7 |   \          |          /   |  1
+//      |      \       |       /      |  
+//      |         \    |    /         |
+//      |            \ | /            |
+//    8 |--------------+--------------|  0
+//      |            / | \            |
+//      |         /    |    \         |
+//   -7 |      /       |       \      | -1
+//      |   /          |          \   |
+//      |/_____________|_____________\|
+//
+//   -6       -5      -4      -3        -2
+    
+    if ( r > 0.98 ) {
+        printf ("-mm");		// disguised mono file
+	return;
+    }
+    if ( fabs (b-2) > 0.666 ) {
+        printf ("-ms");		// low profit for joint stereo
+	return;
+    }
+    if ( r < 0.333 ) {
+        printf ("-ms");		// low profit for joint stereo
+	return;
+    }
+}
+
+void readfile ( const char* name, int fd )
+{
+    unsigned short  header [22];
+    stereo          s [4096];
+    mono            m [8192];
+    size_t          samples;
+    korr_t          k0;
+    korr_t          k1;
+    
+    memset ( &k0, 0, sizeof(k0) );
+    memset ( &k1, 0, sizeof(k1) );
+    
+    read ( fd, header, sizeof(header) );
+    
+    switch ( header[11] ) {
+    case 1:
+        printf ("-mm\n");
+        break;
+	
+    case 2:
+        while  ( ( samples = read (fd, s, sizeof(s)) ) > 0 ) {
+            analyze_stereo  ( s, samples / sizeof (*s), &k0 );
+            analyze_dstereo ( s, samples / sizeof (*s), &k1 );
+	}
+        report (&k0);
+        report (&k1);
+	break;
+	
+    default:
+        fprintf ( stderr, "%u Channels not supported: %s\n", header[11], name );
+        break;
+    }
+}
+
+int main ( int argc, char** argv )
+{
+    char*  name;
+    int    fd;
+    
+    if (argc < 2)
+        readfile ( "<stdin>", 0 );
+    else        
+        while ( (name = *++argv) != NULL ) {
+	    if ( (fd = open ( name, O_RDONLY )) >= 0 ) {
+                readfile ( name, fd );
+		close ( fd );
+	    } else {
+	        fprintf ( stderr, "Can't open: %s\n", name );
+	    }
+        }
+    
+    return 0;
+}
diff --git a/misc/mugeco.sh b/misc/mugeco.sh
new file mode 100755
index 0000000..6be2774
--- /dev/null
+++ b/misc/mugeco.sh
@@ -0,0 +1,137 @@
+#!/bin/sh
+progname=mugeco version=0.1
+programr='Alexander Leidinger'
+progdate='7 Dec 2000'
+progdesc='MUltiGEnerationCOding'
+# NEEDS: getopt, lame
+# Please have a look at the DEFAULTS section.
+
+# $Id: mugeco.sh,v 1.6 2000/12/08 13:47:56 aleidinger Exp $
+
+usage() {
+cat << EOF
+** $progname v$version, $progdate **
+by $programr
+$progdesc
+usage: $progname [ <flags> ] -g <num> <file>
+    -v	       use builtin VBR options
+    -g <num>   number of generations
+    -h help
+
+ used
+  - env vars:
+    * LAME   : alternative encoder binary
+    * LAMEOPT: alternative encoder options
+  - VBR opts: $enc_vbr_opts
+  - CBR opts: $enc_cbr_opts
+EOF
+}
+
+# DEFAULTS
+
+# if you can, use getopt(1) (c)1997 by Frodo Looijaard <frodol@dds.nl>
+# it's in most modern unixen, or look at http://huizen.dds.nl/~frodol/
+: ${GETOPT=getopt}	# helper program
+# mktemp (optional) is also in most modern unixen (originally from OpenBSD)
+: ${MKTEMP=mktemp}	# helper program
+: ${TMPDIR:=/tmp}	# set default temp directory
+: ${LAME:=lame}		# path to LAME
+
+enc_cbr_opts="-b192 -h --lowpass 18 --lowpass-width 0"
+enc_vbr_opts="--vbr-mtrh --nspsytune -v -h -d -Y -X3"
+enc_opts=${LAMEOPT:-$enc_cbr_opts}
+num=			# default number of generations
+
+# DEFINE FUNCTIONS
+
+e() { echo "$progname: $*"; }
+die() {	    # usage:  die [ <exitcode> [ <errormessage> ] ]
+    trap '' 1 2 3 13 15
+    exitcode=0
+    [ $# -gt 0 ] && { exitcode=$1; shift; }
+    [ $# -gt 0 ] && e "Error: $*" >&2
+    exit $exitcode
+}
+
+# tfile()
+# this function creates temporary files.  'tfile temp' will make a tempfile
+# and put the path to it in the variable $temp (defaults to variable $tf)
+trap 'for f in $ztfiles; do rm -f "$f"; done' 0
+trap 'trap "" 1 2 3 13 15; exit 10' 1 2 3 13 15
+unset ztfiles
+tfile() {	# usage: tfile <variable_name>
+    ztf=`$MKTEMP -q $TMPDIR/$progname.XXXXXX 2>/dev/null`	# try mktemp
+    if [ $? -gt 0 -o -z "$ztf" ]; then	# if mktemp fails, do it unsafely
+	ztf=$TMPDIR/$LOGNAME.$progname.$$
+	[ -e "$ztf" ] && ztf= || { touch $ztf && chmod 600 $ztf; }
+    fi
+    [ "$ztf" -a -f "$ztf" ] || { echo Could not make tempfile; exit 8; }
+    ztfiles="$ztfiles $ztf"
+    eval ${1:-tf}='$ztf'
+}
+
+# PARSE COMMAND LINE
+
+options="g:vh"	# option string for getopt(1)
+help=; [ "$1" = -h -o "$1" = -help -o "$1" = --help ] && help=yes
+[ "$help" ] && { usage; die; }
+$GETOPT -T >/dev/null 2>&1
+[ $? -eq 4 ] && GETOPT="$GETOPT -n $progname -s sh" #frodol's getopt?
+eval set -- `$GETOPT "$options" "$@"`
+[ $# -lt 1 ] && { die 9 getopt failed; }
+while [ $# -gt 0 ]; do
+    case "$1" in
+    -g) num=$2; shift ;;
+    -v) enc_opts=$enc_cbr_opts ;;
+    -h)	help=y ;;
+    --)	shift; break ;;
+    *)	usage; die 9 "invalid command line syntax!" ;;
+    esac
+    shift
+done
+[ "$help" ] && { usage; die; }
+[ $# -eq 0 ] && { usage; die 9 no arguments; } #change or remove if desired
+# sanity checking
+[ "$num" ] && echo "$num"|grep -q '^[0-9]*$' && [ $num -ge 1 ] \
+    || die 1 please use the -g flag with a valid number
+
+# MAIN PROGRAM
+
+# what version of lame are we using?
+lame_vers=`$LAME 2>&1 | awk 'NR==1{print $3}'`
+
+# check filename
+[ -f "$1" ] || die 2 "'$1' isn't a file"
+echo "$1"|grep -qi '\.wav$' || die 2 "'$1' isn't a .wav"
+
+# make tempfiles
+base=`echo "$1"|sed 's/\.[^.]*$//'`
+dest=${base}_generation_$num.wav
+[ -e "$dest" ] && die 2 "'$dest' already exists"
+touch "$dest" || die 2 "couldn't create '$dest'"
+TMPDIR=. tfile tmpwav
+TMPDIR=. tfile tmpmp3
+cp -f "$1" "$tmpwav"
+
+# do the loop
+start=`date`
+i=1
+while [ $i -le $num ]; do
+    e "Working on file '$1', generation number $i..."
+
+    $LAME $enc_opts --tc "lame $lame_vers; Generation: $i" \
+	"$tmpwav" "$tmpmp3" || die 3 encoding failed
+    $LAME --decode --mp3input "$tmpmp3" "$tmpwav" || die 3 decoding failed
+
+    i=`expr $i + 1`
+done
+end=`date`
+
+# save the result
+ln -f "$tmpwav" "$dest"
+
+echo
+e "Start: $start"
+e "Stop : $end"
+
+die
diff --git a/misc/scalartest.c b/misc/scalartest.c
new file mode 100644
index 0000000..01680d0
--- /dev/null
+++ b/misc/scalartest.c
@@ -0,0 +1,166 @@
+#include <stdio.h>
+#include <math.h>
+#include <asm/msr.h>
+#include "resample.h"
+
+#define CLK    300.e6
+#define LOOPS  20000
+
+
+typedef double ( *ddf ) ( double );
+
+
+float a1 [256];
+float a2 [256];
+
+void init ( void )
+{
+    int  i;
+    
+    for ( i = 0; i < sizeof(a1)/sizeof(*a1); i++ ) {
+        a1 [i] = sin(i)+0.2*sin(1.8*i)+log(2+i);
+	a2 [i] = cos(0.1*i);
+    }
+}
+
+void test ( int no, scalar_t f )
+{
+    unsigned long long  t1;
+    unsigned long long  t2;
+    unsigned long long  t3;
+    unsigned long long  t4;
+    int                 l;
+    double              last = 0;
+    double              curr = 0;
+    
+    printf ( "[%3u] %22.14f\t\t", no, (double)f (a1,a2) );
+    fflush ( stdout );
+
+    do {
+    rdtscll (t1);
+    l = LOOPS;
+    do
+        ;
+    while (--l);
+    rdtscll (t2);
+    rdtscll (t3);
+    l = LOOPS;
+    do
+        f(a1,a2), f(a1,a2), f(a1,a2), f(a1,a2);
+    while (--l);
+    rdtscll (t4);
+    last = curr;
+    curr = (t4-t3-t2+t1) / CLK / LOOPS / 4 * 1.e9;
+    } while ( fabs(curr-last) > 1.e-4 * (curr+last) );
+    printf ("%8.2f ns\n", (curr+last) / 2 );
+}
+
+void testn ( scalarn_t f )
+{
+    unsigned long long  t1;
+    unsigned long long  t2;
+    unsigned long long  t3;
+    unsigned long long  t4;
+    int                 l;
+    int                 i;
+    double              last = 0;
+    double              curr = 0;
+    
+    for ( i = 1; i <= 64; i += i<6 ? 1 : i<8 ? 2 : i ) {
+        printf ( "[%3u] %22.14f\t\t", 4*i, (double)f (a1,a2,i) );
+        fflush ( stdout );
+
+    do {
+        rdtscll (t1);
+        l = LOOPS;
+        do
+            ;
+        while (--l);
+        rdtscll (t2);
+        rdtscll (t3);
+        l = LOOPS;
+        do
+            f(a1,a2,i), f(a1,a2,i), f(a1,a2,i), f(a1,a2,i);
+        while (--l);
+        rdtscll (t4);
+    last = curr;
+    curr = (t4-t3-t2+t1) / CLK / LOOPS / 4 * 1.e9;
+    } while ( fabs(curr-last) > 1.e-4 * (curr+last) );
+    printf ("%8.2f ns\n", (curr+last) / 2 );
+    }
+}
+
+void test2 ( const char* name, ddf f )
+{
+    int     i;
+    double  x;
+    
+    printf ( "\n%%%% %s\n\n", name );
+    
+    for ( i = -1000; i <= 1000; i++ ) {
+        x = 1.e-3 * i;
+	printf ( "%5d\t%12.8f\t%12.8f\t%12.8f\n", i, f(x), (f(x+5.e-5) - f(x-5.e-5))*1.e+4, (f(x+1.e-4) + f(x-1.e-4) - 2*f(x))*5.e+7 );
+    }
+    printf ( "%%%%\n" );
+    fflush ( stdout );
+}
+
+
+int main ( int argc, char** argv )
+{
+
+#if 0
+
+    test2 ( "Hann", hanning   );
+    test2 ( "Hamm", hamming   );
+    test2 ( "BM", blackman  );
+    test2 ( "BM1",blackman1 );
+    test2 ( "BM2",blackman2 );
+    test2 ( "BMH N",blackmanharris_nuttall );
+    test2 ( "MNH Min",blackmanharris_min4    );
+
+#else
+
+    init ();
+
+    test ( 4, scalar04_float32       );
+    test ( 4, scalar04_float32_i387  );
+    test ( 4, scalar04_float32_3DNow );
+    test ( 4, scalar04_float32_SIMD  );
+
+    test ( 8, scalar08_float32       );
+    test ( 8, scalar08_float32_i387  );
+    test ( 8, scalar08_float32_3DNow );
+    test ( 8, scalar08_float32_SIMD  );
+
+    test ( 12, scalar12_float32       );
+    test ( 12, scalar12_float32_i387  );
+    test ( 12, scalar12_float32_3DNow );
+    test ( 12, scalar12_float32_SIMD  );
+
+    test ( 16, scalar16_float32       );
+    test ( 16, scalar16_float32_i387  );
+    test ( 16, scalar16_float32_3DNow );
+    test ( 16, scalar16_float32_SIMD  );
+
+    test ( 20, scalar20_float32       );
+    test ( 20, scalar20_float32_i387  );
+    test ( 20, scalar20_float32_3DNow );
+    test ( 20, scalar20_float32_SIMD  );
+
+    test ( 24, scalar24_float32       );
+    test ( 24, scalar24_float32_i387  );
+    test ( 24, scalar24_float32_3DNow );
+    test ( 24, scalar24_float32_SIMD  );
+
+    testn( scalar4n_float32       );
+    testn( scalar4n_float32_i387  );
+    testn( scalar4n_float32_3DNow );
+    testn( scalar4n_float32_SIMD  );
+
+#endif    
+    
+    return 0;
+}
+
+/* end of scalartest.c */
diff --git a/missing b/missing
new file mode 100755
index 0000000..894e786
--- /dev/null
+++ b/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case "$firstarg" in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case "$firstarg" in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/mpglib/AUTHORS b/mpglib/AUTHORS
new file mode 100644
index 0000000..0a6a10b
--- /dev/null
+++ b/mpglib/AUTHORS
@@ -0,0 +1,16 @@
+Michael Hipp	<mh@mpg123.de>	Author of orignal mpglib version 0.2a.
+
+Albert L. Faber	<afaber@users.sf.net>
+Aleksander Korzynski	<olcios@users.sf.net> 
+Alexander Leidinger	<aleidinger@users.sf.net>
+Frank Klemm	<pfk@users.sf.net>
+Gabriel Bouvigne	<bouvigne@users.sf.net>
+Leigh Smith	<leighsmith@users.sf.net>
+Mark Taylor	<markt@users.sf.net>
+Myers Carpenter	<myers@users.sf.net>
+Naoki Shibata	<shibatch@users.sf.net>
+Robert Hegemann	<robert@users.sf.net>
+Sigbjorn Skjaeret	<cisc@users.sf.net>
+Stefan Bellon	<sbellon@users.sf.net>
+Steve Lhomme	<robux4@users.sf.net>
+Takehiro TOMINAGA	<takehiro@users.sf.net>
diff --git a/mpglib/Makefile.am b/mpglib/Makefile.am
new file mode 100644
index 0000000..34640c7
--- /dev/null
+++ b/mpglib/Makefile.am
@@ -0,0 +1,57 @@
+## $Id: Makefile.am,v 1.15.8.1 2010/03/22 14:17:14 robert Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+INCLUDES = @INCLUDES@ -I$(top_srcdir)/libmp3lame -I$(top_builddir)
+
+EXTRA_DIST = \
+	AUTHORS \
+	README \
+	mpglib_vc6.dsp \
+	mpglib_vc8.vcproj
+
+DEFS = @DEFS@ @CONFIG_DEFS@
+
+noinst_LTLIBRARIES = libmpgdecoder.la
+
+libmpgdecoder_la_SOURCES = common.c \
+	dct64_i386.c \
+	decode_i386.c \
+	interface.c \
+	layer1.c \
+	layer2.c \
+	layer3.c \
+	tabinit.c
+
+noinst_HEADERS = common.h \
+	dct64_i386.h \
+	decode_i386.h \
+	huffman.h \
+	interface.h \
+	l2tables.h \
+	layer1.h \
+	layer2.h \
+	layer3.h \
+	mpg123.h \
+	mpglib.h \
+	tabinit.h
+
+LCLINTFLAGS= \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+lclint.txt: ${libmpgdecoder_la_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${libmpgdecoder_la_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
diff --git a/mpglib/Makefile.in b/mpglib/Makefile.in
new file mode 100644
index 0000000..27086a8
--- /dev/null
+++ b/mpglib/Makefile.in
@@ -0,0 +1,552 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ANSI2KNR = $(top_srcdir)/ansi2knr
+DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/Makefile.am.global depcomp
+subdir = mpglib
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libmpgdecoder_la_LIBADD =
+am_libmpgdecoder_la_OBJECTS = common$U.lo dct64_i386$U.lo \
+	decode_i386$U.lo interface$U.lo layer1$U.lo layer2$U.lo \
+	layer3$U.lo tabinit$U.lo
+libmpgdecoder_la_OBJECTS = $(am_libmpgdecoder_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libmpgdecoder_la_SOURCES)
+DIST_SOURCES = $(libmpgdecoder_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@ @CONFIG_DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@ -I$(top_srcdir)/libmp3lame -I$(top_builddir)
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = \
+	AUTHORS \
+	README \
+	mpglib_vc6.dsp \
+	mpglib_vc8.vcproj
+
+noinst_LTLIBRARIES = libmpgdecoder.la
+libmpgdecoder_la_SOURCES = common.c \
+	dct64_i386.c \
+	decode_i386.c \
+	interface.c \
+	layer1.c \
+	layer2.c \
+	layer3.c \
+	tabinit.c
+
+noinst_HEADERS = common.h \
+	dct64_i386.h \
+	decode_i386.h \
+	huffman.h \
+	interface.h \
+	l2tables.h \
+	layer1.h \
+	layer2.h \
+	layer3.h \
+	mpg123.h \
+	mpglib.h \
+	tabinit.h
+
+LCLINTFLAGS = \
+	+posixlib \
+	+showsummary \
+	+showalluses \
+	+whichlib \
+	+forcehints \
+	-fixedformalarray \
+	+matchanyintegral \
+	-Dlint
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  mpglib/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  mpglib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libmpgdecoder.la: $(libmpgdecoder_la_OBJECTS) $(libmpgdecoder_la_DEPENDENCIES) 
+	$(LINK)  $(libmpgdecoder_la_OBJECTS) $(libmpgdecoder_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+$(top_srcdir)/ansi2knr:
+	cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
+
+mostlyclean-kr:
+	-test "$U" = "" || rm -f *_.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dct64_i386$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode_i386$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer1$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer2$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer3$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabinit$U.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+common_.c: common.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/common.c; then echo $(srcdir)/common.c; else echo common.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dct64_i386_.c: dct64_i386.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dct64_i386.c; then echo $(srcdir)/dct64_i386.c; else echo dct64_i386.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+decode_i386_.c: decode_i386.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/decode_i386.c; then echo $(srcdir)/decode_i386.c; else echo decode_i386.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+interface_.c: interface.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/interface.c; then echo $(srcdir)/interface.c; else echo interface.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+layer1_.c: layer1.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/layer1.c; then echo $(srcdir)/layer1.c; else echo layer1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+layer2_.c: layer2.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/layer2.c; then echo $(srcdir)/layer2.c; else echo layer2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+layer3_.c: layer3.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/layer3.c; then echo $(srcdir)/layer3.c; else echo layer3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tabinit_.c: tabinit.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tabinit.c; then echo $(srcdir)/tabinit.c; else echo tabinit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+common_.$(OBJEXT) common_.lo dct64_i386_.$(OBJEXT) dct64_i386_.lo \
+decode_i386_.$(OBJEXT) decode_i386_.lo interface_.$(OBJEXT) \
+interface_.lo layer1_.$(OBJEXT) layer1_.lo layer2_.$(OBJEXT) \
+layer2_.lo layer3_.$(OBJEXT) layer3_.lo tabinit_.$(OBJEXT) tabinit_.lo \
+: $(ANSI2KNR)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am
+
+
+# end global section
+
+lclint.txt: ${libmpgdecoder_la_SOURCES} ${noinst_HEADERS}
+	@lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${libmpgdecoder_la_SOURCES} 2>&1 >lclint.txt || true
+
+lclint: lclint.txt
+	more lclint.txt
+
+#$(OBJECTS): libtool
+#libtool: $(LIBTOOL_DEPS)
+#	$(SHELL) $(top_builddir)/config.status --recheck
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mpglib/README b/mpglib/README
new file mode 100644
index 0000000..7155d00
--- /dev/null
+++ b/mpglib/README
@@ -0,0 +1,26 @@
+hip - Hip Isn't a Player
+A LGPLed mpeg audio decoding library.
+
+Based off of Michael Hipp's mpglib 0.2a <http://www.mpg123.de/>, with many
+improvements by the lame development team (see AUTHORS).
+
+The interface to the library is based off of vorbisfile.  If you add mp3
+support to your app using this library it should be a snap to add Ogg Vorbis
+support as well.
+
+This isn't as fast as mpg123 will be for decoding as none of it is in
+assmbler.  
+
+Seeking currently isn't implemented.
+
+
+From mpglib's orginal README:
+=============================
+
+PLEASE NOTE: This software may contain patented algorithms (at least
+  patented in some countries). It may be not allowed to sell/use products
+  based on this source code in these countries. Check this out first!
+
+COPYRIGHT of MP3 music:
+  Please note, that the duplicating of copyrighted music without explicit
+  permission violates the rights of the owner.
diff --git a/mpglib/common.c b/mpglib/common.c
new file mode 100644
index 0000000..0f6a907
--- /dev/null
+++ b/mpglib/common.c
@@ -0,0 +1,344 @@
+/*
+ * common.c: some common bitstream operations
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: common.c,v 1.32.8.4 2010/03/22 14:32:36 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <signal.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef macintosh
+#include   <types.h>
+#include   <stat.h>
+#else
+#include  <sys/types.h>
+#include  <sys/stat.h>
+#endif
+
+#include "common.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* In C++ the array first must be prototyped, why ? */
+
+
+    /* *INDENT-OFF* */
+const int tabsel_123 [2] [3] [16] = {
+   { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
+     {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
+     {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
+
+   { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
+     {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
+     {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
+};
+
+const long freqs[9] = { 44100, 48000, 32000,
+                        22050, 24000, 16000,
+                        11025, 12000,  8000 };
+
+    /* *INDENT-ON* */
+
+
+real    muls[27][64];
+
+#if 0
+static void
+get_II_stuff(struct frame *fr)
+{
+    /* *INDENT-OFF* */
+  static const int translate [3] [2] [16] =   /* char ? */
+   { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
+       { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
+     { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
+       { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } ,
+     { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,
+       { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
+    /* *INDENT-ON* */
+
+    int     table, sblim;
+    static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 };
+    static int sblims[5] = { 27, 30, 8, 12, 30 };
+
+    if (fr->lsf)
+        table = 4;
+    else
+        table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index];
+    sblim = sblims[table];
+
+    fr->alloc = tables[table];
+    fr->II_sblimit = sblim;
+}
+#endif
+
+#define HDRCMPMASK 0xfffffd00
+
+#define MAX_INPUT_FRAMESIZE 4096
+
+int
+head_check(unsigned long head, int check_layer)
+{
+    /*
+       look for a valid header.  
+       if check_layer > 0, then require that
+       nLayer = check_layer.  
+     */
+
+    /* bits 13-14 = layer 3 */
+    int     nLayer = 4 - ((head >> 17) & 3);
+
+    if ((head & 0xffe00000) != 0xffe00000) {
+        /* syncword */
+        return FALSE;
+    }
+
+    if (nLayer == 4)
+        return FALSE;
+
+    if (check_layer > 0 && nLayer != check_layer)
+        return FALSE;
+
+    if (((head >> 12) & 0xf) == 0xf) {
+        /* bits 16,17,18,19 = 1111  invalid bitrate */
+        return FALSE;
+    }
+    if (((head >> 10) & 0x3) == 0x3) {
+        /* bits 20,21 = 11  invalid sampling freq */
+        return FALSE;
+    }
+    if ((head & 0x3) == 0x2)
+        /* invalid emphasis */
+        return FALSE;
+    return TRUE;
+}
+
+
+/*
+ * decode a header and write the information
+ * into the frame structure
+ */
+int
+decode_header(struct frame *fr, unsigned long newhead)
+{
+
+
+    if (newhead & (1 << 20)) {
+        fr->lsf = (newhead & (1 << 19)) ? 0x0 : 0x1;
+        fr->mpeg25 = 0;
+    }
+    else {
+        fr->lsf = 1;
+        fr->mpeg25 = 1;
+    }
+
+
+    fr->lay = 4 - ((newhead >> 17) & 3);
+    if (((newhead >> 10) & 0x3) == 0x3) {
+        fprintf(stderr, "Stream error\n");
+        exit(1);
+    }
+    if (fr->mpeg25) {
+        fr->sampling_frequency = 6 + ((newhead >> 10) & 0x3);
+    }
+    else
+        fr->sampling_frequency = ((newhead >> 10) & 0x3) + (fr->lsf * 3);
+
+    fr->error_protection = ((newhead >> 16) & 0x1) ^ 0x1;
+
+    if (fr->mpeg25)     /* allow Bitrate change for 2.5 ... */
+        fr->bitrate_index = ((newhead >> 12) & 0xf);
+
+    fr->bitrate_index = ((newhead >> 12) & 0xf);
+    fr->padding = ((newhead >> 9) & 0x1);
+    fr->extension = ((newhead >> 8) & 0x1);
+    fr->mode = ((newhead >> 6) & 0x3);
+    fr->mode_ext = ((newhead >> 4) & 0x3);
+    fr->copyright = ((newhead >> 3) & 0x1);
+    fr->original = ((newhead >> 2) & 0x1);
+    fr->emphasis = newhead & 0x3;
+
+    fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2;
+
+    switch (fr->lay) {
+    case 1:
+        fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000;
+        fr->framesize /= freqs[fr->sampling_frequency];
+        fr->framesize = ((fr->framesize + fr->padding) << 2) - 4;
+        fr->down_sample = 0;
+        fr->down_sample_sblimit = SBLIMIT >> (fr->down_sample);
+        break;
+
+    case 2:
+        fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000;
+        fr->framesize /= freqs[fr->sampling_frequency];
+        fr->framesize += fr->padding - 4;
+        fr->down_sample = 0;
+        fr->down_sample_sblimit = SBLIMIT >> (fr->down_sample);
+        break;
+
+    case 3:
+#if 0
+        fr->do_layer = do_layer3;
+        if (fr->lsf)
+            ssize = (fr->stereo == 1) ? 9 : 17;
+        else
+            ssize = (fr->stereo == 1) ? 17 : 32;
+#endif
+
+#if 0
+        if (fr->error_protection)
+            ssize += 2;
+#endif
+        if (fr->framesize > MAX_INPUT_FRAMESIZE) {
+            fprintf(stderr, "Frame size too big.\n");
+            fr->framesize = MAX_INPUT_FRAMESIZE;
+            return (0);
+        }
+
+
+        if (fr->bitrate_index == 0)
+            fr->framesize = 0;
+        else {
+            fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000;
+            fr->framesize /= freqs[fr->sampling_frequency] << (fr->lsf);
+            fr->framesize = fr->framesize + fr->padding - 4;
+        }
+        break;
+    default:
+        fprintf(stderr, "Sorry, layer %d not supported\n", fr->lay);
+        return (0);
+    }
+    /*    print_header(fr); */
+
+    return 1;
+}
+
+
+#if 1
+void
+print_header(struct frame *fr)
+{
+    static const char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
+    static const char *layers[4] = { "Unknown", "I", "II", "III" };
+
+    fprintf(stderr, "MPEG %s, Layer: %s, Freq: %ld, mode: %s, modext: %d, BPF : %d\n",
+            fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
+            layers[fr->lay], freqs[fr->sampling_frequency],
+            modes[fr->mode], fr->mode_ext, fr->framesize + 4);
+    fprintf(stderr, "Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d.\n",
+            fr->stereo, fr->copyright ? "Yes" : "No",
+            fr->original ? "Yes" : "No", fr->error_protection ? "Yes" : "No", fr->emphasis);
+    fprintf(stderr, "Bitrate: %d Kbits/s, Extension value: %d\n",
+            tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], fr->extension);
+}
+
+void
+print_header_compact(struct frame *fr)
+{
+    static const char *modes[4] = { "stereo", "joint-stereo", "dual-channel", "mono" };
+    static const char *layers[4] = { "Unknown", "I", "II", "III" };
+
+    fprintf(stderr, "MPEG %s layer %s, %d kbit/s, %ld Hz %s\n",
+            fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
+            layers[fr->lay],
+            tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index],
+            freqs[fr->sampling_frequency], modes[fr->mode]);
+}
+
+#endif
+
+unsigned int
+getbits(PMPSTR mp, int number_of_bits)
+{
+    unsigned long rval;
+
+    if (number_of_bits <= 0 || !mp->wordpointer)
+        return 0;
+
+    {
+        rval = mp->wordpointer[0];
+        rval <<= 8;
+        rval |= mp->wordpointer[1];
+        rval <<= 8;
+        rval |= mp->wordpointer[2];
+        rval <<= mp->bitindex;
+        rval &= 0xffffff;
+
+        mp->bitindex += number_of_bits;
+
+        rval >>= (24 - number_of_bits);
+
+        mp->wordpointer += (mp->bitindex >> 3);
+        mp->bitindex &= 7;
+    }
+    return rval;
+}
+
+unsigned int
+getbits_fast(PMPSTR mp, int number_of_bits)
+{
+    unsigned long rval;
+
+    {
+        rval = mp->wordpointer[0];
+        rval <<= 8;
+        rval |= mp->wordpointer[1];
+        rval <<= mp->bitindex;
+        rval &= 0xffff;
+        mp->bitindex += number_of_bits;
+
+        rval >>= (16 - number_of_bits);
+
+        mp->wordpointer += (mp->bitindex >> 3);
+        mp->bitindex &= 7;
+    }
+    return rval;
+}
+
+
+int
+set_pointer(PMPSTR mp, long backstep)
+{
+    unsigned char *bsbufold;
+
+    if (mp->fsizeold < 0 && backstep > 0) {
+        fprintf(stderr, "hip: Can't step back %ld bytes!\n", backstep);
+        return MP3_ERR;
+    }
+    bsbufold = mp->bsspace[1 - mp->bsnum] + 512;
+    mp->wordpointer -= backstep;
+    if (backstep)
+        memcpy(mp->wordpointer, bsbufold + mp->fsizeold - backstep, (size_t) backstep);
+    mp->bitindex = 0;
+    return MP3_OK;
+}
diff --git a/mpglib/common.h b/mpglib/common.h
new file mode 100644
index 0000000..d33d75e
--- /dev/null
+++ b/mpglib/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef COMMON_H_INCLUDED
+#define COMMON_H_INCLUDED
+
+#include "mpg123.h"
+#include "mpglib.h"
+
+extern const int tabsel_123[2][3][16];
+extern const long freqs[9];
+
+extern real muls[27][64];
+
+
+int     head_check(unsigned long head, int check_layer);
+int     decode_header(struct frame *fr, unsigned long newhead);
+void    print_header(struct frame *fr);
+void    print_header_compact(struct frame *fr);
+unsigned int getbits(PMPSTR mp, int number_of_bits);
+unsigned int getbits_fast(PMPSTR mp, int number_of_bits);
+int     set_pointer(PMPSTR mp, long backstep);
+
+#endif
diff --git a/mpglib/dct64_i386.c b/mpglib/dct64_i386.c
new file mode 100644
index 0000000..5711d56
--- /dev/null
+++ b/mpglib/dct64_i386.c
@@ -0,0 +1,348 @@
+/*
+ * dct64_i368.c
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ *
+ * Discrete Cosine Tansform (DCT) for subband synthesis
+ * optimized for machines with no auto-increment. 
+ * The performance is highly compiler dependend. Maybe
+ * the dct64.c version for 'normal' processor may be faster
+ * even for Intel processors.
+ */
+
+/* $Id: dct64_i386.c,v 1.10.10.2 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "dct64_i386.h"
+#include "tabinit.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static void
+dct64_1(real * out0, real * out1, real * b1, real * b2, real * samples)
+{
+
+    {
+        real   *costab = pnts[0];
+
+        b1[0x00] = samples[0x00] + samples[0x1F];
+        b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
+
+        b1[0x01] = samples[0x01] + samples[0x1E];
+        b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
+
+        b1[0x02] = samples[0x02] + samples[0x1D];
+        b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
+
+        b1[0x03] = samples[0x03] + samples[0x1C];
+        b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
+
+        b1[0x04] = samples[0x04] + samples[0x1B];
+        b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
+
+        b1[0x05] = samples[0x05] + samples[0x1A];
+        b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
+
+        b1[0x06] = samples[0x06] + samples[0x19];
+        b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
+
+        b1[0x07] = samples[0x07] + samples[0x18];
+        b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
+
+        b1[0x08] = samples[0x08] + samples[0x17];
+        b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
+
+        b1[0x09] = samples[0x09] + samples[0x16];
+        b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
+
+        b1[0x0A] = samples[0x0A] + samples[0x15];
+        b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
+
+        b1[0x0B] = samples[0x0B] + samples[0x14];
+        b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
+
+        b1[0x0C] = samples[0x0C] + samples[0x13];
+        b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
+
+        b1[0x0D] = samples[0x0D] + samples[0x12];
+        b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
+
+        b1[0x0E] = samples[0x0E] + samples[0x11];
+        b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
+
+        b1[0x0F] = samples[0x0F] + samples[0x10];
+        b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
+    }
+
+
+    {
+        real   *costab = pnts[1];
+
+        b2[0x00] = b1[0x00] + b1[0x0F];
+        b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
+        b2[0x01] = b1[0x01] + b1[0x0E];
+        b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
+        b2[0x02] = b1[0x02] + b1[0x0D];
+        b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
+        b2[0x03] = b1[0x03] + b1[0x0C];
+        b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
+        b2[0x04] = b1[0x04] + b1[0x0B];
+        b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
+        b2[0x05] = b1[0x05] + b1[0x0A];
+        b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
+        b2[0x06] = b1[0x06] + b1[0x09];
+        b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
+        b2[0x07] = b1[0x07] + b1[0x08];
+        b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
+
+        b2[0x10] = b1[0x10] + b1[0x1F];
+        b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
+        b2[0x11] = b1[0x11] + b1[0x1E];
+        b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
+        b2[0x12] = b1[0x12] + b1[0x1D];
+        b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
+        b2[0x13] = b1[0x13] + b1[0x1C];
+        b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
+        b2[0x14] = b1[0x14] + b1[0x1B];
+        b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
+        b2[0x15] = b1[0x15] + b1[0x1A];
+        b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
+        b2[0x16] = b1[0x16] + b1[0x19];
+        b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
+        b2[0x17] = b1[0x17] + b1[0x18];
+        b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
+    }
+
+    {
+        real   *costab = pnts[2];
+
+        b1[0x00] = b2[0x00] + b2[0x07];
+        b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
+        b1[0x01] = b2[0x01] + b2[0x06];
+        b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
+        b1[0x02] = b2[0x02] + b2[0x05];
+        b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
+        b1[0x03] = b2[0x03] + b2[0x04];
+        b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
+
+        b1[0x08] = b2[0x08] + b2[0x0F];
+        b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
+        b1[0x09] = b2[0x09] + b2[0x0E];
+        b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
+        b1[0x0A] = b2[0x0A] + b2[0x0D];
+        b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
+        b1[0x0B] = b2[0x0B] + b2[0x0C];
+        b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
+
+        b1[0x10] = b2[0x10] + b2[0x17];
+        b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
+        b1[0x11] = b2[0x11] + b2[0x16];
+        b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
+        b1[0x12] = b2[0x12] + b2[0x15];
+        b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
+        b1[0x13] = b2[0x13] + b2[0x14];
+        b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
+
+        b1[0x18] = b2[0x18] + b2[0x1F];
+        b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
+        b1[0x19] = b2[0x19] + b2[0x1E];
+        b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
+        b1[0x1A] = b2[0x1A] + b2[0x1D];
+        b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
+        b1[0x1B] = b2[0x1B] + b2[0x1C];
+        b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
+    }
+
+    {
+        real const cos0 = pnts[3][0];
+        real const cos1 = pnts[3][1];
+
+        b2[0x00] = b1[0x00] + b1[0x03];
+        b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
+        b2[0x01] = b1[0x01] + b1[0x02];
+        b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
+
+        b2[0x04] = b1[0x04] + b1[0x07];
+        b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
+        b2[0x05] = b1[0x05] + b1[0x06];
+        b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
+
+        b2[0x08] = b1[0x08] + b1[0x0B];
+        b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
+        b2[0x09] = b1[0x09] + b1[0x0A];
+        b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
+
+        b2[0x0C] = b1[0x0C] + b1[0x0F];
+        b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
+        b2[0x0D] = b1[0x0D] + b1[0x0E];
+        b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
+
+        b2[0x10] = b1[0x10] + b1[0x13];
+        b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
+        b2[0x11] = b1[0x11] + b1[0x12];
+        b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
+
+        b2[0x14] = b1[0x14] + b1[0x17];
+        b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
+        b2[0x15] = b1[0x15] + b1[0x16];
+        b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
+
+        b2[0x18] = b1[0x18] + b1[0x1B];
+        b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
+        b2[0x19] = b1[0x19] + b1[0x1A];
+        b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
+
+        b2[0x1C] = b1[0x1C] + b1[0x1F];
+        b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
+        b2[0x1D] = b1[0x1D] + b1[0x1E];
+        b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
+    }
+
+    {
+        real const cos0 = pnts[4][0];
+
+        b1[0x00] = b2[0x00] + b2[0x01];
+        b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
+        b1[0x02] = b2[0x02] + b2[0x03];
+        b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
+        b1[0x02] += b1[0x03];
+
+        b1[0x04] = b2[0x04] + b2[0x05];
+        b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
+        b1[0x06] = b2[0x06] + b2[0x07];
+        b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
+        b1[0x06] += b1[0x07];
+        b1[0x04] += b1[0x06];
+        b1[0x06] += b1[0x05];
+        b1[0x05] += b1[0x07];
+
+        b1[0x08] = b2[0x08] + b2[0x09];
+        b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
+        b1[0x0A] = b2[0x0A] + b2[0x0B];
+        b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
+        b1[0x0A] += b1[0x0B];
+
+        b1[0x0C] = b2[0x0C] + b2[0x0D];
+        b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
+        b1[0x0E] = b2[0x0E] + b2[0x0F];
+        b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
+        b1[0x0E] += b1[0x0F];
+        b1[0x0C] += b1[0x0E];
+        b1[0x0E] += b1[0x0D];
+        b1[0x0D] += b1[0x0F];
+
+        b1[0x10] = b2[0x10] + b2[0x11];
+        b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
+        b1[0x12] = b2[0x12] + b2[0x13];
+        b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
+        b1[0x12] += b1[0x13];
+
+        b1[0x14] = b2[0x14] + b2[0x15];
+        b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
+        b1[0x16] = b2[0x16] + b2[0x17];
+        b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
+        b1[0x16] += b1[0x17];
+        b1[0x14] += b1[0x16];
+        b1[0x16] += b1[0x15];
+        b1[0x15] += b1[0x17];
+
+        b1[0x18] = b2[0x18] + b2[0x19];
+        b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
+        b1[0x1A] = b2[0x1A] + b2[0x1B];
+        b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
+        b1[0x1A] += b1[0x1B];
+
+        b1[0x1C] = b2[0x1C] + b2[0x1D];
+        b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
+        b1[0x1E] = b2[0x1E] + b2[0x1F];
+        b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
+        b1[0x1E] += b1[0x1F];
+        b1[0x1C] += b1[0x1E];
+        b1[0x1E] += b1[0x1D];
+        b1[0x1D] += b1[0x1F];
+    }
+
+    out0[0x10 * 16] = b1[0x00];
+    out0[0x10 * 12] = b1[0x04];
+    out0[0x10 * 8] = b1[0x02];
+    out0[0x10 * 4] = b1[0x06];
+    out0[0x10 * 0] = b1[0x01];
+    out1[0x10 * 0] = b1[0x01];
+    out1[0x10 * 4] = b1[0x05];
+    out1[0x10 * 8] = b1[0x03];
+    out1[0x10 * 12] = b1[0x07];
+
+    b1[0x08] += b1[0x0C];
+    out0[0x10 * 14] = b1[0x08];
+    b1[0x0C] += b1[0x0a];
+    out0[0x10 * 10] = b1[0x0C];
+    b1[0x0A] += b1[0x0E];
+    out0[0x10 * 6] = b1[0x0A];
+    b1[0x0E] += b1[0x09];
+    out0[0x10 * 2] = b1[0x0E];
+    b1[0x09] += b1[0x0D];
+    out1[0x10 * 2] = b1[0x09];
+    b1[0x0D] += b1[0x0B];
+    out1[0x10 * 6] = b1[0x0D];
+    b1[0x0B] += b1[0x0F];
+    out1[0x10 * 10] = b1[0x0B];
+    out1[0x10 * 14] = b1[0x0F];
+
+    b1[0x18] += b1[0x1C];
+    out0[0x10 * 15] = b1[0x10] + b1[0x18];
+    out0[0x10 * 13] = b1[0x18] + b1[0x14];
+    b1[0x1C] += b1[0x1a];
+    out0[0x10 * 11] = b1[0x14] + b1[0x1C];
+    out0[0x10 * 9] = b1[0x1C] + b1[0x12];
+    b1[0x1A] += b1[0x1E];
+    out0[0x10 * 7] = b1[0x12] + b1[0x1A];
+    out0[0x10 * 5] = b1[0x1A] + b1[0x16];
+    b1[0x1E] += b1[0x19];
+    out0[0x10 * 3] = b1[0x16] + b1[0x1E];
+    out0[0x10 * 1] = b1[0x1E] + b1[0x11];
+    b1[0x19] += b1[0x1D];
+    out1[0x10 * 1] = b1[0x11] + b1[0x19];
+    out1[0x10 * 3] = b1[0x19] + b1[0x15];
+    b1[0x1D] += b1[0x1B];
+    out1[0x10 * 5] = b1[0x15] + b1[0x1D];
+    out1[0x10 * 7] = b1[0x1D] + b1[0x13];
+    b1[0x1B] += b1[0x1F];
+    out1[0x10 * 9] = b1[0x13] + b1[0x1B];
+    out1[0x10 * 11] = b1[0x1B] + b1[0x17];
+    out1[0x10 * 13] = b1[0x17] + b1[0x1F];
+    out1[0x10 * 15] = b1[0x1F];
+}
+
+/*
+ * the call via dct64 is a trick to force GCC to use
+ * (new) registers for the b1,b2 pointer to the bufs[xx] field
+ */
+void
+dct64(real * a, real * b, real * c)
+{
+    real    bufs[0x40];
+    dct64_1(a, b, bufs, bufs + 0x20, c);
+}
diff --git a/mpglib/dct64_i386.h b/mpglib/dct64_i386.h
new file mode 100644
index 0000000..a140ee7
--- /dev/null
+++ b/mpglib/dct64_i386.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MPGLIB_DCT64_I386_H_INCLUDED
+#define MPGLIB_DCT64_I386_H_INCLUDED
+
+#include "common.h"
+
+void    dct64(real * a, real * b, real * c);
+
+
+#endif
diff --git a/mpglib/decode_i386.c b/mpglib/decode_i386.c
new file mode 100644
index 0000000..88ba322
--- /dev/null
+++ b/mpglib/decode_i386.c
@@ -0,0 +1,224 @@
+/*
+ * decode_i396.c: Mpeg Layer-1,2,3 audio decoder
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ *
+ * Slighlty optimized for machines without autoincrement/decrement.
+ * The performance is highly compiler dependend. Maybe
+ * the decode.c version for 'normal' processor may be faster
+ * even for Intel processors.
+ */
+
+/* $Id: decode_i386.c,v 1.18.2.2 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#if defined(__riscos__) && defined(FPA10)
+#include "ymath.h"
+#else
+#include <math.h>
+#endif
+
+#include "decode_i386.h"
+#include "dct64_i386.h"
+#include "tabinit.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+ /* old WRITE_SAMPLE_CLIPPED */
+#define WRITE_SAMPLE_CLIPPED(TYPE,samples,sum,clip) \
+  if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
+  else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \
+  else { *(samples) = (TYPE)((sum)>0 ? (sum)+0.5 : (sum)-0.5) ; }
+
+#define WRITE_SAMPLE_UNCLIPPED(TYPE,samples,sum,clip) \
+  *samples = (TYPE)sum;
+
+  /* *INDENT-OFF* */
+
+ /* versions: clipped (when TYPE == short) and unclipped (when TYPE == real) of synth_1to1_mono* functions */
+#define SYNTH_1TO1_MONO_CLIPCHOICE(TYPE,SYNTH_1TO1)                    \
+  TYPE samples_tmp[64];                                                \
+  TYPE *tmp1 = samples_tmp;                                            \
+  int i,ret;                                                           \
+  int pnt1 = 0;                                                        \
+                                                                       \
+  ret = SYNTH_1TO1 (mp,bandPtr,0,(unsigned char *) samples_tmp,&pnt1); \
+  out += *pnt;                                                         \
+                                                                       \
+  for(i=0;i<32;i++) {                                                  \
+    *( (TYPE *) out) = *tmp1;                                          \
+    out += sizeof(TYPE);                                               \
+    tmp1 += 2;                                                         \
+  }                                                                    \
+  *pnt += 32*sizeof(TYPE);                                             \
+                                                                       \
+  return ret; 
+
+  /* *INDENT-ON* */
+
+
+int
+synth_1to1_mono(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt)
+{
+    SYNTH_1TO1_MONO_CLIPCHOICE(short, synth_1to1)
+} int
+synth_1to1_mono_unclipped(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt)
+{
+    SYNTH_1TO1_MONO_CLIPCHOICE(real, synth_1to1_unclipped)
+}
+
+    /* *INDENT-OFF* */
+/* versions: clipped (when TYPE == short) and unclipped (when TYPE == real) of synth_1to1* functions */
+#define SYNTH_1TO1_CLIPCHOICE(TYPE,WRITE_SAMPLE)         \
+  static const int step = 2;                             \
+  int bo;                                                \
+  TYPE *samples = (TYPE *) (out + *pnt);                 \
+                                                         \
+  real *b0,(*buf)[0x110];                                \
+  int clip = 0;                                          \
+  int bo1;                                               \
+                                                         \
+  bo = mp->synth_bo;                                     \
+                                                         \
+  if(!channel) {                                         \
+    bo--;                                                \
+    bo &= 0xf;                                           \
+    buf = mp->synth_buffs[0];                            \
+  }                                                      \
+  else {                                                 \
+    samples++;                                           \
+    buf = mp->synth_buffs[1];                            \
+  }                                                      \
+                                                         \
+  if(bo & 0x1) {                                         \
+    b0 = buf[0];                                         \
+    bo1 = bo;                                            \
+    dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr);        \
+  }                                                      \
+  else {                                                 \
+    b0 = buf[1];                                         \
+    bo1 = bo+1;                                          \
+    dct64(buf[0]+bo,buf[1]+bo+1,bandPtr);                \
+  }                                                      \
+                                                         \
+  mp->synth_bo = bo;                                     \
+                                                         \
+  {                                                      \
+    int j;                                               \
+    real *window = decwin + 16 - bo1;                    \
+                                                         \
+    for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step) \
+    {                                                    \
+      real sum;                                          \
+      sum  = window[0x0] * b0[0x0];                      \
+      sum -= window[0x1] * b0[0x1];                      \
+      sum += window[0x2] * b0[0x2];                      \
+      sum -= window[0x3] * b0[0x3];                      \
+      sum += window[0x4] * b0[0x4];                      \
+      sum -= window[0x5] * b0[0x5];                      \
+      sum += window[0x6] * b0[0x6];                      \
+      sum -= window[0x7] * b0[0x7];                      \
+      sum += window[0x8] * b0[0x8];                      \
+      sum -= window[0x9] * b0[0x9];                      \
+      sum += window[0xA] * b0[0xA];                      \
+      sum -= window[0xB] * b0[0xB];                      \
+      sum += window[0xC] * b0[0xC];                      \
+      sum -= window[0xD] * b0[0xD];                      \
+      sum += window[0xE] * b0[0xE];                      \
+      sum -= window[0xF] * b0[0xF];                      \
+                                                         \
+      WRITE_SAMPLE (TYPE,samples,sum,clip);              \
+    }                                                    \
+                                                         \
+    {                                                    \
+      real sum;                                          \
+      sum  = window[0x0] * b0[0x0];                      \
+      sum += window[0x2] * b0[0x2];                      \
+      sum += window[0x4] * b0[0x4];                      \
+      sum += window[0x6] * b0[0x6];                      \
+      sum += window[0x8] * b0[0x8];                      \
+      sum += window[0xA] * b0[0xA];                      \
+      sum += window[0xC] * b0[0xC];                      \
+      sum += window[0xE] * b0[0xE];                      \
+      WRITE_SAMPLE (TYPE,samples,sum,clip);              \
+      b0-=0x10,window-=0x20,samples+=step;               \
+    }                                                    \
+    window += bo1<<1;                                    \
+                                                         \
+    for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step) \
+    {                                                    \
+      real sum;                                          \
+      sum = -window[-0x1] * b0[0x0];                     \
+      sum -= window[-0x2] * b0[0x1];                     \
+      sum -= window[-0x3] * b0[0x2];                     \
+      sum -= window[-0x4] * b0[0x3];                     \
+      sum -= window[-0x5] * b0[0x4];                     \
+      sum -= window[-0x6] * b0[0x5];                     \
+      sum -= window[-0x7] * b0[0x6];                     \
+      sum -= window[-0x8] * b0[0x7];                     \
+      sum -= window[-0x9] * b0[0x8];                     \
+      sum -= window[-0xA] * b0[0x9];                     \
+      sum -= window[-0xB] * b0[0xA];                     \
+      sum -= window[-0xC] * b0[0xB];                     \
+      sum -= window[-0xD] * b0[0xC];                     \
+      sum -= window[-0xE] * b0[0xD];                     \
+      sum -= window[-0xF] * b0[0xE];                     \
+      sum -= window[-0x0] * b0[0xF];                     \
+                                                         \
+      WRITE_SAMPLE (TYPE,samples,sum,clip);              \
+    }                                                    \
+  }                                                      \
+  *pnt += 64*sizeof(TYPE);                               \
+                                                         \
+  return clip;                                           
+    /* *INDENT-ON* */
+
+
+int
+synth_1to1(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt)
+{
+    SYNTH_1TO1_CLIPCHOICE(short, WRITE_SAMPLE_CLIPPED)
+} int
+synth_1to1_unclipped(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt)
+{
+    SYNTH_1TO1_CLIPCHOICE(real, WRITE_SAMPLE_UNCLIPPED)
+}
diff --git a/mpglib/decode_i386.h b/mpglib/decode_i386.h
new file mode 100644
index 0000000..8fc9dbe
--- /dev/null
+++ b/mpglib/decode_i386.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef DECODE_I386_H_INCLUDED
+#define DECODE_I386_H_INCLUDED
+
+#include "common.h"
+
+int     synth_1to1_mono(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt);
+int     synth_1to1(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt);
+
+int     synth_1to1_mono_unclipped(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt);
+int     synth_1to1_unclipped(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt);
+
+#endif
diff --git a/mpglib/depcomp b/mpglib/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/mpglib/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/mpglib/huffman.h b/mpglib/huffman.h
new file mode 100644
index 0000000..7d73a74
--- /dev/null
+++ b/mpglib/huffman.h
@@ -0,0 +1,353 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * huffman tables ... recalcualted to work with my optimzed
+ * decoder scheme (MH)
+ * 
+ * probably we could save a few bytes of memory, because the 
+ * smaller tables are often the part of a bigger table
+ */
+
+/* *INDENT-OFF* */
+
+
+struct newhuff 
+{
+    const unsigned int linbits;
+    const short * const table;
+};
+
+static const short tab0[] = 
+{ 
+    0
+};
+
+static const short tab1[] =
+{
+    -5,  -3,  -1,  17,   1,  16,   0
+};
+
+static const short tab2[] =
+{
+    -15, -11,  -9,  -5,  -3,  -1,  34,   2,  18,  -1,  33,  32,  17,  -1,   1,   16,   0
+};
+
+static const short tab3[] =
+{
+ -13, -11,  -9,  -5,  -3,  -1,  34,   2,  18,  -1,  33,  32,  16,  17,  -1,
+   1,   0
+};
+
+static const short tab5[] =
+{
+ -29, -25, -23, -15,  -7,  -5,  -3,  -1,  51,  35,  50,  49,  -3,  -1,  19,
+   3,  -1,  48,  34,  -3,  -1,  18,  33,  -1,   2,  32,  17,  -1,   1,  16,
+   0
+};
+
+static const short tab6[] =
+{
+ -25, -19, -13,  -9,  -5,  -3,  -1,  51,   3,  35,  -1,  50,  48,  -1,  19,
+  49,  -3,  -1,  34,   2,  18,  -3,  -1,  33,  32,   1,  -1,  17,  -1,  16,
+   0
+};
+
+static const short tab7[] =
+{
+ -69, -65, -57, -39, -29, -17, -11,  -7,  -3,  -1,  85,  69,  -1,  84,  83,
+  -1,  53,  68,  -3,  -1,  37,  82,  21,  -5,  -1,  81,  -1,   5,  52,  -1,
+  80,  -1,  67,  51,  -5,  -3,  -1,  36,  66,  20,  -1,  65,  64, -11,  -7,
+  -3,  -1,   4,  35,  -1,  50,   3,  -1,  19,  49,  -3,  -1,  48,  34,  18,
+  -5,  -1,  33,  -1,   2,  32,  17,  -1,   1,  16,   0
+};
+
+static const short tab8[] =
+{
+ -65, -63, -59, -45, -31, -19, -13,  -7,  -5,  -3,  -1,  85,  84,  69,  83,
+  -3,  -1,  53,  68,  37,  -3,  -1,  82,   5,  21,  -5,  -1,  81,  -1,  52,
+  67,  -3,  -1,  80,  51,  36,  -5,  -3,  -1,  66,  20,  65,  -3,  -1,   4,
+  64,  -1,  35,  50,  -9,  -7,  -3,  -1,  19,  49,  -1,   3,  48,  34,  -1,
+   2,  32,  -1,  18,  33,  17,  -3,  -1,   1,  16,   0
+};
+
+static const short tab9[] =
+{
+ -63, -53, -41, -29, -19, -11,  -5,  -3,  -1,  85,  69,  53,  -1,  83,  -1,
+  84,   5,  -3,  -1,  68,  37,  -1,  82,  21,  -3,  -1,  81,  52,  -1,  67,
+  -1,  80,   4,  -7,  -3,  -1,  36,  66,  -1,  51,  64,  -1,  20,  65,  -5,
+  -3,  -1,  35,  50,  19,  -1,  49,  -1,   3,  48,  -5,  -3,  -1,  34,   2,
+  18,  -1,  33,  32,  -3,  -1,  17,   1,  -1,  16,   0
+};
+
+static const short tab10[] =
+{
+-125,-121,-111, -83, -55, -35, -21, -13,  -7,  -3,  -1, 119, 103,  -1, 118,
+  87,  -3,  -1, 117, 102,  71,  -3,  -1, 116,  86,  -1, 101,  55,  -9,  -3,
+  -1, 115,  70,  -3,  -1,  85,  84,  99,  -1,  39, 114, -11,  -5,  -3,  -1,
+ 100,   7, 112,  -1,  98,  -1,  69,  53,  -5,  -1,   6,  -1,  83,  68,  23,
+ -17,  -5,  -1, 113,  -1,  54,  38,  -5,  -3,  -1,  37,  82,  21,  -1,  81,
+  -1,  52,  67,  -3,  -1,  22,  97,  -1,  96,  -1,   5,  80, -19, -11,  -7,
+  -3,  -1,  36,  66,  -1,  51,   4,  -1,  20,  65,  -3,  -1,  64,  35,  -1,
+  50,   3,  -3,  -1,  19,  49,  -1,  48,  34,  -7,  -3,  -1,  18,  33,  -1,
+   2,  32,  17,  -1,   1,  16,   0
+};
+
+static const short tab11[] =
+{
+-121,-113, -89, -59, -43, -27, -17,  -7,  -3,  -1, 119, 103,  -1, 118, 117,
+  -3,  -1, 102,  71,  -1, 116,  -1,  87,  85,  -5,  -3,  -1,  86, 101,  55,
+  -1, 115,  70,  -9,  -7,  -3,  -1,  69,  84,  -1,  53,  83,  39,  -1, 114,
+  -1, 100,   7,  -5,  -1, 113,  -1,  23, 112,  -3,  -1,  54,  99,  -1,  96,
+  -1,  68,  37, -13,  -7,  -5,  -3,  -1,  82,   5,  21,  98,  -3,  -1,  38,
+   6,  22,  -5,  -1,  97,  -1,  81,  52,  -5,  -1,  80,  -1,  67,  51,  -1,
+  36,  66, -15, -11,  -7,  -3,  -1,  20,  65,  -1,   4,  64,  -1,  35,  50,
+  -1,  19,  49,  -5,  -3,  -1,   3,  48,  34,  33,  -5,  -1,  18,  -1,   2,
+  32,  17,  -3,  -1,   1,  16,   0
+};
+
+static const short tab12[] =
+{
+-115, -99, -73, -45, -27, -17,  -9,  -5,  -3,  -1, 119, 103, 118,  -1,  87,
+ 117,  -3,  -1, 102,  71,  -1, 116, 101,  -3,  -1,  86,  55,  -3,  -1, 115,
+  85,  39,  -7,  -3,  -1, 114,  70,  -1, 100,  23,  -5,  -1, 113,  -1,   7,
+ 112,  -1,  54,  99, -13,  -9,  -3,  -1,  69,  84,  -1,  68,  -1,   6,   5,
+  -1,  38,  98,  -5,  -1,  97,  -1,  22,  96,  -3,  -1,  53,  83,  -1,  37,
+  82, -17,  -7,  -3,  -1,  21,  81,  -1,  52,  67,  -5,  -3,  -1,  80,   4,
+  36,  -1,  66,  20,  -3,  -1,  51,  65,  -1,  35,  50, -11,  -7,  -5,  -3,
+  -1,  64,   3,  48,  19,  -1,  49,  34,  -1,  18,  33,  -7,  -5,  -3,  -1,
+   2,  32,   0,  17,  -1,   1,  16
+};
+
+static const short tab13[] =
+{
+-509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13,  -9,
+  -7,  -5,  -3,  -1, 254, 252, 253, 237, 255,  -1, 239, 223,  -3,  -1, 238,
+ 207,  -1, 222, 191,  -9,  -3,  -1, 251, 206,  -1, 220,  -1, 175, 233,  -1,
+ 236, 221,  -9,  -5,  -3,  -1, 250, 205, 190,  -1, 235, 159,  -3,  -1, 249,
+ 234,  -1, 189, 219, -17,  -9,  -3,  -1, 143, 248,  -1, 204,  -1, 174, 158,
+  -5,  -1, 142,  -1, 127, 126, 247,  -5,  -1, 218,  -1, 173, 188,  -3,  -1,
+ 203, 246, 111, -15,  -7,  -3,  -1, 232,  95,  -1, 157, 217,  -3,  -1, 245,
+ 231,  -1, 172, 187,  -9,  -3,  -1,  79, 244,  -3,  -1, 202, 230, 243,  -1,
+  63,  -1, 141, 216, -21,  -9,  -3,  -1,  47, 242,  -3,  -1, 110, 156,  15,
+  -5,  -3,  -1, 201,  94, 171,  -3,  -1, 125, 215,  78, -11,  -5,  -3,  -1,
+ 200, 214,  62,  -1, 185,  -1, 155, 170,  -1,  31, 241, -23, -13,  -5,  -1,
+ 240,  -1, 186, 229,  -3,  -1, 228, 140,  -1, 109, 227,  -5,  -1, 226,  -1,
+  46,  14,  -1,  30, 225, -15,  -7,  -3,  -1, 224,  93,  -1, 213, 124,  -3,
+  -1, 199,  77,  -1, 139, 184,  -7,  -3,  -1, 212, 154,  -1, 169, 108,  -1,
+ 198,  61, -37, -21,  -9,  -5,  -3,  -1, 211, 123,  45,  -1, 210,  29,  -5,
+  -1, 183,  -1,  92, 197,  -3,  -1, 153, 122, 195,  -7,  -5,  -3,  -1, 167,
+ 151,  75, 209,  -3,  -1,  13, 208,  -1, 138, 168, -11,  -7,  -3,  -1,  76,
+ 196,  -1, 107, 182,  -1,  60,  44,  -3,  -1, 194,  91,  -3,  -1, 181, 137,
+  28, -43, -23, -11,  -5,  -1, 193,  -1, 152,  12,  -1, 192,  -1, 180, 106,
+  -5,  -3,  -1, 166, 121,  59,  -1, 179,  -1, 136,  90, -11,  -5,  -1,  43,
+  -1, 165, 105,  -1, 164,  -1, 120, 135,  -5,  -1, 148,  -1, 119, 118, 178,
+ -11,  -3,  -1,  27, 177,  -3,  -1,  11, 176,  -1, 150,  74,  -7,  -3,  -1,
+  58, 163,  -1,  89, 149,  -1,  42, 162, -47, -23,  -9,  -3,  -1,  26, 161,
+  -3,  -1,  10, 104, 160,  -5,  -3,  -1, 134,  73, 147,  -3,  -1,  57,  88,
+  -1, 133, 103,  -9,  -3,  -1,  41, 146,  -3,  -1,  87, 117,  56,  -5,  -1,
+ 131,  -1, 102,  71,  -3,  -1, 116,  86,  -1, 101, 115, -11,  -3,  -1,  25,
+ 145,  -3,  -1,   9, 144,  -1,  72, 132,  -7,  -5,  -1, 114,  -1,  70, 100,
+  40,  -1, 130,  24, -41, -27, -11,  -5,  -3,  -1,  55,  39,  23,  -1, 113,
+  -1,  85,   7,  -7,  -3,  -1, 112,  54,  -1,  99,  69,  -3,  -1,  84,  38,
+  -1,  98,  53,  -5,  -1, 129,  -1,   8, 128,  -3,  -1,  22,  97,  -1,   6,
+  96, -13,  -9,  -5,  -3,  -1,  83,  68,  37,  -1,  82,   5,  -1,  21,  81,
+  -7,  -3,  -1,  52,  67,  -1,  80,  36,  -3,  -1,  66,  51,  20, -19, -11,
+  -5,  -1,  65,  -1,   4,  64,  -3,  -1,  35,  50,  19,  -3,  -1,  49,   3,
+  -1,  48,  34,  -3,  -1,  18,  33,  -1,   2,  32,  -3,  -1,  17,   1,  16,
+   0
+};
+
+static const short tab15[] =
+{
+-495,-445,-355,-263,-183,-115, -77, -43, -27, -13,  -7,  -3,  -1, 255, 239,
+  -1, 254, 223,  -1, 238,  -1, 253, 207,  -7,  -3,  -1, 252, 222,  -1, 237,
+ 191,  -1, 251,  -1, 206, 236,  -7,  -3,  -1, 221, 175,  -1, 250, 190,  -3,
+  -1, 235, 205,  -1, 220, 159, -15,  -7,  -3,  -1, 249, 234,  -1, 189, 219,
+  -3,  -1, 143, 248,  -1, 204, 158,  -7,  -3,  -1, 233, 127,  -1, 247, 173,
+  -3,  -1, 218, 188,  -1, 111,  -1, 174,  15, -19, -11,  -3,  -1, 203, 246,
+  -3,  -1, 142, 232,  -1,  95, 157,  -3,  -1, 245, 126,  -1, 231, 172,  -9,
+  -3,  -1, 202, 187,  -3,  -1, 217, 141,  79,  -3,  -1, 244,  63,  -1, 243,
+ 216, -33, -17,  -9,  -3,  -1, 230,  47,  -1, 242,  -1, 110, 240,  -3,  -1,
+  31, 241,  -1, 156, 201,  -7,  -3,  -1,  94, 171,  -1, 186, 229,  -3,  -1,
+ 125, 215,  -1,  78, 228, -15,  -7,  -3,  -1, 140, 200,  -1,  62, 109,  -3,
+  -1, 214, 227,  -1, 155, 185,  -7,  -3,  -1,  46, 170,  -1, 226,  30,  -5,
+  -1, 225,  -1,  14, 224,  -1,  93, 213, -45, -25, -13,  -7,  -3,  -1, 124,
+ 199,  -1,  77, 139,  -1, 212,  -1, 184, 154,  -7,  -3,  -1, 169, 108,  -1,
+ 198,  61,  -1, 211, 210,  -9,  -5,  -3,  -1,  45,  13,  29,  -1, 123, 183,
+  -5,  -1, 209,  -1,  92, 208,  -1, 197, 138, -17,  -7,  -3,  -1, 168,  76,
+  -1, 196, 107,  -5,  -1, 182,  -1, 153,  12,  -1,  60, 195,  -9,  -3,  -1,
+ 122, 167,  -1, 166,  -1, 192,  11,  -1, 194,  -1,  44,  91, -55, -29, -15,
+  -7,  -3,  -1, 181,  28,  -1, 137, 152,  -3,  -1, 193,  75,  -1, 180, 106,
+  -5,  -3,  -1,  59, 121, 179,  -3,  -1, 151, 136,  -1,  43,  90, -11,  -5,
+  -1, 178,  -1, 165,  27,  -1, 177,  -1, 176, 105,  -7,  -3,  -1, 150,  74,
+  -1, 164, 120,  -3,  -1, 135,  58, 163, -17,  -7,  -3,  -1,  89, 149,  -1,
+  42, 162,  -3,  -1,  26, 161,  -3,  -1,  10, 160, 104,  -7,  -3,  -1, 134,
+  73,  -1, 148,  57,  -5,  -1, 147,  -1, 119,   9,  -1,  88, 133, -53, -29,
+ -13,  -7,  -3,  -1,  41, 103,  -1, 118, 146,  -1, 145,  -1,  25, 144,  -7,
+  -3,  -1,  72, 132,  -1,  87, 117,  -3,  -1,  56, 131,  -1, 102,  71,  -7,
+  -3,  -1,  40, 130,  -1,  24, 129,  -7,  -3,  -1, 116,   8,  -1, 128,  86,
+  -3,  -1, 101,  55,  -1, 115,  70, -17,  -7,  -3,  -1,  39, 114,  -1, 100,
+  23,  -3,  -1,  85, 113,  -3,  -1,   7, 112,  54,  -7,  -3,  -1,  99,  69,
+  -1,  84,  38,  -3,  -1,  98,  22,  -3,  -1,   6,  96,  53, -33, -19,  -9,
+  -5,  -1,  97,  -1,  83,  68,  -1,  37,  82,  -3,  -1,  21,  81,  -3,  -1,
+   5,  80,  52,  -7,  -3,  -1,  67,  36,  -1,  66,  51,  -1,  65,  -1,  20,
+   4,  -9,  -3,  -1,  35,  50,  -3,  -1,  64,   3,  19,  -3,  -1,  49,  48,
+  34,  -9,  -7,  -3,  -1,  18,  33,  -1,   2,  32,  17,  -3,  -1,   1,  16,
+   0
+};
+
+static const short tab16[] =
+{
+-509,-503,-461,-323,-103, -37, -27, -15,  -7,  -3,  -1, 239, 254,  -1, 223,
+ 253,  -3,  -1, 207, 252,  -1, 191, 251,  -5,  -1, 175,  -1, 250, 159,  -3,
+  -1, 249, 248, 143,  -7,  -3,  -1, 127, 247,  -1, 111, 246, 255,  -9,  -5,
+  -3,  -1,  95, 245,  79,  -1, 244, 243, -53,  -1, 240,  -1,  63, -29, -19,
+ -13,  -7,  -5,  -1, 206,  -1, 236, 221, 222,  -1, 233,  -1, 234, 217,  -1,
+ 238,  -1, 237, 235,  -3,  -1, 190, 205,  -3,  -1, 220, 219, 174, -11,  -5,
+  -1, 204,  -1, 173, 218,  -3,  -1, 126, 172, 202,  -5,  -3,  -1, 201, 125,
+  94, 189, 242, -93,  -5,  -3,  -1,  47,  15,  31,  -1, 241, -49, -25, -13,
+  -5,  -1, 158,  -1, 188, 203,  -3,  -1, 142, 232,  -1, 157, 231,  -7,  -3,
+  -1, 187, 141,  -1, 216, 110,  -1, 230, 156, -13,  -7,  -3,  -1, 171, 186,
+  -1, 229, 215,  -1,  78,  -1, 228, 140,  -3,  -1, 200,  62,  -1, 109,  -1,
+ 214, 155, -19, -11,  -5,  -3,  -1, 185, 170, 225,  -1, 212,  -1, 184, 169,
+  -5,  -1, 123,  -1, 183, 208, 227,  -7,  -3,  -1,  14, 224,  -1,  93, 213,
+  -3,  -1, 124, 199,  -1,  77, 139, -75, -45, -27, -13,  -7,  -3,  -1, 154,
+ 108,  -1, 198,  61,  -3,  -1,  92, 197,  13,  -7,  -3,  -1, 138, 168,  -1,
+ 153,  76,  -3,  -1, 182, 122,  60, -11,  -5,  -3,  -1,  91, 137,  28,  -1,
+ 192,  -1, 152, 121,  -1, 226,  -1,  46,  30, -15,  -7,  -3,  -1, 211,  45,
+  -1, 210, 209,  -5,  -1,  59,  -1, 151, 136,  29,  -7,  -3,  -1, 196, 107,
+  -1, 195, 167,  -1,  44,  -1, 194, 181, -23, -13,  -7,  -3,  -1, 193,  12,
+  -1,  75, 180,  -3,  -1, 106, 166, 179,  -5,  -3,  -1,  90, 165,  43,  -1,
+ 178,  27, -13,  -5,  -1, 177,  -1,  11, 176,  -3,  -1, 105, 150,  -1,  74,
+ 164,  -5,  -3,  -1, 120, 135, 163,  -3,  -1,  58,  89,  42, -97, -57, -33,
+ -19, -11,  -5,  -3,  -1, 149, 104, 161,  -3,  -1, 134, 119, 148,  -5,  -3,
+  -1,  73,  87, 103, 162,  -5,  -1,  26,  -1,  10, 160,  -3,  -1,  57, 147,
+  -1,  88, 133,  -9,  -3,  -1,  41, 146,  -3,  -1, 118,   9,  25,  -5,  -1,
+ 145,  -1, 144,  72,  -3,  -1, 132, 117,  -1,  56, 131, -21, -11,  -5,  -3,
+  -1, 102,  40, 130,  -3,  -1,  71, 116,  24,  -3,  -1, 129, 128,  -3,  -1,
+   8,  86,  55,  -9,  -5,  -1, 115,  -1, 101,  70,  -1,  39, 114,  -5,  -3,
+  -1, 100,  85,   7,  23, -23, -13,  -5,  -1, 113,  -1, 112,  54,  -3,  -1,
+  99,  69,  -1,  84,  38,  -3,  -1,  98,  22,  -1,  97,  -1,   6,  96,  -9,
+  -5,  -1,  83,  -1,  53,  68,  -1,  37,  82,  -1,  81,  -1,  21,   5, -33,
+ -23, -13,  -7,  -3,  -1,  52,  67,  -1,  80,  36,  -3,  -1,  66,  51,  20,
+  -5,  -1,  65,  -1,   4,  64,  -1,  35,  50,  -3,  -1,  19,  49,  -3,  -1,
+   3,  48,  34,  -3,  -1,  18,  33,  -1,   2,  32,  -3,  -1,  17,   1,  16,
+   0
+};
+
+static const short tab24[] =
+{
+-451,-117, -43, -25, -15,  -7,  -3,  -1, 239, 254,  -1, 223, 253,  -3,  -1,
+ 207, 252,  -1, 191, 251,  -5,  -1, 250,  -1, 175, 159,  -1, 249, 248,  -9,
+  -5,  -3,  -1, 143, 127, 247,  -1, 111, 246,  -3,  -1,  95, 245,  -1,  79,
+ 244, -71,  -7,  -3,  -1,  63, 243,  -1,  47, 242,  -5,  -1, 241,  -1,  31,
+ 240, -25,  -9,  -1,  15,  -3,  -1, 238, 222,  -1, 237, 206,  -7,  -3,  -1,
+ 236, 221,  -1, 190, 235,  -3,  -1, 205, 220,  -1, 174, 234, -15,  -7,  -3,
+  -1, 189, 219,  -1, 204, 158,  -3,  -1, 233, 173,  -1, 218, 188,  -7,  -3,
+  -1, 203, 142,  -1, 232, 157,  -3,  -1, 217, 126,  -1, 231, 172, 255,-235,
+-143, -77, -45, -25, -15,  -7,  -3,  -1, 202, 187,  -1, 141, 216,  -5,  -3,
+  -1,  14, 224,  13, 230,  -5,  -3,  -1, 110, 156, 201,  -1,  94, 186,  -9,
+  -5,  -1, 229,  -1, 171, 125,  -1, 215, 228,  -3,  -1, 140, 200,  -3,  -1,
+  78,  46,  62, -15,  -7,  -3,  -1, 109, 214,  -1, 227, 155,  -3,  -1, 185,
+ 170,  -1, 226,  30,  -7,  -3,  -1, 225,  93,  -1, 213, 124,  -3,  -1, 199,
+  77,  -1, 139, 184, -31, -15,  -7,  -3,  -1, 212, 154,  -1, 169, 108,  -3,
+  -1, 198,  61,  -1, 211,  45,  -7,  -3,  -1, 210,  29,  -1, 123, 183,  -3,
+  -1, 209,  92,  -1, 197, 138, -17,  -7,  -3,  -1, 168, 153,  -1,  76, 196,
+  -3,  -1, 107, 182,  -3,  -1, 208,  12,  60,  -7,  -3,  -1, 195, 122,  -1,
+ 167,  44,  -3,  -1, 194,  91,  -1, 181,  28, -57, -35, -19,  -7,  -3,  -1,
+ 137, 152,  -1, 193,  75,  -5,  -3,  -1, 192,  11,  59,  -3,  -1, 176,  10,
+  26,  -5,  -1, 180,  -1, 106, 166,  -3,  -1, 121, 151,  -3,  -1, 160,   9,
+ 144,  -9,  -3,  -1, 179, 136,  -3,  -1,  43,  90, 178,  -7,  -3,  -1, 165,
+  27,  -1, 177, 105,  -1, 150, 164, -17,  -9,  -5,  -3,  -1,  74, 120, 135,
+  -1,  58, 163,  -3,  -1,  89, 149,  -1,  42, 162,  -7,  -3,  -1, 161, 104,
+  -1, 134, 119,  -3,  -1,  73, 148,  -1,  57, 147, -63, -31, -15,  -7,  -3,
+  -1,  88, 133,  -1,  41, 103,  -3,  -1, 118, 146,  -1,  25, 145,  -7,  -3,
+  -1,  72, 132,  -1,  87, 117,  -3,  -1,  56, 131,  -1, 102,  40, -17,  -7,
+  -3,  -1, 130,  24,  -1,  71, 116,  -5,  -1, 129,  -1,   8, 128,  -1,  86,
+ 101,  -7,  -5,  -1,  23,  -1,   7, 112, 115,  -3,  -1,  55,  39, 114, -15,
+  -7,  -3,  -1,  70, 100,  -1,  85, 113,  -3,  -1,  54,  99,  -1,  69,  84,
+  -7,  -3,  -1,  38,  98,  -1,  22,  97,  -5,  -3,  -1,   6,  96,  53,  -1,
+  83,  68, -51, -37, -23, -15,  -9,  -3,  -1,  37,  82,  -1,  21,  -1,   5,
+  80,  -1,  81,  -1,  52,  67,  -3,  -1,  36,  66,  -1,  51,  20,  -9,  -5,
+  -1,  65,  -1,   4,  64,  -1,  35,  50,  -1,  19,  49,  -7,  -5,  -3,  -1,
+   3,  48,  34,  18,  -1,  33,  -1,   2,  32,  -3,  -1,  17,   1,  -1,  16,
+   0
+};
+
+static const short tab_c0[] =
+{
+ -29, -21, -13,  -7,  -3,  -1,  11,  15,  -1,  13,  14,  -3,  -1,   7,   5,
+   9,  -3,  -1,   6,   3,  -1,  10,  12,  -3,  -1,   2,   1,  -1,   4,   8,
+   0
+};
+
+static const short tab_c1[] =
+{
+ -15,  -7,  -3,  -1,  15,  14,  -1,  13,  12,  -3,  -1,  11,  10,  -1,   9,
+   8,  -7,  -3,  -1,   7,   6,  -1,   5,   4,  -3,  -1,   3,   2,  -1,   1,
+   0
+};
+
+
+
+static const struct newhuff ht[] = 
+{
+ { /* 0 */ 0 , tab0  } ,
+ { /* 2 */ 0 , tab1  } ,
+ { /* 3 */ 0 , tab2  } ,
+ { /* 3 */ 0 , tab3  } ,
+ { /* 0 */ 0 , tab0  } ,
+ { /* 4 */ 0 , tab5  } ,
+ { /* 4 */ 0 , tab6  } ,
+ { /* 6 */ 0 , tab7  } ,
+ { /* 6 */ 0 , tab8  } ,
+ { /* 6 */ 0 , tab9  } ,
+ { /* 8 */ 0 , tab10 } ,
+ { /* 8 */ 0 , tab11 } ,
+ { /* 8 */ 0 , tab12 } ,
+ { /* 16 */ 0 , tab13 } ,
+ { /* 0  */ 0 , tab0  } ,
+ { /* 16 */ 0 , tab15 } ,
+
+ { /* 16 */ 1 , tab16 } ,
+ { /* 16 */ 2 , tab16 } ,
+ { /* 16 */ 3 , tab16 } ,
+ { /* 16 */ 4 , tab16 } ,
+ { /* 16 */ 6 , tab16 } ,
+ { /* 16 */ 8 , tab16 } ,
+ { /* 16 */ 10, tab16 } ,
+ { /* 16 */ 13, tab16 } ,
+ { /* 16 */ 4 , tab24 } ,
+ { /* 16 */ 5 , tab24 } ,
+ { /* 16 */ 6 , tab24 } ,
+ { /* 16 */ 7 , tab24 } ,
+ { /* 16 */ 8 , tab24 } ,
+ { /* 16 */ 9 , tab24 } ,
+ { /* 16 */ 11, tab24 } ,
+ { /* 16 */ 13, tab24 }
+};
+
+static const struct newhuff htc[] = 
+{
+ { /* 1 , 1 , */ 0 , tab_c0 } ,
+ { /* 1 , 1 , */ 0 , tab_c1 }
+};
+
+    /* *INDENT-ON* */
diff --git a/mpglib/interface.c b/mpglib/interface.c
new file mode 100644
index 0000000..79338ae
--- /dev/null
+++ b/mpglib/interface.c
@@ -0,0 +1,695 @@
+/*
+ * interface.c
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/* $Id: interface.c,v 1.52.2.4 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "common.h"
+#include "interface.h"
+#include "tabinit.h"
+#include "layer3.h"
+#include "lame.h"
+#include "machine.h"
+#include "VbrTag.h"
+#include "decode_i386.h"
+
+#include "layer1.h"
+#include "layer2.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* #define HIP_DEBUG */
+
+int
+InitMP3(PMPSTR mp)
+{
+    memset(mp, 0, sizeof(MPSTR));
+
+    mp->framesize = 0;
+    mp->num_frames = 0;
+    mp->enc_delay = -1;
+    mp->enc_padding = -1;
+    mp->vbr_header = 0;
+    mp->header_parsed = 0;
+    mp->side_parsed = 0;
+    mp->data_parsed = 0;
+    mp->free_format = 0;
+    mp->old_free_format = 0;
+    mp->ssize = 0;
+    mp->dsize = 0;
+    mp->fsizeold = -1;
+    mp->bsize = 0;
+    mp->head = mp->tail = NULL;
+    mp->fr.single = -1;
+    mp->bsnum = 0;
+    mp->wordpointer = mp->bsspace[mp->bsnum] + 512;
+    mp->bitindex = 0;
+    mp->synth_bo = 1;
+    mp->sync_bitstream = 1;
+
+    make_decode_tables(32767);
+
+    init_layer3(SBLIMIT);
+
+    init_layer2();
+
+    return 1;
+}
+
+void
+ExitMP3(PMPSTR mp)
+{
+    struct buf *b, *bn;
+
+    b = mp->tail;
+    while (b) {
+        free(b->pnt);
+        bn = b->next;
+        free(b);
+        b = bn;
+    }
+}
+
+static struct buf *
+addbuf(PMPSTR mp, unsigned char *buf, int size)
+{
+    struct buf *nbuf;
+
+    nbuf = (struct buf *) malloc(sizeof(struct buf));
+    if (!nbuf) {
+        fprintf(stderr, "hip: addbuf() Out of memory!\n");
+        return NULL;
+    }
+    nbuf->pnt = (unsigned char *) malloc((size_t) size);
+    if (!nbuf->pnt) {
+        free(nbuf);
+        return NULL;
+    }
+    nbuf->size = size;
+    memcpy(nbuf->pnt, buf, (size_t) size);
+    nbuf->next = NULL;
+    nbuf->prev = mp->head;
+    nbuf->pos = 0;
+
+    if (!mp->tail) {
+        mp->tail = nbuf;
+    }
+    else {
+        mp->head->next = nbuf;
+    }
+
+    mp->head = nbuf;
+    mp->bsize += size;
+
+    return nbuf;
+}
+
+void
+remove_buf(PMPSTR mp)
+{
+    struct buf *buf = mp->tail;
+
+    mp->tail = buf->next;
+    if (mp->tail)
+        mp->tail->prev = NULL;
+    else {
+        mp->tail = mp->head = NULL;
+    }
+
+    free(buf->pnt);
+    free(buf);
+
+}
+
+static int
+read_buf_byte(PMPSTR mp)
+{
+    unsigned int b;
+
+    int     pos;
+
+
+    pos = mp->tail->pos;
+    while (pos >= mp->tail->size) {
+        remove_buf(mp);
+        if (!mp->tail) {
+            fprintf(stderr, "hip: Fatal error! tried to read past mp buffer\n");
+            exit(1);
+        }
+        pos = mp->tail->pos;
+    }
+
+    b = mp->tail->pnt[pos];
+    mp->bsize--;
+    mp->tail->pos++;
+
+
+    return b;
+}
+
+
+
+static void
+read_head(PMPSTR mp)
+{
+    unsigned long head;
+
+    head = read_buf_byte(mp);
+    head <<= 8;
+    head |= read_buf_byte(mp);
+    head <<= 8;
+    head |= read_buf_byte(mp);
+    head <<= 8;
+    head |= read_buf_byte(mp);
+
+    mp->header = head;
+}
+
+
+
+
+static void
+copy_mp(PMPSTR mp, int size, unsigned char *ptr)
+{
+    int     len = 0;
+
+    while (len < size && mp->tail) {
+        int     nlen;
+        int     blen = mp->tail->size - mp->tail->pos;
+        if ((size - len) <= blen) {
+            nlen = size - len;
+        }
+        else {
+            nlen = blen;
+        }
+        memcpy(ptr + len, mp->tail->pnt + mp->tail->pos, (size_t) nlen);
+        len += nlen;
+        mp->tail->pos += nlen;
+        mp->bsize -= nlen;
+        if (mp->tail->pos == mp->tail->size) {
+            remove_buf(mp);
+        }
+    }
+}
+
+/* number of bytes needed by GetVbrTag to parse header */
+#define XING_HEADER_SIZE 194
+
+/*
+traverse mp data structure without changing it
+(just like sync_buffer)
+pull out Xing bytes
+call vbr header check code from LAME
+if we find a header, parse it and also compute the VBR header size
+if no header, do nothing.
+
+bytes = number of bytes before MPEG header.  skip this many bytes
+before starting to read
+return value: number of bytes in VBR header, including syncword
+*/
+static int
+check_vbr_header(PMPSTR mp, int bytes)
+{
+    int     i, pos;
+    struct buf *buf = mp->tail;
+    unsigned char xing[XING_HEADER_SIZE];
+    VBRTAGDATA pTagData;
+
+    pos = buf->pos;
+    /* skip to valid header */
+    for (i = 0; i < bytes; ++i) {
+        while (pos >= buf->size) {
+            buf = buf->next;
+            if (!buf)
+                return -1; /* fatal error */
+            pos = buf->pos;
+        }
+        ++pos;
+    }
+    /* now read header */
+    for (i = 0; i < XING_HEADER_SIZE; ++i) {
+        while (pos >= buf->size) {
+            buf = buf->next;
+            if (!buf)
+                return -1; /* fatal error */
+            pos = buf->pos;
+        }
+        xing[i] = buf->pnt[pos];
+        ++pos;
+    }
+
+    /* check first bytes for Xing header */
+    mp->vbr_header = GetVbrTag(&pTagData, xing);
+    if (mp->vbr_header) {
+        mp->num_frames = pTagData.frames;
+        mp->enc_delay = pTagData.enc_delay;
+        mp->enc_padding = pTagData.enc_padding;
+
+        /* fprintf(stderr,"hip: delays: %i %i \n",mp->enc_delay,mp->enc_padding); */
+        /* fprintf(stderr,"hip: Xing VBR header dectected.  MP3 file has %i frames\n", pTagData.frames); */
+        if (pTagData.headersize < 1)
+            return 1;
+        return pTagData.headersize;
+    }
+    return 0;
+}
+
+
+
+
+
+static int
+sync_buffer(PMPSTR mp, int free_match)
+{
+    /* traverse mp structure without modifying pointers, looking
+     * for a frame valid header.
+     * if free_format, valid header must also have the same
+     * samplerate.   
+     * return number of bytes in mp, before the header
+     * return -1 if header is not found
+     */
+    unsigned int b[4] = { 0, 0, 0, 0 };
+    int     i, h, pos;
+    struct buf *buf = mp->tail;
+    if (!buf)
+        return -1;
+
+    pos = buf->pos;
+    for (i = 0; i < mp->bsize; i++) {
+        /* get 4 bytes */
+
+        b[0] = b[1];
+        b[1] = b[2];
+        b[2] = b[3];
+        while (pos >= buf->size) {
+            buf = buf->next;
+            pos = buf->pos;
+            if (!buf) {
+                return -1;
+                /* not enough data to read 4 bytes */
+            }
+        }
+        b[3] = buf->pnt[pos];
+        ++pos;
+
+        if (i >= 3) {
+            struct frame *fr = &mp->fr;
+            unsigned long head;
+
+            head = b[0];
+            head <<= 8;
+            head |= b[1];
+            head <<= 8;
+            head |= b[2];
+            head <<= 8;
+            head |= b[3];
+            h = head_check(head, fr->lay);
+
+            if (h && free_match) {
+                /* just to be even more thorough, match the sample rate */
+                int     mode, stereo, sampling_frequency, mpeg25, lsf;
+
+                if (head & (1 << 20)) {
+                    lsf = (head & (1 << 19)) ? 0x0 : 0x1;
+                    mpeg25 = 0;
+                }
+                else {
+                    lsf = 1;
+                    mpeg25 = 1;
+                }
+
+                mode = ((head >> 6) & 0x3);
+                stereo = (mode == MPG_MD_MONO) ? 1 : 2;
+
+                if (mpeg25)
+                    sampling_frequency = 6 + ((head >> 10) & 0x3);
+                else
+                    sampling_frequency = ((head >> 10) & 0x3) + (lsf * 3);
+                h = ((stereo == fr->stereo) && (lsf == fr->lsf) && (mpeg25 == fr->mpeg25) &&
+                     (sampling_frequency == fr->sampling_frequency));
+            }
+
+            if (h) {
+                return i - 3;
+            }
+        }
+    }
+    return -1;
+}
+
+
+void
+decode_reset(PMPSTR mp)
+{
+#if 0
+    remove_buf(mp);
+    /* start looking for next frame */
+    /* mp->fsizeold = mp->framesize; */
+    mp->fsizeold = -1;
+    mp->old_free_format = mp->free_format;
+    mp->framesize = 0;
+    mp->header_parsed = 0;
+    mp->side_parsed = 0;
+    mp->data_parsed = 0;
+    mp->sync_bitstream = 1; /* TODO check if this is right */
+#else
+    InitMP3(mp);        /* Less error prone to just to reinitialise. */
+#endif
+}
+
+int
+audiodata_precedesframes(PMPSTR mp)
+{
+    if (mp->fr.lay == 3)
+        return layer3_audiodata_precedesframes(mp);
+    else
+        return 0;       /* For Layer 1 & 2 the audio data starts at the frame that describes it, so no audio data precedes. */
+}
+
+static int
+decodeMP3_clipchoice(PMPSTR mp, unsigned char *in, int isize, char *out, int *done,
+                     int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *),
+                     int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *))
+{
+    int     i, iret, bits, bytes;
+
+    if (in && isize && addbuf(mp, in, isize) == NULL)
+        return MP3_ERR;
+
+    /* First decode header */
+    if (!mp->header_parsed) {
+
+        if (mp->fsizeold == -1 || mp->sync_bitstream) {
+            int     vbrbytes;
+            mp->sync_bitstream = 0;
+
+            /* This is the very first call.   sync with anything */
+            /* bytes= number of bytes before header */
+            bytes = sync_buffer(mp, 0);
+
+            /* now look for Xing VBR header */
+            if (mp->bsize >= bytes + XING_HEADER_SIZE) {
+                /* vbrbytes = number of bytes in entire vbr header */
+                vbrbytes = check_vbr_header(mp, bytes);
+            }
+            else {
+                /* not enough data to look for Xing header */
+#ifdef HIP_DEBUG
+                fprintf(stderr, "hip: not enough data to look for Xing header\n");
+#endif
+                return MP3_NEED_MORE;
+            }
+
+            if (mp->vbr_header) {
+                /* do we have enough data to parse entire Xing header? */
+                if (bytes + vbrbytes > mp->bsize) {
+                    /* fprintf(stderr,"hip: not enough data to parse entire Xing header\n"); */
+                    return MP3_NEED_MORE;
+                }
+
+                /* read in Xing header.  Buffer data in case it
+                 * is used by a non zero main_data_begin for the next
+                 * frame, but otherwise dont decode Xing header */
+#ifdef HIP_DEBUG
+                fprintf(stderr, "hip: found xing header, skipping %i bytes\n", vbrbytes + bytes);
+#endif
+                for (i = 0; i < vbrbytes + bytes; ++i)
+                    read_buf_byte(mp);
+                /* now we need to find another syncword */
+                /* just return and make user send in more data */
+
+                return MP3_NEED_MORE;
+            }
+        }
+        else {
+            /* match channels, samplerate, etc, when syncing */
+            bytes = sync_buffer(mp, 1);
+        }
+
+        /* buffer now synchronized */
+        if (bytes < 0) {
+            /* fprintf(stderr,"hip: need more bytes %d\n", bytes); */
+            return MP3_NEED_MORE;
+        }
+        if (bytes > 0) {
+            /* there were some extra bytes in front of header.
+             * bitstream problem, but we are now resynced 
+             * should try to buffer previous data in case new
+             * frame has nonzero main_data_begin, but we need
+             * to make sure we do not overflow buffer
+             */
+            int     size;
+            fprintf(stderr, "hip: bitstream problem, resyncing skipping %d bytes...\n", bytes);
+            mp->old_free_format = 0;
+#if 1
+            /* FIXME: correct ??? */
+            mp->sync_bitstream = 1;
+#endif
+            /* skip some bytes, buffer the rest */
+            size = (int) (mp->wordpointer - (mp->bsspace[mp->bsnum] + 512));
+
+            if (size > MAXFRAMESIZE) {
+                /* wordpointer buffer is trashed.  probably cant recover, but try anyway */
+                fprintf(stderr, "hip: wordpointer trashed.  size=%i (%i)  bytes=%i \n",
+                        size, MAXFRAMESIZE, bytes);
+                size = 0;
+                mp->wordpointer = mp->bsspace[mp->bsnum] + 512;
+            }
+
+            /* buffer contains 'size' data right now 
+               we want to add 'bytes' worth of data, but do not 
+               exceed MAXFRAMESIZE, so we through away 'i' bytes */
+            i = (size + bytes) - MAXFRAMESIZE;
+            for (; i > 0; --i) {
+                --bytes;
+                read_buf_byte(mp);
+            }
+
+            copy_mp(mp, bytes, mp->wordpointer);
+            mp->fsizeold += bytes;
+        }
+
+        read_head(mp);
+        decode_header(&mp->fr, mp->header);
+        mp->header_parsed = 1;
+        mp->framesize = mp->fr.framesize;
+        mp->free_format = (mp->framesize == 0);
+
+        if (mp->fr.lsf)
+            mp->ssize = (mp->fr.stereo == 1) ? 9 : 17;
+        else
+            mp->ssize = (mp->fr.stereo == 1) ? 17 : 32;
+        if (mp->fr.error_protection)
+            mp->ssize += 2;
+
+        mp->bsnum = 1 - mp->bsnum; /* toggle buffer */
+        mp->wordpointer = mp->bsspace[mp->bsnum] + 512;
+        mp->bitindex = 0;
+
+        /* for very first header, never parse rest of data */
+        if (mp->fsizeold == -1) {
+#ifdef HIP_DEBUG
+            fprintf(stderr, "hip: not parsing the rest of the data of the first header\n");
+#endif
+            return MP3_NEED_MORE;
+        }
+    }                   /* end of header parsing block */
+
+    /* now decode side information */
+    if (!mp->side_parsed) {
+
+        /* Layer 3 only */
+        if (mp->fr.lay == 3) {
+            if (mp->bsize < mp->ssize)
+                return MP3_NEED_MORE;
+
+            copy_mp(mp, mp->ssize, mp->wordpointer);
+
+            if (mp->fr.error_protection)
+                getbits(mp, 16);
+            bits = do_layer3_sideinfo(mp);
+            /* bits = actual number of bits needed to parse this frame */
+            /* can be negative, if all bits needed are in the reservoir */
+            if (bits < 0)
+                bits = 0;
+
+            /* read just as many bytes as necessary before decoding */
+            mp->dsize = (bits + 7) / 8;
+
+#ifdef HIP_DEBUG
+            fprintf(stderr,
+                    "hip: %d bits needed to parse layer III frame, number of bytes to read before decoding dsize = %d\n",
+                    bits, mp->dsize);
+#endif
+
+            /* this will force mpglib to read entire frame before decoding */
+            /* mp->dsize= mp->framesize - mp->ssize; */
+
+        }
+        else {
+            /* Layers 1 and 2 */
+
+            /* check if there is enough input data */
+            if (mp->fr.framesize > mp->bsize)
+                return MP3_NEED_MORE;
+
+            /* takes care that the right amount of data is copied into wordpointer */
+            mp->dsize = mp->fr.framesize;
+            mp->ssize = 0;
+        }
+
+        mp->side_parsed = 1;
+    }
+
+    /* now decode main data */
+    iret = MP3_NEED_MORE;
+    if (!mp->data_parsed) {
+        if (mp->dsize > mp->bsize) {
+            return MP3_NEED_MORE;
+        }
+
+        copy_mp(mp, mp->dsize, mp->wordpointer);
+
+        *done = 0;
+
+        /*do_layer3(&mp->fr,(unsigned char *) out,done); */
+        switch (mp->fr.lay) {
+        case 1:
+            if (mp->fr.error_protection)
+                getbits(mp, 16);
+
+            do_layer1(mp, (unsigned char *) out, done);
+            break;
+
+        case 2:
+            if (mp->fr.error_protection)
+                getbits(mp, 16);
+
+            do_layer2(mp, (unsigned char *) out, done);
+            break;
+
+        case 3:
+            do_layer3(mp, (unsigned char *) out, done, synth_1to1_mono_ptr, synth_1to1_ptr);
+            break;
+        default:
+            fprintf(stderr, "hip: invalid layer %d\n", mp->fr.lay);
+        }
+
+        mp->wordpointer = mp->bsspace[mp->bsnum] + 512 + mp->ssize + mp->dsize;
+
+        mp->data_parsed = 1;
+        iret = MP3_OK;
+    }
+
+
+    /* remaining bits are ancillary data, or reservoir for next frame 
+     * If free format, scan stream looking for next frame to determine
+     * mp->framesize */
+    if (mp->free_format) {
+        if (mp->old_free_format) {
+            /* free format.  bitrate must not vary */
+            mp->framesize = mp->fsizeold_nopadding + (mp->fr.padding);
+        }
+        else {
+            bytes = sync_buffer(mp, 1);
+            if (bytes < 0)
+                return iret;
+            mp->framesize = bytes + mp->ssize + mp->dsize;
+            mp->fsizeold_nopadding = mp->framesize - mp->fr.padding;
+            /*
+               fprintf(stderr,"hip: freeformat bitstream:  estimated bitrate=%ikbs  \n",
+               8*(4+mp->framesize)*freqs[mp->fr.sampling_frequency]/
+               (1000*576*(2-mp->fr.lsf)));
+             */
+        }
+    }
+
+    /* buffer the ancillary data and reservoir for next frame */
+    bytes = mp->framesize - (mp->ssize + mp->dsize);
+    if (bytes > mp->bsize) {
+        return iret;
+    }
+
+    if (bytes > 0) {
+        int     size;
+#if 0
+        /* FIXME: while loop OK ??? */
+        while (bytes > 512) {
+            read_buf_byte(mp);
+            bytes--;
+            mp->framesize--;
+        }
+#endif
+        copy_mp(mp, bytes, mp->wordpointer);
+        mp->wordpointer += bytes;
+
+        size = (int) (mp->wordpointer - (mp->bsspace[mp->bsnum] + 512));
+        if (size > MAXFRAMESIZE) {
+            fprintf(stderr, "hip: fatal error.  MAXFRAMESIZE not large enough.\n");
+        }
+
+    }
+
+    /* the above frame is completely parsed.  start looking for next frame */
+    mp->fsizeold = mp->framesize;
+    mp->old_free_format = mp->free_format;
+    mp->framesize = 0;
+    mp->header_parsed = 0;
+    mp->side_parsed = 0;
+    mp->data_parsed = 0;
+
+    return iret;
+}
+
+int
+decodeMP3(PMPSTR mp, unsigned char *in, int isize, char *out, int osize, int *done)
+{
+    if (osize < 4608) {
+        fprintf(stderr, "hip: Insufficient memory for decoding buffer %d\n", osize);
+        return MP3_ERR;
+    }
+
+    /* passing pointers to the functions which clip the samples */
+    return decodeMP3_clipchoice(mp, in, isize, out, done, synth_1to1_mono, synth_1to1);
+}
+
+int
+decodeMP3_unclipped(PMPSTR mp, unsigned char *in, int isize, char *out, int osize, int *done)
+{
+    /* we forbid input with more than 1152 samples per channel for output in unclipped mode */
+    if (osize < (int) (1152 * 2 * sizeof(real))) {
+        fprintf(stderr, "hip: out space too small for unclipped mode\n");
+        return MP3_ERR;
+    }
+
+    /* passing pointers to the functions which don't clip the samples */
+    return decodeMP3_clipchoice(mp, in, isize, out, done, synth_1to1_mono_unclipped,
+                                synth_1to1_unclipped);
+}
diff --git a/mpglib/interface.h b/mpglib/interface.h
new file mode 100644
index 0000000..f713b46
--- /dev/null
+++ b/mpglib/interface.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INTERFACE_H_INCLUDED
+#define INTERFACE_H_INCLUDED
+
+#ifdef __cplusplus
+extern  "C" {
+#endif
+
+#include "common.h"
+
+    int     InitMP3(PMPSTR mp);
+    int     decodeMP3(PMPSTR mp, unsigned char *inmemory, int inmemsize, char *outmemory,
+                      int outmemsize, int *done);
+    void    ExitMP3(PMPSTR mp);
+
+/* added decodeMP3_unclipped to support returning raw floating-point values of samples. The representation
+   of the floating-point numbers is defined in mpg123.h as #define real. It is 64-bit double by default. 
+   No more than 1152 samples per channel are allowed. */
+    int     decodeMP3_unclipped(PMPSTR mp, unsigned char *inmemory, int inmemsize, char *outmemory,
+                                int outmemsize, int *done);
+
+/* added remove_buf to support mpglib seeking */
+    void    remove_buf(PMPSTR mp);
+
+/* added audiodata_precedesframes to return the number of bitstream frames the audio data will precede the 
+   current frame by for Layer 3 data. Aids seeking.
+ */
+    int     audiodata_precedesframes(PMPSTR mp);
+
+/* Resets decoding. Aids seeking. */
+    void    decode_reset(PMPSTR mp);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mpglib/l2tables.h b/mpglib/l2tables.h
new file mode 100644
index 0000000..6a3deac
--- /dev/null
+++ b/mpglib/l2tables.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Layer 2 Alloc tables .. 
+ * most other tables are calculated on program start (which is (of course)
+ * not ISO-conform) .. 
+ * Layer-3 huffman table is in huffman.h
+ */
+
+const struct al_table2 alloc_0[] = {
+    {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10,
+                                                                                           -511},
+    {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767},
+    {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10,
+                                                                                           -511},
+    {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767},
+    {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10,
+                                                                                           -511},
+    {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767}
+};
+
+const struct al_table2 alloc_1[] = {
+    {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10,
+                                                                                           -511},
+    {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767},
+    {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10,
+                                                                                           -511},
+    {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767},
+    {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10,
+                                                                                           -511},
+    {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767},
+    {2, 0}, {5, 3}, {7, 5}, {16, -32767}
+};
+
+const struct al_table2 alloc_2[] = {
+    {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255},
+    {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383},
+    {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255},
+    {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}
+};
+
+const struct al_table2 alloc_3[] = {
+    {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255},
+    {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383},
+    {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255},
+    {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}
+};
+
+const struct al_table2 alloc_4[] = {
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191},
+    {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127},
+    {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9},
+    {2, 0}, {5, 3}, {7, 5}, {10, 9}
+};
diff --git a/mpglib/layer1.c b/mpglib/layer1.c
new file mode 100644
index 0000000..e6ba85d
--- /dev/null
+++ b/mpglib/layer1.c
@@ -0,0 +1,191 @@
+/* 
+ * layer1.c: Mpeg Layer-1 audio decoder 
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* $Id: layer1.c,v 1.23.2.2 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include "common.h"
+#include "decode_i386.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#include "layer1.h"
+
+static void
+I_step_one(PMPSTR mp, unsigned int balloc[], unsigned int scale_index[2][SBLIMIT], struct frame *fr)
+{
+    unsigned int *ba = balloc;
+    unsigned int *sca = (unsigned int *) scale_index;
+
+    assert(fr->stereo == 1 || fr->stereo == 2);
+    if (fr->stereo == 2) {
+        int     i;
+        int     jsbound = fr->jsbound;
+        for (i = 0; i < jsbound; i++) {
+            *ba++ = getbits(mp, 4);
+            *ba++ = getbits(mp, 4);
+        }
+        for (i = jsbound; i < SBLIMIT; i++)
+            *ba++ = getbits(mp, 4);
+
+        ba = balloc;
+
+        for (i = 0; i < jsbound; i++) {
+            if ((*ba++))
+                *sca++ = getbits(mp, 6);
+            if ((*ba++))
+                *sca++ = getbits(mp, 6);
+        }
+        for (i = jsbound; i < SBLIMIT; i++)
+            if ((*ba++)) {
+                *sca++ = getbits(mp, 6);
+                *sca++ = getbits(mp, 6);
+            }
+    }
+    else {
+        int     i;
+        for (i = 0; i < SBLIMIT; i++)
+            *ba++ = getbits(mp, 4);
+        ba = balloc;
+        for (i = 0; i < SBLIMIT; i++)
+            if ((*ba++))
+                *sca++ = getbits(mp, 6);
+    }
+}
+
+static void
+I_step_two(PMPSTR mp, real fraction[2][SBLIMIT], unsigned int balloc[2 * SBLIMIT],
+           unsigned int scale_index[2][SBLIMIT], struct frame *fr)
+{
+    int     i, n;
+    int     smpb[2 * SBLIMIT]; /* values: 0-65535 */
+    int    *sample;
+    unsigned int *ba;
+    unsigned int *sca = (unsigned int *) scale_index;
+
+    assert(fr->stereo == 1 || fr->stereo == 2);
+    if (fr->stereo == 2) {
+        int     jsbound = fr->jsbound;
+        real   *f0 = fraction[0];
+        real   *f1 = fraction[1];
+        ba = balloc;
+        for (sample = smpb, i = 0; i < jsbound; i++) {
+            n = *ba++;
+            if (n)
+                *sample++ = getbits(mp, n + 1);
+            n = *ba++;
+            if (n)
+                *sample++ = getbits(mp, n + 1);
+        }
+        for (i = jsbound; i < SBLIMIT; i++) {
+            n = *ba++;
+            if (n)
+                *sample++ = getbits(mp, n + 1);
+        }
+        ba = balloc;
+        for (sample = smpb, i = 0; i < jsbound; i++) {
+            n = *ba++;
+            if (n)
+                *f0++ = (real) (((-1) << n) + (*sample++) + 1) * muls[n + 1][*sca++];
+            else
+                *f0++ = 0.0;
+            n = *ba++;
+            if (n)
+                *f1++ = (real) (((-1) << n) + (*sample++) + 1) * muls[n + 1][*sca++];
+            else
+                *f1++ = 0.0;
+        }
+        for (i = jsbound; i < SBLIMIT; i++) {
+            n = *ba++;
+            if (n) {
+                real    samp = (real) (((-1) << n) + (*sample++) + 1);
+                *f0++ = samp * muls[n + 1][*sca++];
+                *f1++ = samp * muls[n + 1][*sca++];
+            }
+            else
+                *f0++ = *f1++ = 0.0;
+        }
+        for (i = fr->down_sample_sblimit; i < 32; i++)
+            fraction[0][i] = fraction[1][i] = 0.0;
+    }
+    else {
+        real   *f0 = fraction[0];
+        ba = balloc;
+        for (sample = smpb, i = 0; i < SBLIMIT; i++) {
+            n = *ba++;
+            if (n)
+                *sample++ = getbits(mp, n + 1);
+        }
+        ba = balloc;
+        for (sample = smpb, i = 0; i < SBLIMIT; i++) {
+            n = *ba++;
+            if (n)
+                *f0++ = (real) (((-1) << n) + (*sample++) + 1) * muls[n + 1][*sca++];
+            else
+                *f0++ = 0.0;
+        }
+        for (i = fr->down_sample_sblimit; i < 32; i++)
+            fraction[0][i] = 0.0;
+    }
+}
+
+/*int do_layer1(struct frame *fr,int outmode,struct audio_info_struct *ai) */
+int
+do_layer1(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point)
+{
+    int     clip = 0;
+    unsigned int balloc[2 * SBLIMIT];
+    unsigned int scale_index[2][SBLIMIT];
+    real    fraction[2][SBLIMIT];
+    struct frame *fr = &(mp->fr);
+    int     i, stereo = fr->stereo;
+    int     single = fr->single;
+
+    fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : 32;
+
+    if (stereo == 1 || single == 3)
+        single = 0;
+
+    I_step_one(mp, balloc, scale_index, fr);
+
+    for (i = 0; i < SCALE_BLOCK; i++) {
+        I_step_two(mp, fraction, balloc, scale_index, fr);
+
+        if (single >= 0) {
+            clip += synth_1to1_mono(mp, (real *) fraction[single], pcm_sample, pcm_point);
+        }
+        else {
+            int     p1 = *pcm_point;
+            clip += synth_1to1(mp, (real *) fraction[0], 0, pcm_sample, &p1);
+            clip += synth_1to1(mp, (real *) fraction[1], 1, pcm_sample, pcm_point);
+        }
+    }
+
+    return clip;
+}
diff --git a/mpglib/layer1.h b/mpglib/layer1.h
new file mode 100644
index 0000000..7395959
--- /dev/null
+++ b/mpglib/layer1.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAYER1_H_INCLUDED
+#define LAYER1_H_INCLUDED
+
+int     do_layer1(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point);
+
+#endif
diff --git a/mpglib/layer2.c b/mpglib/layer2.c
new file mode 100644
index 0000000..28ba309
--- /dev/null
+++ b/mpglib/layer2.c
@@ -0,0 +1,315 @@
+/* 
+ * layer2.c: Mpeg Layer-2 audio decoder 
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/* $Id: layer2.c,v 1.23.2.2 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "common.h"
+#include "layer2.h"
+#include "l2tables.h"
+#include "decode_i386.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static int grp_3tab[32 * 3] = { 0, }; /* used: 27 */
+static int grp_5tab[128 * 3] = { 0, }; /* used: 125 */
+static int grp_9tab[1024 * 3] = { 0, }; /* used: 729 */
+
+void
+init_layer2(void)
+{
+    static const double mulmul[27] = {
+        0.0, -2.0 / 3.0, 2.0 / 3.0,
+        2.0 / 7.0, 2.0 / 15.0, 2.0 / 31.0, 2.0 / 63.0, 2.0 / 127.0, 2.0 / 255.0,
+        2.0 / 511.0, 2.0 / 1023.0, 2.0 / 2047.0, 2.0 / 4095.0, 2.0 / 8191.0,
+        2.0 / 16383.0, 2.0 / 32767.0, 2.0 / 65535.0,
+        -4.0 / 5.0, -2.0 / 5.0, 2.0 / 5.0, 4.0 / 5.0,
+        -8.0 / 9.0, -4.0 / 9.0, -2.0 / 9.0, 2.0 / 9.0, 4.0 / 9.0, 8.0 / 9.0
+    };
+    static const int base[3][9] = {
+        {1, 0, 2,},
+        {17, 18, 0, 19, 20,},
+        {21, 1, 22, 23, 0, 24, 25, 2, 26}
+    };
+    int     i, j, k, l, len;
+    real   *table;
+    static const int tablen[3] = { 3, 5, 9 };
+    static int *itable, *tables[3] = { grp_3tab, grp_5tab, grp_9tab };
+
+    for (i = 0; i < 3; i++) {
+        itable = tables[i];
+        len = tablen[i];
+        for (j = 0; j < len; j++)
+            for (k = 0; k < len; k++)
+                for (l = 0; l < len; l++) {
+                    *itable++ = base[i][l];
+                    *itable++ = base[i][k];
+                    *itable++ = base[i][j];
+                }
+    }
+
+    for (k = 0; k < 27; k++) {
+        double  m = mulmul[k];
+        table = muls[k];
+        for (j = 3, i = 0; i < 63; i++, j--)
+            *table++ = (real) (m * pow(2.0, (double) j / 3.0));
+        *table++ = 0.0;
+    }
+}
+
+
+static void
+II_step_one(PMPSTR mp, unsigned int *bit_alloc, int *scale, struct frame *fr)
+{
+    int     stereo = fr->stereo - 1;
+    int     sblimit = fr->II_sblimit;
+    int     jsbound = fr->jsbound;
+    int     sblimit2 = fr->II_sblimit << stereo;
+    struct al_table2 const *alloc1 = fr->alloc;
+    int     i;
+    static unsigned int scfsi_buf[64];
+    unsigned int *scfsi, *bita;
+    int     sc, step;
+
+    bita = bit_alloc;
+    if (stereo) {
+        for (i = jsbound; i; i--, alloc1 += (1 << step)) {
+            *bita++ = (char) getbits(mp, step = alloc1->bits);
+            *bita++ = (char) getbits(mp, step);
+        }
+        for (i = sblimit - jsbound; i; i--, alloc1 += (1 << step)) {
+            bita[0] = (char) getbits(mp, step = alloc1->bits);
+            bita[1] = bita[0];
+            bita += 2;
+        }
+        bita = bit_alloc;
+        scfsi = scfsi_buf;
+        for (i = sblimit2; i; i--)
+            if (*bita++)
+                *scfsi++ = (char) getbits_fast(mp, 2);
+    }
+    else {              /* mono */
+
+        for (i = sblimit; i; i--, alloc1 += (1 << step))
+            *bita++ = (char) getbits(mp, step = alloc1->bits);
+        bita = bit_alloc;
+        scfsi = scfsi_buf;
+        for (i = sblimit; i; i--)
+            if (*bita++)
+                *scfsi++ = (char) getbits_fast(mp, 2);
+    }
+
+    bita = bit_alloc;
+    scfsi = scfsi_buf;
+    for (i = sblimit2; i; i--)
+        if (*bita++)
+            switch (*scfsi++) {
+            case 0:
+                *scale++ = getbits_fast(mp, 6);
+                *scale++ = getbits_fast(mp, 6);
+                *scale++ = getbits_fast(mp, 6);
+                break;
+            case 1:
+                *scale++ = sc = getbits_fast(mp, 6);
+                *scale++ = sc;
+                *scale++ = getbits_fast(mp, 6);
+                break;
+            case 2:
+                *scale++ = sc = getbits_fast(mp, 6);
+                *scale++ = sc;
+                *scale++ = sc;
+                break;
+            default:   /* case 3 */
+                *scale++ = getbits_fast(mp, 6);
+                *scale++ = sc = getbits_fast(mp, 6);
+                *scale++ = sc;
+                break;
+            }
+
+}
+
+static void
+II_step_two(PMPSTR mp, unsigned int *bit_alloc, real fraction[2][4][SBLIMIT], int *scale,
+            struct frame *fr, int x1)
+{
+    int     i, j, k, ba;
+    int     stereo = fr->stereo;
+    int     sblimit = fr->II_sblimit;
+    int     jsbound = fr->jsbound;
+    struct al_table2 const *alloc2, *alloc1 = fr->alloc;
+    unsigned int *bita = bit_alloc;
+    int     d1, step;
+
+    for (i = 0; i < jsbound; i++, alloc1 += (1 << step)) {
+        step = alloc1->bits;
+        for (j = 0; j < stereo; j++) {
+            ba = *bita++;
+            if (ba) {
+                k = (alloc2 = alloc1 + ba)->bits;
+                if ((d1 = alloc2->d) < 0) {
+                    real    cm = muls[k][scale[x1]];
+                    fraction[j][0][i] = ((real) ((int) getbits(mp, k) + d1)) * cm;
+                    fraction[j][1][i] = ((real) ((int) getbits(mp, k) + d1)) * cm;
+                    fraction[j][2][i] = ((real) ((int) getbits(mp, k) + d1)) * cm;
+                }
+                else {
+                    static int *table[] = { 0, 0, 0, grp_3tab, 0, grp_5tab, 0, 0, 0, grp_9tab };
+                    unsigned int idx, *tab, m = scale[x1];
+                    idx = (unsigned int) getbits(mp, k);
+                    tab = (unsigned int *) (table[d1] + idx + idx + idx);
+                    fraction[j][0][i] = muls[*tab++][m];
+                    fraction[j][1][i] = muls[*tab++][m];
+                    fraction[j][2][i] = muls[*tab][m];
+                }
+                scale += 3;
+            }
+            else
+                fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
+        }
+    }
+
+    for (i = jsbound; i < sblimit; i++, alloc1 += (1 << step)) {
+        step = alloc1->bits;
+        bita++;         /* channel 1 and channel 2 bitalloc are the same */
+        ba = *bita++;
+        if (ba) {
+            k = (alloc2 = alloc1 + ba)->bits;
+            if ((d1 = alloc2->d) < 0) {
+                real    cm;
+                cm = muls[k][scale[x1 + 3]];
+                fraction[1][0][i] = (fraction[0][0][i] = (real) ((int) getbits(mp, k) + d1)) * cm;
+                fraction[1][1][i] = (fraction[0][1][i] = (real) ((int) getbits(mp, k) + d1)) * cm;
+                fraction[1][2][i] = (fraction[0][2][i] = (real) ((int) getbits(mp, k) + d1)) * cm;
+                cm = muls[k][scale[x1]];
+                fraction[0][0][i] *= cm;
+                fraction[0][1][i] *= cm;
+                fraction[0][2][i] *= cm;
+            }
+            else {
+                static int *table[] = { 0, 0, 0, grp_3tab, 0, grp_5tab, 0, 0, 0, grp_9tab };
+                unsigned int idx, *tab, m1, m2;
+                m1 = scale[x1];
+                m2 = scale[x1 + 3];
+                idx = (unsigned int) getbits(mp, k);
+                tab = (unsigned int *) (table[d1] + idx + idx + idx);
+                fraction[0][0][i] = muls[*tab][m1];
+                fraction[1][0][i] = muls[*tab++][m2];
+                fraction[0][1][i] = muls[*tab][m1];
+                fraction[1][1][i] = muls[*tab++][m2];
+                fraction[0][2][i] = muls[*tab][m1];
+                fraction[1][2][i] = muls[*tab][m2];
+            }
+            scale += 6;
+        }
+        else {
+            fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] =
+                fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0;
+        }
+/* 
+   should we use individual scalefac for channel 2 or
+   is the current way the right one , where we just copy channel 1 to
+   channel 2 ?? 
+   The current 'strange' thing is, that we throw away the scalefac
+   values for the second channel ...!!
+-> changed .. now we use the scalefac values of channel one !! 
+*/
+    }
+
+/*  if(sblimit > (fr->down_sample_sblimit) ) */
+/*    sblimit = fr->down_sample_sblimit; */
+
+    for (i = sblimit; i < SBLIMIT; i++)
+        for (j = 0; j < stereo; j++)
+            fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
+
+}
+
+static void
+II_select_table(struct frame *fr)
+{
+    /* *INDENT-OFF* */
+  static const int translate[3][2][16] =
+   { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
+       { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
+     { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
+       { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } ,
+     { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,
+       { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
+    /* *INDENT-ON* */
+
+    int     table, sblim;
+    static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 };
+    static const int sblims[5] = { 27, 30, 8, 12, 30 };
+
+    if (fr->lsf)
+        table = 4;
+    else
+        table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index];
+    sblim = sblims[table];
+
+    fr->alloc = (struct al_table2 const *) tables[table];
+    fr->II_sblimit = sblim;
+}
+
+
+int
+do_layer2(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point)
+/*int do_layer2(struct frame *fr,int outmode,struct audio_info_struct *ai) */
+{
+    int     clip = 0;
+    int     i, j;
+    real    fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */
+    unsigned int bit_alloc[64];
+    int     scale[192];
+    struct frame *fr = &(mp->fr);
+    int     stereo = fr->stereo;
+    int     single = fr->single;
+
+    II_select_table(fr);
+    fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : fr->II_sblimit;
+
+    if (stereo == 1 || single == 3)
+        single = 0;
+
+    II_step_one(mp, bit_alloc, scale, fr);
+
+    for (i = 0; i < SCALE_BLOCK; i++) {
+        II_step_two(mp, bit_alloc, fraction, scale, fr, i >> 2);
+        for (j = 0; j < 3; j++) {
+            if (single >= 0) {
+                clip += synth_1to1_mono(mp, fraction[single][j], pcm_sample, pcm_point);
+            }
+            else {
+                int     p1 = *pcm_point;
+                clip += synth_1to1(mp, fraction[0][j], 0, pcm_sample, &p1);
+                clip += synth_1to1(mp, fraction[1][j], 1, pcm_sample, pcm_point);
+            }
+        }
+    }
+
+    return clip;
+}
diff --git a/mpglib/layer2.h b/mpglib/layer2.h
new file mode 100644
index 0000000..d272b89
--- /dev/null
+++ b/mpglib/layer2.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef LAYER2_H_INCLUDED
+#define LAYER2_H_INCLUDED
+
+
+struct al_table2 {
+    short   bits;
+    short   d;
+};
+
+
+
+void    init_layer2(void);
+int     do_layer2(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point);
+
+
+#endif
diff --git a/mpglib/layer3.c b/mpglib/layer3.c
new file mode 100644
index 0000000..4693f78
--- /dev/null
+++ b/mpglib/layer3.c
@@ -0,0 +1,1847 @@
+/* 
+ * layer3.c: Mpeg Layer-3 audio decoder 
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/* $Id: layer3.c,v 1.51.2.3 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include "common.h"
+#include "huffman.h"
+#include "lame.h"
+#include "machine.h"
+#include "encoder.h"
+#include "lame-analysis.h"
+#include "decode_i386.h"
+#include "layer3.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+
+static real ispow[8207];
+static real aa_ca[8], aa_cs[8];
+static real COS1[12][6];
+static real win[4][36];
+static real win1[4][36];
+static real gainpow2[256 + 118 + 4];
+static real COS9[9];
+static real COS6_1, COS6_2;
+static real tfcos36[9];
+static real tfcos12[3];
+
+struct bandInfoStruct {
+    short   longIdx[23];
+    short   longDiff[22];
+    short   shortIdx[14];
+    short   shortDiff[13];
+};
+
+static int longLimit[9][23];
+static int shortLimit[9][14];
+
+/* *INDENT-OFF* */
+
+const struct bandInfoStruct bandInfo[9] = { 
+
+/* MPEG 1.0 */
+ { {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576},
+   {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158},
+   {0,4*3,8*3,12*3,16*3,22*3,30*3,40*3,52*3,66*3, 84*3,106*3,136*3,192*3},
+   {4,4,4,4,6,8,10,12,14,18,22,30,56} } ,
+
+ { {0,4,8,12,16,20,24,30,36,42,50,60,72, 88,106,128,156,190,230,276,330,384,576},
+   {4,4,4,4,4,4,6,6,6, 8,10,12,16,18,22,28,34,40,46,54, 54,192},
+   {0,4*3,8*3,12*3,16*3,22*3,28*3,38*3,50*3,64*3, 80*3,100*3,126*3,192*3},
+   {4,4,4,4,6,6,10,12,14,16,20,26,66} } ,
+
+ { {0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576} ,
+   {4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102, 26} ,
+   {0,4*3,8*3,12*3,16*3,22*3,30*3,42*3,58*3,78*3,104*3,138*3,180*3,192*3} ,
+   {4,4,4,4,6,8,12,16,20,26,34,42,12} }  ,
+
+/* MPEG 2.0 */
+ { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
+   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 } ,
+   {0,4*3,8*3,12*3,18*3,24*3,32*3,42*3,56*3,74*3,100*3,132*3,174*3,192*3} ,
+   {4,4,4,6,6,8,10,14,18,26,32,42,18 } } ,
+                                             /* docs: 332. mpg123: 330 */
+ { {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576},
+   {6,6,6,6,6,6,8,10,12,14,16,18,22,26,32,38,46,54,62,70,76,36 } ,
+   {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,136*3,180*3,192*3} ,
+   {4,4,4,6,8,10,12,14,18,24,32,44,12 } } ,
+
+ { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
+   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 },
+   {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,134*3,174*3,192*3},
+   {4,4,4,6,8,10,12,14,18,24,30,40,18 } } ,
+/* MPEG 2.5 */
+ { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576} ,
+   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54},
+   {0,12,24,36,54,78,108,144,186,240,312,402,522,576},
+   {4,4,4,6,8,10,12,14,18,24,30,40,18} },
+ { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576} ,
+   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54},
+   {0,12,24,36,54,78,108,144,186,240,312,402,522,576},
+   {4,4,4,6,8,10,12,14,18,24,30,40,18} },
+ { {0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576},
+   {12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2},
+   {0, 24, 48, 72,108,156,216,288,372,480,486,492,498,576},
+   {8,8,8,12,16,20,24,28,36,2,2,2,26} } ,
+};
+/* *INDENT-ON* */
+
+static int mapbuf0[9][152];
+static int mapbuf1[9][156];
+static int mapbuf2[9][44];
+static int *map[9][3];
+static int *mapend[9][3];
+
+static unsigned int n_slen2[512]; /* MPEG 2.0 slen for 'normal' mode */
+static unsigned int i_slen2[256]; /* MPEG 2.0 slen for intensity stereo */
+
+static real tan1_1[16], tan2_1[16], tan1_2[16], tan2_2[16];
+static real pow1_1[2][16], pow2_1[2][16], pow1_2[2][16], pow2_2[2][16];
+
+static unsigned int
+get1bit(PMPSTR mp)
+{
+    unsigned char rval;
+    rval = *mp->wordpointer << mp->bitindex;
+
+    mp->bitindex++;
+    mp->wordpointer += (mp->bitindex >> 3);
+    mp->bitindex &= 7;
+
+    return rval >> 7;
+}
+
+
+
+
+/* 
+ * init tables for layer-3 
+ */
+void
+init_layer3(int down_sample_sblimit)
+{
+    int     i, j, k;
+
+    for (i = -256; i < 118 + 4; i++)
+        gainpow2[i + 256] = pow((double) 2.0, -0.25 * (double) (i + 210));
+
+    for (i = 0; i < 8207; i++)
+        ispow[i] = pow((double) i, (double) 4.0 / 3.0);
+
+    for (i = 0; i < 8; i++) {
+        static double Ci[8] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 };
+        double  sq = sqrt(1.0 + Ci[i] * Ci[i]);
+        aa_cs[i] = 1.0 / sq;
+        aa_ca[i] = Ci[i] / sq;
+    }
+
+    for (i = 0; i < 18; i++) {
+        win[0][i] = win[1][i] =
+            0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 0) + 1)) / cos(M_PI *
+                                                                      (double) (2 * (i + 0) +
+                                                                                19) / 72.0);
+        win[0][i + 18] = win[3][i + 18] =
+            0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 18) + 1)) / cos(M_PI *
+                                                                       (double) (2 * (i + 18) +
+                                                                                 19) / 72.0);
+    }
+    for (i = 0; i < 6; i++) {
+        win[1][i + 18] = 0.5 / cos(M_PI * (double) (2 * (i + 18) + 19) / 72.0);
+        win[3][i + 12] = 0.5 / cos(M_PI * (double) (2 * (i + 12) + 19) / 72.0);
+        win[1][i + 24] =
+            0.5 * sin(M_PI / 24.0 * (double) (2 * i + 13)) / cos(M_PI *
+                                                                 (double) (2 * (i + 24) +
+                                                                           19) / 72.0);
+        win[1][i + 30] = win[3][i] = 0.0;
+        win[3][i + 6] =
+            0.5 * sin(M_PI / 24.0 * (double) (2 * i + 1)) / cos(M_PI * (double) (2 * (i + 6) + 19) /
+                                                                72.0);
+    }
+
+    for (i = 0; i < 9; i++)
+        COS9[i] = cos(M_PI / 18.0 * (double) i);
+
+    for (i = 0; i < 9; i++)
+        tfcos36[i] = 0.5 / cos(M_PI * (double) (i * 2 + 1) / 36.0);
+    for (i = 0; i < 3; i++)
+        tfcos12[i] = 0.5 / cos(M_PI * (double) (i * 2 + 1) / 12.0);
+
+    COS6_1 = cos(M_PI / 6.0 * (double) 1);
+    COS6_2 = cos(M_PI / 6.0 * (double) 2);
+
+    for (i = 0; i < 12; i++) {
+        win[2][i] =
+            0.5 * sin(M_PI / 24.0 * (double) (2 * i + 1)) / cos(M_PI * (double) (2 * i + 7) / 24.0);
+        for (j = 0; j < 6; j++)
+            COS1[i][j] = cos(M_PI / 24.0 * (double) ((2 * i + 7) * (2 * j + 1)));
+    }
+
+    for (j = 0; j < 4; j++) {
+        static int len[4] = { 36, 36, 12, 36 };
+        for (i = 0; i < len[j]; i += 2)
+            win1[j][i] = +win[j][i];
+        for (i = 1; i < len[j]; i += 2)
+            win1[j][i] = -win[j][i];
+    }
+
+    for (i = 0; i < 16; i++) {
+        double  t = tan((double) i * M_PI / 12.0);
+        tan1_1[i] = t / (1.0 + t);
+        tan2_1[i] = 1.0 / (1.0 + t);
+        tan1_2[i] = M_SQRT2 * t / (1.0 + t);
+        tan2_2[i] = M_SQRT2 / (1.0 + t);
+
+        for (j = 0; j < 2; j++) {
+            double  base = pow(2.0, -0.25 * (j + 1.0));
+            double  p1 = 1.0, p2 = 1.0;
+            if (i > 0) {
+                if (i & 1)
+                    p1 = pow(base, (i + 1.0) * 0.5);
+                else
+                    p2 = pow(base, i * 0.5);
+            }
+            pow1_1[j][i] = p1;
+            pow2_1[j][i] = p2;
+            pow1_2[j][i] = M_SQRT2 * p1;
+            pow2_2[j][i] = M_SQRT2 * p2;
+        }
+    }
+
+    for (j = 0; j < 9; j++) {
+        struct bandInfoStruct const *bi = (struct bandInfoStruct const *) &bandInfo[j];
+        int    *mp;
+        int     cb, lwin;
+        short const *bdf;
+
+        mp = map[j][0] = mapbuf0[j];
+        bdf = bi->longDiff;
+        for (i = 0, cb = 0; cb < 8; cb++, i += *bdf++) {
+            *mp++ = (*bdf) >> 1;
+            *mp++ = i;
+            *mp++ = 3;
+            *mp++ = cb;
+        }
+        bdf = bi->shortDiff + 3;
+        for (cb = 3; cb < 13; cb++) {
+            int     l = (*bdf++) >> 1;
+            for (lwin = 0; lwin < 3; lwin++) {
+                *mp++ = l;
+                *mp++ = i + lwin;
+                *mp++ = lwin;
+                *mp++ = cb;
+            }
+            i += 6 * l;
+        }
+        mapend[j][0] = mp;
+
+        mp = map[j][1] = mapbuf1[j];
+        bdf = bi->shortDiff + 0;
+        for (i = 0, cb = 0; cb < 13; cb++) {
+            int     l = (*bdf++) >> 1;
+            for (lwin = 0; lwin < 3; lwin++) {
+                *mp++ = l;
+                *mp++ = i + lwin;
+                *mp++ = lwin;
+                *mp++ = cb;
+            }
+            i += 6 * l;
+        }
+        mapend[j][1] = mp;
+
+        mp = map[j][2] = mapbuf2[j];
+        bdf = bi->longDiff;
+        for (cb = 0; cb < 22; cb++) {
+            *mp++ = (*bdf++) >> 1;
+            *mp++ = cb;
+        }
+        mapend[j][2] = mp;
+
+    }
+
+    for (j = 0; j < 9; j++) {
+        for (i = 0; i < 23; i++) {
+            longLimit[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1;
+            if (longLimit[j][i] > (down_sample_sblimit))
+                longLimit[j][i] = down_sample_sblimit;
+        }
+        for (i = 0; i < 14; i++) {
+            shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1;
+            if (shortLimit[j][i] > (down_sample_sblimit))
+                shortLimit[j][i] = down_sample_sblimit;
+        }
+    }
+
+    for (i = 0; i < 5; i++) {
+        for (j = 0; j < 6; j++) {
+            for (k = 0; k < 6; k++) {
+                int     n = k + j * 6 + i * 36;
+                i_slen2[n] = i | (j << 3) | (k << 6) | (3 << 12);
+            }
+        }
+    }
+    for (i = 0; i < 4; i++) {
+        for (j = 0; j < 4; j++) {
+            for (k = 0; k < 4; k++) {
+                int     n = k + j * 4 + i * 16;
+                i_slen2[n + 180] = i | (j << 3) | (k << 6) | (4 << 12);
+            }
+        }
+    }
+    for (i = 0; i < 4; i++) {
+        for (j = 0; j < 3; j++) {
+            int     n = j + i * 3;
+            i_slen2[n + 244] = i | (j << 3) | (5 << 12);
+            n_slen2[n + 500] = i | (j << 3) | (2 << 12) | (1 << 15);
+        }
+    }
+
+    for (i = 0; i < 5; i++) {
+        for (j = 0; j < 5; j++) {
+            for (k = 0; k < 4; k++) {
+                int     l;
+                for (l = 0; l < 4; l++) {
+                    int     n = l + k * 4 + j * 16 + i * 80;
+                    n_slen2[n] = i | (j << 3) | (k << 6) | (l << 9) | (0 << 12);
+                }
+            }
+        }
+    }
+    for (i = 0; i < 5; i++) {
+        for (j = 0; j < 5; j++) {
+            for (k = 0; k < 4; k++) {
+                int     n = k + j * 4 + i * 20;
+                n_slen2[n + 400] = i | (j << 3) | (k << 6) | (1 << 12);
+            }
+        }
+    }
+}
+
+/*
+ * read additional side information
+ */
+
+static void
+III_get_side_info_1(PMPSTR mp, struct III_sideinfo *si, int stereo,
+                    int ms_stereo, long sfreq, int single)
+{
+    int     ch, gr;
+    int     powdiff = (single == 3) ? 4 : 0;
+
+    si->main_data_begin = getbits(mp, 9);
+    if (stereo == 1)
+        si->private_bits = getbits_fast(mp, 5);
+    else
+        si->private_bits = getbits_fast(mp, 3);
+
+    for (ch = 0; ch < stereo; ch++) {
+        si->ch[ch].gr[0].scfsi = -1;
+        si->ch[ch].gr[1].scfsi = getbits_fast(mp, 4);
+    }
+
+    for (gr = 0; gr < 2; gr++) {
+        for (ch = 0; ch < stereo; ch++) {
+            struct gr_info_s *gr_infos = &(si->ch[ch].gr[gr]);
+
+            gr_infos->part2_3_length = getbits(mp, 12);
+            gr_infos->big_values = getbits_fast(mp, 9);
+            if (gr_infos->big_values > 288) {
+                fprintf(stderr, "big_values too large! %i\n", gr_infos->big_values);
+                gr_infos->big_values = 288;
+            }
+            {
+                unsigned int qss = getbits_fast(mp, 8);
+                gr_infos->pow2gain = gainpow2 + 256 - qss + powdiff;
+                if (mp->pinfo != NULL) {
+                    mp->pinfo->qss[gr][ch] = qss;
+                }
+            }
+            if (ms_stereo)
+                gr_infos->pow2gain += 2;
+            gr_infos->scalefac_compress = getbits_fast(mp, 4);
+/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */
+            if (get1bit(mp)) {
+                int     i;
+                gr_infos->block_type = getbits_fast(mp, 2);
+                gr_infos->mixed_block_flag = get1bit(mp);
+                gr_infos->table_select[0] = getbits_fast(mp, 5);
+                gr_infos->table_select[1] = getbits_fast(mp, 5);
+
+
+                /*
+                 * table_select[2] not needed, because there is no region2,
+                 * but to satisfy some verifications tools we set it either.
+                 */
+                gr_infos->table_select[2] = 0;
+                for (i = 0; i < 3; i++) {
+                    unsigned int sbg = (getbits_fast(mp, 3) << 3);
+                    gr_infos->full_gain[i] = gr_infos->pow2gain + sbg;
+                    if (mp->pinfo != NULL)
+                        mp->pinfo->sub_gain[gr][ch][i] = sbg / 8;
+                }
+
+                if (gr_infos->block_type == 0) {
+                    fprintf(stderr, "Blocktype == 0 and window-switching == 1 not allowed.\n");
+                    /* error seems to be very good recoverable, so don't exit */
+                    /* exit(1); */
+                }
+                /* region_count/start parameters are implicit in this case. */
+                gr_infos->region1start = 36 >> 1;
+                gr_infos->region2start = 576 >> 1;
+            }
+            else {
+                int     i, r0c, r1c;
+                for (i = 0; i < 3; i++)
+                    gr_infos->table_select[i] = getbits_fast(mp, 5);
+                r0c = getbits_fast(mp, 4);
+                r1c = getbits_fast(mp, 3);
+                gr_infos->region1start = bandInfo[sfreq].longIdx[r0c + 1] >> 1;
+                gr_infos->region2start = bandInfo[sfreq].longIdx[r0c + 1 + r1c + 1] >> 1;
+                gr_infos->block_type = 0;
+                gr_infos->mixed_block_flag = 0;
+            }
+            gr_infos->preflag = get1bit(mp);
+            gr_infos->scalefac_scale = get1bit(mp);
+            gr_infos->count1table_select = get1bit(mp);
+        }
+    }
+}
+
+/*
+ * Side Info for MPEG 2.0 / LSF
+ */
+static void
+III_get_side_info_2(PMPSTR mp, struct III_sideinfo *si, int stereo,
+                    int ms_stereo, long sfreq, int single)
+{
+    int     ch;
+    int     powdiff = (single == 3) ? 4 : 0;
+
+    si->main_data_begin = getbits(mp, 8);
+
+    if (stereo == 1)
+        si->private_bits = get1bit(mp);
+    else
+        si->private_bits = getbits_fast(mp, 2);
+
+    for (ch = 0; ch < stereo; ch++) {
+        struct gr_info_s *gr_infos = &(si->ch[ch].gr[0]);
+        unsigned int qss;
+
+        gr_infos->part2_3_length = getbits(mp, 12);
+        gr_infos->big_values = getbits_fast(mp, 9);
+        if (gr_infos->big_values > 288) {
+            fprintf(stderr, "big_values too large! %i\n", gr_infos->big_values);
+            gr_infos->big_values = 288;
+        }
+        qss = getbits_fast(mp, 8);
+        gr_infos->pow2gain = gainpow2 + 256 - qss + powdiff;
+        if (mp->pinfo != NULL) {
+            mp->pinfo->qss[0][ch] = qss;
+        }
+
+
+        if (ms_stereo)
+            gr_infos->pow2gain += 2;
+        gr_infos->scalefac_compress = getbits(mp, 9);
+/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */
+        if (get1bit(mp)) {
+            int     i;
+            gr_infos->block_type = getbits_fast(mp, 2);
+            gr_infos->mixed_block_flag = get1bit(mp);
+            gr_infos->table_select[0] = getbits_fast(mp, 5);
+            gr_infos->table_select[1] = getbits_fast(mp, 5);
+            /*
+             * table_select[2] not needed, because there is no region2,
+             * but to satisfy some verifications tools we set it either.
+             */
+            gr_infos->table_select[2] = 0;
+            for (i = 0; i < 3; i++) {
+                unsigned int sbg = (getbits_fast(mp, 3) << 3);
+                gr_infos->full_gain[i] = gr_infos->pow2gain + sbg;
+                if (mp->pinfo != NULL)
+                    mp->pinfo->sub_gain[0][ch][i] = sbg / 8;
+
+            }
+
+            if (gr_infos->block_type == 0) {
+                fprintf(stderr, "Blocktype == 0 and window-switching == 1 not allowed.\n");
+                /* error seems to be very good recoverable, so don't exit */
+                /* exit(1); */
+            }
+            /* region_count/start parameters are implicit in this case. */
+/* check this again! */
+            if (gr_infos->block_type == 2) {
+                if (sfreq == 8)
+                    gr_infos->region1start = 36;
+                else
+                    gr_infos->region1start = 36 >> 1;
+            }
+            else if (sfreq == 8)
+/* check this for 2.5 and sfreq=8 */
+                gr_infos->region1start = 108 >> 1;
+            else
+                gr_infos->region1start = 54 >> 1;
+            gr_infos->region2start = 576 >> 1;
+        }
+        else {
+            int     i, r0c, r1c;
+            for (i = 0; i < 3; i++)
+                gr_infos->table_select[i] = getbits_fast(mp, 5);
+            r0c = getbits_fast(mp, 4);
+            r1c = getbits_fast(mp, 3);
+            gr_infos->region1start = bandInfo[sfreq].longIdx[r0c + 1] >> 1;
+            gr_infos->region2start = bandInfo[sfreq].longIdx[r0c + 1 + r1c + 1] >> 1;
+            gr_infos->block_type = 0;
+            gr_infos->mixed_block_flag = 0;
+        }
+        gr_infos->scalefac_scale = get1bit(mp);
+        gr_infos->count1table_select = get1bit(mp);
+    }
+}
+
+/*
+ * read scalefactors
+ */
+
+static int
+III_get_scale_factors_1(PMPSTR mp, int *scf, struct gr_info_s *gr_infos)
+{
+    static const unsigned char slen[2][16] = {
+        {0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4},
+        {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}
+    };
+    int     numbits;
+    int     num0 = slen[0][gr_infos->scalefac_compress];
+    int     num1 = slen[1][gr_infos->scalefac_compress];
+
+    if (gr_infos->block_type == 2) {
+        int     i = 18;
+        numbits = (num0 + num1) * 18;
+
+        if (gr_infos->mixed_block_flag) {
+            for (i = 8; i; i--)
+                *scf++ = getbits_fast(mp, num0);
+            i = 9;
+            numbits -= num0; /* num0 * 17 + num1 * 18 */
+        }
+
+        for (; i; i--)
+            *scf++ = getbits_fast(mp, num0);
+        for (i = 18; i; i--)
+            *scf++ = getbits_fast(mp, num1);
+        *scf++ = 0;
+        *scf++ = 0;
+        *scf++ = 0;     /* short[13][0..2] = 0 */
+    }
+    else {
+        int     i;
+        int     scfsi = gr_infos->scfsi;
+
+        if (scfsi < 0) { /* scfsi < 0 => granule == 0 */
+            for (i = 11; i; i--)
+                *scf++ = getbits_fast(mp, num0);
+            for (i = 10; i; i--)
+                *scf++ = getbits_fast(mp, num1);
+            numbits = (num0 + num1) * 10 + num0;
+        }
+        else {
+            numbits = 0;
+            if (!(scfsi & 0x8)) {
+                for (i = 6; i; i--)
+                    *scf++ = getbits_fast(mp, num0);
+                numbits += num0 * 6;
+            }
+            else {
+                scf += 6;
+            }
+
+            if (!(scfsi & 0x4)) {
+                for (i = 5; i; i--)
+                    *scf++ = getbits_fast(mp, num0);
+                numbits += num0 * 5;
+            }
+            else {
+                scf += 5;
+            }
+
+            if (!(scfsi & 0x2)) {
+                for (i = 5; i; i--)
+                    *scf++ = getbits_fast(mp, num1);
+                numbits += num1 * 5;
+            }
+            else {
+                scf += 5;
+            }
+
+            if (!(scfsi & 0x1)) {
+                for (i = 5; i; i--)
+                    *scf++ = getbits_fast(mp, num1);
+                numbits += num1 * 5;
+            }
+            else {
+                scf += 5;
+            }
+        }
+
+        *scf++ = 0;     /* no l[21] in original sources */
+    }
+    return numbits;
+}
+
+
+static int
+III_get_scale_factors_2(PMPSTR mp, int *scf, struct gr_info_s *gr_infos, int i_stereo)
+{
+    unsigned char const *pnt;
+    int     i, j;
+    unsigned int slen;
+    int     n = 0;
+    int     numbits = 0;
+
+  /* *INDENT-OFF* */
+  static const unsigned char stab[3][6][4] = {
+   { { 6, 5, 5,5 } , { 6, 5, 7,3 } , { 11,10,0,0} ,
+     { 7, 7, 7,0 } , { 6, 6, 6,3 } , {  8, 8,5,0} } ,
+   { { 9, 9, 9,9 } , { 9, 9,12,6 } , { 18,18,0,0} ,
+     {12,12,12,0 } , {12, 9, 9,6 } , { 15,12,9,0} } ,
+   { { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0} ,
+     { 6,15,12,0 } , { 6,12, 9,6 } , {  6,18,9,0} } }; 
+  /* *INDENT-ON* */
+
+    if (i_stereo)       /* i_stereo AND second channel -> do_layer3() checks this */
+        slen = i_slen2[gr_infos->scalefac_compress >> 1];
+    else
+        slen = n_slen2[gr_infos->scalefac_compress];
+
+    gr_infos->preflag = (slen >> 15) & 0x1;
+
+    n = 0;
+    if (gr_infos->block_type == 2) {
+        n++;
+        if (gr_infos->mixed_block_flag)
+            n++;
+    }
+
+    pnt = (unsigned char const *) stab[n][(slen >> 12) & 0x7];
+
+    for (i = 0; i < 4; i++) {
+        int     num = slen & 0x7;
+        slen >>= 3;
+        if (num) {
+            for (j = 0; j < (int) (pnt[i]); j++)
+                *scf++ = getbits_fast(mp, num);
+            numbits += pnt[i] * num;
+        }
+        else {
+            for (j = 0; j < (int) (pnt[i]); j++)
+                *scf++ = 0;
+        }
+    }
+
+    n = (n << 1) + 1;
+    for (i = 0; i < n; i++)
+        *scf++ = 0;
+
+    return numbits;
+}
+
+/* *INDENT-OFF* */
+static const int pretab1 [22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0}; /* char enough ? */
+static const int pretab2 [22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+/* *INDENT-ON* */
+
+/*
+ * don't forget to apply the same changes to III_dequantize_sample_ms() !!!
+ */
+static int
+III_dequantize_sample(PMPSTR mp, real xr[SBLIMIT][SSLIMIT], int *scf,
+                      struct gr_info_s *gr_infos, int sfreq, int part2bits)
+{
+    int     shift = 1 + gr_infos->scalefac_scale;
+    real   *xrpnt = (real *) xr;
+    int     l[3], l3;
+    int     part2remain = gr_infos->part2_3_length - part2bits;
+    int    *me;
+
+    /* fprintf(stderr,"part2remain = %d, gr_infos->part2_3_length = %d, part2bits = %d\n",
+       part2remain, gr_infos->part2_3_length, part2bits); */
+
+    {
+        int     i;
+
+        for (i = (&xr[SBLIMIT][0] - xrpnt) >> 1; i > 0; i--) {
+            *xrpnt++ = 0.0;
+            *xrpnt++ = 0.0;
+        }
+
+        xrpnt = (real *) xr;
+    }
+
+    {
+        int     bv = gr_infos->big_values;
+        int     region1 = gr_infos->region1start;
+        int     region2 = gr_infos->region2start;
+
+        l3 = ((576 >> 1) - bv) >> 1;
+/*
+ * we may lose the 'odd' bit here !! 
+ * check this later again 
+ */
+        if (bv <= region1) {
+            l[0] = bv;
+            l[1] = 0;
+            l[2] = 0;
+        }
+        else {
+            l[0] = region1;
+            if (bv <= region2) {
+                l[1] = bv - l[0];
+                l[2] = 0;
+            }
+            else {
+                l[1] = region2 - l[0];
+                l[2] = bv - region2;
+            }
+        }
+    }
+    /* MDH crash fix */
+    {
+        int     i;
+        for (i = 0; i < 3; i++) {
+            if (l[i] < 0) {
+                fprintf(stderr, "hip: Bogus region length (%d)\n", l[i]);
+                l[i] = 0;
+            }
+        }
+    }
+    /* end MDH crash fix */
+
+    if (gr_infos->block_type == 2) {
+        /*
+         * decoding with short or mixed mode BandIndex table 
+         */
+        int     i, max[4];
+        int     step = 0, lwin = 0, cb = 0;
+        real    v = 0.0;
+        int    *m, mc;
+
+        if (gr_infos->mixed_block_flag) {
+            max[3] = -1;
+            max[0] = max[1] = max[2] = 2;
+            m = map[sfreq][0];
+            me = mapend[sfreq][0];
+        }
+        else {
+            max[0] = max[1] = max[2] = max[3] = -1;
+            /* max[3] not really needed in this case */
+            m = map[sfreq][1];
+            me = mapend[sfreq][1];
+        }
+
+        mc = 0;
+        for (i = 0; i < 2; i++) {
+            int     lp = l[i];
+            struct newhuff const *h = (struct newhuff const *) (ht + gr_infos->table_select[i]);
+            for (; lp; lp--, mc--) {
+                int     x, y;
+                if ((!mc)) {
+                    mc = *m++;
+                    xrpnt = ((real *) xr) + (*m++);
+                    lwin = *m++;
+                    cb = *m++;
+                    if (lwin == 3) {
+                        v = gr_infos->pow2gain[(*scf++) << shift];
+                        step = 1;
+                    }
+                    else {
+                        v = gr_infos->full_gain[lwin][(*scf++) << shift];
+                        step = 3;
+                    }
+                }
+                {
+                    short const *val = (short const *) h->table;
+                    while ((y = *val++) < 0) {
+                        if (get1bit(mp))
+                            val -= y;
+                        part2remain--;
+                    }
+                    x = y >> 4;
+                    y &= 0xf;
+                }
+                if (x == 15) {
+                    max[lwin] = cb;
+                    part2remain -= h->linbits + 1;
+                    x += getbits(mp, (int) h->linbits);
+                    if (get1bit(mp))
+                        *xrpnt = -ispow[x] * v;
+                    else
+                        *xrpnt = ispow[x] * v;
+                }
+                else if (x) {
+                    max[lwin] = cb;
+                    if (get1bit(mp))
+                        *xrpnt = -ispow[x] * v;
+                    else
+                        *xrpnt = ispow[x] * v;
+                    part2remain--;
+                }
+                else
+                    *xrpnt = 0.0;
+                xrpnt += step;
+                if (y == 15) {
+                    max[lwin] = cb;
+                    part2remain -= h->linbits + 1;
+                    y += getbits(mp, (int) h->linbits);
+                    if (get1bit(mp))
+                        *xrpnt = -ispow[y] * v;
+                    else
+                        *xrpnt = ispow[y] * v;
+                }
+                else if (y) {
+                    max[lwin] = cb;
+                    if (get1bit(mp))
+                        *xrpnt = -ispow[y] * v;
+                    else
+                        *xrpnt = ispow[y] * v;
+                    part2remain--;
+                }
+                else
+                    *xrpnt = 0.0;
+                xrpnt += step;
+            }
+        }
+        for (; l3 && (part2remain > 0); l3--) {
+            struct newhuff const *h = (struct newhuff const *) (htc + gr_infos->count1table_select);
+            short const *val = (short const *) h->table;
+            short   a;
+
+            while ((a = *val++) < 0) {
+                part2remain--;
+                if (part2remain < 0) {
+                    part2remain++;
+                    a = 0;
+                    break;
+                }
+                if (get1bit(mp))
+                    val -= a;
+            }
+            for (i = 0; i < 4; i++) {
+                if (!(i & 1)) {
+                    if (!mc) {
+                        mc = *m++;
+                        xrpnt = ((real *) xr) + (*m++);
+                        lwin = *m++;
+                        cb = *m++;
+                        if (lwin == 3) {
+                            v = gr_infos->pow2gain[(*scf++) << shift];
+                            step = 1;
+                        }
+                        else {
+                            v = gr_infos->full_gain[lwin][(*scf++) << shift];
+                            step = 3;
+                        }
+                    }
+                    mc--;
+                }
+                if ((a & (0x8 >> i))) {
+                    max[lwin] = cb;
+                    part2remain--;
+                    if (part2remain < 0) {
+                        part2remain++;
+                        break;
+                    }
+                    if (get1bit(mp))
+                        *xrpnt = -v;
+                    else
+                        *xrpnt = v;
+                }
+                else
+                    *xrpnt = 0.0;
+                xrpnt += step;
+            }
+        }
+
+        while (m < me) {
+            if (!mc) {
+                mc = *m++;
+                xrpnt = ((real *) xr) + *m++;
+                if ((*m++) == 3)
+                    step = 1;
+                else
+                    step = 3;
+                m++;    /* cb */
+            }
+            mc--;
+            *xrpnt = 0.0;
+            xrpnt += step;
+            *xrpnt = 0.0;
+            xrpnt += step;
+/* we could add a little opt. here:
+ * if we finished a band for window 3 or a long band
+ * further bands could copied in a simple loop without a
+ * special 'map' decoding
+ */
+        }
+
+        gr_infos->maxband[0] = max[0] + 1;
+        gr_infos->maxband[1] = max[1] + 1;
+        gr_infos->maxband[2] = max[2] + 1;
+        gr_infos->maxbandl = max[3] + 1;
+
+        {
+            int     rmax = max[0] > max[1] ? max[0] : max[1];
+            rmax = (rmax > max[2] ? rmax : max[2]) + 1;
+            gr_infos->maxb = rmax ? shortLimit[sfreq][rmax] : longLimit[sfreq][max[3] + 1];
+        }
+
+    }
+    else {
+        /*
+         * decoding with 'long' BandIndex table (block_type != 2)
+         */
+        int const *pretab = (int const *) (gr_infos->preflag ? pretab1 : pretab2);
+        int     i, max = -1;
+        int     cb = 0;
+        int    *m = map[sfreq][2];
+        real    v = 0.0;
+        int     mc = 0;
+
+        /*
+         * long hash table values
+         */
+        for (i = 0; i < 3; i++) {
+            int     lp = l[i];
+            struct newhuff const *h = (struct newhuff const *) (ht + gr_infos->table_select[i]);
+
+            for (; lp; lp--, mc--) {
+                int     x, y;
+
+                if (!mc) {
+                    mc = *m++;
+                    v = gr_infos->pow2gain[((*scf++) + (*pretab++)) << shift];
+                    cb = *m++;
+                }
+                {
+                    short const *val = (short const *) h->table;
+                    while ((y = *val++) < 0) {
+                        if (get1bit(mp))
+                            val -= y;
+                        part2remain--;
+                    }
+                    x = y >> 4;
+                    y &= 0xf;
+                }
+                if (x == 15) {
+                    max = cb;
+                    part2remain -= h->linbits + 1;
+                    x += getbits(mp, (int) h->linbits);
+                    if (get1bit(mp))
+                        *xrpnt++ = -ispow[x] * v;
+                    else
+                        *xrpnt++ = ispow[x] * v;
+                }
+                else if (x) {
+                    max = cb;
+                    if (get1bit(mp))
+                        *xrpnt++ = -ispow[x] * v;
+                    else
+                        *xrpnt++ = ispow[x] * v;
+                    part2remain--;
+                }
+                else
+                    *xrpnt++ = 0.0;
+
+                if (y == 15) {
+                    max = cb;
+                    part2remain -= h->linbits + 1;
+                    y += getbits(mp, (int) h->linbits);
+                    if (get1bit(mp))
+                        *xrpnt++ = -ispow[y] * v;
+                    else
+                        *xrpnt++ = ispow[y] * v;
+                }
+                else if (y) {
+                    max = cb;
+                    if (get1bit(mp))
+                        *xrpnt++ = -ispow[y] * v;
+                    else
+                        *xrpnt++ = ispow[y] * v;
+                    part2remain--;
+                }
+                else
+                    *xrpnt++ = 0.0;
+            }
+        }
+
+        /*
+         * short (count1table) values
+         */
+        for (; l3 && (part2remain > 0); l3--) {
+            struct newhuff const *h = (struct newhuff const *) (htc + gr_infos->count1table_select);
+            short const *val = (short const *) h->table;
+            short   a;
+
+            while ((a = *val++) < 0) {
+                part2remain--;
+                if (part2remain < 0) {
+                    part2remain++;
+                    a = 0;
+                    break;
+                }
+                if (get1bit(mp))
+                    val -= a;
+            }
+            for (i = 0; i < 4; i++) {
+                if (!(i & 1)) {
+                    if (!mc) {
+                        mc = *m++;
+                        cb = *m++;
+                        v = gr_infos->pow2gain[((*scf++) + (*pretab++)) << shift];
+                    }
+                    mc--;
+                }
+                if ((a & (0x8 >> i))) {
+                    max = cb;
+                    part2remain--;
+                    if (part2remain < 0) {
+                        part2remain++;
+                        break;
+                    }
+                    if (get1bit(mp))
+                        *xrpnt++ = -v;
+                    else
+                        *xrpnt++ = v;
+                }
+                else
+                    *xrpnt++ = 0.0;
+            }
+        }
+
+        /* 
+         * zero part
+         */
+        for (i = (&xr[SBLIMIT][0] - xrpnt) >> 1; i; i--) {
+            *xrpnt++ = 0.0;
+            *xrpnt++ = 0.0;
+        }
+
+        gr_infos->maxbandl = max + 1;
+        gr_infos->maxb = longLimit[sfreq][gr_infos->maxbandl];
+    }
+
+    while (part2remain > 16) {
+        getbits(mp, 16); /* Dismiss stuffing Bits */
+        part2remain -= 16;
+    }
+    if (part2remain > 0)
+        getbits(mp, part2remain);
+    else if (part2remain < 0) {
+        fprintf(stderr, "hip: Can't rewind stream by %d bits!\n", -part2remain);
+        return 1;       /* -> error */
+    }
+    return 0;
+}
+
+
+/* 
+ * III_stereo: calculate real channel values for Joint-I-Stereo-mode
+ */
+static void
+III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac,
+             struct gr_info_s *gr_infos, int sfreq, int ms_stereo, int lsf)
+{
+    real(*xr)[SBLIMIT * SSLIMIT] = (real(*)[SBLIMIT * SSLIMIT]) xr_buf;
+    struct bandInfoStruct const *bi = (struct bandInfoStruct const *) &bandInfo[sfreq];
+    real   *tabl1, *tabl2;
+
+    if (lsf) {
+        int     p = gr_infos->scalefac_compress & 0x1;
+        if (ms_stereo) {
+            tabl1 = pow1_2[p];
+            tabl2 = pow2_2[p];
+        }
+        else {
+            tabl1 = pow1_1[p];
+            tabl2 = pow2_1[p];
+        }
+    }
+    else {
+        if (ms_stereo) {
+            tabl1 = tan1_2;
+            tabl2 = tan2_2;
+        }
+        else {
+            tabl1 = tan1_1;
+            tabl2 = tan2_1;
+        }
+    }
+
+    if (gr_infos->block_type == 2) {
+        int     lwin, do_l = 0;
+        if (gr_infos->mixed_block_flag)
+            do_l = 1;
+
+        for (lwin = 0; lwin < 3; lwin++) { /* process each window */
+            /* get first band with zero values */
+            int     is_p, sb, idx, sfb = gr_infos->maxband[lwin]; /* sfb is minimal 3 for mixed mode */
+            if (sfb > 3)
+                do_l = 0;
+
+            for (; sfb < 12; sfb++) {
+                is_p = scalefac[sfb * 3 + lwin - gr_infos->mixed_block_flag]; /* scale: 0-15 */
+                if (is_p != 7) {
+                    real    t1, t2;
+                    sb = bi->shortDiff[sfb];
+                    idx = bi->shortIdx[sfb] + lwin;
+                    t1 = tabl1[is_p];
+                    t2 = tabl2[is_p];
+                    for (; sb > 0; sb--, idx += 3) {
+                        real    v = xr[0][idx];
+                        xr[0][idx] = v * t1;
+                        xr[1][idx] = v * t2;
+                    }
+                }
+            }
+
+#if 1
+/* in the original: copy 10 to 11 , here: copy 11 to 12 
+maybe still wrong??? (copy 12 to 13?) */
+            is_p = scalefac[11 * 3 + lwin - gr_infos->mixed_block_flag]; /* scale: 0-15 */
+            sb = bi->shortDiff[12];
+            idx = bi->shortIdx[12] + lwin;
+#else
+            is_p = scalefac[10 * 3 + lwin - gr_infos->mixed_block_flag]; /* scale: 0-15 */
+            sb = bi->shortDiff[11];
+            idx = bi->shortIdx[11] + lwin;
+#endif
+            if (is_p != 7) {
+                real    t1, t2;
+                t1 = tabl1[is_p];
+                t2 = tabl2[is_p];
+                for (; sb > 0; sb--, idx += 3) {
+                    real    v = xr[0][idx];
+                    xr[0][idx] = v * t1;
+                    xr[1][idx] = v * t2;
+                }
+            }
+        }               /* end for(lwin; .. ; . ) */
+
+        if (do_l) {
+/* also check l-part, if ALL bands in the three windows are 'empty'
+ * and mode = mixed_mode 
+ */
+            int     sfb = gr_infos->maxbandl;
+            int     idx = bi->longIdx[sfb];
+
+            for (; sfb < 8; sfb++) {
+                int     sb = bi->longDiff[sfb];
+                int     is_p = scalefac[sfb]; /* scale: 0-15 */
+                if (is_p != 7) {
+                    real    t1, t2;
+                    t1 = tabl1[is_p];
+                    t2 = tabl2[is_p];
+                    for (; sb > 0; sb--, idx++) {
+                        real    v = xr[0][idx];
+                        xr[0][idx] = v * t1;
+                        xr[1][idx] = v * t2;
+                    }
+                }
+                else
+                    idx += sb;
+            }
+        }
+    }
+    else {              /* ((gr_infos->block_type != 2)) */
+
+        int     sfb = gr_infos->maxbandl;
+        int     is_p, idx = bi->longIdx[sfb];
+        for (; sfb < 21; sfb++) {
+            int     sb = bi->longDiff[sfb];
+            is_p = scalefac[sfb]; /* scale: 0-15 */
+            if (is_p != 7) {
+                real    t1, t2;
+                t1 = tabl1[is_p];
+                t2 = tabl2[is_p];
+                for (; sb > 0; sb--, idx++) {
+                    real    v = xr[0][idx];
+                    xr[0][idx] = v * t1;
+                    xr[1][idx] = v * t2;
+                }
+            }
+            else
+                idx += sb;
+        }
+
+        is_p = scalefac[20]; /* copy l-band 20 to l-band 21 */
+        if (is_p != 7) {
+            int     sb;
+            real    t1 = tabl1[is_p], t2 = tabl2[is_p];
+
+            for (sb = bi->longDiff[21]; sb > 0; sb--, idx++) {
+                real    v = xr[0][idx];
+                xr[0][idx] = v * t1;
+                xr[1][idx] = v * t2;
+            }
+        }
+    }                   /* ... */
+}
+
+static void
+III_antialias(real xr[SBLIMIT][SSLIMIT], struct gr_info_s *gr_infos)
+{
+    int     sblim;
+
+    if (gr_infos->block_type == 2) {
+        if (!gr_infos->mixed_block_flag)
+            return;
+        sblim = 1;
+    }
+    else {
+        sblim = gr_infos->maxb - 1;
+    }
+
+    /* 31 alias-reduction operations between each pair of sub-bands */
+    /* with 8 butterflies between each pair                         */
+
+    {
+        int     sb;
+        real   *xr1 = (real *) xr[1];
+
+        for (sb = sblim; sb; sb--, xr1 += 10) {
+            int     ss;
+            real   *cs = aa_cs, *ca = aa_ca;
+            real   *xr2 = xr1;
+
+            for (ss = 7; ss >= 0; ss--) { /* upper and lower butterfly inputs */
+                real    bu = *--xr2, bd = *xr1;
+                *xr2 = (bu * (*cs)) - (bd * (*ca));
+                *xr1++ = (bd * (*cs++)) + (bu * (*ca++));
+            }
+        }
+    }
+}
+
+
+/* *INDENT-OFF* */
+
+/*
+ DCT insipired by Jeff Tsay's DCT from the maplay package
+ this is an optimized version with manual unroll.
+
+ References:
+ [1] S. Winograd: "On Computing the Discrete Fourier Transform",
+     Mathematics of Computation, Volume 32, Number 141, January 1978,
+     Pages 175-199
+*/
+
+static void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf)
+{
+  {
+    real *in = inbuf;
+
+    in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14];
+    in[14]+=in[13]; in[13]+=in[12]; in[12]+=in[11];
+    in[11]+=in[10]; in[10]+=in[9];  in[9] +=in[8];
+    in[8] +=in[7];  in[7] +=in[6];  in[6] +=in[5];
+    in[5] +=in[4];  in[4] +=in[3];  in[3] +=in[2];
+    in[2] +=in[1];  in[1] +=in[0];
+
+    in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9];
+    in[9] +=in[7];  in[7] +=in[5];  in[5] +=in[3];  in[3] +=in[1];
+
+  {
+
+#define MACRO0(v) { \
+    real tmp; \
+    out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \
+    out2[8-(v)] = tmp * w[26-(v)];  } \
+    sum0 -= sum1; \
+    ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \
+    ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)]; 
+#define MACRO1(v) { \
+    real sum0,sum1; \
+    sum0 = tmp1a + tmp2a; \
+    sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \
+    MACRO0(v); }
+#define MACRO2(v) { \
+    real sum0,sum1; \
+    sum0 = tmp2a - tmp1a; \
+    sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \
+    MACRO0(v); }
+
+    const real *c = COS9;
+    real *out2 = o2;
+    real *w = wintab;
+    real *out1 = o1;
+    real *ts = tsbuf;
+
+    real ta33,ta66,tb33,tb66;
+
+    ta33 = in[2*3+0] * c[3];
+    ta66 = in[2*6+0] * c[6];
+    tb33 = in[2*3+1] * c[3];
+    tb66 = in[2*6+1] * c[6];
+
+    { 
+      real tmp1a,tmp2a,tmp1b,tmp2b;
+      tmp1a =             in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7];
+      tmp1b =             in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7];
+      tmp2a = in[2*0+0] + in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8];
+      tmp2b = in[2*0+1] + in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8];
+
+      MACRO1(0);
+      MACRO2(8);
+    }
+
+    {
+      real tmp1a,tmp2a,tmp1b,tmp2b;
+      tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3];
+      tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3];
+      tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0];
+      tmp2b = ( in[2*2+1] - in[2*4+1] - in[2*8+1] ) * c[6] - in[2*6+1] + in[2*0+1];
+
+      MACRO1(1);
+      MACRO2(7);
+    }
+
+    {
+      real tmp1a,tmp2a,tmp1b,tmp2b;
+      tmp1a =             in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1];
+      tmp1b =             in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1];
+      tmp2a = in[2*0+0] - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4];
+      tmp2b = in[2*0+1] - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4];
+
+      MACRO1(2);
+      MACRO2(6);
+    }
+
+    {
+      real tmp1a,tmp2a,tmp1b,tmp2b;
+      tmp1a =             in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5];
+      tmp1b =             in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5];
+      tmp2a = in[2*0+0] - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2];
+      tmp2b = in[2*0+1] - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - in[2*8+1] * c[2];
+
+      MACRO1(3);
+      MACRO2(5);
+    }
+
+    {
+      real sum0,sum1;
+      sum0 =  in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0];
+      sum1 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4];
+      MACRO0(4);
+    }
+  }
+
+  }
+}
+
+
+/*
+ * new DCT12
+ */
+static void dct12(real *in,real *rawout1,real *rawout2,real *wi,real *ts)
+{
+#define DCT12_PART1 \
+             in5 = in[5*3];  \
+     in5 += (in4 = in[4*3]); \
+     in4 += (in3 = in[3*3]); \
+     in3 += (in2 = in[2*3]); \
+     in2 += (in1 = in[1*3]); \
+     in1 += (in0 = in[0*3]); \
+                             \
+     in5 += in3; in3 += in1; \
+                             \
+     in2 *= COS6_1; \
+     in3 *= COS6_1; \
+
+#define DCT12_PART2 \
+     in0 += in4 * COS6_2; \
+                          \
+     in4 = in0 + in2;     \
+     in0 -= in2;          \
+                          \
+     in1 += in5 * COS6_2; \
+                          \
+     in5 = (in1 + in3) * tfcos12[0]; \
+     in1 = (in1 - in3) * tfcos12[2]; \
+                         \
+     in3 = in4 + in5;    \
+     in4 -= in5;         \
+                         \
+     in2 = in0 + in1;    \
+     in0 -= in1;
+
+
+   {
+     real in0,in1,in2,in3,in4,in5;
+     real *out1 = rawout1;
+     ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2];
+     ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5];
+ 
+     DCT12_PART1
+
+     {
+       real tmp0,tmp1 = (in0 - in4);
+       {
+         real tmp2 = (in1 - in5) * tfcos12[1];
+         tmp0 = tmp1 + tmp2;
+         tmp1 -= tmp2;
+       }
+       ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1];
+       ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1];
+       ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1];
+       ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1];
+     }
+
+     DCT12_PART2
+
+     ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0];
+     ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0];
+     ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2];
+     ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2];
+
+     ts[(6+0)*SBLIMIT]  = out1[6+0] + in0 * wi[0];
+     ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0];
+     ts[(6+2)*SBLIMIT]  = out1[6+2] + in4 * wi[2];
+     ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2];
+  }
+
+  in++;
+
+  {
+     real in0,in1,in2,in3,in4,in5;
+     real *out2 = rawout2;
+ 
+     DCT12_PART1
+
+     {
+       real tmp0,tmp1 = (in0 - in4);
+       {
+         real tmp2 = (in1 - in5) * tfcos12[1];
+         tmp0 = tmp1 + tmp2;
+         tmp1 -= tmp2;
+       }
+       out2[5-1] = tmp0 * wi[11-1];
+       out2[0+1] = tmp0 * wi[6+1];
+       ts[(12+1)*SBLIMIT] += tmp1 * wi[1];
+       ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1];
+     }
+
+     DCT12_PART2
+
+     out2[5-0] = in2 * wi[11-0];
+     out2[0+0] = in2 * wi[6+0];
+     out2[0+2] = in3 * wi[6+2];
+     out2[5-2] = in3 * wi[11-2];
+
+     ts[(12+0)*SBLIMIT] += in0 * wi[0];
+     ts[(17-0)*SBLIMIT] += in0 * wi[5-0];
+     ts[(12+2)*SBLIMIT] += in4 * wi[2];
+     ts[(17-2)*SBLIMIT] += in4 * wi[5-2];
+  }
+
+  in++; 
+
+  {
+     real in0,in1,in2,in3,in4,in5;
+     real *out2 = rawout2;
+     out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0;
+
+     DCT12_PART1
+
+     {
+       real tmp0,tmp1 = (in0 - in4);
+       {
+         real tmp2 = (in1 - in5) * tfcos12[1];
+         tmp0 = tmp1 + tmp2;
+         tmp1 -= tmp2;
+       }
+       out2[11-1] = tmp0 * wi[11-1];
+       out2[6 +1] = tmp0 * wi[6+1];
+       out2[0+1] += tmp1 * wi[1];
+       out2[5-1] += tmp1 * wi[5-1];
+     }
+
+     DCT12_PART2
+
+     out2[11-0] = in2 * wi[11-0];
+     out2[6 +0] = in2 * wi[6+0];
+     out2[6 +2] = in3 * wi[6+2];
+     out2[11-2] = in3 * wi[11-2];
+
+     out2[0+0] += in0 * wi[0];
+     out2[5-0] += in0 * wi[5-0];
+     out2[0+2] += in4 * wi[2];
+     out2[5-2] += in4 * wi[5-2];
+  }
+}
+/* *INDENT-ON* */
+
+/*
+ * III_hybrid
+ */
+static void
+III_hybrid(PMPSTR mp, real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT],
+           int ch, struct gr_info_s *gr_infos)
+{
+    real   *tspnt = (real *) tsOut;
+    real(*block)[2][SBLIMIT * SSLIMIT] = mp->hybrid_block;
+    int    *blc = mp->hybrid_blc;
+    real   *rawout1, *rawout2;
+    int     bt;
+    int     sb = 0;
+
+    {
+        int     b = blc[ch];
+        rawout1 = block[b][ch];
+        b = -b + 1;
+        rawout2 = block[b][ch];
+        blc[ch] = b;
+    }
+
+
+    if (gr_infos->mixed_block_flag) {
+        sb = 2;
+        dct36(fsIn[0], rawout1, rawout2, win[0], tspnt);
+        dct36(fsIn[1], rawout1 + 18, rawout2 + 18, win1[0], tspnt + 1);
+        rawout1 += 36;
+        rawout2 += 36;
+        tspnt += 2;
+    }
+
+    bt = gr_infos->block_type;
+    if (bt == 2) {
+        for (; sb < (int) gr_infos->maxb; sb += 2, tspnt += 2, rawout1 += 36, rawout2 += 36) {
+            dct12(fsIn[sb], rawout1, rawout2, win[2], tspnt);
+            dct12(fsIn[sb + 1], rawout1 + 18, rawout2 + 18, win1[2], tspnt + 1);
+        }
+    }
+    else {
+        for (; sb < (int) gr_infos->maxb; sb += 2, tspnt += 2, rawout1 += 36, rawout2 += 36) {
+            dct36(fsIn[sb], rawout1, rawout2, win[bt], tspnt);
+            dct36(fsIn[sb + 1], rawout1 + 18, rawout2 + 18, win1[bt], tspnt + 1);
+        }
+    }
+
+    for (; sb < SBLIMIT; sb++, tspnt++) {
+        int     i;
+        for (i = 0; i < SSLIMIT; i++) {
+            tspnt[i * SBLIMIT] = *rawout1++;
+            *rawout2++ = 0.0;
+        }
+    }
+}
+
+/*
+ * main layer3 handler
+ */
+struct III_sideinfo sideinfo;
+
+int
+layer3_audiodata_precedesframes(PMPSTR mp)
+{
+    int     audioDataInFrame;
+    int     framesToBacktrack;
+
+    /* specific to Layer 3, since Layer 1 & 2 the audio data starts at the frame that describes it. */
+    /* determine how many bytes and therefore bitstream frames the audio data precedes it's matching frame */
+    /* fprintf(stderr, "hip: main_data_begin = %d, mp->bsize %d, mp->fsizeold %d, mp->ssize %d\n",
+       sideinfo.main_data_begin, mp->bsize, mp->fsizeold, mp->ssize); */
+    /* compute the number of frames to backtrack, 4 for the header, ssize already holds the CRC */
+    /* TODO Erroneously assumes current frame is same as previous frame. */
+    audioDataInFrame = mp->bsize - 4 - mp->ssize;
+    framesToBacktrack = (sideinfo.main_data_begin + audioDataInFrame - 1) / audioDataInFrame;
+    /* fprintf(stderr, "hip: audioDataInFrame %d framesToBacktrack %d\n", audioDataInFrame, framesToBacktrack); */
+    return framesToBacktrack;
+}
+
+int
+do_layer3_sideinfo(PMPSTR mp)
+{
+    struct frame *fr = &mp->fr;
+    int     stereo = fr->stereo;
+    int     single = fr->single;
+    int     ms_stereo;
+    int     sfreq = fr->sampling_frequency;
+    int     granules;
+    int     ch, gr, databits;
+
+    if (stereo == 1) {  /* stream is mono */
+        single = 0;
+    }
+
+    if (fr->mode == MPG_MD_JOINT_STEREO) {
+        ms_stereo = fr->mode_ext & 0x2;
+    }
+    else
+        ms_stereo = 0;
+
+
+    if (fr->lsf) {
+        granules = 1;
+        III_get_side_info_2(mp, &sideinfo, stereo, ms_stereo, sfreq, single);
+    }
+    else {
+        granules = 2;
+        III_get_side_info_1(mp, &sideinfo, stereo, ms_stereo, sfreq, single);
+    }
+
+    databits = 0;
+    for (gr = 0; gr < granules; ++gr) {
+        for (ch = 0; ch < stereo; ++ch) {
+            struct gr_info_s *gr_infos = &(sideinfo.ch[ch].gr[gr]);
+            databits += gr_infos->part2_3_length;
+        }
+    }
+    return databits - 8 * sideinfo.main_data_begin;
+}
+
+
+
+int
+do_layer3(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point,
+          int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *),
+          int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *))
+{
+    int     gr, ch, ss, clip = 0;
+    int     scalefacs[2][39]; /* max 39 for short[13][3] mode, mixed: 38, long: 22 */
+    /*  struct III_sideinfo sideinfo; */
+    struct frame *fr = &(mp->fr);
+    int     stereo = fr->stereo;
+    int     single = fr->single;
+    int     ms_stereo, i_stereo;
+    int     sfreq = fr->sampling_frequency;
+    int     stereo1, granules;
+
+    if (set_pointer(mp, (int) sideinfo.main_data_begin) == MP3_ERR)
+        return 0;
+
+    if (stereo == 1) {  /* stream is mono */
+        stereo1 = 1;
+        single = 0;
+    }
+    else if (single >= 0) /* stream is stereo, but force to mono */
+        stereo1 = 1;
+    else
+        stereo1 = 2;
+
+    if (fr->mode == MPG_MD_JOINT_STEREO) {
+        ms_stereo = fr->mode_ext & 0x2;
+        i_stereo = fr->mode_ext & 0x1;
+    }
+    else
+        ms_stereo = i_stereo = 0;
+
+
+    if (fr->lsf) {
+        granules = 1;
+    }
+    else {
+        granules = 2;
+    }
+
+    for (gr = 0; gr < granules; gr++) {
+        static real hybridIn[2][SBLIMIT][SSLIMIT];
+        static real hybridOut[2][SSLIMIT][SBLIMIT];
+
+        {
+            struct gr_info_s *gr_infos = &(sideinfo.ch[0].gr[gr]);
+            long    part2bits;
+
+            if (fr->lsf)
+                part2bits = III_get_scale_factors_2(mp, scalefacs[0], gr_infos, 0);
+            else {
+                part2bits = III_get_scale_factors_1(mp, scalefacs[0], gr_infos);
+            }
+
+            if (mp->pinfo != NULL) {
+                int     i;
+                mp->pinfo->sfbits[gr][0] = part2bits;
+                for (i = 0; i < 39; i++)
+                    mp->pinfo->sfb_s[gr][0][i] = scalefacs[0][i];
+            }
+
+            /* fprintf(stderr, "calling III dequantize sample 1 gr_infos->part2_3_length %d\n", gr_infos->part2_3_length); */
+            if (III_dequantize_sample(mp, hybridIn[0], scalefacs[0], gr_infos, sfreq, part2bits))
+                return clip;
+        }
+        if (stereo == 2) {
+            struct gr_info_s *gr_infos = &(sideinfo.ch[1].gr[gr]);
+            long    part2bits;
+            if (fr->lsf)
+                part2bits = III_get_scale_factors_2(mp, scalefacs[1], gr_infos, i_stereo);
+            else {
+                part2bits = III_get_scale_factors_1(mp, scalefacs[1], gr_infos);
+            }
+            if (mp->pinfo != NULL) {
+                int     i;
+                mp->pinfo->sfbits[gr][1] = part2bits;
+                for (i = 0; i < 39; i++)
+                    mp->pinfo->sfb_s[gr][1][i] = scalefacs[1][i];
+            }
+
+            /* fprintf(stderr, "calling III dequantize sample 2  gr_infos->part2_3_length %d\n", gr_infos->part2_3_length); */
+            if (III_dequantize_sample(mp, hybridIn[1], scalefacs[1], gr_infos, sfreq, part2bits))
+                return clip;
+
+            if (ms_stereo) {
+                int     i;
+                for (i = 0; i < SBLIMIT * SSLIMIT; i++) {
+                    real    tmp0, tmp1;
+                    tmp0 = ((real *) hybridIn[0])[i];
+                    tmp1 = ((real *) hybridIn[1])[i];
+                    ((real *) hybridIn[1])[i] = tmp0 - tmp1;
+                    ((real *) hybridIn[0])[i] = tmp0 + tmp1;
+                }
+            }
+
+            if (i_stereo)
+                III_i_stereo(hybridIn, scalefacs[1], gr_infos, sfreq, ms_stereo, fr->lsf);
+
+            if (ms_stereo || i_stereo || (single == 3)) {
+                if (gr_infos->maxb > sideinfo.ch[0].gr[gr].maxb)
+                    sideinfo.ch[0].gr[gr].maxb = gr_infos->maxb;
+                else
+                    gr_infos->maxb = sideinfo.ch[0].gr[gr].maxb;
+            }
+
+            switch (single) {
+            case 3:
+                {
+                    int     i;
+                    real   *in0 = (real *) hybridIn[0], *in1 = (real *) hybridIn[1];
+                    for (i = 0; i < (int) (SSLIMIT * gr_infos->maxb); i++, in0++)
+                        *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */
+                }
+                break;
+            case 1:
+                {
+                    int     i;
+                    real   *in0 = (real *) hybridIn[0], *in1 = (real *) hybridIn[1];
+                    for (i = 0; i < (int) (SSLIMIT * gr_infos->maxb); i++)
+                        *in0++ = *in1++;
+                }
+                break;
+            }
+        }
+
+        if (mp->pinfo != NULL) {
+            int     i, sb;
+            float   ifqstep;
+
+            mp->pinfo->bitrate = tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index];
+            mp->pinfo->sampfreq = freqs[sfreq];
+            mp->pinfo->emph = fr->emphasis;
+            mp->pinfo->crc = fr->error_protection;
+            mp->pinfo->padding = fr->padding;
+            mp->pinfo->stereo = fr->stereo;
+            mp->pinfo->js = (fr->mode == MPG_MD_JOINT_STEREO);
+            mp->pinfo->ms_stereo = ms_stereo;
+            mp->pinfo->i_stereo = i_stereo;
+            mp->pinfo->maindata = sideinfo.main_data_begin;
+
+            for (ch = 0; ch < stereo1; ch++) {
+                struct gr_info_s *gr_infos = &(sideinfo.ch[ch].gr[gr]);
+                mp->pinfo->big_values[gr][ch] = gr_infos->big_values;
+                mp->pinfo->scalefac_scale[gr][ch] = gr_infos->scalefac_scale;
+                mp->pinfo->mixed[gr][ch] = gr_infos->mixed_block_flag;
+                mp->pinfo->mpg123blocktype[gr][ch] = gr_infos->block_type;
+                mp->pinfo->mainbits[gr][ch] = gr_infos->part2_3_length;
+                mp->pinfo->preflag[gr][ch] = gr_infos->preflag;
+                if (gr == 1)
+                    mp->pinfo->scfsi[ch] = gr_infos->scfsi;
+            }
+
+
+            for (ch = 0; ch < stereo1; ch++) {
+                struct gr_info_s *gr_infos = &(sideinfo.ch[ch].gr[gr]);
+                ifqstep = (mp->pinfo->scalefac_scale[gr][ch] == 0) ? .5 : 1.0;
+                if (2 == gr_infos->block_type) {
+                    for (i = 0; i < 3; i++) {
+                        for (sb = 0; sb < 12; sb++) {
+                            int     j = 3 * sb + i;
+                            /*
+                               is_p = scalefac[sfb*3+lwin-gr_infos->mixed_block_flag]; 
+                             */
+                            /* scalefac was copied into pinfo->sfb_s[] above */
+                            mp->pinfo->sfb_s[gr][ch][j] =
+                                -ifqstep * mp->pinfo->sfb_s[gr][ch][j - gr_infos->mixed_block_flag];
+                            mp->pinfo->sfb_s[gr][ch][j] -= 2 * (mp->pinfo->sub_gain[gr][ch][i]);
+                        }
+                        mp->pinfo->sfb_s[gr][ch][3 * sb + i] =
+                            -2 * (mp->pinfo->sub_gain[gr][ch][i]);
+                    }
+                }
+                else {
+                    for (sb = 0; sb < 21; sb++) {
+                        /* scalefac was copied into pinfo->sfb[] above */
+                        mp->pinfo->sfb[gr][ch][sb] = mp->pinfo->sfb_s[gr][ch][sb];
+                        if (gr_infos->preflag)
+                            mp->pinfo->sfb[gr][ch][sb] += pretab1[sb];
+                        mp->pinfo->sfb[gr][ch][sb] *= -ifqstep;
+                    }
+                    mp->pinfo->sfb[gr][ch][21] = 0;
+                }
+            }
+
+
+
+            for (ch = 0; ch < stereo1; ch++) {
+                int     j = 0;
+                for (sb = 0; sb < SBLIMIT; sb++)
+                    for (ss = 0; ss < SSLIMIT; ss++, j++)
+                        mp->pinfo->mpg123xr[gr][ch][j] = hybridIn[ch][sb][ss];
+            }
+        }
+
+
+        for (ch = 0; ch < stereo1; ch++) {
+            struct gr_info_s *gr_infos = &(sideinfo.ch[ch].gr[gr]);
+            III_antialias(hybridIn[ch], gr_infos);
+            III_hybrid(mp, hybridIn[ch], hybridOut[ch], ch, gr_infos);
+        }
+
+        for (ss = 0; ss < SSLIMIT; ss++) {
+            if (single >= 0) {
+                clip += (*synth_1to1_mono_ptr) (mp, hybridOut[0][ss], pcm_sample, pcm_point);
+            }
+            else {
+                int     p1 = *pcm_point;
+                clip += (*synth_1to1_ptr) (mp, hybridOut[0][ss], 0, pcm_sample, &p1);
+                clip += (*synth_1to1_ptr) (mp, hybridOut[1][ss], 1, pcm_sample, pcm_point);
+            }
+        }
+    }
+
+    return clip;
+}
diff --git a/mpglib/layer3.h b/mpglib/layer3.h
new file mode 100644
index 0000000..783cb0e
--- /dev/null
+++ b/mpglib/layer3.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LAYER3_H_INCLUDED
+#define LAYER3_H_INCLUDED
+
+void    init_layer3(int);
+int     do_layer3_sideinfo(PMPSTR mp);
+int     do_layer3(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point,
+                  int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *),
+                  int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *));
+int     layer3_audiodata_precedesframes(PMPSTR mp);
+
+#endif
diff --git a/mpglib/mpg123.h b/mpglib/mpg123.h
new file mode 100644
index 0000000..b9d8ce5
--- /dev/null
+++ b/mpglib/mpg123.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef MPG123_H_INCLUDED
+#define MPG123_H_INCLUDED
+
+#include        <stdio.h>
+
+#ifdef STDC_HEADERS
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char   *strchr(), *strrchr();
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#include        <signal.h>
+
+
+#if defined(__riscos__) && defined(FPA10)
+#include "ymath.h"
+#else
+#include <math.h>
+#endif
+
+#ifndef M_PI
+#define M_PI       3.14159265358979323846
+#endif
+#ifndef M_SQRT2
+#define M_SQRT2    1.41421356237309504880
+#endif
+
+#ifndef FALSE
+#define         FALSE                   0
+#endif
+#ifndef TRUE
+#define         TRUE                    1
+#endif
+
+#undef REAL_IS_FLOAT
+#define REAL_IS_FLOAT
+
+#ifdef REAL_IS_FLOAT
+#  define real float
+#elif defined(REAL_IS_LONG_DOUBLE)
+#  define real long double
+#else
+#  define real double
+#endif
+
+#define         FALSE                   0
+#define         TRUE                    1
+
+#define         SBLIMIT                 32
+#define         SSLIMIT                 18
+
+#define         MPG_MD_STEREO           0
+#define         MPG_MD_JOINT_STEREO     1
+#define         MPG_MD_DUAL_CHANNEL     2
+#define         MPG_MD_MONO             3
+
+#define MAXFRAMESIZE 2880
+
+/* AF: ADDED FOR LAYER1/LAYER2 */
+#define         SCALE_BLOCK             12
+
+
+/* Pre Shift fo 16 to 8 bit converter table */
+#define AUSHIFT (3)
+
+struct frame {
+    int     stereo;
+    int     jsbound;
+    int     single;          /* single channel (monophonic) */
+    int     lsf;             /* 0 = MPEG-1, 1 = MPEG-2/2.5 */
+    int     mpeg25;          /* 1 = MPEG-2.5, 0 = MPEG-1/2 */
+    int     header_change;
+    int     lay;             /* Layer */
+    int     error_protection; /* 1 = CRC-16 code following header */
+    int     bitrate_index;
+    int     sampling_frequency; /* sample rate of decompressed audio in Hz */
+    int     padding;
+    int     extension;
+    int     mode;
+    int     mode_ext;
+    int     copyright;
+    int     original;
+    int     emphasis;
+    int     framesize;       /* computed framesize */
+
+    /* AF: ADDED FOR LAYER1/LAYER2 */
+    int     II_sblimit;
+    struct al_table2 const *alloc;
+    int     down_sample_sblimit;
+    int     down_sample;
+
+
+};
+
+struct gr_info_s {
+    int     scfsi;
+    unsigned part2_3_length;
+    unsigned big_values;
+    unsigned scalefac_compress;
+    unsigned block_type;
+    unsigned mixed_block_flag;
+    unsigned table_select[3];
+    unsigned subblock_gain[3];
+    unsigned maxband[3];
+    unsigned maxbandl;
+    unsigned maxb;
+    unsigned region1start;
+    unsigned region2start;
+    unsigned preflag;
+    unsigned scalefac_scale;
+    unsigned count1table_select;
+    real   *full_gain[3];
+    real   *pow2gain;
+};
+
+struct III_sideinfo {
+    unsigned main_data_begin;
+    unsigned private_bits;
+    struct {
+        struct gr_info_s gr[2];
+    } ch[2];
+};
+
+
+#endif
diff --git a/mpglib/mpglib.h b/mpglib/mpglib.h
new file mode 100644
index 0000000..0dff62a
--- /dev/null
+++ b/mpglib/mpglib.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef _MPGLIB_H_
+#define _MPGLIB_H_
+
+#ifndef plotting_data_defined
+#define plotting_data_defined
+struct plotting_data;
+typedef struct plotting_data plotting_data;
+#endif
+
+
+
+
+struct buf {
+    unsigned char *pnt;
+    long    size;
+    long    pos;
+    struct buf *next;
+    struct buf *prev;
+};
+
+struct framebuf {
+    struct buf *buf;
+    long    pos;
+    struct frame *next;
+    struct frame *prev;
+};
+
+typedef struct mpstr_tag {
+    struct buf *head, *tail; /* buffer linked list pointers, tail points to oldest buffer */
+    int     vbr_header;      /* 1 if valid Xing vbr header detected */
+    int     num_frames;      /* set if vbr header present */
+    int     enc_delay;       /* set if vbr header present */
+    int     enc_padding;     /* set if vbr header present */
+    /* header_parsed, side_parsed and data_parsed must be all set 1
+       before the full frame has been parsed */
+    int     header_parsed;   /* 1 = header of current frame has been parsed */
+    int     side_parsed;     /* 1 = header of sideinfo of current frame has been parsed */
+    int     data_parsed;
+    int     free_format;     /* 1 = free format frame */
+    int     old_free_format; /* 1 = last frame was free format */
+    int     bsize;
+    int     framesize;
+    int     ssize;           /* number of bytes used for side information, including 2 bytes for CRC-16 if present */
+    int     dsize;
+    int     fsizeold;        /* size of previous frame, -1 for first */
+    int     fsizeold_nopadding;
+    struct frame fr;         /* holds the parameters decoded from the header */
+    unsigned char bsspace[2][MAXFRAMESIZE + 1024]; /* bit stream space used ???? */ /* MAXFRAMESIZE */
+    real    hybrid_block[2][2][SBLIMIT * SSLIMIT];
+    int     hybrid_blc[2];
+    unsigned long header;
+    int     bsnum;
+    real    synth_buffs[2][2][0x110];
+    int     synth_bo;
+    int     sync_bitstream;  /* 1 = bitstream is yet to be synchronized */
+
+    int     bitindex;
+    unsigned char *wordpointer;
+    plotting_data *pinfo;
+} MPSTR, *PMPSTR;
+
+
+#define MP3_ERR -1
+#define MP3_OK  0
+#define MP3_NEED_MORE 1
+
+
+
+#endif /* _MPGLIB_H_ */
diff --git a/mpglib/mpglib_vc6.dsp b/mpglib/mpglib_vc6.dsp
new file mode 100644
index 0000000..9ce315b
--- /dev/null
+++ b/mpglib/mpglib_vc6.dsp
@@ -0,0 +1,226 @@
+# Microsoft Developer Studio Project File - Name="mpglib" - Package Owner=<4>

+# Microsoft Developer Studio Generated Build File, Format Version 6.00

+# ** NICHT BEARBEITEN **

+

+# TARGTYPE "Win32 (x86) Static Library" 0x0104

+

+CFG=mpglib - Win32 Release

+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE

+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl

+!MESSAGE 

+!MESSAGE NMAKE /f "mpglib_vc6.mak".

+!MESSAGE 

+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben

+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:

+!MESSAGE 

+!MESSAGE NMAKE /f "mpglib_vc6.mak" CFG="mpglib - Win32 Release"

+!MESSAGE 

+!MESSAGE Für die Konfiguration stehen zur Auswahl:

+!MESSAGE 

+!MESSAGE "mpglib - Win32 Release" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE "mpglib - Win32 Debug" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE "mpglib - Win32 Release NASM" (basierend auf  "Win32 (x86) Static Library")

+!MESSAGE 

+

+# Begin Project

+# PROP AllowPerConfigDependencies 1

+# PROP Scc_ProjName ""

+# PROP Scc_LocalPath ""

+CPP=cl.exe

+RSC=rc.exe

+

+!IF  "$(CFG)" == "mpglib - Win32 Release"

+

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release"

+# PROP Intermediate_Dir "..\obj\Release\mpglib"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "HAVE_CONFIG_H" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /W3 /O2 /Ob2 /I "../libmp3lame" /I "../include" /I ".." /D "NDEBUG" /D "HAVE_MPGLIB" /D "_WINDOWS" /D "USE_LAYER_2" /D "WIN32" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo /out:"..\output\Release\mpglib-static.lib"

+

+!ELSEIF  "$(CFG)" == "mpglib - Win32 Debug"

+

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 1

+# PROP Output_Dir "..\output\Debug"

+# PROP Intermediate_Dir "..\obj\Debug\mpglib"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "HAVE_CONFIG_H" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c

+# ADD CPP /nologo /W3 /ZI /Od /I "../libmp3lame" /I "../include" /I ".." /D "_DEBUG" /D "_WINDOWS" /D "USE_LAYER_2" /D "HAVE_MPGLIB" /D "WIN32" /D "HAVE_CONFIG_H" /YX /FD /c

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo

+# ADD LIB32 /nologo /out:"..\output\Debug\mpglib-static.lib"

+

+!ELSEIF  "$(CFG)" == "mpglib - Win32 Release NASM"

+

+# PROP BASE Use_MFC 0

+# PROP BASE Use_Debug_Libraries 0

+# PROP BASE Output_Dir "mpglib___Win32_Release_NASM"

+# PROP BASE Intermediate_Dir "mpglib___Win32_Release_NASM"

+# PROP BASE Target_Dir ""

+# PROP Use_MFC 0

+# PROP Use_Debug_Libraries 0

+# PROP Output_Dir "..\output\Release_NASM"

+# PROP Intermediate_Dir "..\obj\Release_NASM\mpglib"

+# PROP Target_Dir ""

+LINK32=link.exe

+# ADD BASE CPP /nologo /W3 /O2 /Ob2 /I "../libmp3lame" /I "../include" /I ".." /D "NDEBUG" /D "HAVE_MPGLIB" /D "_WINDOWS" /D "USE_LAYER_2" /D "USE_LAYER_1" /D "WIN32" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT BASE CPP /YX

+# ADD CPP /nologo /W3 /O2 /Ob2 /I "../libmp3lame" /I "../include" /I ".." /D "NDEBUG" /D "HAVE_MPGLIB" /D "_WINDOWS" /D "USE_LAYER_2" /D "WIN32" /D "HAVE_CONFIG_H" /FD /c

+# SUBTRACT CPP /YX

+# ADD BASE RSC /l 0x409

+# ADD RSC /l 0x409

+BSC32=bscmake.exe

+# ADD BASE BSC32 /nologo

+# ADD BSC32 /nologo

+LIB32=link.exe -lib

+# ADD BASE LIB32 /nologo /out:"Release\mpglib.lib"

+# ADD LIB32 /nologo /out:"..\output\Release_NASM\mpglib-static.lib"

+

+!ENDIF 

+

+# Begin Target

+

+# Name "mpglib - Win32 Release"

+# Name "mpglib - Win32 Debug"

+# Name "mpglib - Win32 Release NASM"

+# Begin Group "Source"

+

+# PROP Default_Filter "c"

+# Begin Source File

+

+SOURCE=.\common.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\dct64_i386.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\decode_i386.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\interface.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\layer1.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\layer2.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\layer3.c

+# End Source File

+# Begin Source File

+

+SOURCE=.\tabinit.c

+# End Source File

+# End Group

+# Begin Group "Include"

+

+# PROP Default_Filter "h"

+# Begin Source File

+

+SOURCE=.\common.h

+# End Source File

+# Begin Source File

+

+SOURCE=..\configMS.h

+

+!IF  "$(CFG)" == "mpglib - Win32 Release"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ELSEIF  "$(CFG)" == "mpglib - Win32 Debug"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ELSEIF  "$(CFG)" == "mpglib - Win32 Release NASM"

+

+# Begin Custom Build - Performing Custom Build Step on $(InputName)

+InputPath=..\configMS.h

+

+"..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

+	copy ..\configMS.h ..\config.h

+

+# End Custom Build

+

+!ENDIF 

+

+# End Source File

+# Begin Source File

+

+SOURCE=.\dct64_i386.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\decode_i386.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\huffman.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\interface.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\layer1.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\layer2.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\layer3.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\mpg123.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\mpglib.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\tabinit.h

+# End Source File

+# End Group

+# End Target

+# End Project

diff --git a/mpglib/mpglib_vc8.vcproj b/mpglib/mpglib_vc8.vcproj
new file mode 100644
index 0000000..2abbe74
--- /dev/null
+++ b/mpglib/mpglib_vc8.vcproj
@@ -0,0 +1,566 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="mpglib_vc8"

+	ProjectGUID="{0AB48E5D-FAA5-402B-84D6-2F5166D90DD4}"

+	RootNamespace="mpglib_vc8"

+	Keyword="Win32Proj"

+	TargetFrameworkVersion="131072"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+		<Platform

+			Name="x64"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../libmp3lame;../include"

+				PreprocessorDefinitions="_DEBUG,HAVE_MPGLIB,_WINDOWS,USE_LAYER_2,WIN32,HAVE_CONFIG_H"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="4"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(ProjectDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../;../libmp3lame;../include"

+				PreprocessorDefinitions="NDEBUG,HAVE_MPGLIB,_WINDOWS,USE_LAYER_2,WIN32,HAVE_CONFIG_H"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug GTK|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="4"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../libmp3lame;../include"

+				PreprocessorDefinitions="_DEBUG,HAVE_MPGLIB,_WINDOWS,USE_LAYER_2,WIN32,HAVE_CONFIG_H,HAVE_GTK"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="4"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="4"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../libmp3lame;../include"

+				PreprocessorDefinitions="_DEBUG,HAVE_MPGLIB,_WINDOWS,USE_LAYER_2,WIN32,HAVE_CONFIG_H"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="4"

+			CharacterSet="1"

+			WholeProgramOptimization="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../;../libmp3lame;../include"

+				PreprocessorDefinitions="NDEBUG,HAVE_MPGLIB,_WINDOWS,USE_LAYER_2,WIN32,HAVE_CONFIG_H"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug GTK|x64"

+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"

+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"

+			ConfigurationType="4"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="../;../libmp3lame;../include"

+				PreprocessorDefinitions="_DEBUG,HAVE_MPGLIB,_WINDOWS,USE_LAYER_2,WIN32,HAVE_CONFIG_H"

+				MinimalRebuild="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="0"

+				UsePrecompiledHeader="0"

+				WarningLevel="3"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLibrarianTool"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source"

+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"

+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

+			>

+			<File

+				RelativePath=".\common.c"

+				>

+			</File>

+			<File

+				RelativePath=".\dct64_i386.c"

+				>

+			</File>

+			<File

+				RelativePath=".\decode_i386.c"

+				>

+			</File>

+			<File

+				RelativePath=".\interface.c"

+				>

+			</File>

+			<File

+				RelativePath=".\layer1.c"

+				>

+			</File>

+			<File

+				RelativePath=".\layer2.c"

+				>

+			</File>

+			<File

+				RelativePath=".\layer3.c"

+				>

+			</File>

+			<File

+				RelativePath=".\tabinit.c"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header"

+			Filter="h;hpp;hxx;hm;inl;inc;xsd"

+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"

+			>

+			<File

+				RelativePath=".\common.h"

+				>

+			</File>

+			<File

+				RelativePath="..\configMS.h"

+				>

+				<FileConfiguration

+					Name="Debug|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug GTK|Win32"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|x64"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|x64"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug GTK|x64"

+					>

+					<Tool

+						Name="VCCustomBuildTool"

+						Description="copy configMS.h -&gt; config.h"

+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"

+						Outputs="..\config.h"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath=".\dct64_i386.h"

+				>

+			</File>

+			<File

+				RelativePath=".\decode_i386.h"

+				>

+			</File>

+			<File

+				RelativePath=".\huffman.h"

+				>

+			</File>

+			<File

+				RelativePath=".\interface.h"

+				>

+			</File>

+			<File

+				RelativePath=".\l2tables.h"

+				>

+			</File>

+			<File

+				RelativePath=".\layer1.h"

+				>

+			</File>

+			<File

+				RelativePath=".\layer2.h"

+				>

+			</File>

+			<File

+				RelativePath=".\layer3.h"

+				>

+			</File>

+			<File

+				RelativePath=".\mpg123.h"

+				>

+			</File>

+			<File

+				RelativePath=".\tabinit.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Interface"

+			>

+			<File

+				RelativePath=".\mpglib.h"

+				>

+			</File>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/mpglib/tabinit.c b/mpglib/tabinit.c
new file mode 100644
index 0000000..bc07f8f
--- /dev/null
+++ b/mpglib/tabinit.c
@@ -0,0 +1,146 @@
+/*
+ * tabinit.c
+ *
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/* $Id: tabinit.c,v 1.12.10.2 2010/03/22 14:17:14 robert Exp $ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include "tabinit.h"
+#include "mpg123.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+real    decwin[512 + 32];
+static real cos64[16], cos32[8], cos16[4], cos8[2], cos4[1];
+real   *pnts[] = { cos64, cos32, cos16, cos8, cos4 };
+
+/* *INDENT-OFF* */
+
+static const double dewin[512] = {
+   0.000000000,-0.000015259,-0.000015259,-0.000015259,
+  -0.000015259,-0.000015259,-0.000015259,-0.000030518,
+  -0.000030518,-0.000030518,-0.000030518,-0.000045776,
+  -0.000045776,-0.000061035,-0.000061035,-0.000076294,
+  -0.000076294,-0.000091553,-0.000106812,-0.000106812,
+  -0.000122070,-0.000137329,-0.000152588,-0.000167847,
+  -0.000198364,-0.000213623,-0.000244141,-0.000259399,
+  -0.000289917,-0.000320435,-0.000366211,-0.000396729,
+  -0.000442505,-0.000473022,-0.000534058,-0.000579834,
+  -0.000625610,-0.000686646,-0.000747681,-0.000808716,
+  -0.000885010,-0.000961304,-0.001037598,-0.001113892,
+  -0.001205444,-0.001296997,-0.001388550,-0.001480103,
+  -0.001586914,-0.001693726,-0.001785278,-0.001907349,
+  -0.002014160,-0.002120972,-0.002243042,-0.002349854,
+  -0.002456665,-0.002578735,-0.002685547,-0.002792358,
+  -0.002899170,-0.002990723,-0.003082275,-0.003173828,
+  -0.003250122,-0.003326416,-0.003387451,-0.003433228,
+  -0.003463745,-0.003479004,-0.003479004,-0.003463745,
+  -0.003417969,-0.003372192,-0.003280640,-0.003173828,
+  -0.003051758,-0.002883911,-0.002700806,-0.002487183,
+  -0.002227783,-0.001937866,-0.001617432,-0.001266479,
+  -0.000869751,-0.000442505, 0.000030518, 0.000549316,
+   0.001098633, 0.001693726, 0.002334595, 0.003005981,
+   0.003723145, 0.004486084, 0.005294800, 0.006118774,
+   0.007003784, 0.007919312, 0.008865356, 0.009841919,
+   0.010848999, 0.011886597, 0.012939453, 0.014022827,
+   0.015121460, 0.016235352, 0.017349243, 0.018463135,
+   0.019577026, 0.020690918, 0.021789551, 0.022857666,
+   0.023910522, 0.024932861, 0.025909424, 0.026840210,
+   0.027725220, 0.028533936, 0.029281616, 0.029937744,
+   0.030532837, 0.031005859, 0.031387329, 0.031661987,
+   0.031814575, 0.031845093, 0.031738281, 0.031478882,
+   0.031082153, 0.030517578, 0.029785156, 0.028884888,
+   0.027801514, 0.026535034, 0.025085449, 0.023422241,
+   0.021575928, 0.019531250, 0.017257690, 0.014801025,
+   0.012115479, 0.009231567, 0.006134033, 0.002822876,
+  -0.000686646,-0.004394531,-0.008316040,-0.012420654,
+  -0.016708374,-0.021179199,-0.025817871,-0.030609131,
+  -0.035552979,-0.040634155,-0.045837402,-0.051132202,
+  -0.056533813,-0.061996460,-0.067520142,-0.073059082,
+  -0.078628540,-0.084182739,-0.089706421,-0.095169067,
+  -0.100540161,-0.105819702,-0.110946655,-0.115921021,
+  -0.120697021,-0.125259399,-0.129562378,-0.133590698,
+  -0.137298584,-0.140670776,-0.143676758,-0.146255493,
+  -0.148422241,-0.150115967,-0.151306152,-0.151962280,
+  -0.152069092,-0.151596069,-0.150497437,-0.148773193,
+  -0.146362305,-0.143264771,-0.139450073,-0.134887695,
+  -0.129577637,-0.123474121,-0.116577148,-0.108856201,
+  -0.100311279,-0.090927124,-0.080688477,-0.069595337,
+  -0.057617187,-0.044784546,-0.031082153,-0.016510010,
+  -0.001068115, 0.015228271, 0.032379150, 0.050354004,
+   0.069168091, 0.088775635, 0.109161377, 0.130310059,
+   0.152206421, 0.174789429, 0.198059082, 0.221984863,
+   0.246505737, 0.271591187, 0.297210693, 0.323318481,
+   0.349868774, 0.376800537, 0.404083252, 0.431655884,
+   0.459472656, 0.487472534, 0.515609741, 0.543823242,
+   0.572036743, 0.600219727, 0.628295898, 0.656219482,
+   0.683914185, 0.711318970, 0.738372803, 0.765029907,
+   0.791213989, 0.816864014, 0.841949463, 0.866363525,
+   0.890090942, 0.913055420, 0.935195923, 0.956481934,
+   0.976852417, 0.996246338, 1.014617920, 1.031936646,
+   1.048156738, 1.063217163, 1.077117920, 1.089782715,
+   1.101211548, 1.111373901, 1.120223999, 1.127746582,
+   1.133926392, 1.138763428, 1.142211914, 1.144287109,
+   1.144989014
+};
+/* *INDENT-ON* */
+
+void
+make_decode_tables(long scaleval)
+{
+    int     i, j, k, kr, divv;
+    real   *table, *costab;
+
+
+    for (i = 0; i < 5; i++) {
+        kr = 0x10 >> i;
+        divv = 0x40 >> i;
+        costab = pnts[i];
+        for (k = 0; k < kr; k++)
+            costab[k] = (real) (1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv)));
+    }
+
+    table = decwin;
+    scaleval = -scaleval;
+    for (i = 0, j = 0; i < 256; i++, j++, table += 32) {
+        if (table < decwin + 512 + 16)
+            table[16] = table[0] = (real) (dewin[j] * scaleval);
+        if (i % 32 == 31)
+            table -= 1023;
+        if (i % 64 == 63)
+            scaleval = -scaleval;
+    }
+
+    for ( /* i=256 */ ; i < 512; i++, j--, table += 32) {
+        if (table < decwin + 512 + 16)
+            table[16] = table[0] = (real) (dewin[j] * scaleval);
+        if (i % 32 == 31)
+            table -= 1023;
+        if (i % 64 == 63)
+            scaleval = -scaleval;
+    }
+}
diff --git a/mpglib/tabinit.h b/mpglib/tabinit.h
new file mode 100644
index 0000000..76f4c42
--- /dev/null
+++ b/mpglib/tabinit.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 1999-2010 The L.A.M.E. project
+ *
+ * Initially written by Michael Hipp, see also AUTHORS and README.
+ *  
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MPGLIB_TABINIT_H_INCLUDED
+#define MPGLIB_TABINIT_H_INCLUDED
+
+#include "mpg123.h"
+
+extern real decwin[512 + 32];
+extern real *pnts[5];
+
+void    make_decode_tables(long scale);
+
+#endif
diff --git a/test/CBRABR.op b/test/CBRABR.op
new file mode 100644
index 0000000..909c512
--- /dev/null
+++ b/test/CBRABR.op
@@ -0,0 +1,118 @@
+-b 8 -q 0
+-b 8 -q 1
+-b 8 -q 2
+-b 8 -q 3
+-b 8 -q 4
+-b 8 -q 5
+-b 8 -q 6
+-b 8 -q 7
+-b 8 -q 8
+-b 8 -q 9
+-b 8 -m m -q 0
+-b 8 -m m -q 1
+-b 8 -m m -q 2
+-b 8 -m m -q 3
+-b 8 -m m -q 4
+-b 8 -m m -q 5
+-b 8 -m m -q 6
+-b 8 -m m -q 7
+-b 8 -m m -q 8
+-b 8 -m m -q 9
+-b 8 -m s -q 0
+-b 8 -m s -q 1
+-b 8 -m s -q 2
+-b 8 -m s -q 3
+-b 8 -m s -q 4
+-b 8 -m s -q 5
+-b 8 -m s -q 6
+-b 8 -m s -q 7
+-b 8 -m s -q 8
+-b 8 -m s -q 9
+--abr 9
+-b 16
+--abr 20
+-b 24
+--abr 28
+-b 32
+--abr 36
+-b 40
+--abr 48
+-b 56
+--abr 60
+-b 64
+--abr 72
+-b 80
+--abr 88
+-b 96
+--abr 108 -q 0
+--abr 108 -q 1
+--abr 108 -q 2
+--abr 108 -q 3
+--abr 108 -q 4
+--abr 108 -q 5
+--abr 108 -q 6
+--abr 108 -q 7
+--abr 108 -q 8
+--abr 108 -q 9
+--abr 108 -m m -q 0
+--abr 108 -m m -q 1
+--abr 108 -m m -q 2
+--abr 108 -m m -q 3
+--abr 108 -m m -q 4
+--abr 108 -m m -q 5
+--abr 108 -m m -q 6
+--abr 108 -m m -q 7
+--abr 108 -m m -q 8
+--abr 108 -m m -q 9
+--abr 108 -m s -q 0
+--abr 108 -m s -q 1
+--abr 108 -m s -q 2
+--abr 108 -m s -q 3
+--abr 108 -m s -q 4
+--abr 108 -m s -q 5
+--abr 108 -m s -q 6
+--abr 108 -m s -q 7
+--abr 108 -m s -q 8
+--abr 108 -m s -q 9
+-b 112
+--abr 120
+-b 128
+--abr 140
+-b 160
+--abr 180
+-b 192
+--abr 210
+-b 224
+--abr 235
+-b 256
+--abr 319
+-b 320 -q 0
+-b 320 -q 1
+-b 320 -q 2
+-b 320 -q 3
+-b 320 -q 4
+-b 320 -q 5
+-b 320 -q 6
+-b 320 -q 7
+-b 320 -q 8
+-b 320 -q 9
+-b 320 -m m -q 0
+-b 320 -m m -q 1
+-b 320 -m m -q 2
+-b 320 -m m -q 3
+-b 320 -m m -q 4
+-b 320 -m m -q 5
+-b 320 -m m -q 6
+-b 320 -m m -q 7
+-b 320 -m m -q 8
+-b 320 -m m -q 9
+-b 320 -m s -q 0
+-b 320 -m s -q 1
+-b 320 -m s -q 2
+-b 320 -m s -q 3
+-b 320 -m s -q 4
+-b 320 -m s -q 5
+-b 320 -m s -q 6
+-b 320 -m s -q 7
+-b 320 -m s -q 8
+-b 320 -m s -q 9
diff --git a/test/VBR.op b/test/VBR.op
new file mode 100644
index 0000000..65fc9ae
--- /dev/null
+++ b/test/VBR.op
@@ -0,0 +1,196 @@
+-V9 -q0
+-V9 -q1
+-V9 -q2
+-V9 -q3
+-V9 -q4
+-V9 -q5
+-V9 -q6
+-V9 -q7
+-V9 -q8
+-V9 -q9
+-V9 -m m -q0
+-V9 -m m -q1
+-V9 -m m -q2
+-V9 -m m -q3
+-V9 -m m -q4
+-V9 -m m -q5
+-V9 -m m -q6
+-V9 -m m -q7
+-V9 -m m -q8
+-V9 -m m -q9
+-V9 -m s -q0
+-V9 -m s -q1
+-V9 -m s -q2
+-V9 -m s -q3
+-V9 -m s -q4
+-V9 -m s -q5
+-V9 -m s -q6
+-V9 -m s -q7
+-V9 -m s -q8
+-V9 -m s -q9
+-V8
+-V7
+-V6
+-V5
+-V4 -q0
+-V4 -q1
+-V4 -q2
+-V4 -q3
+-V4 -q4
+-V4 -q5
+-V4 -q6
+-V4 -q7
+-V4 -q8
+-V4 -q9
+-V4 -m m -q0
+-V4 -m m -q1
+-V4 -m m -q2
+-V4 -m m -q3
+-V4 -m m -q4
+-V4 -m m -q5
+-V4 -m m -q6
+-V4 -m m -q7
+-V4 -m m -q8
+-V4 -m m -q9
+-V4 -m s -q0
+-V4 -m s -q1
+-V4 -m s -q2
+-V4 -m s -q3
+-V4 -m s -q4
+-V4 -m s -q5
+-V4 -m s -q6
+-V4 -m s -q7
+-V4 -m s -q8
+-V4 -m s -q9
+-V3
+-V2
+-V1
+-V0 -q0
+-V0 -q1
+-V0 -q2
+-V0 -q3
+-V0 -q4
+-V0 -q5
+-V0 -q6
+-V0 -q7
+-V0 -q8
+-V0 -q9
+-V0 -m m -q0
+-V0 -m m -q1
+-V0 -m m -q2
+-V0 -m m -q3
+-V0 -m m -q4
+-V0 -m m -q5
+-V0 -m m -q6
+-V0 -m m -q7
+-V0 -m m -q8
+-V0 -m m -q9
+-V0 -m s -q0
+-V0 -m s -q1
+-V0 -m s -q2
+-V0 -m s -q3
+-V0 -m s -q4
+-V0 -m s -q5
+-V0 -m s -q6
+-V0 -m s -q7
+-V0 -m s -q8
+-V0 -m s -q9
+--vbr-new -V9 -q0
+--vbr-new -V9 -q1
+--vbr-new -V9 -q2
+--vbr-new -V9 -q3
+--vbr-new -V9 -q4
+--vbr-new -V9 -q5
+--vbr-new -V9 -q6
+--vbr-new -V9 -q7
+--vbr-new -V9 -q8
+--vbr-new -V9 -q9
+--vbr-new -V9 -m m -q0
+--vbr-new -V9 -m m -q1
+--vbr-new -V9 -m m -q2
+--vbr-new -V9 -m m -q3
+--vbr-new -V9 -m m -q4
+--vbr-new -V9 -m m -q5
+--vbr-new -V9 -m m -q6
+--vbr-new -V9 -m m -q7
+--vbr-new -V9 -m m -q8
+--vbr-new -V9 -m m -q9
+--vbr-new -V9 -m s -q0
+--vbr-new -V9 -m s -q1
+--vbr-new -V9 -m s -q2
+--vbr-new -V9 -m s -q3
+--vbr-new -V9 -m s -q4
+--vbr-new -V9 -m s -q5
+--vbr-new -V9 -m s -q6
+--vbr-new -V9 -m s -q7
+--vbr-new -V9 -m s -q8
+--vbr-new -V9 -m s -q9
+--vbr-new -V8
+--vbr-new -V7
+--vbr-new -V6
+--vbr-new -V5
+--vbr-new -V4 -q0
+--vbr-new -V4 -q1
+--vbr-new -V4 -q2
+--vbr-new -V4 -q3
+--vbr-new -V4 -q4
+--vbr-new -V4 -q5
+--vbr-new -V4 -q6
+--vbr-new -V4 -q7
+--vbr-new -V4 -q8
+--vbr-new -V4 -q9
+--vbr-new -V4 -m m -q0
+--vbr-new -V4 -m m -q1
+--vbr-new -V4 -m m -q2
+--vbr-new -V4 -m m -q3
+--vbr-new -V4 -m m -q4
+--vbr-new -V4 -m m -q5
+--vbr-new -V4 -m m -q6
+--vbr-new -V4 -m m -q7
+--vbr-new -V4 -m m -q8
+--vbr-new -V4 -m m -q9
+--vbr-new -V4 -m s -q0
+--vbr-new -V4 -m s -q1
+--vbr-new -V4 -m s -q2
+--vbr-new -V4 -m s -q3
+--vbr-new -V4 -m s -q4
+--vbr-new -V4 -m s -q5
+--vbr-new -V4 -m s -q6
+--vbr-new -V4 -m s -q7
+--vbr-new -V4 -m s -q8
+--vbr-new -V4 -m s -q9
+--vbr-new -V3
+--vbr-new -V2
+--vbr-new -V1
+--vbr-new -V0 -q0
+--vbr-new -V0 -q1
+--vbr-new -V0 -q2
+--vbr-new -V0 -q3
+--vbr-new -V0 -q4
+--vbr-new -V0 -q5
+--vbr-new -V0 -q6
+--vbr-new -V0 -q7
+--vbr-new -V0 -q8
+--vbr-new -V0 -q9
+--vbr-new -V0 -m m -q0
+--vbr-new -V0 -m m -q1
+--vbr-new -V0 -m m -q2
+--vbr-new -V0 -m m -q3
+--vbr-new -V0 -m m -q4
+--vbr-new -V0 -m m -q5
+--vbr-new -V0 -m m -q6
+--vbr-new -V0 -m m -q7
+--vbr-new -V0 -m m -q8
+--vbr-new -V0 -m m -q9
+--vbr-new -V0 -m s -q0
+--vbr-new -V0 -m s -q1
+--vbr-new -V0 -m s -q2
+--vbr-new -V0 -m s -q3
+--vbr-new -V0 -m s -q4
+--vbr-new -V0 -m s -q5
+--vbr-new -V0 -m s -q6
+--vbr-new -V0 -m s -q7
+--vbr-new -V0 -m s -q8
+--vbr-new -V0 -m s -q9
+
+
diff --git a/test/cvscheck.sh b/test/cvscheck.sh
new file mode 100644
index 0000000..fe7203b
--- /dev/null
+++ b/test/cvscheck.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+#
+# checkout lame
+# run python scripts
+# mail output
+#
+
+CVS_RSH=/home/mt/bin/sshcvs
+LAME_DIR=/home/mt/mp3/lame_cvscheck
+TESTCASE=/home/mt/mp3/test/castanets.wav
+export OUTPUT=/tmp/cvscheck.out
+export TO="lame-cvs@lists.sourceforge.net"
+
+cd ${LAME_DIR}
+#cvs -z3 -dmarkt@cvs.lame.sourceforge.net:/cvsroot/lame co -d lame_cvscheck lame
+cvs update -P -d
+if [ $? != 0 ]; then
+    echo "Error running CVS update. cvscheck script exiting."
+    exit 1
+fi
+
+if [ -f ${OUTPUT} ]; then
+    mv -f ${OUTPUT} ${OUTPUT}.old
+fi
+rm -f frontend/lame
+rm -f config.cache
+./configure --enable-debug
+make clean
+make
+
+if [ $? != 0 ]; then
+    echo "Error compiling code..." > ${OUTPUT}
+else
+    test/lametest.py test/CBRABR.op ${TESTCASE} frontend/lame > ${OUTPUT}
+fi
+
+# check if there are failed tests
+if grep >/dev/null 2>&1 "Number of tests which failed:  0" ${OUTPUT} ; then
+    echo "No failed tests."
+else
+    # yes, failed tests, send output
+
+    if diff >/dev/null 2>&1 -bBiq ${OUTPUT}.old ${OUTPUT} ; then
+        export MSG='No change since last failed test(s).'
+    else
+        export MSG='Another change since last failed test(s)!'
+        cat ${OUTPUT}; echo "${MSG}"
+    fi
+
+    ( cat ${OUTPUT}; echo "${MSG}" ) | mail -s "Automated lame test" ${TO}
+fi
+
diff --git a/test/lametest.py b/test/lametest.py
new file mode 100755
index 0000000..11152e7
--- /dev/null
+++ b/test/lametest.py
@@ -0,0 +1,225 @@
+#!/usr/bin/env python
+from string import *
+import os, commands, getopt, sys
+
+
+def Usage(mesg):
+    print mesg + os.linesep
+
+    print "Usage: " + os.linesep
+
+    print "Mode 1. Compare output of 'lame1' and 'lame2':"
+    print "./lametest.py  [options] options_file  input.wav lame1 lame2" + os.linesep
+
+    print "Mode 2. Compare output of lame1 with reference solutions:"
+    print "./lametest.py [options] options_file input.wav lame1" + os.linesep
+
+    print "Mode 3. Generate reference solutions using lame1:"
+    print "./lametest.py -m options_file input.wav lame1" + os.linesep
+
+    print "options: "	
+    print "   -w   convert mp3's to wav's before comparison"
+
+    sys.exit(0)
+
+
+
+##################################################################
+# compare two files, return # bytes which differ and the
+# number of bytes in larger file 
+##################################################################
+def fdiff(name1,name2):
+    cmd = "cmp -l "+name1 + " " + name2 + " | wc -l"
+    # XXX either
+    #    use a combination of os.popen + read
+    # or
+    #    write owen cmp+wc function
+    # to replace commands.getoutput
+    out = commands.getoutput(cmd)
+    out = split(out,"\n")
+    out=out[-1]
+    if (-1==find(out,"No")):
+        diff = atof(out)
+
+	status = os.access(name1, os.R_OK)
+	if 1 != status:
+	    size1=0
+	else:
+            size1 = os.path.getsize(name1)
+        size2 = os.path.getsize(name2)
+        diff = diff + abs(size1-size2)
+        size = max(size1,size2) 
+    else:
+        diff = -1
+        size = 0
+    return (diff,size)
+
+################################################################## 
+# compare two files, return # bytes which differ and the
+# number of bytes in larger file 
+##################################################################
+def compare(name1,name2,decode):
+    if (decode):
+        print "converting mp3 to wav for comparison..."
+        # XXX shouldn't we use lame1 instead of a hardcoded lame?
+        os.system("lame --quiet --mp3input --decode " + name1)
+        os.system("lame --quiet --mp3input --decode " + name2)
+        name1 = name1 + ".wav"
+        name2 = name2 + ".wav"
+
+    rcode = 0
+    diff,size=fdiff(name1,name2)
+    if (diff==0):
+        print "output identical:  diff=%i  total=%i" % (diff,size)
+        rcode = 1
+    elif (diff>0):
+	print "output different: diff=%i  total=%i  %2.0f%%" % \
+        (diff,size,100*float(diff)/size)
+    else:
+	print "Error comparing files:"
+        print "File 1: " + name1
+        print "File 2: " + name2
+
+    return rcode
+
+
+
+
+
+
+################################################################## 
+# main program
+##################################################################
+try:
+    optlist, args = getopt.getopt(sys.argv[1:], 'wm')
+except getopt.error, val:
+    Usage('ERROR: ' + val)
+
+decode=0
+lame2="none"
+for opt in optlist:
+    if opt[0] == '-w':
+        decode=1
+    elif opt[0] == '-m':
+        lame2="makeref"
+        print os.linesep + "Generating reference output"
+
+
+if len(args) < 3:
+    Usage("Not enough arguments.")
+if len(args) > 4:
+    Usage("Too many arguments.")
+
+if (lame2=="makeref"):
+    if len(args) != 3:
+    	Usage("Too many arguments for -r/-m mode.")
+else:
+    if len(args) ==3:	
+        lame2="ref"
+
+# populate variables from args and normalize & expand path
+if len(args) >=3:
+    options_file = os.path.normpath(os.path.expanduser(args[0]))
+    input_file = os.path.normpath(os.path.expanduser(args[1]))
+    lame1 = os.path.normpath(os.path.expanduser(args[2]))
+if len(args) >=4:
+    lame2 = os.path.normpath(os.path.expanduser(args[3]))
+
+# check readability of options_file
+status = os.access(options_file, os.R_OK)
+if 1 != status:
+    Usage(options_file + " not readable")
+
+# check readability of input_file
+status = os.access(input_file, os.R_OK)
+if 1 != status:
+    Usage(input_file + " not readable")
+
+
+# generate searchlist of directories
+path = split(os.environ['PATH'], os.pathsep)
+path.append(os.curdir)
+
+# init indicator vars
+lame1_ok = 0
+lame2_ok = 0
+
+# check for executable lame1
+for x in path:
+    status = os.access(os.path.join(x, lame1), os.X_OK)
+    if 1 == status:
+        lame1_ok = 1
+        break
+if 1 != lame1_ok:
+    Usage(lame1 + " is not executable")
+
+if not (lame2=="ref" or lame2=="makeref"):
+    # check for executable lame2
+    for x in path:
+        status = os.access(os.path.join(x, lame2), os.X_OK)
+        if 1 == status:
+            lame2_ok = 1 
+            break
+    if 1 != lame2_ok:
+        Usage(lame2 + " is not executable")
+
+
+tmp = split(options_file, os.sep)
+tmp = tmp[-1]
+basename = replace(input_file,".wav","")
+basename = basename + "." + tmp
+
+
+num_ok=0
+n=0
+foptions=open(options_file)
+line = rstrip(foptions.readline())
+while line:
+    n = n+1
+    name1 = basename + "." + str(n) + ".mp3"
+    name2 = basename + "." + str(n) + "ref.mp3"
+
+    print      # empty line
+
+    if (lame2=='ref'):
+        cmd = "rm -f "+name1
+        os.system(cmd)
+        cmd = lame1 + " --quiet " + line + " " + input_file + " " + name1
+        print "executable:      ",lame1
+        print "options:         ",line
+        print "input:           ",input_file 
+        print "reference output:",name2
+        print cmd
+        os.system(cmd)
+        num_ok = num_ok+compare(name1,name2,decode)
+    elif (lame2=='makeref'):
+        cmd = "rm -f "+name2
+        os.system(cmd)
+        print "executable: ",lame1
+        print "options:    ",line
+        print "input:      ",input_file 
+        print "output:     ",name2
+        cmd = lame1 + " --quiet " + line + " " + input_file + " " + name2
+        os.system(cmd)
+    else:
+        cmd = "rm -f "+name1
+        os.system(cmd)
+        cmd = "rm -f "+name2
+        os.system(cmd)
+        print "executable:  ",lame1
+        print "executable2: ",lame2
+        print "options:     ",line
+        print "input:       ",input_file
+        cmd1 = lame1 + " --quiet " + line + " " + input_file + " " + name1
+        cmd2 = lame2 + " --quiet " + line + " " + input_file + " " + name2
+        os.system(cmd1)
+        os.system(cmd2)
+	num_ok = num_ok + compare(name1,name2,decode)
+
+    line = rstrip(foptions.readline())
+
+foptions.close()
+
+if lame2 != 'makeref':
+    print os.linesep + "Number of tests which passed: ",num_ok
+    print "Number of tests which failed: ",n-num_ok
diff --git a/test/misc.op b/test/misc.op
new file mode 100644
index 0000000..f108ac5
--- /dev/null
+++ b/test/misc.op
@@ -0,0 +1,16 @@
+--athlower 10
+--abr 160 -b 128 -B 192 -F
+-V3 -b 128 -B 192 -F
+--freeformat -b 33
+--freeformat -b 330
+-k
+--lowpass 12
+--noath
+--noasm mmx --noasm 3dnow --noasm sse
+--noshort
+--notemp
+--nores
+-p
+--resample 48000
+--scale 0.8
+-t
diff --git a/test/nores.op b/test/nores.op
new file mode 100644
index 0000000..41d418a
--- /dev/null
+++ b/test/nores.op
@@ -0,0 +1,4 @@
+-h --nores
+--nores
+
+
diff --git a/test/shortCBRABR.op b/test/shortCBRABR.op
new file mode 100644
index 0000000..6fc577b
--- /dev/null
+++ b/test/shortCBRABR.op
@@ -0,0 +1,18 @@
+-b 8
+-b 8 -f
+-b 8 -h
+-b 8 -h -m m
+--abr 9
+-b 56
+--abr 60
+--abr 128 
+--abr 128 -f
+--abr 128 -h
+--abr 128 -h -m m
+-b 128
+--abr 319
+-b 320 
+-b 320 -f
+-b 320 -h
+-b 320 -h -m m 
+-b 320 -h -m s
diff --git a/test/shortVBR.op b/test/shortVBR.op
new file mode 100644
index 0000000..32cee9d
--- /dev/null
+++ b/test/shortVBR.op
@@ -0,0 +1,26 @@
+-V9
+-V9 -f
+-V9 -h
+-V9 -h -m m
+-V4
+-V4 -f
+-V4 -h
+-V4 -h -m m
+-V0
+-V0 -f
+-V0 -h
+-V0 -h -m m
+-V0 -h -m s
+--vbr-new -V9
+--vbr-new -V9 -f
+--vbr-new -V9 -h
+--vbr-new -V9 -h -m m
+--vbr-new -V4
+--vbr-new -V4 -f
+--vbr-new -V4 -h
+--vbr-new -V4 -h -m m
+--vbr-new -V0
+--vbr-new -V0 -f
+--vbr-new -V0 -h
+--vbr-new -V0 -h -m m
+--vbr-new -V0 -h -m s
diff --git a/testcase.mp3 b/testcase.mp3
new file mode 100644
index 0000000..f982139
--- /dev/null
+++ b/testcase.mp3
Binary files differ
diff --git a/testcase.wav b/testcase.wav
new file mode 100644
index 0000000..7c835f7
--- /dev/null
+++ b/testcase.wav
Binary files differ
diff --git a/vc_solution/Makefile.am b/vc_solution/Makefile.am
new file mode 100644
index 0000000..0363dd6
--- /dev/null
+++ b/vc_solution/Makefile.am
@@ -0,0 +1,8 @@
+## $Id: Makefile.am,v 1.1.2.2 2010/02/26 01:56:52 robert Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = *.sln \
+	*.vcproj \
+	*.vsprops \
+	*.rules
diff --git a/vc_solution/Makefile.in b/vc_solution/Makefile.in
new file mode 100644
index 0000000..df69d70
--- /dev/null
+++ b/vc_solution/Makefile.in
@@ -0,0 +1,366 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.am.global
+subdir = vc_solution
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+HAVE_NASM_FALSE = @HAVE_NASM_FALSE@
+HAVE_NASM_TRUE = @HAVE_NASM_TRUE@
+INCLUDES = @INCLUDES@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LIB_WITH_DECODER_FALSE = @LIB_WITH_DECODER_FALSE@
+LIB_WITH_DECODER_TRUE = @LIB_WITH_DECODER_TRUE@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_BRHIST_FALSE = @WITH_BRHIST_FALSE@
+WITH_BRHIST_TRUE = @WITH_BRHIST_TRUE@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+WITH_VECTOR_FALSE = @WITH_VECTOR_FALSE@
+WITH_VECTOR_TRUE = @WITH_VECTOR_TRUE@
+WITH_XMM_FALSE = @WITH_XMM_FALSE@
+WITH_XMM_TRUE = @WITH_XMM_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = *.sln \
+	*.vcproj \
+	*.vsprops \
+	*.rules
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  vc_solution/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  vc_solution/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/..
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vc_solution/vc9_lame.sln b/vc_solution/vc9_lame.sln
new file mode 100644
index 0000000..d76de9f
--- /dev/null
+++ b/vc_solution/vc9_lame.sln
@@ -0,0 +1,67 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MP3x", "vc9_lame_mp3x.vcproj", "{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{20536101-3B0E-43EF-94F9-080D595DAC57} = {20536101-3B0E-43EF-94F9-080D595DAC57}
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8} = {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38} = {EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lame", "vc9_lame_lame.vcproj", "{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}"
+	ProjectSection(ProjectDependencies) = postProject
+		{20536101-3B0E-43EF-94F9-080D595DAC57} = {20536101-3B0E-43EF-94F9-080D595DAC57}
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8} = {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp3lame", "vc9_libmp3lame.vcproj", "{20536101-3B0E-43EF-94F9-080D595DAC57}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8} = {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp3lameDLL", "vc9_libmp3lame_dll.vcproj", "{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpglib", "vc9_mpglib.vcproj", "{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+		ReleaseNASM|Win32 = ReleaseNASM|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}.Debug|Win32.Build.0 = Debug|Win32
+		{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}.Release|Win32.ActiveCfg = Release|Win32
+		{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}.Release|Win32.Build.0 = Release|Win32
+		{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}.ReleaseNASM|Win32.ActiveCfg = Release|Win32
+		{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}.ReleaseNASM|Win32.Build.0 = Release|Win32
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Debug|Win32.Build.0 = Debug|Win32
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Release|Win32.ActiveCfg = Release|Win32
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Release|Win32.Build.0 = Release|Win32
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.ReleaseNASM|Win32.ActiveCfg = ReleaseNASM|Win32
+		{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.ReleaseNASM|Win32.Build.0 = ReleaseNASM|Win32
+		{20536101-3B0E-43EF-94F9-080D595DAC57}.Debug|Win32.ActiveCfg = Debug|Win32
+		{20536101-3B0E-43EF-94F9-080D595DAC57}.Debug|Win32.Build.0 = Debug|Win32
+		{20536101-3B0E-43EF-94F9-080D595DAC57}.Release|Win32.ActiveCfg = Release|Win32
+		{20536101-3B0E-43EF-94F9-080D595DAC57}.Release|Win32.Build.0 = Release|Win32
+		{20536101-3B0E-43EF-94F9-080D595DAC57}.ReleaseNASM|Win32.ActiveCfg = ReleaseNASM|Win32
+		{20536101-3B0E-43EF-94F9-080D595DAC57}.ReleaseNASM|Win32.Build.0 = ReleaseNASM|Win32
+		{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Debug|Win32.ActiveCfg = Debug|Win32
+		{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Debug|Win32.Build.0 = Debug|Win32
+		{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Release|Win32.ActiveCfg = Release|Win32
+		{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Release|Win32.Build.0 = Release|Win32
+		{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.ReleaseNASM|Win32.ActiveCfg = ReleaseNASM|Win32
+		{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.ReleaseNASM|Win32.Build.0 = ReleaseNASM|Win32
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Debug|Win32.Build.0 = Debug|Win32
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Release|Win32.ActiveCfg = Release|Win32
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Release|Win32.Build.0 = Release|Win32
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.ReleaseNASM|Win32.ActiveCfg = ReleaseNASM|Win32
+		{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.ReleaseNASM|Win32.Build.0 = ReleaseNASM|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/vc_solution/vc9_lame_acm.vcproj b/vc_solution/vc9_lame_acm.vcproj
new file mode 100644
index 0000000..9c4608b
--- /dev/null
+++ b/vc_solution/vc9_lame_acm.vcproj
@@ -0,0 +1,433 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="ACM"
+	ProjectGUID="{FC3D65E7-B7CB-406E-B6C9-0B26E30FE7F4}"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\..\output\Release/lameACM.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				AdditionalIncludeDirectories="../include,../mpglib,../ACM,../ACM/ddk"
+				PreprocessorDefinitions="NDEBUG;_BLADEDLL;_WINDOWS;WIN32;LAME_ACM"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				StructMemberAlignment="2"
+				TreatWChar_tAsBuiltInType="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalDependencies="libmp3lame.lib url.lib winmm.lib"
+				OutputFile="..\output\Release\lameACM.acm"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				IgnoreAllDefaultLibraries="false"
+				ModuleDefinitionFile="..\ACM\lameACM.def"
+				SubSystem="2"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				Description="ACM config files"
+				CommandLine="copy ..\ACM\lameacm.inf $(TargetDir)*.*&#x0D;&#x0A;copy ..\ACM\lame_acm.xml $(TargetDir)*.*&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName="..\output\Debug\lameACM.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../include,../mpglib,../ACM,../ACM/ddk"
+				PreprocessorDefinitions="_DEBUG;_BLADEDLL;_WINDOWS;WIN32;LAME_ACM"
+				StringPooling="true"
+				RuntimeLibrary="3"
+				StructMemberAlignment="2"
+				TreatWChar_tAsBuiltInType="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalDependencies="libmp3lame.lib url.lib winmm.lib"
+				OutputFile="..\output\Debug\lameACM.acm"
+				AdditionalLibraryDirectories=""
+				IgnoreAllDefaultLibraries="false"
+				ModuleDefinitionFile="..\ACM\lameACM.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				Description="ACM config files"
+				CommandLine="copy ..\ACM\lameacm.inf $(TargetDir)*.*&#x0D;&#x0A;copy ..\ACM\lame_acm.xml $(TargetDir)*.*&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source"
+			Filter="c;cpp"
+			>
+			<File
+				RelativePath="..\ACM\ACM.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ACM\ACMStream.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ACM\AEncodeProperties.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ACM\DecodeStream.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ACM\lameACM.def"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ACM\main.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Include"
+			Filter="h"
+			>
+			<File
+				RelativePath="..\ACM\ACM.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ACM\ACMStream.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ACM\adebug.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ACM\AEncodeProperties.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ACM\DecodeStream.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource"
+			Filter="rc"
+			>
+			<File
+				RelativePath="..\ACM\acm.rc"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ACM\lame.ico"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Install"
+			Filter="inf;acm"
+			>
+			<File
+				RelativePath="..\ACM\LameACM.inf"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\ACM\readme.txt"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\ACM\TODO"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_acm_adbg.vcproj b/vc_solution/vc9_lame_acm_adbg.vcproj
new file mode 100644
index 0000000..0f6b75c
--- /dev/null
+++ b/vc_solution/vc9_lame_acm_adbg.vcproj
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="ACM ADbg"
+	ProjectGUID="{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				StringPooling="true"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1036"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(IntDir)\$(ProjectName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1036"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(IntDir)\$(ProjectName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Sources"
+			Filter="cpp"
+			>
+			<File
+				RelativePath="..\ACM\ADbg\ADbg.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Headers"
+			Filter="h"
+			>
+			<File
+				RelativePath="..\ACM\ADbg\ADbg.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_acm_tinyxml.vcproj b/vc_solution/vc9_lame_acm_tinyxml.vcproj
new file mode 100644
index 0000000..3072ddd
--- /dev/null
+++ b/vc_solution/vc9_lame_acm_tinyxml.vcproj
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="ACM tinyxml"
+	ProjectGUID="{30219289-3B7F-4E02-BC34-C1DBD08CD848}"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1036"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(IntDir)\$(ProjectName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				StringPooling="true"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1036"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(IntDir)\$(ProjectName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath="..\ACM\tinyxml\changes.txt"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\ACM\tinyxml\readme.txt"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\ACM\tinyxml\tinyxml.cpp"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\ACM\tinyxml\tinyxml.h"
+			>
+		</File>
+		<File
+			RelativePath="..\ACM\tinyxml\tinyxmlerror.cpp"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\ACM\tinyxml\tinyxmlparser.cpp"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_clients.sln b/vc_solution/vc9_lame_clients.sln
new file mode 100644
index 0000000..d063a95
--- /dev/null
+++ b/vc_solution/vc9_lame_clients.sln
@@ -0,0 +1,54 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ADbg", "vc9_lame_acm_adbg.vcproj", "{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "vc9_lame_acm_tinyxml.vcproj", "{30219289-3B7F-4E02-BC34-C1DBD08CD848}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lameACM", "vc9_lame_acm.vcproj", "{FC3D65E7-B7CB-406E-B6C9-0B26E30FE7F4}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA} = {0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}
+		{30219289-3B7F-4E02-BC34-C1DBD08CD848} = {30219289-3B7F-4E02-BC34-C1DBD08CD848}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAME DShow", "vc9_lame_dshow.vcproj", "{6D348A4E-8B40-4FB0-BB57-C982D51FFA01}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LameMp3EncDll", "vc9_lame_dll.vcproj", "{0E4820D3-DBE3-477A-910B-7C020D6066D1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example", "vc9_lame_dll_example.vcproj", "{D169F06E-6607-4A9F-A075-2335717B9AB5}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}.Debug|Win32.Build.0 = Debug|Win32
+		{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}.Release|Win32.ActiveCfg = Release|Win32
+		{0D7CAB1B-AE57-4BA1-BDBF-D7391AAA81AA}.Release|Win32.Build.0 = Release|Win32
+		{6D348A4E-8B40-4FB0-BB57-C982D51FFA01}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6D348A4E-8B40-4FB0-BB57-C982D51FFA01}.Debug|Win32.Build.0 = Debug|Win32
+		{6D348A4E-8B40-4FB0-BB57-C982D51FFA01}.Release|Win32.ActiveCfg = Release|Win32
+		{6D348A4E-8B40-4FB0-BB57-C982D51FFA01}.Release|Win32.Build.0 = Release|Win32
+		{0E4820D3-DBE3-477A-910B-7C020D6066D1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0E4820D3-DBE3-477A-910B-7C020D6066D1}.Debug|Win32.Build.0 = Debug|Win32
+		{0E4820D3-DBE3-477A-910B-7C020D6066D1}.Release|Win32.ActiveCfg = Release|Win32
+		{0E4820D3-DBE3-477A-910B-7C020D6066D1}.Release|Win32.Build.0 = Release|Win32
+		{FC3D65E7-B7CB-406E-B6C9-0B26E30FE7F4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FC3D65E7-B7CB-406E-B6C9-0B26E30FE7F4}.Debug|Win32.Build.0 = Debug|Win32
+		{FC3D65E7-B7CB-406E-B6C9-0B26E30FE7F4}.Release|Win32.ActiveCfg = Release|Win32
+		{FC3D65E7-B7CB-406E-B6C9-0B26E30FE7F4}.Release|Win32.Build.0 = Release|Win32
+		{30219289-3B7F-4E02-BC34-C1DBD08CD848}.Debug|Win32.ActiveCfg = Debug|Win32
+		{30219289-3B7F-4E02-BC34-C1DBD08CD848}.Debug|Win32.Build.0 = Debug|Win32
+		{30219289-3B7F-4E02-BC34-C1DBD08CD848}.Release|Win32.ActiveCfg = Release|Win32
+		{30219289-3B7F-4E02-BC34-C1DBD08CD848}.Release|Win32.Build.0 = Release|Win32
+		{D169F06E-6607-4A9F-A075-2335717B9AB5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D169F06E-6607-4A9F-A075-2335717B9AB5}.Debug|Win32.Build.0 = Debug|Win32
+		{D169F06E-6607-4A9F-A075-2335717B9AB5}.Release|Win32.ActiveCfg = Release|Win32
+		{D169F06E-6607-4A9F-A075-2335717B9AB5}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/vc_solution/vc9_lame_config.vsprops b/vc_solution/vc9_lame_config.vsprops
new file mode 100644
index 0000000..1849b92
--- /dev/null
+++ b/vc_solution/vc9_lame_config.vsprops
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="vc9_lame_config"
+	OutputDirectory="$(SolutionDir)..\output\$(ConfigurationName)"
+	IntermediateDirectory="$(SolutionDir)..\obj\$(ConfigurationName)\$(ProjectName)"
+	>
+	<Tool
+		Name="VCBscMakeTool"
+		OutputFile="$(IntDir)/$(ProjectName).bsc"
+	/>
+	<Tool
+		Name="VCCLCompilerTool"
+		PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATED"
+		StringPooling="true"
+		EnableFunctionLevelLinking="true"
+		AssemblerListingLocation="$(IntDir)\"
+		BrowseInformation="1"
+		WarningLevel="3"
+		DisableSpecificWarnings="4995;4996"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		LinkIncremental="1"
+		AdditionalLibraryDirectories="$(OutDir)"
+		ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+		OptimizeReferences="2"
+	/>
+</VisualStudioPropertySheet>
diff --git a/vc_solution/vc9_lame_dll.vcproj b/vc_solution/vc9_lame_dll.vcproj
new file mode 100644
index 0000000..e7ca678
--- /dev/null
+++ b/vc_solution/vc9_lame_dll.vcproj
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="lame_enc_dll"
+	ProjectGUID="{0E4820D3-DBE3-477A-910B-7C020D6066D1}"
+	RootNamespace="lame_enc_dll"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName="..\output\Debug/LameDll.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEMP3ENCDLL_EXPORTS"
+				StringPooling="true"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1036"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libmp3lame.lib odbc32.lib odbccp32.lib"
+				OutputFile="..\output\Debug\lame_enc.dll"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ImportLibrary="$(OutDir)/lame_enc.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName="..\output\Release/LameDll.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				AdditionalIncludeDirectories="../include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LAMEMP3ENCDLL_EXPORTS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1036"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libmp3lame.lib"
+				OutputFile="..\output\Release\lame_enc.dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				ImportLibrary="$(OutDir)/lame_enc.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<File
+				RelativePath="..\Dll\BladeMP3EncDLL.c"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\Dll\BladeMP3EncDLL.def"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="..\Dll\BladeMP3EncDLL.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_dll_example.vcproj b/vc_solution/vc9_lame_dll_example.vcproj
new file mode 100644
index 0000000..9655c4a
--- /dev/null
+++ b/vc_solution/vc9_lame_dll_example.vcproj
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="lame_enc_dll_example"
+	ProjectGUID="{D169F06E-6607-4A9F-A075-2335717B9AB5}"
+	RootNamespace="lame_enc_dll_example"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\obj\Release\LameMp3EncDll/Example.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\obj\Debug\LameMp3EncDll/Example.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				StringPooling="true"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath="..\Dll\Example.cpp"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					PreprocessorDefinitions=""
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_dshow.vcproj b/vc_solution/vc9_lame_dshow.vcproj
new file mode 100644
index 0000000..9480419
--- /dev/null
+++ b/vc_solution/vc9_lame_dshow.vcproj
@@ -0,0 +1,487 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="DShow"
+	ProjectGUID="{6D348A4E-8B40-4FB0-BB57-C982D51FFA01}"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName="..\obj\Debug/dshow.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\include,..\DShow"
+				PreprocessorDefinitions="DEBUG;INC_OLE2;WINVER=0x0400;_X86_=1;STRICT;_WINDOWS;WIN32;STDC_HEADERS"
+				StringPooling="true"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+				CallingConvention="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalDependencies="libmp3lame.lib ..\DShow\strmbasD.lib vfw32.lib winmm.lib version.lib Comdlg32.lib comctl32.lib quartz.lib msvcrtd.lib"
+				OutputFile="..\output\Debug\lame.ax"
+				AdditionalLibraryDirectories=""
+				IgnoreAllDefaultLibraries="true"
+				ModuleDefinitionFile="..\DShow\Mpegac.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				EntryPointSymbol="DllEntryPoint@12"
+				BaseAddress="0x1c400000"
+				RandomizedBaseAddress="1"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				TargetEnvironment="1"
+				TypeLibraryName="..\obj\Release/dshow.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="../include,../DShow"
+				PreprocessorDefinitions="NDEBUG;INC_OLE2;STRICT;WINVER=0x0400;_X86_=1;_WINDOWS;WIN32;STDC_HEADERS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				CallingConvention="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalDependencies="libmp3lame.lib ..\DShow\strmbase.lib vfw32.lib winmm.lib version.lib Comdlg32.lib comctl32.lib quartz.lib msvcrt.lib"
+				OutputFile="..\output\Release\lame.ax"
+				Version="0.3"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				IgnoreAllDefaultLibraries="true"
+				ModuleDefinitionFile="..\DShow\Mpegac.def"
+				SubSystem="2"
+				EntryPointSymbol="DllEntryPoint@12"
+				BaseAddress="0x1c400000"
+				RandomizedBaseAddress="1"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+			>
+			<File
+				RelativePath="..\DShow\aboutprp.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\DShow\Encoder.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\DShow\Mpegac.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\DShow\Mpegac.def"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\Property.rc"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\DShow\PropPage.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\DShow\PropPage_adv.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\DShow\REG.CPP"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;fi;fd"
+			>
+			<File
+				RelativePath="..\DShow\aboutprp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\Encoder.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\iaudioprops.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\Mpegac.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\PropPage.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\PropPage_adv.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\reg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\resource.h"
+				>
+			</File>
+			<File
+				RelativePath="..\DShow\uids.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+			>
+			<File
+				RelativePath="..\DShow\elogo.ico"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\include\lame.h"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\output\libmp3lame-dynamic.lib"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\DShow\README"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\DShow\STRMBASE.lib"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_lame.vcproj b/vc_solution/vc9_lame_lame.vcproj
new file mode 100644
index 0000000..374e619
--- /dev/null
+++ b/vc_solution/vc9_lame_lame.vcproj
@@ -0,0 +1,508 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="lame"
+	ProjectGUID="{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}"
+	RootNamespace="lame"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="ReleaseNASM|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\ReleaseNASM/lame.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..,../mpglib,../libmp3lame,../include,../"
+				PreprocessorDefinitions="NDEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H;HAVE_NASM;MMX_choose_table"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_APP=$(TargetFileName)"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\Debug/lame.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../,../mpglib,../libmp3lame,../include"
+				PreprocessorDefinitions="_DEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_APP=$(TargetFileName)"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\Release/lame.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..,../mpglib,../libmp3lame,../include,../"
+				PreprocessorDefinitions="NDEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_APP=$(TargetFileName)"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ProgramDatabaseFile="..\output\Release/lame.pdb"
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<File
+				RelativePath="..\frontend\brhist.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\console.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\get_audio.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\lametime.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\main.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\parse.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\portableio.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\timestatus.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="..\frontend\brhist.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\console.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\get_audio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\lametime.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\main.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\parse.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\portableio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\timestatus.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\libmp3lame\lame.rc"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_lame_mp3x.vcproj b/vc_solution/vc9_lame_mp3x.vcproj
new file mode 100644
index 0000000..2868f77
--- /dev/null
+++ b/vc_solution/vc9_lame_mp3x.vcproj
@@ -0,0 +1,423 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="MP3x"
+	ProjectGUID="{E745EB1A-070A-45ED-B8BD-D9F794E23CFA}"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\Release/mp3x.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="./WinGTK/gtk-plus,./WinGTK/glib-1.2,./WinGtk/src/gtk+,./WinGtk/src/glib,./WinGtk/src/gtk+/gdk,../include,../libmp3lame,../mp3x,../frontend,.."
+				PreprocessorDefinitions="NDEBUG;LAMEPARSE;WIN32;_CONSOLE;HAVE_MPGLIB;LAMESNDFILE;BRHIST;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="glib-2.0.lib odbc32.lib odbccp32.lib gdk.lib gtk.lib"
+				AdditionalLibraryDirectories="./WinGtk/src/gtk+/gtk,./WinGtk/src/gtk+/gdk,./WinGtk/src/glib"
+				GenerateMapFile="true"
+				MapFileName="..\obj\Release\frontend/mp3x.map"
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\Debug/mp3x.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="./WinGtk/src/gtk+,./WinGtk/src/glib,./WinGtk/src/gtk+/gdk,../include,../libmp3lame,../mp3x,../frontend,.."
+				PreprocessorDefinitions="LAMESNDFILE;BRHIST;_DEBUG;WIN32;_CONSOLE;HAVE_MPGLIB;HAVE_CONFIG_H"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="glib-2.0.lib odbc32.lib odbccp32.lib gdk.lib gtk.lib"
+				AdditionalLibraryDirectories="./WinGtk/src/gtk+/gtk,./WinGtk/src/gtk+/gdk,./WinGtk/src/glib"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source"
+			Filter="c"
+			>
+			<File
+				RelativePath="..\frontend\brhist.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\console.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\get_audio.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\gpkplotting.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\gtkanal.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\lametime.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\mp3x.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\parse.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\portableio.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\frontend\timestatus.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Include"
+			Filter="h"
+			>
+			<File
+				RelativePath="..\frontend\brhist.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\..\configMS.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\console.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\get_audio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\gpkplotting.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\lametime.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\parse.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\portableio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\frontend\timestatus.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\frontend\..\README.WINGTK"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_libmp3lame.vcproj b/vc_solution/vc9_libmp3lame.vcproj
new file mode 100644
index 0000000..eecf7e7
--- /dev/null
+++ b/vc_solution/vc9_libmp3lame.vcproj
@@ -0,0 +1,1146 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="libmp3lame"
+	ProjectGUID="{20536101-3B0E-43EF-94F9-080D595DAC57}"
+	RootNamespace="libmp3lame"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+		<ToolFile
+			RelativePath=".\vc9_nasm.rules"
+		/>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="ReleaseNASM|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="NASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="../mpglib,../include,.."
+				PreprocessorDefinitions="NDEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H;HAVE_NASM;MMX_choose_table;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmp3lame-static.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="NASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="../mpglib,../include,.."
+				PreprocessorDefinitions="NDEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmp3lame-static.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="NASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../mpglib,../include,.."
+				PreprocessorDefinitions="_DEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="3"
+				ProgramDataBaseFileName="$(OutDir)\$(TargetName).pdb"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmp3lame-static.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source"
+			Filter="c"
+			>
+			<File
+				RelativePath="..\libmp3lame\bitstream.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\encoder.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\fft.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\gain_analysis.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\id3tag.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lame.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\mpglib_interface.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\newmdct.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\presets.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\psymodel.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize_pvt.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\reservoir.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\set_get.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\tables.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						WarningLevel="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						WarningLevel="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						WarningLevel="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\takehiro.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\util.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\vbrquantize.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\VbrTag.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\version.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\.\vector\xmm_quantize_sub.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="../libmp3lame"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="../libmp3lame"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="../libmp3lame"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Include"
+			Filter="h"
+			>
+			<File
+				RelativePath="..\libmp3lame\bitstream.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\configMS.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step on $(InputName)"
+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+						Outputs="..\config.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step on $(InputName)"
+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+						Outputs="..\config.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step on $(InputName)"
+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+						Outputs="..\config.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\encoder.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\fft.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\gain_analysis.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\id3tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\l3side.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lame-analysis.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lame_global_flags.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\.\vector\lame_intrin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lameerror.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\machine.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\newmdct.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\psymodel.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize_pvt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\reservoir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\set_get.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\tables.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\vbrquantize.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\VbrTag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\version.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Asm"
+			Filter=".nas"
+			>
+			<File
+				RelativePath="..\libmp3lame\i386\choose_table.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\cpu_feat.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fft.nas"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fft3dn.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fftfpu.nas"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fftsse.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\ffttbl.nas"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\scalar.nas"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\include\lame.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_libmp3lame_dll.vcproj b/vc_solution/vc9_libmp3lame_dll.vcproj
new file mode 100644
index 0000000..c2d1ea6
--- /dev/null
+++ b/vc_solution/vc9_libmp3lame_dll.vcproj
@@ -0,0 +1,1803 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="libmp3lameDLL"
+	ProjectGUID="{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}"
+	RootNamespace="libmp3lameDLL"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+		<ToolFile
+			RelativePath=".\vc9_nasm.rules"
+		/>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="NASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\Release/libmp3lame_dll.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="../libmp3lame,../,../mpglib,../include,.."
+				PreprocessorDefinitions="NDEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_VC80_UPGRADE=0x0600;_DLL=$(TargetFileName)"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libmp3lame.dll"
+				ModuleDefinitionFile="..\include\lame.def"
+				ImportLibrary="$(OutDir)/libmp3lame.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="ReleaseNASM|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="NASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\ReleaseNASM/libmp3lame_dll.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="../libmp3lame,../,../mpglib,../include,.."
+				PreprocessorDefinitions="NDEBUG;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H;HAVE_NASM;MMX_choose_table;WIN32;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_VC80_UPGRADE=0x0600;_DLL=$(TargetFileName)"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libmp3lame.dll"
+				ModuleDefinitionFile="..\include\lame.def"
+				ImportLibrary="$(OutDir)/libmp3lame.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="NASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName="..\output\Debug/libmp3lame_dll.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../libmp3lame,../,../mpglib,../include,.."
+				PreprocessorDefinitions="_DEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_VC80_UPGRADE=0x0600;_DLL=$(TargetFileName);_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libmp3lame.dll"
+				ModuleDefinitionFile="..\include\lame.def"
+				GenerateDebugInformation="true"
+				ImportLibrary="$(OutDir)/libmp3lame.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="encoder sources"
+			Filter="*.c"
+			>
+			<File
+				RelativePath="..\libmp3lame\bitstream.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\encoder.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\fft.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\gain_analysis.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\id3tag.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lame.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\mpglib_interface.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\newmdct.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\presets.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\psymodel.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize_pvt.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\reservoir.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\set_get.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\tables.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\takehiro.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\util.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\vbrquantize.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\VbrTag.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\version.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\.\vector\xmm_quantize_sub.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="../libmp3lame"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="../libmp3lame"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="../libmp3lame"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="encoder header"
+			Filter=".h"
+			>
+			<File
+				RelativePath="..\libmp3lame\bitstream.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\encoder.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\fft.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\gain_analysis.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\id3tag.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\l3side.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lame-analysis.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lame_global_flags.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\.\vector\lame_intrin.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\lameerror.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\machine.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\newmdct.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\psymodel.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\quantize_pvt.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\reservoir.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\set_get.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\tables.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\util.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\vbrquantize.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\VbrTag.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\version.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Asm"
+			>
+			<File
+				RelativePath="..\libmp3lame\i386\choose_table.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\cpu_feat.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fft.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fft3dn.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fftfpu.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\fftsse.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\ffttbl.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\i386\scalar.nas"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="NASM"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="decoder sources"
+			Filter=".c"
+			>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\common.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\dct64_i386.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\decode_i386.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\interface.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\layer1.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\layer2.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\layer3.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\tabinit.c"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						ObjectFile="..\obj\ReleaseNASM\libmp3lameDLL/"
+						ProgramDataBaseFileName="..\obj\ReleaseNASM\libmp3lameDLL/"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="decoder header"
+			Filter=".h"
+			>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\common.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\dct64_i386.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\decode_i386.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\huffman.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\interface.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\layer1.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\layer2.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\layer3.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\mpg123.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\mpglib.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libmp3lame\..\mpglib\tabinit.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\libmp3lame\..\configMS.h"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Performing Custom Build Step on $(InputName)"
+					CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+					Outputs="..\config.h"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="ReleaseNASM|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Performing Custom Build Step on $(InputName)"
+					CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+					Outputs="..\config.h"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\libmp3lame\..\include\lame.def"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="ReleaseNASM|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\include\lame.h"
+			>
+		</File>
+		<File
+			RelativePath="..\libmp3lame\lame.rc"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_mpglib.vcproj b/vc_solution/vc9_mpglib.vcproj
new file mode 100644
index 0000000..0f78d6a
--- /dev/null
+++ b/vc_solution/vc9_mpglib.vcproj
@@ -0,0 +1,525 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="mpglib"
+	ProjectGUID="{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="ReleaseNASM|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="../libmp3lame,../include,.."
+				PreprocessorDefinitions="NDEBUG;HAVE_MPGLIB;_WINDOWS;USE_LAYER_2;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/mpglib-static.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="../libmp3lame,../include,.."
+				PreprocessorDefinitions="NDEBUG;HAVE_MPGLIB;_WINDOWS;USE_LAYER_2;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/mpglib-static.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\vc9_lame_config.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../libmp3lame,../include,.."
+				PreprocessorDefinitions="_DEBUG;_WINDOWS;USE_LAYER_2;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="3"
+				ProgramDataBaseFileName="$(OutDir)\$(TargetName).pdb"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/mpglib-static.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source"
+			Filter="c"
+			>
+			<File
+				RelativePath="..\mpglib\common.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\dct64_i386.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\decode_i386.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\interface.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\layer1.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\layer2.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\layer3.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\tabinit.c"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Include"
+			Filter="h"
+			>
+			<File
+				RelativePath="..\mpglib\common.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\..\configMS.h"
+				>
+				<FileConfiguration
+					Name="ReleaseNASM|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step on $(InputName)"
+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+						Outputs="..\config.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step on $(InputName)"
+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+						Outputs="..\config.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step on $(InputName)"
+						CommandLine="copy ..\configMS.h ..\config.h&#x0D;&#x0A;"
+						Outputs="..\config.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\mpglib\dct64_i386.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\decode_i386.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\huffman.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\interface.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\l2tables.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\layer1.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\layer2.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\layer3.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\mpg123.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\mpglib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\mpglib\tabinit.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/vc_solution/vc9_nasm.rules b/vc_solution/vc9_nasm.rules
new file mode 100644
index 0000000..8b7f64e
--- /dev/null
+++ b/vc_solution/vc9_nasm.rules
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<VisualStudioToolFile
+	Name="NASM "
+	Version="8,00"
+	>
+	<Rules>
+		<CustomBuildRule
+			Name="NASM"
+			DisplayName="NASM"
+			CommandLine="nasmw [BinFormat] [IncludeDir] [Defines] -o [OutFile] $(InputPath)"
+			Outputs="[OutFile]"
+			FileExtensions="*.nas"
+			ExecutionDescription="Assembling $(InputName)..."
+			ShowOnlyRuleProperties="false"
+			>
+			<Properties>
+				<StringProperty
+					Name="OutFile"
+					DisplayName="output file path"
+					Switch="[value]"
+					DefaultValue="$(IntDir)\$(InputName).obj"
+				/>
+				<StringProperty
+					Name="BinFormat"
+					DisplayName="Binary format"
+					Switch="-f [value]"
+					DefaultValue="win32"
+				/>
+				<StringProperty
+					Name="IncludeDir"
+					DisplayName="Additional include directories"
+					Switch="-i [value]"
+					DefaultValue="$(InputDir)"
+					Delimited="true"
+				/>
+				<StringProperty
+					Name="Defines"
+					DisplayName="Defines"
+					Switch="-D[value]"
+					DefaultValue="WIN32"
+					Delimited="true"
+					Delimiters=" ;,"
+				/>
+			</Properties>
+		</CustomBuildRule>
+	</Rules>
+</VisualStudioToolFile>