richarddobson 3 éve
szülő
commit
f24fd8ba76
100 módosított fájl, 32215 hozzáadás és 0 törlés
  1. 8 0
      dev/externals/CMakeLists.txt
  2. 21 0
      dev/externals/fastconv/CMakeLists.txt
  3. 768 0
      dev/externals/fastconv/fconv-fftw.cpp
  4. 752 0
      dev/externals/fastconv/fconv.cpp
  5. 235 0
      dev/externals/fastconv/genrespframe2.cpp
  6. 883 0
      dev/externals/fastconv/mxfftd.c
  7. 110 0
      dev/externals/fastconv/readme.txt
  8. 258 0
      dev/externals/include/portsf.h
  9. 81 0
      dev/externals/mctools/CMakeLists.txt
  10. 189 0
      dev/externals/mctools/abfdcode.cpp
  11. 180 0
      dev/externals/mctools/abfdcode2.cpp
  12. 276 0
      dev/externals/mctools/abfpan.cpp
  13. 296 0
      dev/externals/mctools/abfpan2.cpp
  14. 302 0
      dev/externals/mctools/channel.c
  15. 297 0
      dev/externals/mctools/chorder.c
  16. 760 0
      dev/externals/mctools/chxformat.c
  17. 604 0
      dev/externals/mctools/copysf.c
  18. 400 0
      dev/externals/mctools/fmdcode.c
  19. 106 0
      dev/externals/mctools/fmdcode.h
  20. 32 0
      dev/externals/mctools/fmhcube1.txt
  21. 712 0
      dev/externals/mctools/fmhfuncs.c
  22. 504 0
      dev/externals/mctools/interlx.c
  23. 698 0
      dev/externals/mctools/njoin.c
  24. 333 0
      dev/externals/mctools/nmix.c
  25. 320 0
      dev/externals/mctools/rmsinfo.cpp
  26. 378 0
      dev/externals/mctools/sfprops.c
  27. 5 0
      dev/externals/paprogs/CMakeLists.txt
  28. BIN
      dev/externals/paprogs/dx9mgw.zip
  29. 26 0
      dev/externals/paprogs/listaudevs/CMakeLists.txt
  30. 69 0
      dev/externals/paprogs/listaudevs/devs.c
  31. 32 0
      dev/externals/paprogs/listaudevs/orig_Makefile
  32. BIN
      dev/externals/paprogs/pa_stable_v19_20140130.tgz
  33. 37 0
      dev/externals/paprogs/palinuxbuild.txt
  34. 44 0
      dev/externals/paprogs/pamacbuild.txt
  35. 74 0
      dev/externals/paprogs/pamingwbuild.txt
  36. 30 0
      dev/externals/paprogs/paplay/CMakeLists.txt
  37. 106 0
      dev/externals/paprogs/paplay/fmdcode.h
  38. 712 0
      dev/externals/paprogs/paplay/fmhfuncs.c
  39. 1593 0
      dev/externals/paprogs/paplay/paplay.c
  40. 349 0
      dev/externals/paprogs/portaudio/CMakeLists.txt
  41. 240 0
      dev/externals/paprogs/portaudio/Doxyfile
  42. 243 0
      dev/externals/paprogs/portaudio/Doxyfile.developer
  43. 81 0
      dev/externals/paprogs/portaudio/LICENSE.txt
  44. 22 0
      dev/externals/paprogs/portaudio/README.configure.txt
  45. 98 0
      dev/externals/paprogs/portaudio/README.txt
  46. 197 0
      dev/externals/paprogs/portaudio/SConstruct
  47. 8620 0
      dev/externals/paprogs/portaudio/aclocal.m4
  48. 0 0
      dev/externals/paprogs/portaudio/bin-stamp
  49. BIN
      dev/externals/paprogs/portaudio/bin/pa_devs
  50. BIN
      dev/externals/paprogs/portaudio/bin/pa_fuzz
  51. BIN
      dev/externals/paprogs/portaudio/bin/pa_minlat
  52. BIN
      dev/externals/paprogs/portaudio/bin/paex_pink
  53. BIN
      dev/externals/paprogs/portaudio/bin/paex_read_write_wire
  54. BIN
      dev/externals/paprogs/portaudio/bin/paex_record
  55. BIN
      dev/externals/paprogs/portaudio/bin/paex_saw
  56. BIN
      dev/externals/paprogs/portaudio/bin/paex_sine
  57. BIN
      dev/externals/paprogs/portaudio/bin/paex_write_sine
  58. BIN
      dev/externals/paprogs/portaudio/bin/paex_write_sine_nonint
  59. BIN
      dev/externals/paprogs/portaudio/bin/paqa_devs
  60. BIN
      dev/externals/paprogs/portaudio/bin/paqa_errs
  61. BIN
      dev/externals/paprogs/portaudio/bin/paqa_latency
  62. BIN
      dev/externals/paprogs/portaudio/bin/patest1
  63. BIN
      dev/externals/paprogs/portaudio/bin/patest_buffer
  64. BIN
      dev/externals/paprogs/portaudio/bin/patest_callbackstop
  65. BIN
      dev/externals/paprogs/portaudio/bin/patest_clip
  66. BIN
      dev/externals/paprogs/portaudio/bin/patest_dither
  67. BIN
      dev/externals/paprogs/portaudio/bin/patest_hang
  68. BIN
      dev/externals/paprogs/portaudio/bin/patest_in_overflow
  69. BIN
      dev/externals/paprogs/portaudio/bin/patest_latency
  70. BIN
      dev/externals/paprogs/portaudio/bin/patest_leftright
  71. BIN
      dev/externals/paprogs/portaudio/bin/patest_longsine
  72. BIN
      dev/externals/paprogs/portaudio/bin/patest_many
  73. BIN
      dev/externals/paprogs/portaudio/bin/patest_maxsines
  74. BIN
      dev/externals/paprogs/portaudio/bin/patest_mono
  75. BIN
      dev/externals/paprogs/portaudio/bin/patest_multi_sine
  76. BIN
      dev/externals/paprogs/portaudio/bin/patest_out_underflow
  77. BIN
      dev/externals/paprogs/portaudio/bin/patest_prime
  78. BIN
      dev/externals/paprogs/portaudio/bin/patest_ringmix
  79. BIN
      dev/externals/paprogs/portaudio/bin/patest_sine8
  80. BIN
      dev/externals/paprogs/portaudio/bin/patest_sine_channelmaps
  81. BIN
      dev/externals/paprogs/portaudio/bin/patest_sine_formats
  82. BIN
      dev/externals/paprogs/portaudio/bin/patest_sine_srate
  83. BIN
      dev/externals/paprogs/portaudio/bin/patest_sine_time
  84. BIN
      dev/externals/paprogs/portaudio/bin/patest_start_stop
  85. BIN
      dev/externals/paprogs/portaudio/bin/patest_stop
  86. BIN
      dev/externals/paprogs/portaudio/bin/patest_stop_playout
  87. BIN
      dev/externals/paprogs/portaudio/bin/patest_toomanysines
  88. BIN
      dev/externals/paprogs/portaudio/bin/patest_two_rates
  89. BIN
      dev/externals/paprogs/portaudio/bin/patest_underflow
  90. BIN
      dev/externals/paprogs/portaudio/bin/patest_wire
  91. 0 0
      dev/externals/paprogs/portaudio/bindings/cpp/AUTHORS
  92. 31 0
      dev/externals/paprogs/portaudio/bindings/cpp/COPYING
  93. 178 0
      dev/externals/paprogs/portaudio/bindings/cpp/ChangeLog
  94. 365 0
      dev/externals/paprogs/portaudio/bindings/cpp/INSTALL
  95. 0 0
      dev/externals/paprogs/portaudio/bindings/cpp/NEWS
  96. 0 0
      dev/externals/paprogs/portaudio/bindings/cpp/README
  97. 65 0
      dev/externals/paprogs/portaudio/bindings/cpp/SConscript
  98. 9438 0
      dev/externals/paprogs/portaudio/bindings/cpp/aclocal.m4
  99. 0 0
      dev/externals/paprogs/portaudio/bindings/cpp/build/gnu/OUT_OF_DATE
  100. 57 0
      dev/externals/paprogs/portaudio/bindings/cpp/build/gnu/aclocal.m4

+ 8 - 0
dev/externals/CMakeLists.txt

@@ -0,0 +1,8 @@
+add_subdirectory(portsf)
+add_subdirectory(fastconv)
+add_subdirectory(reverb)
+add_subdirectory(mctools)
+
+##if(USE_LOCAL_PORTAUDIO)
+  add_subdirectory(paprogs)
+##endif()

+ 21 - 0
dev/externals/fastconv/CMakeLists.txt

@@ -0,0 +1,21 @@
+if(APPLE)
+  set(CMAKE_C_FLAGS "-O2 -Wall -mmacosx-version-min=10.8 -Dunix -fomit-frame-pointer -funroll-loops")
+  set(CMAKE_CXX_FLAGS "-O2 -Wall -mmacosx-version-min=10.8 -Dunix -fomit-frame-pointer -funroll-loops  -std=c++11 -stdlib=libc++")
+else()
+  if(MINGW)
+    set(CMAKE_C_FLAGS "-O3 -DWIN32 -D_WIN32 -fomit-frame-pointer  -funroll-loops")
+  else()
+    set(CMAKE_C_FLAGS "-O3 -Wall -Dlinux -Dunix -fomit-frame-pointer -funroll-loops")
+  endif()
+endif()
+
+link_directories(../lib)
+
+include_directories(../include)
+
+add_executable(fconv fconv.cpp genrespframe2.cpp mxfftd.c)
+
+target_link_libraries(fconv portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(fconv)
+

+ 768 - 0
dev/externals/fastconv/fconv-fftw.cpp

@@ -0,0 +1,768 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* fastconv.cpp: */
+/*  self-contained prog for fast convolution (reverb, FIR filtering, bformat etc) 
+ *  
+*/
+
+/* um, there is nothing C++ish about this code apart from use of new, delete! */
+
+/*TODO: control wet/dry mix with something... */
+/* auto-rescale arbitrary impulse responses? */
+/* Feb 2013: rebuilt with updated portsf */
+/* August 2013 epanded usage message re text file. */
+extern "C"
+{
+
+#include <portsf.h>
+
+}
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/timeb.h>
+
+
+#ifdef _DEBUG
+#include <assert.h>
+#endif
+
+#ifdef unix
+#include <ctype.h>
+int stricmp(const char *a, const char *b);
+int strnicmp(const char *a, const char *b, const int length);
+#endif
+
+
+#include <rfftw.h>
+
+
+#ifndef WAVE_FORMAT_IEEE_FLOAT
+#define WAVE_FORMAT_IEEE_FLOAT (0x0003)
+#endif
+
+//#define FFTTEST
+
+/* convert from mono text impulse file */
+long genimpframe1(double *insbuf, double*** outbuf, long npoints, double scalefac);
+/* convert from multichan soundfile */
+long genimpframe2(int ifd,double*** outframe, double* rms,long imchans,double scalefac);
+void mc_split(double* inbuf,double** out,long insize,long chans);
+void mc_interl(double** in,double* out,long insize,long chans);
+void complexmult(double *frame,const double *impulse,long length);
+
+#ifdef FFTTEST
+extern "C"{
+void fft_(double *, double *,int,int,int,int);
+void fftmx(double *,double *,int,int,int,int,int,int *,double *,double *,double *,double *,int *,int[]);
+void reals_(double *,double *,int,int);
+}
+#endif
+
+#define DEFAULT_BUFLEN (32768)
+
+enum {ARG_NAME,ARG_INFILE,ARG_IMPFILE,ARG_OUTFILE,ARG_NARGS};
+
+void usage(const char *progname)
+{
+
+    printf("\n\n%s v1.2 RWD,CDP July 2010,2013",progname);
+	printf("\nMulti-channel FFT-based convolver");
+
+	printf("\nUsage: \n    %s [-aX][-f] infile impulsefile outfile [dry]\n"		               
+           "   -aX        : scale output amplitude by X\n"
+           "   -f         : write output as floats (no clipping)\n"
+           "  infile      : input soundfile to be processed.\n"
+           "  impulsefile : m/c soundfile or mono text file containing impulse response,\n"
+           "                  e.g. reverb or FIR filter.\n"
+           "                Text file name must have extension .txt.\n"
+		   "                  File must contain 1 column of floating point values,\n"
+		   "                  typically in the range -1.0 to 1.0.\n"
+           "              Supported channel combinations:\n"
+           "               (a) mono infile, N-channel impulsefile;\n"
+           "               (b) channels are the same;\n"
+           "               (c) mono impulsefile, N-channel infile.\n"
+           "  [dry]       :  set dry/wet mix (e.g. for reverb)\n"
+           "                 Range: 0.0 - 1.0,  default = 0.0\n"
+           "                 (uses sin/cos law for constant power mix)\n"
+           "Note: some recorded reverb impulses effectively include the direct signal.\n"
+           "In such cases  <dry>  need not be used\n"
+           "Where impulsefile is filter response (FIR), optimum length is power-of-two - 1.\n",progname
+		   );		   
+}
+
+
+double
+timer()
+{
+	struct timeb now;
+	double secs, ticks;	
+	ftime(&now);
+	ticks = (double)now.millitm/(1000.0);
+	secs = (double) now.time;
+
+	return secs + ticks;
+}
+
+
+void			
+stopwatch(int flag) 
+{
+	static double start;		    
+	long mins=0,hours=0;
+	double end, secs=0;
+
+	if(flag)
+		start = timer();	
+	else 
+	{
+		end    = timer(); 
+		secs   = end - start;
+		mins   = (long)(secs/60.0);
+		secs  -= mins*60.0; 
+		hours  = mins/60;
+		mins  -= hours*60;
+
+		fprintf(stderr,"\nElapsed time: ");
+		if(hours > 0)
+			fprintf(stderr,"%ld h ", hours);
+		if(mins > 0)
+			fprintf(stderr,"%ld m ", mins);
+		fprintf(stderr,"%2.3lf s\n\n",secs);
+	}
+}
+
+/* how do we want this to work?
+
+  (1)  multi-chan impulse:  EITHER: mono infile  OR infile with same chan count
+  (2)  mono impulse:  expanded to infile chancount
+     Therefore: need to open both infiles before deciding action
+*/
+#define PI2 (1.570796327)
+
+int main(int argc,char **argv)
+{
+
+	long fftlen = 1,imlen = 0,chans = 0,srate;
+	long buflen = 0;
+	double scalefac = 1.0f;
+	double ampfac = 1.0;
+    double Ninv = 1.0;
+	int insndfile = -1,inimpfile = -1,outsndfile = -1; 
+    int dorms = 0;
+    int nameoffset = 0;
+	PSF_PROPS inprops,outprops, impulseprops;
+    psf_format format;
+    PSF_CHPEAK  *fpeaks = NULL;
+	MYLONG peaktime;
+	int i,jj,minheader = 0,do_timer = 1;
+    int writefloats = 0;
+    long framesneeded;
+	double oneovrsr;
+    double *inmonobuf = 0;
+	double *insbuf=0,*outsbuf = 0;
+    double **inbuf = 0, **outbuf = 0;    
+	double **imbuf = 0;
+	double **overlapbuf = 0;
+    double rms = 0.0;
+    double dry = 0.0;
+    double wet = 1.0;
+#ifdef FFTTEST
+    double *anal = 0;
+#endif
+    rfftwnd_plan* forward_plan = 0;
+    rfftwnd_plan* inverse_plan = 0;
+	
+    if(argv[0][0]=='.' && argv[0][1]=='/'){
+        nameoffset  = 2;
+    }
+	
+    if(argc==2){
+        if(strcmp(argv[1],"--version")==0){
+            printf("1.2.0.\n");
+            return 0;
+        }
+    }
+
+	if(psf_init()){
+		puts("unable to start portsf\n");
+		return 1;
+	}
+
+
+	if(argc < ARG_NARGS){		 
+		usage(argv[0]+nameoffset);
+		return(1);
+	}
+
+    
+
+    while(argc > 1 && argv[1][0]=='-'){				
+		switch(argv[1][1]){
+        case 'a':
+            scalefac =  atof(&(argv[1][2]));
+            if(scalefac <=0.0){
+                printf("Error: scalefac must be positive!\n");
+                return 1;
+            }
+            break;        
+        case 'f':
+            writefloats = 1;
+            break;
+        default:
+            break;
+        }
+        argv++;
+        argc--;
+    }		
+	/* 2 legal possibilities: infile and outfile, or -I used with infile only */
+	if(argc< ARG_NARGS){
+		fprintf(stderr,"\nInsufficient arguments.");
+		usage(argv[0]+nameoffset);
+		return(1);
+	}
+    if(argc==ARG_NARGS+1){
+        double dryarg;
+        dryarg = atof(argv[ARG_NARGS]);
+        if(dryarg < 0.0 || dryarg > 1.0){
+            printf("dry value out of range.\n");
+            return 0;
+        }
+        if(dryarg==1.0){
+            printf("Warning: dry=1 copies input!\n");
+            wet = 0.0;
+        }
+        else{
+            dry = sin(PI2 * dryarg);
+            wet = cos(PI2 * dryarg);
+        }
+    }
+
+		
+
+/* TODO:  where -F[file] is combined with -A, it signifies create analysis file
+           compatible with impulse file (e.g 50% overlap, etc) */
+
+	
+	/* open infile, check props */	
+		
+	if((insndfile = psf_sndOpen(argv[ARG_INFILE],&inprops, 0)) < 0){
+		fprintf(stderr,"\nUnable to open input soundfile %s",argv[1]);
+        delete []imbuf;
+		return 1;
+	}
+    srate = inprops.srate;
+	if(srate <=0){
+		fprintf(stderr,"\nBad srate found: corrupted file?\n");
+        delete []imbuf;
+		return 1;
+	}
+	chans = inprops.chans;
+    framesneeded = psf_sndSize(insndfile);
+    if(framesneeded <= 0){
+        printf("Error in input file - no data!\n");
+        psf_sndClose(insndfile);
+        return 1;
+    }
+    /* open impulse file */
+    /* check for soundfile */
+      
+    format = psf_getFormatExt(argv[ARG_IMPFILE]);
+    if(format==PSF_FMT_UNKNOWN){  /* must be a text file */
+        FILE *fp = 0;
+        char tmp[80];
+        char* dot;
+        int size = 0,got = 0;
+        int read = 0;
+
+        dot = strrchr(argv[ARG_IMPFILE],'.');
+        if(dot==NULL || stricmp(dot,".txt") != 0){
+            fprintf(stderr,"Error: impulse text file must have .txt extension.\n");
+            return 1;
+        }
+        fp = fopen(argv[ARG_IMPFILE],"r");
+        if(fp==0){
+            printf("Cannot open impulse text file %s\n.",argv[ARG_IMPFILE]);
+            return 1;
+        }
+        /* count lines! */
+        while(fgets(tmp,80,fp) != NULL)
+            size++;
+        if(size==0){
+            printf("Impulse textfile %s has no data!.\n",argv[ARG_IMPFILE]);
+            return 1;
+        }
+        rewind(fp);
+            
+        inmonobuf = new double[size+1];
+        for(i=0;i < size;i++)  {
+            read = fscanf(fp,"%lf",&inmonobuf[i]);
+            if(read==0){
+                i--;
+                continue;
+            }
+            if(read==EOF)
+                break;
+            got++;
+        }
+        imlen = got;
+        impulseprops.chans = 1;
+        fclose(fp);
+    }
+    else{
+        if((inimpfile = psf_sndOpen(argv[ARG_IMPFILE],&impulseprops, 0))< 0){
+            fprintf(stderr,"\nUnable to open impulse file %s",argv[ARG_IMPFILE]);       
+            return 0;
+        }
+        //printf("impulse file sr = %d\n",impulseprops.srate);
+        if(srate != impulseprops.srate){
+            printf("Error: files must have same sample rate");
+            delete []imbuf;
+            return 1;
+        }
+        long  len = psf_sndSize(inimpfile);
+        if(len <= 0){
+            printf("Error in impulse soundfile - no data!\n");
+            return 1;
+        }
+        if(impulseprops.chans > 1){
+            if(! (chans == 1 || chans == impulseprops.chans)){
+                fprintf(stderr,"\nChannel mismatch.\n    Infile must be mono or have same channels as irfile.\n");
+                return(1);
+            }
+            chans = impulseprops.chans;
+        }    
+    }
+
+    imbuf = new double*[chans];
+
+    /* if impulse file is mono, we will need to copy data to the other buffers */
+    // allocate  impulseprops.chans buffers ; may need more
+
+    if(inimpfile >=0){
+	    if((imlen = genimpframe2(inimpfile,&imbuf,&rms,impulseprops.chans, scalefac)) == 0){
+	    	fprintf(stderr,"Error reading impulse file\n");
+	    	return(1);
+	    }
+    }
+    
+    else if(imlen){        
+        genimpframe1(inmonobuf,&imbuf,imlen,scalefac);       
+    }
+    printf("mean rms level = %.4lf (%.2lf dB)\n",rms, 20.0 * log10(rms));
+    
+
+    framesneeded +=  imlen;        /* can  close outfile, when this length reached */
+
+    while(fftlen < imlen*2)			/* convolution style - double-length */
+		fftlen <<= 1;
+    double norm = sqrt(2.0);       /* relative: rms of 0dBFS sine is 0.707 = 1/root2 */
+    Ninv = 1.0 / sqrt(imlen*2);
+    Ninv *= norm;
+    Ninv /= imlen;
+    // take simple avg of  rms for adjustment factor.
+    // may not adequately represent some responses, e.g. with strong attack/earlies, soft reverb tail */
+    double rmsdif2 =  (-20.0 * log10(rms)) * 0.5;
+    double rmsadjust = pow(10, rmsdif2/20.0);
+#ifdef _DEBUG
+    printf("rescaling factor = %.6e\n",Ninv);   
+    printf("rmsadjust = %.4lf\n",rmsadjust);
+#endif
+   Ninv /= rmsadjust; 
+
+
+    /* copy buffers if required */
+    for(i = impulseprops.chans;i < chans;i++){
+        imbuf[i] = new double[fftlen+2];
+        memcpy(imbuf[i],imbuf[0],(fftlen+2)* sizeof(double));
+    }         
+    oneovrsr = 1.0 / (double) srate;
+    
+    /*make sure buflen is at least fftlen */
+//	if(fftlen > buflen)
+//		buflen = fftlen;
+
+    
+	/* main i/o buffers */
+	
+	insbuf     = new double [fftlen  * chans];
+    outsbuf    = new double [fftlen  * chans];
+	inbuf      = new double*[chans];
+    outbuf     = new double*[chans];  /* overlap-add buffers */
+    overlapbuf = new double*[chans];
+    
+    for(i=0;i < chans;i++){
+        inbuf[i]  = new double[fftlen+2];   // main in-place buf 
+        outbuf[i] = new double[fftlen+2];        
+	    /* channel buffers */	
+        overlapbuf[i] = new double[fftlen/2];
+        memset(overlapbuf[i],0,sizeof(double)*(fftlen/2));        
+    }
+#ifdef FFTTEST
+    anal = new double[fftlen+2];
+#endif
+    
+    
+    forward_plan = new rfftwnd_plan[chans];
+    inverse_plan = new rfftwnd_plan[chans];
+    int insize = (int) fftlen;
+    for(i=0;i < chans;i++){		    
+	    memset(inbuf[i], 0, sizeof(double) * (fftlen+2));
+        memset(outbuf[i],0,sizeof(double) * (fftlen+2));
+        
+        forward_plan[i] = rfftwnd_create_plan_specific(1,&insize, 
+		FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE | FFTW_IN_PLACE,
+		inbuf[i],1,NULL,1);
+        inverse_plan[i] = rfftwnd_create_plan_specific(1,&insize, 
+		FFTW_COMPLEX_TO_REAL, FFTW_ESTIMATE | FFTW_IN_PLACE,
+		inbuf[i],1,NULL,1);
+    }
+
+    
+	/* use generic init function */
+/*bool phasevocoder::init(long outsrate,long fftlen,long winlen,long decfac,float scalefac,
+						pvoc_scaletype stype,pvoc_windowtype wtype,pvocmode mode)
+*/
+	
+	/*create output sfile */
+	psf_stype smptype;
+	psf_format outformat;
+	/* will it be aiff, wav, etc? */
+	outformat = psf_getFormatExt(argv[ARG_OUTFILE]);
+	if(outformat==PSF_FMT_UNKNOWN){
+		fprintf(stderr,"\nOutfile name has unrecognized extension.");
+        delete []imbuf;
+		return(1);
+	}
+		
+		
+	smptype = inprops.samptype;
+    if(writefloats)
+        smptype= PSF_SAMP_IEEE_FLOAT;
+
+	/*the one gotcha: if output is floats and format is aiff, change to aifc */
+	if(smptype==PSF_SAMP_IEEE_FLOAT && outformat==PSF_AIFF){
+		fprintf(stderr,"Warning: AIFF output written as AIFC for float samples\n");
+		outformat = PSF_AIFC;
+	}
+
+	outprops          = inprops;
+	outprops.chans    = chans;
+	outprops.srate    = srate;
+	outprops.format   = outformat;
+	outprops.samptype = smptype;
+	outprops.chformat = STDWAVE;
+    /* if irfile is BFormat, need to set outfile fmt likewise */
+    if(impulseprops.chformat==MC_BFMT)
+        outprops.chformat = MC_BFMT;
+    /* I suppose people will want automatic decoding too...grrr */
+
+    fpeaks = new PSF_CHPEAK[chans];
+	if(fpeaks==NULL){
+		puts("no memory for fpeak data buffer\n");
+		return 1;
+	}
+
+	/*last arg: no clipping of f/p samples: we use PEAK chunk */
+	if((outsndfile = psf_sndCreate(argv[ARG_OUTFILE],&outprops,0,minheader,PSF_CREATE_RDWR)) <0 ){
+		fprintf(stderr,"\nUnable to open outfile %s",argv[ARG_OUTFILE]);
+        delete []imbuf;
+		return(1);
+	}
+				
+
+	
+	printf("\n");
+	
+	
+	stopwatch(1);
+
+	long written,thisblock,framesread;
+    long frameswritten = 0;
+	double intime= 0.0,outtime = 0.0;
+    int last = 0;
+				
+	while((framesread = psf_sndReadDoubleFrames(insndfile,insbuf,imlen)) > 0){        
+		written = thisblock =  0;
+
+		for(i = framesread * inprops.chans; i< fftlen * inprops.chans; i++)
+			insbuf[i] = 0.0f;
+        framesread = imlen;
+		memset(inbuf[0],0,(fftlen+2) * sizeof(double));
+        if(chans == inprops.chans)  {
+            /* must clean buffers! */
+		    for(i=0;i < chans;i++)
+                memset(inbuf[i],0,(fftlen+2) * sizeof(double));
+            mc_split(insbuf,inbuf,imlen * chans, chans);
+
+        }
+        else{
+            for(i=0;i < chans;i++) {
+                memset(inbuf[i],0,(fftlen+2) * sizeof(double));
+                memcpy(inbuf[i],insbuf,imlen * sizeof(double));
+                memset(outbuf[i],0,sizeof(double) * (fftlen+2));
+
+            }
+        }
+        if(impulseprops.chans==1){
+            for(jj = 0; jj < chans;jj++){
+#ifdef FFTTEST
+                int zz;
+                memcpy(anal,inbuf[jj],(fftlen+2) * sizeof(double));
+                fft_(anal,anal+1,1,fftlen/2,1,-2);
+	            reals_(anal,anal+1,fftlen/2,-2);
+                for(zz=0;zz < fftlen+2;zz++)
+                    anal[zz] *= 0.001;
+#endif
+                rfftwnd_one_real_to_complex(forward_plan[jj],inbuf[jj],NULL);			    				
+                complexmult(inbuf[jj],imbuf[0],fftlen+2);                
+			    rfftwnd_one_complex_to_real(inverse_plan[jj],(fftw_complex * )inbuf[jj],NULL);				
+            }           
+        }
+        else{
+            for(jj = 0; jj < chans;jj++){
+				rfftwnd_one_real_to_complex(forward_plan[jj],inbuf[jj],NULL);                   				
+                complexmult(inbuf[jj],imbuf[jj],fftlen+2);                
+				rfftwnd_one_complex_to_real(inverse_plan[jj],(fftw_complex * )inbuf[jj],NULL);    				    			    
+            }            
+        }
+        
+        /* overlap-add  for each channel */
+        /* TODO: verify  use of imlen here - should it be fftlen/2 -1 ? */
+        for(jj=0;jj < chans;jj++){
+            for(i=0;i < imlen;i++) {
+                outbuf[jj][i] = inbuf[jj][i] + overlapbuf[jj][i];
+                overlapbuf[jj][i] = inbuf[jj][i+imlen];
+            }
+        }
+		mc_interl(outbuf,outsbuf,imlen,chans);
+        if(inprops.chans == chans){
+            for(i=0;i < framesread; i++) {
+                for(jj=0;jj < chans;jj++){
+                    long  outindex = i*chans + jj;            
+                    outsbuf[outindex] *= Ninv;
+                    outsbuf[outindex] *= wet;
+                    outsbuf[outindex] += dry * insbuf[outindex];
+                }
+            }
+        }
+        /* elso mono input */
+        else {
+            for(i=0;i < framesread; i++) {
+                for(jj=0;jj < chans;jj++){
+                    long  outindex = i*chans + jj;
+                    double inval = dry *  insbuf[i];
+                    outsbuf[outindex] *= Ninv;
+                    outsbuf[outindex] *= wet;
+                    outsbuf[outindex] += inval;
+                }
+            }
+        }
+
+        if((written = psf_sndWriteDoubleFrames(outsndfile,outsbuf,framesread)) != framesread){
+		    fprintf(stderr,"\nerror writing to outfile");
+		    return(1);		               
+        }
+        frameswritten += written;
+
+		if(do_timer){
+			intime += (double)framesread * oneovrsr;
+			printf("Input time: %.2lf\r",intime);
+		}    
+    }
+    /* complete tail */
+
+    if(frameswritten < framesneeded){
+        // TODO: imlen? see above
+        mc_interl(overlapbuf,outsbuf,imlen,chans);
+        long towrite = framesneeded - frameswritten; 
+        for(i=0;i < towrite * chans; i++) {
+            outsbuf[i] *= Ninv;
+            outsbuf[i] *= wet;
+        }
+        if((written = psf_sndWriteDoubleFrames(outsndfile,outsbuf,towrite)) != towrite){
+	        fprintf(stderr,"\nerror writing to outfile");
+	        return(1);
+	    }
+    }
+
+	stopwatch(0);
+    if(psf_sndReadPeaks( outsndfile,fpeaks,&peaktime)){
+        double peakmax = 0.0;
+		printf("PEAK values:\n");
+		for(i=0; i < chans; i++)	{
+            peakmax = fpeaks[i].val > peakmax ? fpeaks[i].val : peakmax;
+			if(fpeaks[i].val < 0.0001f)
+				printf("CH %d:\t%e (%.2lf dB)\tat frame %10lu :\t%.4lf secs\n",i+1,
+				fpeaks[i].val,20.0*log10(fpeaks[i].val),fpeaks[i].pos,(double) (fpeaks[i].pos) / (double)srate);
+			else
+				printf("CH %d:\t%.4lf (%.2lf dB)\tat frame %10lu :\t%.4lf secs\n",i+1,
+				fpeaks[i].val,20.0 * log10(fpeaks[i].val),fpeaks[i].pos,(double) (fpeaks[i].pos) / (double)srate);		
+		}
+        if(peakmax > 1.0)
+            printf("Overflows!  Rescale by %.10lf\n",1.0 / peakmax);
+	}
+
+	if(insndfile >=0)
+		psf_sndClose(insndfile);
+	if(outsndfile >=0)
+		psf_sndClose(outsndfile);
+    if(inimpfile >=0)
+	    psf_sndClose(inimpfile);
+	psf_finish();
+    delete [] fpeaks;
+	if(insbuf)
+		delete [] insbuf;
+	if(outsbuf)
+		delete [] outsbuf;
+    
+
+    for(i=0;i < chans;i++){
+        if(inbuf){       
+		    delete [] inbuf[i];
+        }           
+        if(outbuf){
+		    delete [] outbuf[i];
+        }       	
+        if(imbuf){        
+	        delete [] imbuf[i];
+        }
+        if(overlapbuf)
+            delete [] overlapbuf[i];
+        if(forward_plan)
+            rfftwnd_destroy_plan(forward_plan[i]);
+        if(inverse_plan)
+            rfftwnd_destroy_plan(inverse_plan[i]);
+    }
+    delete [] outbuf;
+    delete [] inbuf;
+    delete [] imbuf;
+    delete [] overlapbuf;
+	return 0;
+}
+
+
+// insize is raw samplecount,buflen is insize/chans
+void mc_split(double* inbuf,double** out,long insize,long chans)
+{
+    long i,j,buflen = insize/chans;
+    double* pinbuf;
+
+    
+    for(j=0;j < chans;j++){
+        pinbuf = inbuf+j;
+        for(i=0;i < buflen;i++){
+            out[j][i] = *pinbuf;
+            pinbuf += chans;
+        }
+    }
+}
+
+
+/* insize is m/c frame count */
+void mc_interl(double** in,double* out,long insize,long chans)
+{
+    long i,j;
+    double* poutbuf;
+
+    for(j = 0;j < chans;j++){
+        poutbuf = out+j;
+        for(i=0;i < insize;i++){
+            *poutbuf = in[j][i];
+            poutbuf += chans;
+        }
+    }
+}
+
+/* OR:  apply scalefac to impulse responses */
+void complexmult(double *frame,const double *impulse,long length)
+{
+	double re,im;
+	
+	int i,j;
+	
+
+	for(i=0,j = 1;i < length;i+=2,j+=2){
+		re = frame[i] * impulse[i] - frame[j] * impulse[j];
+		im = frame[i] * impulse[j] + frame[j]* impulse[i];
+		frame[i] = re;
+		frame[j] = im;
+	}
+}
+
+#ifdef unix
+int stricmp(const char *a, const char *b)
+{
+	while(*a != '\0' && *b != '\0') {
+		int ca = islower(*a) ? toupper(*a) : *a;
+		int cb = islower(*b) ? toupper(*b) : *b;
+        
+		if(ca < cb)
+			return -1;
+		if(ca > cb)
+			return 1;
+        
+		a++;
+		b++;
+	}
+	if(*a == '\0' && *b == '\0')
+		return 0;
+	if(*a != '\0')
+		return 1;
+	return -1;
+}
+
+int
+strnicmp(const char *a, const char *b, const int length)
+{
+	int len = length;
+    
+	while(*a != '\0' && *b != '\0') {
+		int ca = islower(*a) ? toupper(*a) : *a;
+		int cb = islower(*b) ? toupper(*b) : *b;
+        
+		if(len-- < 1)
+			return 0;
+        
+		if(ca < cb)
+			return -1;
+		if(ca > cb)
+			return 1;
+        
+		a++;
+		b++;
+	}
+	if(*a == '\0' && *b == '\0')
+		return 0;
+	if(*a != '\0')
+		return 1;
+	return -1;
+}
+#endif
+
+
+
+
+
+

+ 752 - 0
dev/externals/fastconv/fconv.cpp

@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* fastconv.cpp: */
+/*  self-contained prog for fast convolution (reverb, FIR filtering, bformat etc) 
+ *  
+*/
+
+/* um, there is nothing C++ish about this code apart from use of new, delete! */
+
+/*TODO: control wet/dry mix with something... */
+/* auto-rescale arbitrary impulse responses? */
+/* Feb 2013: rebuilt with updated portsf */
+/* August 2013 epanded usage message re text file. */
+extern "C"
+{
+
+#include <portsf.h>
+
+}
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/timeb.h>
+
+
+#ifdef _DEBUG
+#include <assert.h>
+#endif
+
+#ifdef unix
+#include <ctype.h>
+int stricmp(const char *a, const char *b);
+int strnicmp(const char *a, const char *b, const int length);
+#endif
+
+#ifndef WAVE_FORMAT_IEEE_FLOAT
+#define WAVE_FORMAT_IEEE_FLOAT (0x0003)
+#endif
+
+/* convert from mono text impulse file */
+int genimpframe1(double *insbuf, double*** outbuf, int npoints, double scalefac);
+/* convert from multichan soundfile */
+int genimpframe2(int ifd,double*** outframe, double* rms,int imchans,double scalefac);
+void mc_split(double* inbuf,double** out,int insize,int chans);
+void mc_interl(double** in,double* out,int insize,int chans);
+void complexmult(double *frame,const double *impulse,int length);
+
+
+extern "C"{
+void fft_(double *, double *,int,int,int,int);
+void fftmx(double *,double *,int,int,int,int,int,int *,double *,double *,double *,double *,int *,int[]);
+void reals_(double *,double *,int,int);
+}
+
+
+#define DEFAULT_BUFLEN (32768)
+
+enum {ARG_NAME,ARG_INFILE,ARG_IMPFILE,ARG_OUTFILE,ARG_NARGS};
+
+void usage(const char *progname)
+{
+
+    printf("\n\n%s v1.2 RWD,CDP July 2010,2013",progname);
+	printf("\nMulti-channel FFT-based convolver");
+
+	printf("\nUsage: \n    %s [-aX][-f] infile impulsefile outfile [dry]\n"		               
+           "   -aX        : scale output amplitude by X\n"
+           "   -f         : write output as floats (no clipping)\n"
+           "  infile      : input soundfile to be processed.\n"
+           "  impulsefile : m/c soundfile or mono text file containing impulse response,\n"
+           "                  e.g. reverb or FIR filter.\n"
+           "                Text file name must have extension .txt.\n"
+		   "                  File must contain 1 column of floating point values,\n"
+		   "                  typically in the range -1.0 to 1.0.\n"
+           "              Supported channel combinations:\n"
+           "               (a) mono infile, N-channel impulsefile;\n"
+           "               (b) channels are the same;\n"
+           "               (c) mono impulsefile, N-channel infile.\n"
+           "  [dry]       :  set dry/wet mix (e.g. for reverb)\n"
+           "                 Range: 0.0 - 1.0,  default = 0.0\n"
+           "                 (uses sin/cos law for constant power mix)\n"
+           "Note: some recorded reverb impulses effectively include the direct signal.\n"
+           "In such cases  <dry>  need not be used\n"
+           "Where impulsefile is filter response (FIR), optimum length is power-of-two - 1.\n",progname
+		   );		   
+}
+
+
+double
+timer()
+{
+	struct timeb now;
+	double secs, ticks;	
+	ftime(&now);
+	ticks = (double)now.millitm/(1000.0);
+	secs = (double) now.time;
+
+	return secs + ticks;
+}
+
+
+void			
+stopwatch(int flag) 
+{
+	static double start;		    
+	int mins=0,hours=0;
+	double end, secs=0;
+
+	if(flag)
+		start = timer();	
+	else 
+	{
+		end    = timer(); 
+		secs   = end - start;
+		mins   = (int)(secs/60.0);
+		secs  -= mins*60.0; 
+		hours  = mins/60;
+		mins  -= hours*60;
+
+		fprintf(stderr,"\nElapsed time: ");
+		if(hours > 0)
+			fprintf(stderr,"%d h ", hours);
+		if(mins > 0)
+			fprintf(stderr,"%d m ", mins);
+		fprintf(stderr,"%2.3lf s\n\n",secs);
+	}
+}
+
+/* how do we want this to work?
+
+  (1)  multi-chan impulse:  EITHER: mono infile  OR infile with same chan count
+  (2)  mono impulse:  expanded to infile chancount
+     Therefore: need to open both infiles before deciding action
+*/
+#define PI2 (1.570796327)
+
+int main(int argc,char **argv)
+{
+
+	int fftlen = 1,imlen = 0,chans = 0,srate;
+	double scalefac = 1.0f;
+    double Ninv = 1.0;
+	int insndfile = -1,inimpfile = -1,outsndfile = -1; 
+    int nameoffset = 0;
+	PSF_PROPS inprops,outprops, impulseprops;
+    psf_format format;
+    PSF_CHPEAK  *fpeaks = NULL;
+	MYLONG peaktime;
+	int i,jj,minheader = 0,do_timer = 1;
+    int writefloats = 0;
+    int framesneeded;
+	double oneovrsr;
+    double *inmonobuf = 0;
+	double *insbuf=0,*outsbuf = 0;
+    double **inbuf = 0, **outbuf = 0;    
+	double **imbuf = 0;
+	double **overlapbuf = 0;
+    double rms = 0.0;
+    double dry = 0.0;
+    double wet = 1.0;
+#ifdef FFTTEST
+    double *anal = 0;
+#endif
+    	
+    if(argv[0][0]=='.' && argv[0][1]=='/'){
+        nameoffset  = 2;
+    }
+	
+    if(argc==2){
+        if(strcmp(argv[1],"--version")==0){
+            printf("1.2.0.\n");
+            return 0;
+        }
+    }
+
+	if(psf_init()){
+		puts("unable to start portsf\n");
+		return 1;
+	}
+
+
+	if(argc < ARG_NARGS){		 
+		usage(argv[0]+nameoffset);
+		return(1);
+	}
+
+    
+
+    while(argc > 1 && argv[1][0]=='-'){				
+		switch(argv[1][1]){
+        case 'a':
+            scalefac =  atof(&(argv[1][2]));
+            if(scalefac <=0.0){
+                printf("Error: scalefac must be positive!\n");
+                return 1;
+            }
+            break;        
+        case 'f':
+            writefloats = 1;
+            break;
+        default:
+            break;
+        }
+        argv++;
+        argc--;
+    }		
+	/* 2 legal possibilities: infile and outfile, or -I used with infile only */
+	if(argc< ARG_NARGS){
+		fprintf(stderr,"\nInsufficient arguments.");
+		usage(argv[0]+nameoffset);
+		return(1);
+	}
+    if(argc==ARG_NARGS+1){
+        double dryarg;
+        dryarg = atof(argv[ARG_NARGS]);
+        if(dryarg < 0.0 || dryarg > 1.0){
+            printf("dry value out of range.\n");
+            return 0;
+        }
+        if(dryarg==1.0){
+            printf("Warning: dry=1 copies input!\n");
+            wet = 0.0;
+        }
+        else{
+            dry = sin(PI2 * dryarg);
+            wet = cos(PI2 * dryarg);
+        }
+    }
+
+		
+
+/* TODO:  where -F[file] is combined with -A, it signifies create analysis file
+           compatible with impulse file (e.g 50% overlap, etc) */
+
+	
+	/* open infile, check props */	
+		
+	if((insndfile = psf_sndOpen(argv[ARG_INFILE],&inprops, 0)) < 0){
+		fprintf(stderr,"\nUnable to open input soundfile %s",argv[1]);
+        delete []imbuf;
+		return 1;
+	}
+    srate = inprops.srate;
+	if(srate <=0){
+		fprintf(stderr,"\nBad srate found: corrupted file?\n");
+        delete []imbuf;
+		return 1;
+	}
+	chans = inprops.chans;
+    framesneeded = psf_sndSize(insndfile);
+    if(framesneeded <= 0){
+        printf("Error in input file - no data!\n");
+        psf_sndClose(insndfile);
+        return 1;
+    }
+    /* open impulse file */
+    /* check for soundfile */
+      
+    format = psf_getFormatExt(argv[ARG_IMPFILE]);
+    if(format==PSF_FMT_UNKNOWN){  /* must be a text file */
+        FILE *fp = 0;
+        char tmp[80];
+        char* dot;
+        int size = 0,got = 0;
+        int read = 0;
+
+        dot = strrchr(argv[ARG_IMPFILE],'.');
+        if(dot==NULL || stricmp(dot,".txt") != 0){
+            fprintf(stderr,"Error: impulse text file must have .txt extension.\n");
+            return 1;
+        }
+        fp = fopen(argv[ARG_IMPFILE],"r");
+        if(fp==0){
+            printf("Cannot open impulse text file %s\n.",argv[ARG_IMPFILE]);
+            return 1;
+        }
+        /* count lines! */
+        while(fgets(tmp,80,fp) != NULL)
+            size++;
+        if(size==0){
+            printf("Impulse textfile %s has no data!.\n",argv[ARG_IMPFILE]);
+            return 1;
+        }
+        rewind(fp);
+            
+        inmonobuf = new double[size+1];
+        for(i=0;i < size;i++)  {
+            read = fscanf(fp,"%lf",&inmonobuf[i]);
+            if(read==0){
+                i--;
+                continue;
+            }
+            if(read==EOF)
+                break;
+            got++;
+        }
+        imlen = got;
+        impulseprops.chans = 1;
+        fclose(fp);
+    }
+    else{
+        if((inimpfile = psf_sndOpen(argv[ARG_IMPFILE],&impulseprops, 0))< 0){
+            fprintf(stderr,"\nUnable to open impulse file %s",argv[ARG_IMPFILE]);       
+            return 0;
+        }
+        //printf("impulse file sr = %d\n",impulseprops.srate);
+        if(srate != impulseprops.srate){
+            printf("Error: files must have same sample rate");
+            delete []imbuf;
+            return 1;
+        }
+        int  len = psf_sndSize(inimpfile);
+        if(len <= 0){
+            printf("Error in impulse soundfile - no data!\n");
+            return 1;
+        }
+        if(impulseprops.chans > 1){
+            if(! (chans == 1 || chans == impulseprops.chans)){
+                fprintf(stderr,"\nChannel mismatch.\n    Infile must be mono or have same channels as irfile.\n");
+                return(1);
+            }
+            chans = impulseprops.chans;
+        }    
+    }
+
+    imbuf = new double*[chans];
+
+    /* if impulse file is mono, we will need to copy data to the other buffers */
+    // allocate  impulseprops.chans buffers ; may need more
+
+    if(inimpfile >=0){
+	    if((imlen = genimpframe2(inimpfile,&imbuf,&rms,impulseprops.chans, scalefac)) == 0){
+	    	fprintf(stderr,"Error reading impulse file\n");
+	    	return(1);
+	    }
+    }
+    
+    else if(imlen){        
+        genimpframe1(inmonobuf,&imbuf,imlen,scalefac);       
+    }
+    printf("mean rms level = %.4lf (%.2lf dB)\n",rms, 20.0 * log10(rms));
+    
+
+    framesneeded +=  imlen;        /* can  close outfile, when this length reached */
+
+    while(fftlen < imlen*2)			/* convolution style - double-length */
+		fftlen <<= 1;
+    double norm = sqrt(2.0);       /* relative: rms of 0dBFS sine is 0.707 = 1/root2 */
+    // scale factor: most of this sheer guesswork!
+    Ninv = fftlen;
+    Ninv /= sqrt(imlen*2);
+    Ninv *= norm;
+    Ninv /= imlen;
+    
+    // take simple avg of  rms for adjustment factor.
+    // may not adequately represent some responses, e.g. with strong attack/earlies, soft reverb tail */
+    double rmsdif2 =  (-20.0 * log10(rms)) * 0.5;
+    double rmsadjust = pow(10, rmsdif2/20.0);
+#ifdef _DEBUG
+    printf("rescaling factor = %.6e\n",Ninv);   
+    printf("rmsadjust = %.4lf\n",rmsadjust);
+#endif
+   Ninv /= rmsadjust; 
+
+
+    /* copy buffers if required */
+    for(i = impulseprops.chans;i < chans;i++){
+        imbuf[i] = new double[fftlen+2];
+        memcpy(imbuf[i],imbuf[0],(fftlen+2)* sizeof(double));
+    }         
+    oneovrsr = 1.0 / (double) srate;
+    
+   
+	/* main i/o buffers */
+	
+	insbuf     = new double [fftlen  * chans];
+    outsbuf    = new double [fftlen  * chans];
+	inbuf      = new double*[chans];
+    outbuf     = new double*[chans];  /* overlap-add buffers */
+    overlapbuf = new double*[chans];
+    
+    for(i=0;i < chans;i++){
+        inbuf[i]  = new double[fftlen+2];   // main in-place buf 
+        outbuf[i] = new double[fftlen+2];        
+	    /* channel buffers */	
+        overlapbuf[i] = new double[fftlen/2];
+        memset(overlapbuf[i],0,sizeof(double)*(fftlen/2));        
+    }
+#ifdef FFTTEST
+    anal = new double[fftlen+2];
+#endif
+    
+    for(i=0;i < chans;i++){		    
+	    memset(inbuf[i], 0, sizeof(double) * (fftlen+2));
+        memset(outbuf[i],0,sizeof(double) * (fftlen+2));
+    }
+
+    
+	/* use generic init function */
+/*bool phasevocoder::init(int outsrate,int fftlen,int winlen,int decfac,float scalefac,
+						pvoc_scaletype stype,pvoc_windowtype wtype,pvocmode mode)
+*/
+	
+	/*create output sfile */
+	psf_stype smptype;
+	psf_format outformat;
+	/* will it be aiff, wav, etc? */
+	outformat = psf_getFormatExt(argv[ARG_OUTFILE]);
+	if(outformat==PSF_FMT_UNKNOWN){
+		fprintf(stderr,"\nOutfile name has unrecognized extension.");
+        delete []imbuf;
+		return(1);
+	}
+		
+		
+	smptype = inprops.samptype;
+    if(writefloats)
+        smptype= PSF_SAMP_IEEE_FLOAT;
+
+	/*the one gotcha: if output is floats and format is aiff, change to aifc */
+	if(smptype==PSF_SAMP_IEEE_FLOAT && outformat==PSF_AIFF){
+		fprintf(stderr,"Warning: AIFF output written as AIFC for float samples\n");
+		outformat = PSF_AIFC;
+	}
+
+	outprops          = inprops;
+	outprops.chans    = chans;
+	outprops.srate    = srate;
+	outprops.format   = outformat;
+	outprops.samptype = smptype;
+	outprops.chformat = STDWAVE;
+    /* if irfile is BFormat, need to set outfile fmt likewise */
+    if(impulseprops.chformat==MC_BFMT)
+        outprops.chformat = MC_BFMT;
+    /* I suppose people will want automatic decoding too...grrr */
+
+    fpeaks = new PSF_CHPEAK[chans];
+	if(fpeaks==NULL){
+		puts("no memory for fpeak data buffer\n");
+		return 1;
+	}
+
+	/*last arg: no clipping of f/p samples: we use PEAK chunk */
+	if((outsndfile = psf_sndCreate(argv[ARG_OUTFILE],&outprops,0,minheader,PSF_CREATE_RDWR)) <0 ){
+		fprintf(stderr,"\nUnable to open outfile %s",argv[ARG_OUTFILE]);
+        delete []imbuf;
+		return(1);
+	}
+				
+
+	
+	printf("\n");
+	
+	
+	stopwatch(1);
+
+	int written,thisblock,framesread;
+    int frameswritten = 0;
+	double intime= 0.0;
+				
+	while((framesread = psf_sndReadDoubleFrames(insndfile,insbuf,imlen)) > 0){        
+		written = thisblock =  0;
+
+		for(i = framesread * inprops.chans; i< fftlen * inprops.chans; i++)
+			insbuf[i] = 0.0f;
+        framesread = imlen;
+		memset(inbuf[0],0,(fftlen+2) * sizeof(double));
+        if(chans == inprops.chans)  {
+            /* must clean buffers! */
+		    for(i=0;i < chans;i++)
+                memset(inbuf[i],0,(fftlen+2) * sizeof(double));
+            mc_split(insbuf,inbuf,imlen * chans, chans);
+
+        }
+        else{
+            for(i=0;i < chans;i++) {
+                memset(inbuf[i],0,(fftlen+2) * sizeof(double));
+                memcpy(inbuf[i],insbuf,imlen * sizeof(double));
+                memset(outbuf[i],0,sizeof(double) * (fftlen+2));
+
+            }
+        }
+        if(impulseprops.chans==1){
+			
+            for(jj = 0; jj < chans;jj++){
+#ifdef FFTTEST
+                int zz;
+                memcpy(anal,inbuf[jj],(fftlen+2) * sizeof(double));
+                fft_(anal,anal+1,1,fftlen/2,1,-2);
+	            reals_(anal,anal+1,fftlen/2,-2);
+                for(zz=0;zz < fftlen+2;zz++)
+                    anal[zz] *= 0.001;
+#endif
+                //rfftwnd_one_real_to_complex(forward_plan[jj],inbuf[jj],NULL);	
+				double *danal = inbuf[jj];
+				fft_(danal,danal+1,1,fftlen/2,1,-2);
+				reals_(danal,danal+1,fftlen/2,-2);
+                complexmult(inbuf[jj],imbuf[0],fftlen+2);                
+			    //rfftwnd_one_complex_to_real(inverse_plan[jj],(fftw_complex * )inbuf[jj],NULL);
+				reals_(danal,danal+1,fftlen/2,2);
+				fft_(danal,danal+1,1,fftlen/2,1,2);
+            }           
+        }
+        else{
+            for(jj = 0; jj < chans;jj++){
+				//rfftwnd_one_real_to_complex(forward_plan[jj],inbuf[jj],NULL);                   				
+                double *danal = inbuf[jj];
+				fft_(danal,danal+1,1,fftlen/2,1,-2);
+				reals_(danal,danal+1,fftlen/2,-2);
+				complexmult(inbuf[jj],imbuf[jj],fftlen+2);                
+				//rfftwnd_one_complex_to_real(inverse_plan[jj],(fftw_complex * )inbuf[jj],NULL); 
+				reals_(danal,danal+1,fftlen/2,2);
+				fft_(danal,danal+1,1,fftlen/2,1,2);
+            }            
+        }
+        
+        /* overlap-add  for each channel */
+        /* TODO: verify  use of imlen here - should it be fftlen/2 -1 ? */
+        for(jj=0;jj < chans;jj++){
+            for(i=0;i < imlen;i++) {
+                outbuf[jj][i] = inbuf[jj][i] + overlapbuf[jj][i];
+                overlapbuf[jj][i] = inbuf[jj][i+imlen];
+            }
+        }
+		mc_interl(outbuf,outsbuf,imlen,chans);
+
+        if(inprops.chans == chans){
+            for(i=0;i < framesread; i++) {
+                for(jj=0;jj < chans;jj++){
+                    int  outindex = i*chans + jj;            
+                    outsbuf[outindex] *= Ninv;
+                    outsbuf[outindex] *= wet;
+                    outsbuf[outindex] += dry * insbuf[outindex];
+                }
+            }
+        }
+        /* elso mono input */
+        else {
+            for(i=0;i < framesread; i++) {
+                for(jj=0;jj < chans;jj++){
+                    int  outindex = i*chans + jj;
+                    double inval = dry *  insbuf[i];
+                    outsbuf[outindex] *= Ninv;
+                    outsbuf[outindex] *= wet;
+                    outsbuf[outindex] += inval;
+                }
+            }
+        }
+
+        if((written = psf_sndWriteDoubleFrames(outsndfile,outsbuf,framesread)) != framesread){
+		    fprintf(stderr,"\nerror writing to outfile");
+		    return(1);		               
+        }
+        frameswritten += written;
+
+		if(do_timer){
+			intime += (double)framesread * oneovrsr;
+			printf("Input time: %.2lf\r",intime);
+		}    
+    }
+    /* complete tail */
+
+    if(frameswritten < framesneeded){
+        // TODO: imlen? see above
+        mc_interl(overlapbuf,outsbuf,imlen,chans);
+        int towrite = framesneeded - frameswritten; 
+        for(i=0;i < towrite * chans; i++) {
+            outsbuf[i] *= Ninv;
+            outsbuf[i] *= wet;
+        }
+        if((written = psf_sndWriteDoubleFrames(outsndfile,outsbuf,towrite)) != towrite){
+	        fprintf(stderr,"\nerror writing to outfile");
+	        return(1);
+	    }
+    }
+
+	stopwatch(0);
+    if(psf_sndReadPeaks( outsndfile,fpeaks,&peaktime)){
+        double peakmax = 0.0;
+		printf("PEAK values:\n");
+		for(i=0; i < chans; i++)	{
+            peakmax = fpeaks[i].val > peakmax ? fpeaks[i].val : peakmax;
+			if(fpeaks[i].val < 0.0001f)
+				printf("CH %d:\t%e (%.2lf dB)\tat frame %10u :\t%.4lf secs\n",i+1,
+				fpeaks[i].val,20.0*log10(fpeaks[i].val),fpeaks[i].pos,(double) (fpeaks[i].pos) / (double)srate);
+			else
+				printf("CH %d:\t%.4lf (%.2lf dB)\tat frame %10u :\t%.4lf secs\n",i+1,
+				fpeaks[i].val,20.0 * log10(fpeaks[i].val),fpeaks[i].pos,(double) (fpeaks[i].pos) / (double)srate);		
+		}
+        if(peakmax > 1.0)
+            printf("Overflows!  Rescale by %.10lf\n",1.0 / peakmax);
+	}
+
+	if(insndfile >=0)
+		psf_sndClose(insndfile);
+	if(outsndfile >=0)
+		psf_sndClose(outsndfile);
+    if(inimpfile >=0)
+	    psf_sndClose(inimpfile);
+	psf_finish();
+    delete [] fpeaks;
+	if(insbuf)
+		delete [] insbuf;
+	if(outsbuf)
+		delete [] outsbuf;
+    
+
+    for(i=0;i < chans;i++){
+        if(inbuf){       
+		    delete [] inbuf[i];
+        }           
+        if(outbuf){
+		    delete [] outbuf[i];
+        }       	
+        if(imbuf){        
+	        delete [] imbuf[i];
+        }
+        if(overlapbuf)
+            delete [] overlapbuf[i];
+    }
+    delete [] outbuf;
+    delete [] inbuf;
+    delete [] imbuf;
+    delete [] overlapbuf;
+	return 0;
+}
+
+
+// insize is raw samplecount,buflen is insize/chans
+void mc_split(double* inbuf,double** out,int insize,int chans)
+{
+    int i,j,buflen = insize/chans;
+    double* pinbuf;
+
+    
+    for(j=0;j < chans;j++){
+        pinbuf = inbuf+j;
+        for(i=0;i < buflen;i++){
+            out[j][i] = *pinbuf;
+            pinbuf += chans;
+        }
+    }
+}
+
+
+/* insize is m/c frame count */
+void mc_interl(double** in,double* out,int insize,int chans)
+{
+    int i,j;
+    double* poutbuf;
+
+    for(j = 0;j < chans;j++){
+        poutbuf = out+j;
+        for(i=0;i < insize;i++){
+            *poutbuf = in[j][i];
+            poutbuf += chans;
+        }
+    }
+}
+
+/* OR:  apply scalefac to impulse responses */
+void complexmult(double *frame,const double *impulse,int length)
+{
+	double re,im;
+	
+	int i,j;
+	
+
+	for(i=0,j = 1;i < length;i+=2,j+=2){
+		re = frame[i] * impulse[i] - frame[j] * impulse[j];
+		im = frame[i] * impulse[j] + frame[j]* impulse[i];
+		frame[i] = re;
+		frame[j] = im;
+	}
+}
+
+#ifdef unix
+int stricmp(const char *a, const char *b)
+{
+	while(*a != '\0' && *b != '\0') {
+		int ca = islower(*a) ? toupper(*a) : *a;
+		int cb = islower(*b) ? toupper(*b) : *b;
+        
+		if(ca < cb)
+			return -1;
+		if(ca > cb)
+			return 1;
+        
+		a++;
+		b++;
+	}
+	if(*a == '\0' && *b == '\0')
+		return 0;
+	if(*a != '\0')
+		return 1;
+	return -1;
+}
+
+int
+strnicmp(const char *a, const char *b, const int length)
+{
+	int len = length;
+    
+	while(*a != '\0' && *b != '\0') {
+		int ca = islower(*a) ? toupper(*a) : *a;
+		int cb = islower(*b) ? toupper(*b) : *b;
+        
+		if(len-- < 1)
+			return 0;
+        
+		if(ca < cb)
+			return -1;
+		if(ca > cb)
+			return 1;
+        
+		a++;
+		b++;
+	}
+	if(*a == '\0' && *b == '\0')
+		return 0;
+	if(*a != '\0')
+		return 1;
+	return -1;
+}
+#endif
+
+
+
+
+
+

+ 235 - 0
dev/externals/fastconv/genrespframe2.cpp

@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* genrespframe2.cpp */
+/* generate m/c pvoc frames containing impulse response */
+extern "C"
+{
+#include <portsf.h>
+}
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+
+
+#ifdef _DEBUG
+#include <assert.h>
+#endif
+
+/* deinterleave input buffer of insize samps to array of chans buffers */
+void mc_split(double* inbuf,double** out,int insize,int chans);
+extern "C"{
+	void fft_(double *, double *,int,int,int,int);
+	void fftmx(double *,double *,int,int,int,int,int,int *,double *,double *,double *,double *,int *,int[]);
+	void reals_(double *,double *,int,int);
+}
+
+/*  read impulse data from soundfile */
+/* return 0 for error, or size of impulse */
+/*we assume pvsys initialized by caller */
+int genimpframe2(int ifd, double*** outbufs, double* rms,int imchans, double scalefac)
+{
+	int i,j;	
+	double *insbuf = 0;
+    double **inbuf = *outbufs;
+	int fftsize = 1;
+    int inframes;
+    double*  rmsfac = 0;
+    double* ampsum = 0;
+    double  maxrmsfac = 0.0;
+#ifdef _DEBUG
+    double *re,*im,*mag;
+#endif
+	inframes = psf_sndSize(ifd);  // m/c frames
+	if(inframes <= 0)
+        return 0;
+	while(fftsize < inframes*2)			/* convolution style - double-length */
+		fftsize <<= 1;
+	printf("impulse length = %d frames, fftsize = %d\n",inframes,fftsize);
+    insbuf = new double[inframes * imchans];
+#ifdef _DEBUG
+    re = new double[fftsize/2+1];
+    im = new double[fftsize/2+1];
+    mag = new double[fftsize/2+1];
+#endif
+    for(i=0;i < imchans;i++){	
+	    inbuf[i] = new double[fftsize+2];
+	    if(inbuf[i]==NULL){
+		    puts("no memory for file buffer!\n");                    
+		    return 0;
+	    }
+	    memset(inbuf[i],0,(fftsize+2)* sizeof(double));
+    }
+
+
+	if(inframes != psf_sndReadDoubleFrames(ifd,insbuf,inframes)){
+		fprintf(stderr,"Error reading impulse data\n");
+		
+		delete [] insbuf;
+        // and do other cleanup!
+        
+		return 0;
+	}
+    rmsfac = new double[imchans];
+    ampsum = new double[imchans];
+    for(i=0;i< imchans;i++) {
+        rmsfac[i] = 0.0;
+        ampsum[i] = 0.0;
+    }
+    /* do user scaling first */
+    for(i = 0;i < inframes * imchans;i++)
+        insbuf[i] *= scalefac;
+    /* now try to adjust rms  */
+
+    for(i = 0;i < inframes;i++) {
+        for(j=0;j < imchans;j++){
+            double val = insbuf[i*imchans + j];
+            ampsum[j] += fabs(val);
+            rmsfac[j] += val*val; 
+        }
+    }
+    for(j=0;j < imchans;j++){
+        //    rmsfac = sqrt(rmsfac);
+        rmsfac[j] /= inframes;
+        rmsfac[j] = sqrt(rmsfac[j]);
+        ampsum[j] /= inframes;
+        if(rmsfac[j] > maxrmsfac)
+            maxrmsfac = rmsfac[j];
+#ifdef _DEBUG
+        if(ampsum[j] > maxampsum)
+            maxampsum = ampsum[j];
+#endif
+    }
+    /* do the rescaling! */
+          
+#ifdef _DEBUG        
+        printf("ampsum = %.4f\n",maxampsum);
+#endif
+    
+    // now deinterleave to each inbuf
+    mc_split(insbuf,inbuf,inframes * imchans,imchans);
+    for(i=0;i < imchans;i++){
+		double *anal = inbuf[i];
+	    //rfftwnd_one_real_to_complex(forward_plan[i],inbuf[i],NULL);
+		fft_(anal,anal+1,1,fftsize/2,1,-2);
+		reals_(anal,anal+1,fftsize/2,-2);
+    }
+#ifdef _DEBUG
+    /* in order to look at it all */
+    double  magmax = 0.0;
+    double magsum = 0.0;
+    for(i=0;i < fftsize/2+1;i++){
+        double thisre, thisim;
+        thisre =inbuf[0][i*2];        
+        thisim = inbuf[0][i*2+1]; 
+        re[i] = thisre;
+        im[i] = thisim;
+        mag[i] = sqrt(thisre*thisre + thisim*thisim); 
+        magsum += (mag[i] * mag[i]);
+        if(mag[i] > magmax)
+            magmax = mag[i];
+    }
+    magsum = sqrt(magsum);
+    printf("maxamp of FFT = %.4f\n",magmax);
+    printf("mean level of FFT = %.4f\n",magsum / (fftsize/2+1));
+#endif	
+    
+    delete [] rmsfac;
+    delete [] ampsum;
+
+#ifdef _DEBUG
+    delete [] re;
+    delete [] im;
+    delete [] mag;
+#endif
+    *rms = maxrmsfac;
+	return inframes;
+}
+/* convert from input double buffer (read from mono text impulse file) */
+int genimpframe1(double *insbuf, double*** outbuf, int npoints, double scalefac)
+{
+	int i;	
+    double **inbuf = *outbuf;
+	int fftsize = 1;
+    int insamps;
+#ifdef _DEBUG
+    double *re,*im,*mag;
+#endif
+	insamps = npoints;  // m/c frames
+	if(insamps <= 0)
+        return 0;
+	while(fftsize < insamps*2)			/* convolution style - double-length */
+		fftsize <<= 1;
+	printf("infile size = %d,impulse framesize = %d\n",insamps,fftsize);
+    
+#ifdef _DEBUG
+    re = new double[fftsize/2+1];
+    im = new double[fftsize/2+1];
+    mag = new double[fftsize/2+1];
+#endif
+    	
+	inbuf[0] = new double[fftsize+2];
+	if(inbuf[0]==NULL){
+	    puts("no memory for file buffer!\n");                    
+	    return 0;
+	}
+	memset(inbuf[0],0,(fftsize+2)* sizeof(double)); 
+#ifdef _DEBUG
+    double ampsum = 0.0;
+#endif
+    for(i = 0;i < insamps;i++) {
+#ifdef _DEBUG
+        ampsum += fabs(insbuf[i]);
+#endif        
+        insbuf[i] *= scalefac;
+    }
+#ifdef _DEBUG
+    printf("amplitude sum of impulse file = %f\n",ampsum);
+#endif
+    memcpy(inbuf[0],insbuf,npoints* sizeof(double));
+	//rfftwnd_one_real_to_complex(forward_plan,inbuf[0],NULL);
+	double *anal = inbuf[0];
+	fft_(anal,anal+1,1,fftsize/2,1,-2);
+	reals_(anal,anal+1,fftsize/2,-2);
+    
+#ifdef _DEBUG
+    /* in order to look at it all */
+    for(i=0;i < fftsize/2+1;i++){
+        double thisre, thisim;
+        thisre =inbuf[0][i*2];        
+        thisim = inbuf[0][i*2+1]; 
+        re[i] = thisre;
+        im[i] = thisim;
+        mag[i] = sqrt(thisre*thisre + thisim*thisim);
+    }
+#endif	
+    
+    
+#ifdef _DEBUG
+    delete [] re;
+    delete [] im;
+    delete [] mag;
+#endif
+   
+
+	return insamps;
+}

+ 883 - 0
dev/externals/fastconv/mxfftd.c

@@ -0,0 +1,883 @@
+/*  
+    mxfftd.c: double precision version of mxfft.c
+	 
+	This file is part of the CDP System.
+
+    The CDP System 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.
+
+    The CDP System 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 the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+
+*/
+
+/* This program converted from the FORTRAN routines by Singleton in
+ * Section 1.4 of  "Programs for Digital Signal Processing", IEEE Press, 1979.
+ *  Conversion by Trevor Wishart and Keith Henderson, York Univ.
+ */
+
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+void fft_(double *, double *, int, int, int, int);
+void fftmx(double *, double *, int, int, int, int, int,
+      int*, double *, double *, double *, double *, int *, int[]);
+void reals_(double *, double *, int, int);
+
+/*
+ *-----------------------------------------------------------------------
+ * subroutine:  fft
+ * multivariate complex fourier transform, computed in place
+ * using mixed-radix fast fourier transform algorithm.
+ *-----------------------------------------------------------------------
+ *
+ *      this is the call from C:
+ *              fft_(anal,banal,&one,&N2,&one,&mtwo);
+ *      CHANGED TO:-
+ *              fft_(anal,banal,one,N2,one,mtwo);
+ */
+
+void
+fft_(double *a, double *b, int nseg, int n, int nspn, int isn)
+  /*    *a,       pointer to array 'anal'  */
+  /*    *b;       pointer to array 'banal' */
+{
+    int nfac[16];               /*  These are one bigger than needed   */
+                                /*  because wish to use Fortran array  */
+                                /* index which runs 1 to n, not 0 to n */
+
+    int         m = 0,
+                nf,
+                k,
+                kt,
+                ntot,
+                j,
+                jj,
+                maxf, maxp=-1;
+
+/* work space pointers */
+    double       *at, *ck, *bt, *sk;
+    int *np;
+
+
+/* reduce the pointers to input arrays - by doing this, FFT uses FORTRAN
+   indexing but retains compatibility with C arrays */
+    a--;        b--;
+
+/*
+ * determine the factors of n
+ */
+    k=nf=abs(n);
+    if (nf==1)
+      return;
+
+    nspn=abs(nf*nspn);
+    ntot=abs(nspn*nseg);
+
+    if (isn*ntot == 0) {
+      printf("\nerror - zero in fft parameters %d %d %d %d",
+              nseg, n, nspn, isn);
+      return;
+    }
+    for (m=0; !(k%16); nfac[++m]=4,k/=16);
+    for (j=3,jj=9; jj<=k; j+=2,jj=j*j)
+      for (; !(k%jj); nfac[++m]=j,k/=jj);
+
+    if (k<=4) {
+      kt = m;
+      nfac[m+1] = k;
+      if (k != 1)
+        m++;
+    }
+    else {
+      if (k%4==0) {
+        nfac[++m]=2;
+        k/=4;
+      }
+
+      kt = m;
+      maxp = (kt+kt+2 > k-1 ? kt+kt+2 : k-1);
+      for (j=2; j<=k; j=1+((j+1)/2)*2)
+        if (k%j==0) {
+          nfac[++m]=j;
+          k/=j;
+        }
+    }
+    if (m <= kt+1)
+      maxp = m + kt + 1;
+    if (m+kt > 15) {
+      printf("\nerror - fft parameter n has more than 15 factors : %d", n);
+      return;
+    }
+    if (kt!=0) {
+      j = kt;
+      while (j)
+        nfac[++m]=nfac[j--];
+    }
+    maxf = nfac[m-kt];
+    if (kt > 0 && maxf <nfac[kt])
+      maxf = nfac[kt];
+
+/*  allocate workspace - assume no errors! */
+    at = (double *) calloc(maxf,sizeof(double));
+    ck = (double *) calloc(maxf,sizeof(double));
+    bt = (double *) calloc(maxf,sizeof(double));
+    sk = (double *) calloc(maxf,sizeof(double));
+    np = (int *) calloc(maxp,sizeof(int));
+
+/* decrement pointers to allow FORTRAN type usage in fftmx */
+    at--;       bt--;   ck--;   sk--;   np--;
+
+/* call fft driver */
+
+    fftmx(a,b,ntot,nf,nspn,isn,m,&kt,at,ck,bt,sk,np,nfac);
+
+/* restore pointers before releasing */
+    at++;       bt++;   ck++;   sk++;   np++;
+
+/* release working storage before returning - assume no problems */
+    free(at);
+    free(sk);
+    free(bt);
+    free(ck);
+    free(np);
+    return;
+}
+
+/*
+ *-----------------------------------------------------------------------
+ * subroutine:  fftmx
+ * called by subroutine 'fft' to compute mixed-radix fourier transform
+ *-----------------------------------------------------------------------
+ */
+void
+fftmx(double *a, double *b, int ntot, int n, int nspan, int isn, int m,
+      int *kt, double *at, double *ck, double *bt, double *sk, int *np, int nfac[])
+{
+    int i,inc,
+      j,jc,jf, jj,
+      k, k1, k2, k3, k4,
+      kk,klim,ks,kspan, kspnn,
+      lim,
+      maxf,mm,
+      nn,nt;
+    double  aa, aj, ajm, ajp, ak, akm, akp,
+      bb, bj, bjm, bjp, bk, bkm, bkp,
+      c1, c2, c3, c72, cd,
+      dr,
+      rad,
+      sd, s1, s2, s3, s72, s120;
+
+    double      xx;     /****** ADDED APRIL 1991 *********/
+    inc=abs(isn);
+    nt = inc*ntot;
+    ks = inc*nspan;
+/******************* REPLACED MARCH 29: ***********************
+                                        rad = atan((double)1.0);
+**************************************************************/
+    rad = 0.785398163397448278900;
+/******************* REPLACED MARCH 29: ***********************
+                                        s72 = rad/0.625;
+                                        c72 = cos(s72);
+                                        s72 = sin(s72);
+**************************************************************/
+    c72 = 0.309016994374947451270;
+    s72 = 0.951056516295153531190;
+/******************* REPLACED MARCH 29: ***********************
+                                        s120 = sqrt((double)0.75);
+**************************************************************/
+    s120 = 0.866025403784438707600;
+
+/* scale by 1/n for isn > 0 ( reverse transform ) */
+
+    if (isn < 0) {
+      s72 = -s72;
+      s120 = -s120;
+      rad = -rad;}
+    else {
+      ak = 1.0/(double)n;
+      for (j=1; j<=nt;j += inc) {
+        a[j] *= (double)ak;
+        b[j] *= (double)ak;
+      }
+    }
+    kspan = ks;
+    nn = nt - inc;
+    jc = ks/n;
+
+/* sin, cos values are re-initialised each lim steps  */
+
+    lim = 32;
+    klim = lim * jc;
+    i = 0;
+    jf = 0;
+    maxf = m - (*kt);
+    maxf = nfac[maxf];
+    if ((*kt) > 0 && maxf < nfac[*kt])
+      maxf = nfac[*kt];
+
+/*
+ * compute fourier transform
+ */
+
+ lbl40:
+    dr = (8.0 * (double)jc)/((double)kspan);
+/*************************** APRIL 1991 POW & POW2 not WORKING.. REPLACE *******
+                    cd = 2.0 * (pow2 ( sin((double)0.5 * dr * rad)) );
+*******************************************************************************/
+    xx =  sin((double)0.5 * dr * rad);
+    cd = 2.0 * xx * xx;
+    sd = sin(dr * rad);
+    kk = 1;
+    if (nfac[++i]!=2) goto lbl110;
+/*
+ * transform for factor of 2 (including rotation factor)
+ */
+    kspan /= 2;
+    k1 = kspan + 2;
+    do {
+      do {
+        k2 = kk + kspan;
+        ak = a[k2];
+        bk = b[k2];
+        a[k2] = (a[kk]) - (double)ak;
+        b[k2] = (b[kk]) - (double)bk;
+        a[kk] = (a[kk]) + (double)ak;
+        b[kk] = (b[kk]) + (double)bk;
+        kk = k2 + kspan;
+      } while (kk <= nn);
+      kk -= nn;
+    } while (kk <= jc);
+    if (kk > kspan) goto lbl350;
+ lbl60:
+    c1 = 1.0 - cd;
+    s1 = sd;
+    mm = (k1/2 < klim ? k1/2 :klim);
+    goto lbl80;
+ lbl70:
+    ak = c1 - ((cd*c1)+(sd*s1));
+    s1 = ((sd*c1)-(cd*s1)) + s1;
+    c1 = ak;
+lbl80:
+    do {
+      do {
+        k2 = kk + kspan;
+        ak = a[kk] - a[k2];
+        bk = b[kk] - b[k2];
+        a[kk] = a[kk] + a[k2];
+        b[kk] = b[kk] + b[k2];
+        a[k2] = (double)((c1 * ak) - (s1 * bk));
+        b[k2] = (double)((s1 * ak) + (c1 * bk));
+        kk = k2 + kspan;
+      } while (kk < nt);
+      k2 = kk - nt;
+      c1 = -c1;
+      kk = k1 - k2;
+    } while (kk > k2);
+    kk += jc;
+    if (kk <= mm) goto lbl70;
+    if (kk < k2)  goto lbl90;
+    k1 += (inc + inc);
+    kk = ((k1-kspan)/2) + jc;
+    if (kk <= (jc+jc)) goto lbl60;
+    goto lbl40;
+ lbl90:
+    s1 = ((double)((kk-1)/jc)) * dr * rad;
+    c1 = cos(s1);
+    s1 = sin(s1);
+    mm = (k1/2 < mm+klim ? k1/2 : mm+klim);
+    goto lbl80;
+/*
+ * transform for factor of 3 (optional code)
+ */
+
+
+ lbl100:
+    k1 = kk + kspan;
+    k2 = k1 + kspan;
+    ak = a[kk];
+    bk = b[kk];
+    aj = a[k1] + a[k2];
+    bj = b[k1] + b[k2];
+    a[kk] = (double)(ak + aj);
+    b[kk] = (double)(bk + bj);
+    ak += (-0.5 * aj);
+    bk += (-0.5 * bj);
+    aj = (a[k1] - a[k2]) * s120;
+    bj = (b[k1] - b[k2]) * s120;
+    a[k1] = (double)(ak - bj);
+    b[k1] = (double)(bk + aj);
+    a[k2] = (double)(ak + bj);
+    b[k2] = (double)(bk - aj);
+    kk = k2 + kspan;
+    if (kk < nn)     goto lbl100;
+    kk -= nn;
+    if (kk <= kspan) goto lbl100;
+    goto lbl290;
+
+/*
+ * transform for factor of 4
+ */
+
+ lbl110:
+    if (nfac[i] != 4) goto lbl230;
+    kspnn = kspan;
+    kspan = kspan/4;
+ lbl120:
+    c1 = 1.0;
+    s1 = 0;
+    mm = (kspan < klim ? kspan : klim);
+    goto lbl150;
+ lbl130:
+    c2 = c1 - ((cd*c1)+(sd*s1));
+    s1 = ((sd*c1)-(cd*s1)) + s1;
+/*
+ * the following three statements compensate for truncation
+ * error.  if rounded arithmetic is used, substitute
+ * c1=c2
+ *
+ * c1 = (0.5/(pow2(c2)+pow2(s1))) + 0.5;
+ * s1 = c1*s1;
+ * c1 = c1*c2;
+ */
+    c1 = c2;
+ lbl140:
+    c2 = (c1 * c1) - (s1 * s1);
+    s2 = c1 * s1 * 2.0;
+    c3 = (c2 * c1) - (s2 * s1);
+    s3 = (c2 * s1) + (s2 * c1);
+ lbl150:
+    k1 = kk + kspan;
+    k2 = k1 + kspan;
+    k3 = k2 + kspan;
+    akp = a[kk] + a[k2];
+    akm = a[kk] - a[k2];
+    ajp = a[k1] + a[k3];
+    ajm = a[k1] - a[k3];
+    a[kk] = (double)(akp + ajp);
+    ajp = akp - ajp;
+    bkp = b[kk] + b[k2];
+    bkm = b[kk] - b[k2];
+    bjp = b[k1] + b[k3];
+    bjm = b[k1] - b[k3];
+    b[kk] = (double)(bkp + bjp);
+    bjp = bkp - bjp;
+    if (isn < 0) goto lbl180;
+    akp = akm - bjm;
+    akm = akm + bjm;
+    bkp = bkm + ajm;
+    bkm = bkm - ajm;
+    if (s1 == 0.0) goto lbl190;
+ lbl160:
+    a[k1] = (double)((akp*c1) - (bkp*s1));
+    b[k1] = (double)((akp*s1) + (bkp*c1));
+    a[k2] = (double)((ajp*c2) - (bjp*s2));
+    b[k2] = (double)((ajp*s2) + (bjp*c2));
+    a[k3] = (double)((akm*c3) - (bkm*s3));
+    b[k3] = (double)((akm*s3) + (bkm*c3));
+    kk = k3 + kspan;
+    if (kk <= nt)   goto lbl150;
+ lbl170:
+    kk -= (nt - jc);
+    if (kk <= mm)   goto lbl130;
+    if (kk < kspan) goto lbl200;
+    kk -= (kspan - inc);
+    if (kk <= jc)   goto lbl120;
+    if (kspan==jc)  goto lbl350;
+    goto lbl40;
+lbl180:
+    akp = akm + bjm;
+    akm = akm - bjm;
+    bkp = bkm - ajm;
+    bkm = bkm + ajm;
+    if (s1 != 0.0)  goto lbl160;
+ lbl190:
+    a[k1] = (double)akp;
+    b[k1] = (double)bkp;
+    a[k2] = (double)ajp;
+    b[k2] = (double)bjp;
+    a[k3] = (double)akm;
+    b[k3] = (double)bkm;
+    kk = k3 + kspan;
+    if (kk <= nt) goto lbl150;
+    goto lbl170;
+ lbl200:
+    s1 = ((double)((kk-1)/jc)) * dr * rad;
+    c1 = cos(s1);
+    s1 = sin(s1);
+    mm = (kspan < mm+klim ? kspan : mm+klim);
+    goto lbl140;
+
+/*
+ * transform for factor of 5 (optional code)
+ */
+
+ lbl210:
+    c2 = (c72*c72) - (s72*s72);
+    s2 = 2.0 * c72 * s72;
+ lbl220:
+    k1 = kk + kspan;
+    k2 = k1 + kspan;
+    k3 = k2 + kspan;
+    k4 = k3 + kspan;
+    akp = a[k1] + a[k4];
+    akm = a[k1] - a[k4];
+    bkp = b[k1] + b[k4];
+    bkm = b[k1] - b[k4];
+    ajp = a[k2] + a[k3];
+    ajm = a[k2] - a[k3];
+    bjp = b[k2] + b[k3];
+    bjm = b[k2] - b[k3];
+    aa = a[kk];
+    bb = b[kk];
+    a[kk] = (double)(aa + akp + ajp);
+    b[kk] = (double)(bb + bkp + bjp);
+    ak = (akp*c72) + (ajp*c2) + aa;
+    bk = (bkp*c72) + (bjp*c2) + bb;
+    aj = (akm*s72) + (ajm*s2);
+    bj = (bkm*s72) + (bjm*s2);
+    a[k1] = (double)(ak - bj);
+    a[k4] = (double)(ak + bj);
+    b[k1] = (double)(bk + aj);
+    b[k4] = (double)(bk - aj);
+    ak = (akp*c2) + (ajp*c72) + aa;
+    bk = (bkp*c2) + (bjp*c72) + bb;
+    aj = (akm*s2) - (ajm*s72);
+    bj = (bkm*s2) - (bjm*s72);
+    a[k2] = (double)(ak - bj);
+    a[k3] = (double)(ak + bj);
+    b[k2] = (double)(bk + aj);
+    b[k3] = (double)(bk - aj);
+    kk = k4 + kspan;
+    if (kk < nn)     goto lbl220;
+    kk -= nn;
+    if (kk <= kspan) goto lbl220;
+    goto lbl290;
+
+/*
+ * transform for odd factors
+ */
+
+ lbl230:
+    k = nfac[i];
+    kspnn = kspan;
+    kspan /= k;
+    if (k==3)   goto lbl100;
+    if (k==5)   goto lbl210;
+    if (k==jf)  goto lbl250;
+    jf = k;
+    s1 = rad/(((double)(k))/8.0);
+    c1 = cos(s1);
+    s1 = sin(s1);
+    ck[jf] = 1.0;
+    sk[jf] = 0.0;
+    for (j=1; j<k ; j++) {
+      ck[j] = (double)((ck[k])*c1 + (sk[k])*s1);
+      sk[j] = (double)((ck[k])*s1 - (sk[k])*c1);
+      k--;
+      ck[k] = ck[j];
+      sk[k] = -(sk[j]);
+    }
+ lbl250:
+    k1 = kk;
+    k2 = kk + kspnn;
+    aa = a[kk];
+    bb = b[kk];
+    ak = aa;
+    bk = bb;
+    j = 1;
+    k1 += kspan;
+    do {
+      k2 -= kspan;
+      j++;
+      at[j] = a[k1] + a[k2];
+      ak = at[j] + ak;
+      bt[j] = b[k1] + b[k2];
+      bk = bt[j] + bk;
+      j++;
+      at[j] = a[k1] - a[k2];
+      bt[j] = b[k1] - b[k2];
+      k1 += kspan;
+    } while (k1 < k2);
+    a[kk] = (double)ak;
+    b[kk] = (double)bk;
+    k1 = kk;
+    k2 = kk + kspnn;
+    j = 1;
+ lbl270:
+    k1 += kspan;
+    k2 -= kspan;
+    jj = j;
+    ak = aa;
+    bk = bb;
+    aj = 0.0;
+    bj = 0.0;
+    k = 1;
+    do {
+      k++;
+      ak = (at[k] * ck[jj]) + ak;
+      bk = (bt[k] * ck[jj]) + bk;
+      k++;
+      aj = (at[k] * sk[jj]) + aj;
+      bj = (bt[k] * sk[jj]) + bj;
+      jj += j;
+      if (jj > jf)
+        jj -= jf;
+    } while (k < jf);
+    k = jf - j;
+    a[k1] = (double)(ak - bj);
+    b[k1] = (double)(bk + aj);
+    a[k2] = (double)(ak + bj);
+    b[k2] = (double)(bk - aj);
+    j++;
+    if (j < k)     goto lbl270;
+    kk += kspnn;
+    if (kk <= nn)  goto lbl250;
+    kk -= nn;
+    if (kk<=kspan) goto lbl250;
+
+/*
+ * multiply by rotation factor (except for factors of 2 and 4)
+ */
+
+ lbl290:
+    if (i==m) goto lbl350;
+    kk = jc + 1;
+ lbl300:
+    c2 = 1.0 - cd;
+    s1 = sd;
+    mm = (kspan < klim ? kspan : klim);
+    goto lbl320;
+ lbl310:
+    c2 = c1 - ((cd*c1) + (sd*s1));
+    s1 = s1 + ((sd*c1) - (cd*s1));
+ lbl320:
+    c1 = c2;
+    s2 = s1;
+    kk += kspan;
+ lbl330:
+    ak = a[kk];
+    a[kk] = (double)((c2*ak) - (s2 * b[kk]));
+    b[kk] = (double)((s2*ak) + (c2 * b[kk]));
+    kk += kspnn;
+    if (kk <= nt) goto lbl330;
+    ak = s1*s2;
+    s2 = (s1*c2) + (c1*s2);
+    c2 = (c1*c2) - ak;
+    kk -= (nt - kspan);
+    if (kk <= kspnn) goto lbl330;
+    kk -= (kspnn - jc);
+    if (kk <= mm)   goto lbl310;
+    if (kk < kspan) goto lbl340;
+    kk -= (kspan - jc - inc);
+    if (kk <= (jc+jc)) goto lbl300;
+    goto lbl40;
+ lbl340:
+    s1 = ((double)((kk-1)/jc)) * dr * rad;
+    c2 = cos(s1);
+    s1 = sin(s1);
+    mm = (kspan < mm+klim ?  kspan :mm+klim);
+    goto lbl320;
+
+/*
+ * permute the results to normal order---done in two stages
+ * permutation for square factors of n
+ */
+
+ lbl350:
+    np[1] = ks;
+    if (!(*kt)) goto lbl440;
+    k = *kt + *kt + 1;
+    if (m < k)
+      k--;
+    np[k+1] = jc;
+    for (j=1; j < k; j++,k--) {
+      np[j+1] = np[j] / nfac[j];
+      np[k] = np[k+1] * nfac[j];
+    }
+    k3 = np[k+1];
+    kspan = np[2];
+    kk = jc + 1;
+    k2 = kspan + 1;
+    j = 1;
+    if (n != ntot) goto lbl400;
+/*
+ * permutation for single-variate transform (optional code)
+ */
+ lbl370:
+    do {
+      ak = a[kk];
+      a[kk] = a[k2];
+      a[k2] = (double)ak;
+      bk = b[kk];
+      b[kk] = b[k2];
+      b[k2] = (double)bk;
+      kk += inc;
+      k2 += kspan;
+    } while (k2 < ks);
+lbl380:
+    do {
+      k2 -= np[j++];
+      k2 += np[j+1];
+    } while (k2 > np[j]);
+    j = 1;
+ lbl390:
+    if (kk < k2) {
+      goto lbl370;
+    }
+    kk += inc;
+    k2 += kspan;
+    if (k2 < ks) goto lbl390;
+    if (kk < ks) goto lbl380;
+    jc = k3;
+    goto lbl440;
+/*
+ * permutation for multivariate transform
+ */
+ lbl400:
+    do {
+      do {
+        k = kk + jc;
+        do {
+          ak = a[kk];
+          a[kk] = a[k2];
+          a[k2] = (double)ak;
+          bk = b[kk];
+          b[kk] = b[k2];
+          b[k2] = (double)bk;
+          kk += inc;
+          k2 += inc;
+        } while (kk < k);
+        kk += (ks - jc);
+        k2 += (ks - jc);
+      } while (kk < nt);
+      k2 -= (nt - kspan);
+      kk -= (nt - jc);
+    } while (k2 < ks);
+ lbl420:
+    do {
+      k2 -= np[j++];
+      k2 += np[j+1];
+    } while (k2 > np[j]);
+    j = 1;
+ lbl430:
+    if (kk < k2)         goto lbl400;
+    kk += jc;
+    k2 += kspan;
+    if (k2 < ks)      goto lbl430;
+    if (kk < ks)      goto lbl420;
+    jc = k3;
+ lbl440:
+    if ((2*(*kt))+1 >= m)
+      return;
+
+    kspnn = *(np + *(kt) + 1);
+    j = m - *kt;
+    nfac[j+1] = 1;
+ lbl450:
+    nfac[j] = nfac[j] * nfac[j+1];
+    j--;
+    if (j != *kt) goto lbl450;
+    *kt = *(kt) + 1;
+    nn = nfac[*kt] - 1;
+    jj = 0;
+    j = 0;
+    goto lbl480;
+ lbl460:
+    jj -= k2;
+    k2 = kk;
+    kk = nfac[++k];
+ lbl470:
+    jj += kk;
+    if (jj >= k2) goto lbl460;
+    np[j] = jj;
+ lbl480:
+    k2 = nfac[*kt];
+    k = *kt + 1;
+    kk = nfac[k];
+    j++;
+    if (j <= nn) goto lbl470;
+/* Determine permutation cycles of length greater than 1 */
+    j = 0;
+    goto lbl500;
+ lbl490:
+    k = kk;
+    kk = np[k];
+    np[k] = -kk;
+    if (kk != j) goto lbl490;
+    k3 = kk;
+ lbl500:
+    kk = np[++j];
+    if (kk < 0)  goto lbl500;
+    if (kk != j) goto lbl490;
+    np[j] = -j;
+    if (j != nn) goto lbl500;
+    maxf *= inc;
+    /* Perform reordering following permutation cycles */
+    goto lbl570;
+ lbl510:
+    j--;
+    if (np[j] < 0) goto lbl510;
+    jj = jc;
+ lbl520:
+    kspan = jj;
+    if (jj > maxf)
+      kspan = maxf;
+    jj -= kspan;
+    k = np[j];
+    kk = (jc*k) + i + jj;
+    k1 = kk + kspan;
+    k2 = 0;
+ lbl530:
+    k2++;
+    at[k2] = a[k1];
+    bt[k2] = b[k1];
+    k1 -= inc;
+    if (k1 != kk) goto lbl530;
+ lbl540:
+    k1 = kk + kspan;
+    k2 = k1 - (jc * (k + np[k]));
+    k = -(np[k]);
+ lbl550:
+    a[k1] = a[k2];
+    b[k1] = b[k2];
+    k1 -= inc;
+    k2 -= inc;
+    if (k1 != kk) goto lbl550;
+    kk = k2;
+    if (k != j)   goto lbl540;
+    k1 = kk + kspan;
+    k2 = 0;
+ lbl560:
+    k2++;
+    a[k1] = at[k2];
+    b[k1] = bt[k2];
+    k1 -= inc;
+    if (k1 != kk) goto lbl560;
+    if (jj)       goto lbl520;
+    if (j  != 1)  goto lbl510;
+lbl570:
+    j = k3 + 1;
+    nt -= kspnn;
+    i = nt - inc + 1;
+    if (nt >= 0)  goto lbl510;
+    return;
+}
+
+
+/*
+ *-----------------------------------------------------------------------
+ * subroutine:
+  reals
+ * used with 'fft' to compute fourier transform or inverse for real data
+ *-----------------------------------------------------------------------
+ *      this is the call from C:
+
+ *              reals_(anal,banal,N2,mtwo);
+ *      which has been changed from CARL call
+ *              reals_(anal,banal,&N2,&mtwo);
+ */
+
+void
+reals_(double *a, double *b, int n, int isn)
+
+  /*    *a,       a refers to an array of floats 'anal'   */
+  /*    *b;       b refers to an array of floats 'banal'  */
+/* See IEEE book for a long comment here on usage */
+
+{
+    int inc,
+      j,
+      k,
+      lim,
+      mm,ml,
+      nf,nk,nh;
+
+    double      aa,ab,
+      ba,bb,
+      cd,cn,
+      dr,
+      em,
+      rad,re,
+      sd,sn;
+    double      xx;     /******* ADDED APRIL 1991 ******/
+    /* adjust  input array pointers (called from C) */
+    a--;        b--;
+    inc=abs(isn);
+    nf=abs(n);
+    if (nf*isn==0) {
+      printf("\nerror - zero in reals parameters : %d : %d ",n,isn);
+      return;
+    }
+    nk = (nf*inc) + 2;
+    nh = nk/2;
+/*****************************
+        rad  = atan((double)1.0);
+******************************/
+    rad = 0.785398163397448278900;
+    dr = -4.0/(double)(nf);
+/********************************** POW2 REMOVED APRIL 1991 *****************
+                                cd = 2.0 * (pow2(sin((double)0.5 * dr * rad)));
+*****************************************************************************/
+    xx = sin((double)0.5 * dr * rad);
+    cd = 2.0 * xx * xx;
+    sd = sin(dr * rad);
+/*
+ * sin,cos values are re-initialised each lim steps
+ */
+    lim = 32;
+    mm = lim;
+    ml = 0;
+    sn = 0.0;
+    if (isn<0) {
+      cn = 1.0;
+      a[nk-1] = a[1];
+      b[nk-1] = b[1]; }
+    else {
+      cn = -1.0;
+      sd = -sd;
+    }
+    for (j=1;j<=nh;j+=inc)      {
+      k = nk - j;
+      aa = a[j] + a[k];
+      ab = a[j] - a[k];
+      ba = b[j] + b[k];
+      bb = b[j] - b[k];
+      re = (cn*ba) + (sn*ab);
+      em = (sn*ba) - (cn*ab);
+      b[k] = (double)((em-bb)*0.5);
+      b[j] = (double)((em+bb)*0.5);
+      a[k] = (double)((aa-re)*0.5);
+      a[j] = (double)((aa+re)*0.5);
+      ml++;
+      if (ml!=mm) {
+        aa = cn - ((cd*cn)+(sd*sn));
+        sn = ((sd*cn) - (cd*sn)) + sn;
+        cn = aa;}
+      else {
+        mm +=lim;
+        sn = ((double)ml) * dr * rad;
+        cn = cos(sn);
+        if (isn>0)
+          cn = -cn;
+        sn = sin(sn);
+      }
+    }
+    return;
+}
+
+

+ 110 - 0
dev/externals/fastconv/readme.txt

@@ -0,0 +1,110 @@
+Preliminary documentation  for fastconv.
+
+
+FASTCONV:  multi-channel fast convolution (using FFTs)
+
+version: 1.0 2010
+
+usage message: 
+fastconv [-aX][-f] infile impulsefile outfile [dry]
+   -aX        : scale output amplitude by X
+   -f         : write output as floats (no clipping)
+  infile      : input soundfile to be processed.
+  impulsefile : soundfile or text file containing impulse response,
+                  e.g. reverb or FIR filter.
+                (text file name must have extension .txt)
+              Supported channel combinations:
+               (a) mono infile, N-channel impulsefile;
+               (b) channels are the same;
+               (c) mono impulsefile, N-channel infile.
+  [dry]       :  set dry/wet mix (e.g. for reverb)
+                 Range: 0.0 - 1.0,  default = 0.0
+                 (uses sin/cos law for constant power mix)
+Note: some recorded reverb impulses effectively include the direct signal.
+In such cases  <dry>  need not be used
+Where impulsefile is a filter response (FIR), optimum length is power-of-two - 1.
+
+
+The primary application of fastconv is convolution reverberation using a 
+sampled impulse response of a building or other responsive space. The term "fast"  
+refers to the use of the Fast Fourier transform (FFT) to perfume the convolution. 
+The program can also be used more experimentally, as the impulse response input can 
+be any mono or multi-channel file (see details of available channel combinations below); 
+a file can also be convolved with itself. 
+The program uses double-precision processing throughout, and files of considerable 
+length can be processed cleanly.
+Note however that the FFT of the impulse response is stored in main memory, 
+so very large files may raise memory demands to critical levels.
+
+
+More on channel options:
+
+  Impulse soundfile can be multi-channel.
+  The .amb format is supported, also Logic Pro SDIR files for reading (change the file extension to .aifc).
+
+  When the infile is multi-channel, impulse file must be mono, or the same number of channels.
+        Where the impulse file is mono, data is duplicated for all input channels.
+		Typical usage: linear-phase filtering. Output should be 100% "wet".
+	The optimum length for a filter impulse response is power-of-two-1, 
+	e.g. 127,255, 511 etc. Most filter creation tools will output a file of this size.
+
+	(More tools to support linear-phase filtering are in preparation!).
+
+
+  When infile is mono, impulse soundfile can be multi-channel, outfile has channel count of
+      impulse response.
+    Typical usage: reverb convolution for spatialization, B-Format convolution
+	It will be usual to supply a non-zero value for "dry", e.g. 0.5. Note however that some recorded 
+       or synthetic impulse responses  may already include a "direct" component. In such cases, 
+	a "dry" value may not be needed.
+
+  The program employs an rms-based gain scaling algorithm which attempts to ensure all outputs are
+ approximately at the same level as the input. In normal use (e.g. a naturally decaying reverb impulse response),
+ the -a flag should not be needed.
+When the -f flag is used, output is forced to floats, with no clipping. The program reports 
+the output level together with a suggested corrective gain factor. This will be of particular relevance to more
+experimental procedures, such as convolving a soundfile with itself or with some other arbitrary source.
+
+
+Note for advanced users - use for FIR linear-phase filtering.
+
+Convolution implements a filtering process - equivalent to multiplication of the spectra of the two inputs. 
+The most common filter in audio work is recursive - it recycles output samples back into the input. The output 
+continues in principle for ever, hence the term "infinite impulse response" (IIR). The advantage of this technique 
+(as employed for example in CDP's "filter' package) is that even a low-order filter (i.e. using a small 
+number of delayed inputs and outputs) can be very powerful in its effects. A disadvantage in some applications 
+can be that an IIR filter changes the phase of components in the input (frequency components are 
+delayed by different amounts). This means among the things that the waveform shape of the input is not 
+preserved. The timbre of the sound (even in regions  not directly boosted 
+or attenuated by the filter) will therefore be changed. In common parlance, such a filter "colours" the signal.
+
+The alternative is a linear phase filter, which preserves all phase relationships in the signal. 
+All frequency components are delayed equally. To achieve this the impulse response must have a symmetrical 
+shape (see illustration). The response decays identically either side of the central peak.  
+
+This requires that there be no recirculated outputs reinjected into the filter. 
+Such a filter has a Finite Impulse Response (FIR). The impulse response data now comprises literally the 
+response of the filter to a single input sample (impulse). An impulse response of 31 samples means 
+that the filter generates and adds together 31 delayed copies of the input, to create each output sample. 
+While IIR filter coefficients may involve only two delayed samples ("a "second-order" filter), FIR responses 
+need to employ many more samples to achieve similar effects. It would not be unusual to use a 511-th order FIR filter. 
+This also means that the overall delay ("latency") of a FIR filter is much longer than that of an IIR filter. 
+
+A FIR filter cannot resonate as an IIR filter can. By computing only delayed inputs, It is unconditionally 
+"stable" - whereas a badly designed IIR filter can "blow up" with output values rapidly exceeding the sample limit.
+
+Fastconv supports the use of FIR coefficient files either in the form of either a short soundfile, or a 
+plain text file containing (in a single column)  the list of coefficients as floating-point numbers within 
+the "normalised" range -1.0 to 1.0. For orthodox filtering purposes a mono soundfile should be used, to process 
+all channels identically. FIR coefficient text files are generated by many engineering-oriented filter design 
+applications.  User may be tempted to  write response files by hand; this can be done, but the results will be 
+virtually impossible to predict or control. 
+
+For maximum efficiency, such files should ideally have a size that is a power-of-two less one: e.g. 255, 511, 1023, etc.
+
+For more information about FIR filters, see :
+
+http://www.labbookpages.co.uk/audio/firWindowing.html
+
+
+August 23 2010

+ 258 - 0
dev/externals/include/portsf.h

@@ -0,0 +1,258 @@
+/* Copyright (c) 2009, 2014 Richard Dobson
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+/* POST_BOOK!*/
+/* RWD Oct 2009: added MC_CUBE to listy of supported speaker layouts */
+/* corrected 7.1 speaker value (hex) */
+/* Aug 2012 corrected SPKRS_MONO value */
+/* Nov 2013: added SPKRS_6_1 and MC_SURR_6_1 to list */
+
+#ifndef __RIFFWAV_H_INCLUDED
+#define __RIFFWAV_H_INCLUDED
+
+/* Revision 16th September 2003: added TPDF dither support */
+/* revision Dec 2005: support new B-Format extensions */
+/* RWD Nov 1 2006: extended with double sread/write for research purposes! */
+/* July 2009: attempt portability with 64bit platforms */
+/* unable to test Win64 yet - but the symbol to check is simply _WIN64  */
+#ifdef __GNUC__ 
+# ifdef __LP64__
+#   define CPLONG64
+# endif
+#endif
+/* failing that, manually define CPLONG64 in makefile or project setting */
+#ifdef CPLONG64
+// all this effort is for readPeaks() and ctime only!
+# define MYLONG int
+#else
+# define MYLONG long
+#endif
+
+#ifdef __cplusplus
+extern "C" {	
+#endif	   
+/* compatible with <windows.h> */
+#ifndef DWORD
+typedef unsigned MYLONG DWORD;
+typedef unsigned short WORD;
+#endif
+/* NB: AIFF spec always illustrates chunksize as (signed) long; 
+   even though nFrames is always unsigned long!
+   So we make everything DWORD here.
+ */
+
+/* the file sample formats we could support */
+
+typedef enum {
+	PSF_SAMP_UNKNOWN	=	0,
+	PSF_SAMP_8,				   /* not yet supported! */
+	PSF_SAMP_16,
+	PSF_SAMP_24,
+	PSF_SAMP_32,
+	PSF_SAMP_IEEE_FLOAT
+} psf_stype;
+
+/* the file format */
+/* currently based only on file extension. 
+   To be friendly, we should parse the header to get the format.
+*/
+typedef enum {
+	PSF_FMT_UNKNOWN = 0,		/* e.g if no extension given. This could also signify 'raw' */
+	PSF_STDWAVE,
+	PSF_WAVE_EX,
+	PSF_AIFF,
+	PSF_AIFC
+} psf_format;
+
+/* provisional stab at error codes */
+enum {
+	PSF_E_NOERROR		= 0,
+	PSF_E_CANT_OPEN		= -1,
+	PSF_E_CANT_CLOSE	= -2,
+	PSF_E_CANT_WRITE	= -3,
+	PSF_E_CANT_READ		= -4,
+	PSF_E_NOT_WAVE		= -5,
+	PSF_E_BAD_TYPE		= -6,
+	PSF_E_BAD_FORMAT	= -7,
+	PSF_E_UNSUPPORTED	= -8,
+	PSF_E_NOMEM			= -9,
+	PSF_E_BADARG		= -10,
+	PSF_E_CANT_SEEK		= -11,
+	PSF_E_TOOMANYFILES  = -12,
+	PSF_E_FILE_READONLY = -13,
+	PSF_E_SEEK_BEYOND_EOF = -14
+};
+
+#define NUM_SPEAKER_POSITIONS (18)
+
+#define SPEAKER_FRONT_LEFT				0x1
+#define SPEAKER_FRONT_RIGHT				0x2
+#define SPEAKER_FRONT_CENTER			0x4
+#define SPEAKER_LOW_FREQUENCY			0x8
+#define SPEAKER_BACK_LEFT				0x10
+#define SPEAKER_BACK_RIGHT				0x20
+#define SPEAKER_FRONT_LEFT_OF_CENTER	0x40
+#define SPEAKER_FRONT_RIGHT_OF_CENTER	0x80
+#define SPEAKER_BACK_CENTER				0x100
+#define SPEAKER_SIDE_LEFT				0x200
+#define SPEAKER_SIDE_RIGHT				0x400
+#define SPEAKER_TOP_CENTER				0x800
+#define SPEAKER_TOP_FRONT_LEFT			0x1000
+#define SPEAKER_TOP_FRONT_CENTER		0x2000
+#define SPEAKER_TOP_FRONT_RIGHT			0x4000
+#define SPEAKER_TOP_BACK_LEFT			0x8000
+#define SPEAKER_TOP_BACK_CENTER			0x10000
+#define SPEAKER_TOP_BACK_RIGHT			0x20000
+#define SPEAKER_RESERVED      			0x80000000
+
+/* my extras*/
+#define SPKRS_UNASSIGNED	(0)
+#define SPKRS_MONO			(0x00000004)
+#define SPKRS_STEREO		(0x00000003)
+#define SPKRS_GENERIC_QUAD	(0x00000033)
+#define SPKRS_SURROUND_LCRS	(0x00000107)
+#define SPKRS_SURR_5_0      (0x00000037)
+#define SPKRS_DOLBY5_1		(0x0000003f)
+#define SPKRS_6_1			(0x0000013f)
+#define SPKRS_7_1           (0x000000ff)
+#define SPKRS_CUBE          (SPKRS_GENERIC_QUAD | SPEAKER_TOP_FRONT_LEFT | SPEAKER_TOP_FRONT_RIGHT | SPEAKER_TOP_BACK_LEFT | SPEAKER_TOP_BACK_RIGHT)
+#define SPKRS_ACCEPT_ALL	(0xffffffff)	 /*???? no use for a file*/
+
+
+/* support for the PEAK chunk */
+typedef struct psf_chpeak {	
+	float val;
+	DWORD pos;   /* OK for all WAVE and AIFF <= 4GB */
+} PSF_CHPEAK;
+
+/* second two are speculative at present! */
+typedef enum  {PSF_CREATE_RDWR,PSF_CREATE_TEMPORARY,PSF_CREATE_WRONLY} psf_create_mode;
+/* the speakerfeed format */
+/* MC_WAVE_EX is a possibly temporary one to cover abstruse infile formats! */
+typedef enum { STDWAVE,MC_STD,MC_MONO,MC_STEREO,MC_QUAD,MC_LCRS,MC_BFMT,MC_DOLBY_5_1,
+				MC_SURR_5_0,MC_SURR_6_1,MC_SURR_7_1,MC_CUBE,MC_WAVE_EX } psf_channelformat;
+
+/* read access support */
+/* for psf_sndSeek(); ~should~ map directly to fseek mode flags*/
+enum { PSF_SEEK_SET=0,PSF_SEEK_CUR,PSF_SEEK_END};
+
+enum {PSF_DITHER_OFF,PSF_DITHER_TPDF};
+
+/* main structure to define a soundile. Extended props must be asked for separately */
+typedef struct psf_props 
+{
+	int		srate;
+	int		chans;	
+	psf_stype	samptype;		
+	psf_format	format;			
+	psf_channelformat chformat;	
+	/* probably add more stuff...esp for full WAVE-EX support */
+} PSF_PROPS;
+
+
+/*************** PUBLIC FUNCS */
+
+/* init sfs system. return 0 for success */
+int psf_init(void);
+/* close sfs-system. Does auto cleanup of open files, etc. return 0 for success */
+int psf_finish(void);
+/* Create soundfile from props.
+   Supports clipping or non-clipping of floats to 0dbFS, 
+   set minimum header (or use PEAK)
+   returns Sf descriptor >= 0, or some PSF_E_*  on error.
+*/
+/* using WIN32, it is possible to share for reading, but not under ANSI */
+/* maybe we just abandon all that */ 
+/* TODO (?): enforce non-destructive creation */
+int psf_sndCreate(const char *path,const PSF_PROPS *props, int clip_floats,int minheader,int mode);
+
+
+/* open existing soundfile. Receive format info in props. Supports auto rescale from PEAK
+   data, with floats files. Only RDONLY access supported.
+   Return sf descriptor >= 0, or some PSF_E_+ on error.
+  */
+int psf_sndOpen(const char *path,PSF_PROPS *props, int rescale);
+/*snd close. Updates PEAK data if used. return 0 for success, or some PSF_E_+ on error.*/
+int psf_sndClose(int sfd);
+
+/* all data read/write is counted in multi-channel sample 'frames', NOT in raw samples.*/
+
+/* get size of file, in m/c frames. Return size, or PSF_E_BADARG on bad sfd  */
+int psf_sndSize(int sfd);
+
+/* write m/c frames of floats. this updates internal PEAK data automatically.
+   return num frames written, or  some PSF_E_* on error. 
+  */
+int psf_sndWriteFloatFrames(int sfd, const float *buf, DWORD nFrames);
+int psf_sndWriteDoubleFrames(int sfd, const double *buf, DWORD nFrames);
+/* as above, with 16bit data */
+int psf_sndWriteShortFrames(int sfd, const short *buf, DWORD nFrames);
+
+/* 	get current m/c frame position in file, or PSF_E_BADARG with bad sfd*/    
+int psf_sndTell(int sfd);
+
+/* m/c frame wrapper for stdio fseek. return 0 for success. Offset counted in m/c frames.
+ seekmode must be one of PSF_SEEK_* options, to ensure correct mapping to SEEK_CUR, etc */
+int psf_sndSeek(int sfd,int offset,int seekmode);
+
+/* read m/c sample frames into floats buffer. return nFrames, or some PSF_E_*.
+    if file opened with rescale = 1, over-range floats data, as indicated by PEAK chunk,
+	is automatically scaled to 0dbFS.
+	NB we could add a facility to define 'headroom', as some level below 0dBFS.
+ */
+int psf_sndReadFloatFrames(int sfd, float *buf, DWORD nFrames);
+int psf_sndReadDoubleFrames(int sfd, double *buf, DWORD nFrames);
+/* can add ReadShortFrames if we really need it! */
+
+int psf_sndReadPeaks(int sfd,PSF_CHPEAK peakdata[],MYLONG *peaktime);
+
+/* find the soundfile format from the filename extension */
+/* currently supported: .wav, .aif, .aiff,.aifc,.afc, .amb */
+psf_format psf_getFormatExt(const char *path);
+
+
+/* set/unset dither. 
+   Returns 0 on success, -1 if error (unrecognised type, or read-only)
+   no-op for input files
+*/
+
+int psf_sndSetDither(int sfd,unsigned int dtype);
+/* get current dither setting */
+int psf_sndGetDither(int sfd);
+
+/* RWD NEW Nov 2009 */
+int psf_speakermask(int sfd);
+
+/* Feb 2010 */
+int psf_getWarning(int sfd,const char** warnstring);
+
+/* Sept 2010  return 1 for true, 0 for false */
+    /* NB tests up to 32bit size for now! */
+int is_legalsize(unsigned long nFrames, const PSF_PROPS *props);
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 81 - 0
dev/externals/mctools/CMakeLists.txt

@@ -0,0 +1,81 @@
+if(APPLE)
+  set(CMAKE_C_FLAGS "-O2 -Wall -mmacosx-version-min=10.8 -Dunix -fomit-frame-pointer -funroll-loops")
+  set(CMAKE_CXX_FLAGS "-O2 -Wall -mmacosx-version-min=10.8 -Dunix -fomit-frame-pointer -funroll-loops -std=c++11 -stdlib=libc++")
+#  SET(CMAKE_EXE_LINKER_FLAGS "-static")
+else()
+  if(MINGW)
+    set(CMAKE_C_FLAGS "-O3 -DWIN32 -D_WIN32 -fomit-frame-pointer  -funroll-loops")
+  else()
+    set(CMAKE_C_FLAGS "-O3 -Wall -Dlinux -Dunix -fomit-frame-pointer -funroll-loops")
+  endif()
+endif()
+
+link_directories(../lib)
+
+include_directories(../../../include ../include)
+
+add_executable(abfpan abfpan.cpp)
+target_link_libraries(abfpan portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(abfpan)
+
+add_executable(abfpan2 abfpan2.cpp)
+target_link_libraries(abfpan2 portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(abfpan2)
+
+add_executable(abfdcode abfdcode.cpp)
+target_link_libraries(abfdcode portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(abfdcode)
+
+add_executable(fmdcode fmdcode.c fmhfuncs.c)
+target_link_libraries(fmdcode portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(fmdcode)
+
+add_executable(channelx channel.c)
+target_link_libraries(channelx portsf sfsys m ${EXTRA_LIBRARIES})
+
+my_install(channelx)
+
+add_executable(chorder chorder.c)
+target_link_libraries(chorder portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(chorder)
+
+add_executable(chxformat chxformat.c)
+target_link_libraries(chxformat portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(chxformat)
+
+add_executable(copysfx copysf.c)
+target_link_libraries(copysfx portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(copysfx)
+
+add_executable(interlx interlx.c)
+target_link_libraries(interlx portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(interlx)
+
+add_executable(nmix nmix.c)
+target_link_libraries(nmix portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(nmix)
+
+add_executable(njoin njoin.c)
+target_link_libraries(njoin portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(njoin)
+
+add_executable(rmsinfo rmsinfo.cpp)
+target_link_libraries(rmsinfo portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(rmsinfo)
+
+add_executable(sfprops sfprops.c)
+target_link_libraries(sfprops portsf sfsys ${EXTRA_LIBRARIES})
+
+my_install(sfprops)
+

+ 189 - 0
dev/externals/mctools/abfdcode.cpp

@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//abfdcode.cpp  : write mono wave file into ambisonic B-format
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "portsf.h"
+
+#ifdef unix
+/* in portsf.lib */
+extern  "C" {
+    int stricmp(const char *a, const char *b);
+}
+#endif
+
+typedef struct abf_samp {
+	float W;
+	float X;
+	float Y;
+	float Z;	
+} ABFSAMPLE;
+
+int main(int argc,char *argv[])
+{
+	int i,ifd, ofd;
+	long outchans = 4;
+	long outsize;
+	char *sfname;
+	bool write_wavex = false;
+	ABFSAMPLE abfsample;
+	float frame[4];
+	PSF_PROPS props;
+	PSF_CHPEAK peaks[4];
+	long inchans;
+    MYLONG peaktime;
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.2.1\n");
+        return 0;
+    }
+    
+	if(argc < 3){
+		printf("\nCDP MCTOOLS: ABFDCODE v 1.2.1: CDP 1999,2004,2005\n"
+				"Horizontal B Format Decoder\n"
+				"usage: abfdcode [-x] infile outfile\n"
+				"       -x    :   write WAVE_EX (Quad) outfile format\n"
+				"                (requires .wav extension)\n"
+				"NB: infile must have 3 or 4 channels\n"
+                "UPDATE 2009: This program is now replaced by FMDCODE, \n"
+                "and may be omitted in future updates to the Toolkit.\n"
+                "For this task use fmdcode with e.g. layout 4.\n"
+				);
+		return 1;
+	}
+	while(argv[1][0] =='-'){		
+		switch(argv[1][1]){
+		case('x'):
+			write_wavex = true;
+			break;
+		default:
+			fprintf(stderr,"abfdecode: error: illegal flag option %s\n",argv[1]);
+			return 1;
+		}
+		argc--; argv++;
+	}
+	if(argc < 3){
+		fprintf(stderr,"CDP MCTOOLS: ABFDCODE.EXE: CDP 1999,2005\nHorizontal B Format Decoder\nusage: abfdcode [-x] infile outfile\n");
+		return 1;
+	}
+	if(psf_init()){
+		fprintf(stderr,"abfdcode: startup failure.\n");
+		return 1;
+	}
+	
+	sfname = argv[2];
+	
+	ifd = psf_sndOpen(argv[1],&props,0);
+	if(ifd < 0){
+		fprintf(stderr,"unable toopen infile %s\n",argv[1]);
+		return 1;
+	}
+
+	inchans = props.chans;
+	if(!(inchans == 3 || inchans == 4)){
+		fprintf(stderr,"Sorry: infile is not first-order\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+
+	outsize = psf_sndSize(ifd);
+	if(outsize <= 0){
+		fprintf(stderr,"infile is empty!\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+	
+	props.chformat = STDWAVE;
+	props.chans = 4;
+    if(!is_legalsize(outsize,&props)){
+        fprintf(stderr,"error: outfile size exceeds capacity of format.\n");
+        return 1;
+    }
+    
+    
+	if(write_wavex){
+		props.chformat = MC_QUAD;
+		props.format = PSF_WAVE_EX;
+	}
+	//ofd = sndcreat_formatted(sfname,outsize * outchans,stype,outchans,srate,CDP_CREATE_NORMAL);
+	ofd = psf_sndCreate(sfname,&props,0,0,PSF_CREATE_RDWR);
+	if(ofd < 0){
+		fprintf(stderr,"can't create outfile %s.\n",sfname);
+		psf_sndClose(ifd);
+		return 1;
+	}
+	
+
+	int got, halfsec = props.srate / 2;
+	unsigned int framepos = 0;
+	printf("\ndoing b-format decoding:\n");
+	while((got = psf_sndReadFloatFrames(ifd,(float *) &abfsample,1))==1){
+		//this_samp	= 0.5 * p_iosc->tick(1000);
+		float aw = abfsample.W;
+		float ax = abfsample.X * 0.707f;
+		float ay = abfsample.Y * 0.707f;
+		frame[0] = 0.3333f * (aw + ax + ay);
+		frame[1] = 0.3333f * (aw + ax - ay);
+		frame[2] = 0.3333f * (aw - ax + ay);
+		frame[3] = 0.3333f * (aw - ax - ay);
+
+		if(0 > psf_sndWriteFloatFrames(ofd,frame,1)){
+			fprintf(stderr,"error writing sample block  %ld\n",got * outchans);
+			psf_sndClose(ifd);
+			psf_sndClose(ofd);
+			return 1;
+		}
+		if(framepos % halfsec==0) {
+			printf("%.2lf secs\r",(double)framepos / (double) props.srate);
+            fflush(stdout);
+        }
+		framepos++;
+	}
+
+	if(got != 0){
+		fprintf(stderr,"warning: not all data was read\n");
+	}
+	printf("\n%.4lf secs\nWritten %d quad frames to %s\n",(double)framepos / (double) props.srate,framepos,sfname);
+    if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+        printf("PEAK values:\n");
+        for(i=0; i < outchans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+                printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                        val,dbval,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props.srate);
+            }
+            else{
+                printf("CH %d: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+                    val,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props.srate); 
+            }
+        }
+              
+    }
+    psf_sndClose(ifd);
+	psf_sndClose(ofd);
+	psf_finish();
+	return 0;
+}

+ 180 - 0
dev/externals/mctools/abfdcode2.cpp

@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//abfdcode2.cpp  : decode to std wavex speaker positions
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+extern "C"{
+#include <sfsys.h>
+
+}
+
+typedef struct abf_samp {
+	float W;
+	float X;
+	float Y;
+	float Z;	
+} ABFSAMPLE;
+
+int main(int argc,char *argv[])
+{
+	int ifd, ofd;
+	long outchans = 4;
+	long outsize;
+	char *sfname;
+	bool write_wavex = false;
+	ABFSAMPLE abfsample;
+	float frame[4];
+	SFPROPS props;
+	CHPEAK peaks[4];
+	long inchans;
+
+	if(argc < 3){
+		printf("\nCDP MCTOOLS: ABFDCODE2 v 1.0: RWD,CDP 2009\n"
+				"Horizontal B Format Decoder\n"
+				"usage: abfdcode2 infile outfile layout\n"
+				"       (wavex layouts require .wav extension)\n"
+				
+				);
+		return 1;
+	}
+	while(argv[1][0] =='-'){		
+		switch(argv[1][1]){
+		case('x'):
+			write_wavex = true;
+			break;
+		default:
+			fprintf(stderr,"abfdecode: error: illegal flag option %s\n",argv[1]);
+			return 1;
+		}
+		argc--; argv++;
+	}
+	if(argc < 3){
+		fprintf(stderr,"CDP MCTOOLS: ABFDCODE.EXE: CDP 1999,2005\nHorizontal B Format Decoder\nusage: abfdcode [-x] infile outfile\n");
+		return 1;
+	}
+	if(sflinit("abfdcode")){
+		fprintf(stderr,"unable to initialize sfsys\n");
+		return 1;
+	}
+	
+	sfname = argv[2];
+	
+	ifd = sndopenEx(argv[1],0,CDP_OPEN_RDONLY);
+	if(ifd < 0){
+		fprintf(stderr,"unable toopen infile %s\n",argv[1]);
+		return 1;
+	}
+
+	if(!snd_headread(ifd,&props)){
+		fprintf(stderr,"unable to read infile header data\n");
+		sndcloseEx(ifd);
+		return 1;
+	}
+	if(!props.type==wt_wave){
+		fprintf(stderr,"infile is not a soundfile\n");
+		sndcloseEx(ifd);
+		return 1;
+	}
+	inchans = props.chans;
+	if(!(inchans == 3 || inchans == 4)){
+		fprintf(stderr,"Sorry: infile is not first-order\n");
+		sndcloseEx(ifd);
+		return 1;
+	}
+
+	outsize = sndsizeEx(ifd) / inchans;
+	if(outsize <= 0){
+		fprintf(stderr,"infile is empty!\n");
+		sndcloseEx(ifd);
+		return 1;
+	}
+	
+
+	//srate = props.srate;
+	//stype = props.samptype == FLOAT32 ? SAMP_FLOAT : SAMP_SHORT;
+	props.chformat = STDWAVE;
+	props.chans = 4;
+	if(write_wavex){
+		props.chformat = MC_QUAD;
+		props.format = WAVE_EX;
+	}
+	//ofd = sndcreat_formatted(sfname,outsize * outchans,stype,outchans,srate,CDP_CREATE_NORMAL);
+	ofd = sndcreat_ex(sfname,outsize * outchans,&props,SFILE_CDP,CDP_CREATE_NORMAL);
+	if(ofd < 0){
+		fprintf(stderr,"can't create outfile %s : %s\n",sfname,sferrstr());
+		//delete p_iosc;
+		//delete p_sintable;
+		sndcloseEx(ifd);
+		return 1;
+	}
+	peaks[0].value = peaks[1].value = peaks[2].value = peaks[3].value = 0.0f;
+	peaks[0].position = peaks[1].position = peaks[2].position = peaks[3].position = 0;
+
+	int got,quartersec = props.srate / 4;
+	unsigned int framepos = 0;
+	printf("\ndoing b-format decoding:\n");
+	while((got = fgetfbufEx((float *) &abfsample,inchans,ifd,0))==inchans){
+		int i;
+		//this_samp	= 0.5 * p_iosc->tick(1000);
+		float aw = abfsample.W;
+		float ax = abfsample.X * 0.707f;
+		float ay = abfsample.Y * 0.707f;
+		frame[0] = 0.3333f * (aw + ax + ay);
+		frame[1] = 0.3333f * (aw + ax - ay);
+		frame[2] = 0.3333f * (aw - ax + ay);
+		frame[3] = 0.3333f * (aw - ax - ay);
+
+		if(0 > fputfbufEx(frame,outchans,ofd)){
+			fprintf(stderr,"error writing sample block  %ld\n",got * outchans);
+			sndcloseEx(ifd);
+			sndcloseEx(ofd);
+			return 1;
+		}
+		for(i=0;i < 4;i++){
+			float val;
+			val= (float)fabs(frame[i]);
+			if(val > peaks[i].value) {
+				peaks[i].value = val;
+				peaks[i].position = framepos;
+			}
+		}
+		if(framepos % quartersec==0)
+			printf("%.2lf secs\r",(double)framepos / (double) props.srate);
+		framepos++;
+	}
+
+	if(got != 0){
+		fprintf(stderr,"warning: not all data was read\n");
+	}
+	printf("\n%.4lf secs\nWritten %d quad frames to %s\n",(double)framepos / (double) props.srate,framepos,sfname);
+	printf("PEAK values:\n");
+	printf("CH 1: %.4f at frame %ld:\t%.4f secs\n",peaks[0].value,peaks[0].position,(double)peaks[0].position / (double) props.srate);
+	printf("CH 2: %.4f at frame %ld:\t%.4f secs\n",peaks[1].value,peaks[1].position,(double)peaks[1].position / (double) props.srate);
+	printf("CH 3: %.4f at frame %ld:\t%.4f secs\n",peaks[2].value,peaks[2].position,(double)peaks[2].position / (double) props.srate);
+	printf("CH 4: %.4f at frame %ld:\t%.4f secs\n",peaks[3].value,peaks[3].position,(double)peaks[3].position / (double) props.srate);
+	sndputpeaks(ofd,4,peaks);
+	sndcloseEx(ifd);
+	sndcloseEx(ofd);
+	sffinish();
+	return 0;
+}

+ 276 - 0
dev/externals/mctools/abfpan.cpp

@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//abfpan.cpp  : write mono wave file into ambisonic B-format
+// Dec 2005 support .amb extension, and 3ch output
+// Jan 2010: corrected usage message about -b and -x
+// Nov 2013: updated usage message formatting, infile must be mono
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "portsf.h"
+
+#ifdef unix
+/* in portsf.lib */
+extern "C" {
+    int stricmp(const char *a, const char *b);
+}
+#endif
+
+#ifndef TWOPI
+#define TWOPI	(6.283185307)
+#endif
+typedef struct abf_samp {
+	float W;
+	float X;
+	float Y;
+	float Z;	
+} ABFSAMPLE;
+
+
+enum {ARG_PROGNAME, ARG_INFILE, ARG_OUTFILE,ARG_STARTPOS, ARG_ENDPOS,ARG_NARGS};
+void usage()
+{
+	fprintf(stderr,"CDP MCTOOLS V1.5.3 (c) RWD,CDP 2009,2010,2013\n"
+				   "ABFPAN:  apply fixed or orbiting 1st-order B-Format pan to infile\n");
+	fprintf(stderr,"usage : abfpan [-b][-x][-oN] infile outfile startpos endpos\n");
+	fprintf(stderr,"    infile:   input soundfile, must be mono\n");
+	fprintf(stderr,"    startpos: 0.0 <= startpos <= 1.0 (0.0 and 1.0 = Centre Front)\n");
+	fprintf(stderr,"    endpos:   endpos < 0.0 gives anticlockwise rotation,\n"
+				   "                endpos > 0.0 gives clockwise rotation.\n"
+				   "                Units give number of revolutions, fraction gives final position\n"
+				   "                Set endpos = startpos for fixed pan\n");
+	fprintf(stderr,"    -b:       write output as horizontal Ambisonic B-format (.amb),\n"
+                   "                (i.e. bypass B-Format decoding).\n"
+			       "    -x:       write (WAVE_EX) format file (.wav). \n"			   
+				   "                Default: write standard m/c soundfile (WAVE,AIFF).\n"
+                   "                NB: -b overrides -x - no meaning in using both.\n"
+				   "    -oN:      number of B-Format output channels: N = 3 or 4 only.\n"
+				   "                Default: write 4-ch file.\n"
+                   "    See also ABFPAN2 for 2nd order version with fixed height.\n"
+	);
+    fprintf(stderr,"\n");
+}
+
+
+
+#define SYN_BUFLEN	(32768)
+#define TABLEN (1024)
+int main(int argc,char *argv[])
+{
+	int ifd, ofd;
+	int srate = 44100;
+	int outchans = 4;
+    MYLONG peaktime;
+	long outsize;	
+	float this_samp;
+	char *sfname;
+	double angle_incr;
+	double start_angle = 0.0;
+	double startpos,endpos;
+	
+	ABFSAMPLE abfsample;
+	PSF_PROPS props;
+	PSF_CHPEAK peaks[4];
+
+	bool write_bformat = false;
+	bool write_wavex = false;
+	int iarg = outchans;
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.5.2.\n");
+        return 0;
+    }
+    
+	if(argc < 5){
+		usage();
+		return 1;
+	}
+
+	if(psf_init()){
+		fprintf(stderr,"abfpan2: Startup failure.\n");
+		return 1;
+	}
+	
+	while(argv[1][0] =='-'){
+		
+		switch(argv[1][1]){
+		case('b'):
+			write_bformat = true;
+			break;
+
+		case('x'):
+			write_wavex = true;
+			break;
+		case('o'):
+			if(argv[1][2]=='\0'){
+				fprintf(stderr,"abfpan: error: -o flag requires channel value\n");
+				return 1;
+			}
+			iarg = atoi(&(argv[1][2]));
+			if(!(iarg == 3 || iarg == 4)){
+				fprintf(stderr,"abfpan: error: invalid channel value for -o flag\n");
+				return 1;
+			}
+
+			break;
+		default:
+			fprintf(stderr,"abfpan: error: illegal flag option %s.\n",argv[1]);
+			return 1;
+		}
+
+		argc--; argv++;
+	}
+
+	if(argc != 5){
+		usage();
+		return 1;
+	}
+
+	if(write_bformat)
+		outchans = iarg;
+    
+	sfname = argv[ARG_INFILE];
+	startpos = atof(argv[ARG_STARTPOS]);
+	if(startpos < 0.0 || startpos > 1.0){
+		fprintf(stderr,"abfpan: startpos %.4lf out of range: must be between 0.0 and 1.0.\n",startpos);
+		return 1;
+	}
+
+	endpos = atof(argv[ARG_ENDPOS]);
+
+
+
+	ifd = psf_sndOpen(sfname,&props,0);
+	if(ifd < 0){
+		fprintf(stderr,"abfpan: unable to open infile %s.\n",argv[1]);
+		return 1;
+	}
+	if(props.chans != 1){
+		fprintf(stderr,"abfpan: infile must be mono.\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+
+	outsize = psf_sndSize(ifd);
+	if(outsize <= 0){
+		fprintf(stderr,"abfpan: infile is empty!\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+    srate = props.srate;
+	props.chans = outchans;
+    if(!is_legalsize(outsize,&props)){
+        fprintf(stderr,"error: outfile size exceeds capacity of format.\n");
+        return 1;
+    }
+                
+	start_angle = - (TWOPI * startpos);	   //we think of positive as clockwise at cmdline!
+	angle_incr = TWOPI / outsize;
+	angle_incr *= (endpos - startpos);
+	
+	if(write_wavex){
+		props.format = PSF_WAVE_EX;
+		props.chformat = MC_QUAD;
+	}
+	if(write_bformat)
+		props.chformat = MC_BFMT;
+	ofd = psf_sndCreate(argv[ARG_OUTFILE],&props,0,0,PSF_CREATE_RDWR);
+	if(ofd < 0){
+		fprintf(stderr,"abfpan: can't create outfile %s.\n",argv[ARG_OUTFILE]);	
+		return 1;
+	}
+
+	int i,got;
+	int half_sec = srate / 4;
+	long total_frames = 0;
+	double d_srate = (double)srate;
+
+	abfsample.Z = 0.0f;
+	for(i=0; i < outchans; i++){
+		peaks[i].val = 0.0f;
+		peaks[i].pos = 0;
+	}
+	//should make one 360deg rotate over duration
+	//TODO: make lookup_sin and lookup_cos ugens, taking angle arg
+	if(write_bformat)
+		printf("\nWriting B-Format file:\n");
+	else
+		printf("\n");
+	while((got = psf_sndReadFloatFrames(ifd,&this_samp,1))==1){		
+		abfsample.W = (float) (this_samp * 0.707);
+        abfsample.X = (float) (this_samp * cos(start_angle));
+		abfsample.Y	= (float) (this_samp * sin(start_angle));
+
+		//set this for periphonic; otherwise = 0.0 for horizontal_only
+		//abfsample.Z = (float) (this_samp*0.25);
+		if(!write_bformat){
+			//decode into quad file
+			float aw = abfsample.W;
+			float ax = abfsample.X * 0.707f;
+			float ay = abfsample.Y * 0.707f;
+            /* ignore wxyz names  - this is now handy container for quad speaker feeds*/
+			abfsample.W = 0.33333f * (aw + ax + ay); /* front L */
+			abfsample.X = 0.33333f * (aw + ax - ay); /* front R */
+			abfsample.Y = 0.33333f * (aw - ax + ay); /* rear  L */
+			abfsample.Z = 0.33333f * (aw - ax - ay); /* rear  R */
+		}
+		if(0 > psf_sndWriteFloatFrames(ofd,(float*)  &abfsample,1)){
+			fprintf(stderr,"error writing abf sample frame  %ld\n",total_frames);
+			return 1;
+		}
+		start_angle -= angle_incr;
+		total_frames++;		
+		if(total_frames % half_sec ==0) {
+			printf("%.2lf secs\r",(double)total_frames / d_srate);
+            fflush(stdout);
+        }
+	}
+
+	if(got != 0){
+		fprintf(stderr,"abfpan: warning: not all data was read.\n");
+	}
+
+	printf("%.4lf secs\nwritten %ld %d-ch sample frames to %s\n",(double)outsize / d_srate,outsize,outchans, argv[ARG_OUTFILE]);
+	if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+		printf("PEAK values:\n");
+		for(i=0; i < outchans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+                printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                       val,dbval,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props.srate);
+            }
+            else{
+                printf("CH %d: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+                        val, (unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props.srate); 
+            }
+        }
+        
+	}
+	printf("\n");
+	psf_sndClose(ifd);
+	psf_sndClose(ofd);
+	psf_finish();
+	return 0;
+}

+ 296 - 0
dev/externals/mctools/abfpan2.cpp

@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//abfpan2.cpp  : write mono wave file into ambisonic B-format
+// Dec 2005 support .amb extension, and 3ch output
+// OCT 2009 portsf version, with 2nd-order encoding
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <memory.h>
+#include "portsf.h"
+
+#ifndef M_PI
+#define M_PI (3.141592654)
+#endif
+#ifndef TWOPI
+#define TWOPI	(6.283185307)
+#endif
+
+#ifdef unix
+/* in portsf.lib */
+extern "C" {
+    int stricmp(const char *a, const char *b);
+}
+#endif
+
+enum {W,X,Y,Z,R,S,T,U,V};
+
+
+enum {ARG_PROGNAME, ARG_INFILE, ARG_OUTFILE,ARG_STARTPOS,ARG_ENDPOS,ARG_NARGS};
+
+void usage()
+{
+	fprintf(stderr,"\nCDP MCTOOLS V1.0.1 beta (c) RWD,CDP 2010"
+				   "\n\nABFPAN2:  apply fixed or orbiting 2nd-order B-Format pan to infile\n");
+	fprintf(stderr,"usage : abfpan2 [-gGAIN][-w] [-p[DEG]] infile outfile startpos endpos\n"
+                   "    infile : mono source.\n"
+                   "    outfile: 2nd order B-format output.\n"        
+	               "        0.0 <= startpos <= 1.0 (0.0 and 1.0 = Centre Front).\n");
+	fprintf(stderr,"    endpos : endpos < 0.0 gives anticlockwise rotation,\n"
+				   "            endpos > 0.0 gives clockwise rotation.\n"
+				   "            Units give number of revolutions, fraction gives final position\n"
+				   "            Set endpos = startpos for fixed pan\n"
+                   "    -gGAIN : scale infile amplitude by GAIN (GAIN > 0).\n"
+                   "    -w     : Write standard soundfile (wave, aiff)\n"
+                   "            Default: WAVEX B-Format; use .amb extension.\n"
+                   "    -p[DEG]: write full 9-channel (periphonic) B-Format file.\n"
+                   "        Default: write 5-channel (2nd-order horizontal) file.\n"
+                   "        DEG:  optional fixed height argument (degrees).\n"
+                   "             Range = -180  to +180,\n"
+                   "             where  -90 = nadir, +90 = zenith (directly above).\n"
+                   "             Default: DEG=0;  height channels (Z,R,S,T)  will be empty.\n"
+                   "    NB: this program does not create a decoded output.\n"
+                   "    Use FMDCODE to decode to choice of speaker layouts.\n"
+				   );
+    fprintf(stderr,"\n");
+}
+
+int main(int argc,char *argv[])
+{
+	int i,got,ifd, ofd;
+	long srate = 44100;
+	long outchans = 5;
+    long do_peri = 0;
+    int write_wav = 1;
+	MYLONG peaktime;
+	long outsize;	
+	float this_samp;
+	int half_sec;
+	long total_frames;
+	double d_srate;
+	char *sfname;
+	double angle_incr;
+	double start_angle = 0.0;
+	double startpos,endpos;
+    double gain = 1.0;
+    double degree=0.0,elevation = 0.0;  
+	
+	float abfsample[9];
+    float outframe[5];
+    float *p_frame;
+    
+	PSF_PROPS props;
+	PSF_CHPEAK *peaks = NULL;
+	
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.0.1b\n");
+        return 0;
+    }
+    
+	if(argc < 5){
+		usage();
+		return 1;
+	}
+
+	if(psf_init()){
+		fprintf(stderr,"\nabfpan2: Startup failure");
+		return 1;
+	}
+	
+	while(argv[1][0] =='-'){
+		switch(argv[1][1]){
+        case 'g':
+            if(argv[1][2] == '\0'){
+                fprintf(stderr,"abfpan2 Error: -g flag requires a value.\n");
+                return 1;
+            }
+            gain = atof(&argv[1][2]);
+            if(gain <= 0.0){
+                printf("abfpan2: gain value must be positive!\n");
+                return 1;
+            }
+            break;
+        case 'p':
+            if(argv[1][2] != '\0'){
+                degree = atof(&argv[1][2]);
+                if(degree < -180.0 || degree > 180.0){
+                    fprintf(stderr,"-p: degree value out of range.\n");
+                    return 1;
+                }
+                elevation = degree * (M_PI  / 180.0);
+            }
+            outchans = 9;
+            do_peri = 1;
+            break;
+        case 'w':
+            write_wav = 0;
+            break;
+		default:
+			fprintf(stderr,"\nabfpan: error: illegal flag option %s",argv[1]);
+			return 1;
+		}
+		argc--; argv++;
+	}
+
+	if(argc < ARG_NARGS ){
+		usage();
+		return 1;
+	}
+
+	sfname = argv[ARG_INFILE];
+	startpos = atof(argv[ARG_STARTPOS]);
+	if(startpos < 0.0 || startpos > 1.0){
+		fprintf(stderr,"abfpan2: startpos %.4lf out of range: must be between 0.0 and 1.0\n",startpos);
+		return 1;
+	}
+
+	endpos = atof(argv[ARG_ENDPOS]);
+	ifd = psf_sndOpen(sfname,&props,0);
+	if(ifd < 0){
+		fprintf(stderr,"abfpan2: unable toopen infile %s.\n",sfname);
+		return 1;
+	}
+
+    if(props.chans != 1){
+		fprintf(stderr,"abfpan2: infile must be mono.\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+
+	outsize = psf_sndSize(ifd);
+	if(outsize <= 0){
+		fprintf(stderr,"abfpan2: infile is empty!\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+    srate = props.srate;
+	props.chans = outchans;
+    if(!is_legalsize(outsize,&props)){
+        fprintf(stderr,"error: outfile size exceeds capacity of format.\n");
+        return 1;
+    }
+    
+	start_angle = - (TWOPI * startpos);	   //we think of positive as clockwise at cmdline!
+	angle_incr = TWOPI / outsize;
+	angle_incr *= (endpos - startpos);
+    
+	
+    if(write_wav == 0)
+        props.format = PSF_STDWAVE;
+    else {
+        printf("Writing B-Format file.\n");
+	    props.format = PSF_WAVE_EX;
+        props.chformat = MC_BFMT;
+    }
+    
+    peaks = (PSF_CHPEAK*)  malloc(sizeof(PSF_CHPEAK) * outchans);
+    memset(peaks,0,sizeof(PSF_CHPEAK) * outchans);
+    
+    
+	ofd = psf_sndCreate(argv[ARG_OUTFILE],&props,0,0,PSF_CREATE_RDWR);
+	if(ofd < 0){
+		fprintf(stderr,"abfpan2: can't create outfile %s.\n",sfname);	
+		return 1;
+	}
+
+	half_sec = srate / 2;
+	total_frames = 0;
+	d_srate = (double)srate;
+	
+	//should make one 360deg rotate over duration
+	//TODO: make lookup_sin and lookup_cos ugens, taking angle arg
+	
+    if(do_peri)
+        p_frame = abfsample;
+    else
+        p_frame = outframe;
+    
+	while((got = psf_sndReadFloatFrames(ifd,&this_samp,1))==1){
+		double x,y,z,xx,yy,zz;
+        x = cos(start_angle);
+        y = sin(start_angle);
+        if(elevation ==0.0)
+            z = 0.0;
+        else
+            z = sin(elevation);
+        xx = x * x;
+        yy = y * y;
+        zz = z * z;
+        this_samp *= gain;
+        if(do_peri) {
+            abfsample[W] = (float) (this_samp * 0.7071);
+            abfsample[X] = (float) (this_samp * x);
+            abfsample[Y] = (float) (this_samp * y);
+            abfsample[Z] = (float) (this_samp * z);
+            abfsample[R] = (float) (this_samp * (1.5 * zz - 0.5));  /// ????
+            abfsample[S] = (float) (this_samp * (2.0 * z * x));
+            abfsample[T] = (float) (this_samp * (2.0 * y * z));
+            abfsample[U] = (float) (this_samp * (xx-yy));
+            abfsample[V] = (float) (this_samp * (2.0 * x * y));
+        }
+        else{
+            outframe[0]  = (float) (this_samp * 0.7071);
+            outframe[1]  = (float) (this_samp * x);
+            outframe[2]  = (float) (this_samp * y);
+            outframe[3] = (float) (this_samp * (xx-yy));
+            outframe[4] = (float) (this_samp * (2.0 * x * y));
+        }
+            
+		if(0 > psf_sndWriteFloatFrames(ofd, p_frame,1)){
+			fprintf(stderr,"abfpan2: error writing frame %ld\n",total_frames);
+			return 1;
+		}
+		start_angle -= angle_incr;
+		total_frames++;		
+		if(total_frames % half_sec ==0) {
+			printf("%.2lf secs\r",(double)total_frames / d_srate);
+            fflush(stdout);
+        }
+	}
+	if(got != 0){
+		fprintf(stderr,"abfpan2: warning: not all data was read.\n");
+	}
+	printf("%.4lf secs\nWritten %ld frames to %s.\n",(double)total_frames / d_srate,total_frames, argv[ARG_OUTFILE]);
+	if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+		printf("PEAK values:\n");
+		for(i=0; i < outchans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+                printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                       val,dbval,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props.srate);
+            }
+            else{
+                printf("CH %d: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+                       val,(unsigned int)peaks[i].pos,(double)peaks[i].pos / (double) props.srate); 
+            }
+        }
+        
+	}
+
+	psf_sndClose(ifd);
+	psf_sndClose(ofd);
+	psf_finish();
+	return 0;
+}

+ 302 - 0
dev/externals/mctools/channel.c

@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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.
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* channelx.c */
+//RWD MCTOOLS, portsf version Oct 2009
+// nothing special, but use PEAK chunk (reading it where available)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <memory.h>
+#include <ctype.h>
+#include <portsf.h>
+
+#ifndef _MAX_PATH
+#define _MAX_PATH (1024)
+#endif
+#define MAXFILES 16
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+
+void usage(void);
+//RWD.7.99 extended to get file extension from base name
+// so can be used without CDP_SOUND_EXT
+static void getbody(char*,char*,char *);
+
+void
+usage(void)
+{
+    fprintf(stderr,"\nCDP MCTOOLS: CHANNELX V1.6 (c) RWD, CDP 2010\n");
+    fprintf(stderr,
+            "Extract all channels from m/c file\n"
+            "usage: channelx [-oBASENAME] infile chan_no [chan_no...]\n"
+            //"\nusage:  channelx [-oBASENAME] infile"
+            "  -oBASENAME = base name (with extension) of outfiles (appended *_cN for ch N)\n"
+            "(NB: Channels of WAVE-EX files are written as standard soundfiles)\n"
+            );
+}
+
+#if defined(unix)
+#define SEP     '/'
+#else
+#define SEP     '\\'
+#endif
+
+void getbody(char *filename,char *body,char *ext)
+{
+    char *fn, *sl;
+
+    if((sl = strrchr(filename, SEP)) != 0)
+        sl++;
+    else
+        sl = filename;
+
+    for(fn = sl; *fn != '.' && *fn != '\0'; ) {
+        *body++ = *fn++;
+    }
+    *body++ = '\0';
+    //save extension
+    while(*fn != '\0')
+        *ext++ = *fn++;
+    *ext = '\0';
+}
+
+
+
+
+
+int main(int argc,char *argv[])
+{
+
+    int ifd = 0;                            /* Infile descriptor */
+    int ofd[MAXFILES];                      /* Outfile descriptors */
+    int i;                      /* Assorted indexes */
+    int inchans=1;                          /* Infile channels */
+    char filename[_MAX_PATH];       /* Infilename */
+    int select[MAXFILES];           /* Flags for each channel to MAXFILES */
+    int lastchan = 0;                       /* Maximum Requested channels */
+    int numchans = 0;                       /* number of channels extracted */
+    char body[100];                         /* Infile name prefix */
+    char ext[8];
+    char outext[8];                         /* output extension: to change .amb to .wav */
+    char *p_dot;
+    char ofile[_MAX_PATH];          /* Raw outfile name */
+    PSF_PROPS inprops;
+    int nframes =0, total_frames = 0;
+    float *frame = NULL;
+    int writefiles = 0;                     /* try to keep working even if one file fails...*/
+
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.6.\n");
+        return 0;
+    }
+    if(argc<2) {
+        usage();
+        return 1;
+    }
+
+    if(psf_init()) {
+        fprintf(stderr,"Startup failure.\n");
+        return 1;
+    }
+
+    body[0] = '\0';
+    ext[0] = '\0';
+
+    while(argv[1] != 0 && argv[1][0] == '-') {
+        if(strncmp(argv[1], "-o", 2) == 0) {
+            if(body[0] != '\0')
+                usage();
+            strcpy(body, &argv[1][2]);
+        }
+        argv++;
+        argc--;
+    }
+    if(argc < 2) {
+        usage();
+        return 1;
+    }
+
+    if(argv[1] != 0) {
+        sprintf(filename,"%s",argv[1]);
+        if((ifd = psf_sndOpen(filename,&inprops,0)) < 0) {
+            fprintf(stderr,"Channelx: Cannot open input file %s\n",argv[1]);
+            return 1;
+        }
+    }
+    argv++;
+
+    if(inprops.chans > MAXFILES){
+        fprintf(stderr,"Channelx: infile has too many channels!\n");
+        psf_sndClose(ifd);
+        return 1;
+    }
+    inchans = inprops.chans;
+    nframes = psf_sndSize(ifd);
+    if(nframes < 0){
+        fprintf(stderr,"Channelx: error reading infile size\n");
+        psf_sndClose(ifd);
+        return 1;
+    }
+    if(nframes==0){
+        fprintf(stderr,"Channelx: infile contains no data!\n");
+        psf_sndClose(ifd);
+        return 1;
+    }
+    nframes /= inchans;
+    //always create a standard file!
+    if(inprops.format == PSF_WAVE_EX) {
+        inprops.format = PSF_STDWAVE;
+        inprops.chformat = STDWAVE;
+    }
+    //that's all we need to know, now set one output channel
+    inprops.chans = 1;
+
+    frame = calloc(inchans,sizeof(float));
+    if(frame == NULL){
+        puts("Channelx: no memory for internal sample data\n");
+        psf_sndClose(ifd);
+        return 1;
+    }
+
+    for(i=0;i<MAXFILES;i++){
+        select[i] = 0;
+        ofd[i] = -1;
+    }
+
+
+    while(argv[1] != 0) {
+        int chn;
+
+        if(sscanf(argv[1],"%d",&chn) < 1){
+            fprintf(stderr,
+                    "Channelx: illegal channel argument %s\n\n",argv[1]);
+            goto cleanup;
+        }
+
+        if((chn > inchans) || (chn < 1)){
+            fprintf(stderr,"Channelx: channel argument out of range\n\n");
+            goto cleanup;
+        }
+        //check for duplicates
+        if(select[chn-1]==0){
+            select[chn-1] = 1;
+            if(chn > lastchan)
+                lastchan = chn;
+            numchans++;
+        }
+        else
+            fprintf(stderr,"Channelx: WARNING: duplicate channel number %d\n",chn);
+
+        argv++;
+        argc--;
+    }
+    if(numchans < 1) {              //RWD
+        fprintf(stderr, "channelx: must extract at least one channel\n");
+        goto cleanup;
+    }
+
+    writefiles = numchans;
+
+    if(body[0] == '\0')
+        getbody(filename,body,ext);
+
+    else if((p_dot = strrchr(body,'.')) != NULL){
+        //extension set in body arg
+        *p_dot++ = '\0';
+        sprintf(ext,".%s",p_dot);
+    }
+    //trap ambisonic file; single channels must be wav
+    strcpy(outext,ext);
+    if(stricmp(outext,".amb")==0)
+        strcpy(outext,".wav");
+    for(i=0;i<inchans;i++){
+        if(select[i]){
+            sprintf(ofile, "%s_c%d%s", body, i+1,outext);
+
+
+            if((ofd[i] = psf_sndCreate(ofile,&inprops,0,0,PSF_CREATE_RDWR)) < 0) {
+                fprintf(stderr,"Channelx: Failed to create %s\n\n",ofile);
+                goto cleanup;
+            }
+        }
+    }
+
+    printf("Extracting %d channels from '%s':\n%d sample frames\n",numchans,filename,nframes);
+
+    //stopwatch(1);
+    for(i=0;i < nframes; i++){
+        int got;
+        if(writefiles==0)
+            goto cleanup;
+
+        if((got = psf_sndReadFloatFrames(ifd,frame,1)) < 1){
+            if(got < 0)
+                fprintf(stderr,"error reading data from infile, after %d frames\n",i);
+            //sndunlink all outfiles?
+            else
+                break;
+            //goto cleanup;
+        }
+
+        for(i=1;i<lastchan+1;i++){
+            if(select[i-1]){
+                if((psf_sndWriteFloatFrames(ofd[i-1],frame +(i-1),1))<0){
+                    fprintf(stderr,"Channelx: Write [channel %d] failed.\n\n",i);
+                    //RWD
+                    //sndunlink(ofd[i-1]);
+                    writefiles--;
+                    if(writefiles==0)
+                        break;
+                    else
+                        continue;       //may be other files we can still write to...
+                }
+            }
+        }
+        total_frames++;
+        if((total_frames % (inprops.srate/2)) == 0){
+            printf("%.2lf secs\r",(double)total_frames / (double)inprops.srate);
+            fflush(stdout);
+        }
+    }
+    printf("%.4lf secs\n",(double)total_frames / (double)inprops.srate);
+    printf("%d files created.\n",writefiles);
+
+ cleanup:
+    psf_sndClose(ifd);
+
+    for(i=0;i < MAXFILES; i++){
+        if(ofd[i] >= 0)
+            psf_sndClose(ofd[i]);
+    }
+
+
+    free(frame);
+    psf_finish();
+    return 0;
+}

+ 297 - 0
dev/externals/mctools/chorder.c

@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* chorder :  reorder channels in m/c file */
+/* Jan 2010: corrected behaviour with out of range order chars */
+/* July 2010 removed spurious premature call to usage() */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <portsf.h>
+
+/* set size of multi-channel frame-buffer */
+#define NFRAMES (1024)
+
+/* TODO define program argument list, excluding flags */
+enum {ARG_PROGNAME,ARG_INFILE,ARG_OUTFILE,ARG_ORDERSTRING,ARG_NARGS};
+#define N_BFORMATS (10)
+static const int bformats[N_BFORMATS] = {2,3,4,5,6,7,8,9,11,16};
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+
+void usage(void)
+{
+    fprintf(stderr,"\nCDP MCTOOLS: CHORDER V1.2 (c) RWD,CDP 2009,2010\n");	
+    fprintf(stderr,
+            "Reorder soundfile channels.\n"
+            "Usage:  chorder infile outfile orderstring\n"
+            "  orderstring = any combination of characters a-z inclusive.\n"
+            "  Infile channels are mapped in order as a=1,b=2...z=26\n"
+            "  (For example: channels in a 4-channel file are represented by the\n"
+            "    characters abcd; any other character is an error).\n"
+            "  Characters must be lower case, and may be used more than once.\n"
+            "  Duplicate characters duplicate the corresponding input channel.\n"
+            "  The zero character (0) may be used to set a silent channel.\n"
+            "  A maximum of 26 channels is supported for both input and output.\n"
+            "  NB: infile (WAVEX) speaker positions are discarded.\n"
+            "  The .amb extension is supported for the outfile.\n\n"
+            );
+}
+
+
+int main(int argc, char* argv[])
+{
+	PSF_PROPS inprops,outprops;									
+	long framesread;	
+	/* init all dynamic resources to default states */
+	unsigned int i;
+    int halfsec;
+	unsigned int framepos;
+    long outsize;
+    int ifd = -1,ofd = -1;
+	int error = 0;
+	PSF_CHPEAK* peaks = NULL;	
+	psf_format outformat =  PSF_FMT_UNKNOWN;
+	unsigned long nframes = 1;
+	float* inframe = NULL;
+	float* outframe = NULL;
+    float* orderptr[26];
+    char* argstring = NULL;
+    unsigned int rootchar = 'a';
+    unsigned int maxchar = 'z';
+    unsigned int  nchars,nzeros = 0;
+    unsigned int max_inchar;
+    MYLONG peaktime;
+	
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.2.\n");
+        return 0;
+    }
+
+	/* process any optional flags: remove this block if none used! */
+	if(argc > 1){
+		char flag;
+		while(argv[1][0] == '-') {
+			flag = argv[1][1];
+			switch(flag){
+			/*TODO: handle any  flag arguments here */
+			case('\0'):
+				printf("Error: missing flag name\n");
+				return 1;
+			default:
+				break;
+			}
+			argc--;
+			argv++;
+		}
+	}
+
+	if(argc < ARG_NARGS){
+		printf("insufficient arguments.\n");
+		usage();
+		return 1;
+	}
+    
+    /* initial check of charstring */
+    argstring = argv[ARG_ORDERSTRING];
+    nchars = strlen(argstring);
+    if(nchars > 26) {
+        printf("error: order string too long.\n");
+        return 1;
+    }
+    
+	/*  always startup portsf */
+	if(psf_init()){
+		printf("unable to start portsf\n");
+		return 1;
+	}
+																							
+	ifd = psf_sndOpen(argv[ARG_INFILE],&inprops,0);															  
+	if(ifd < 0){
+		printf("Error: unable to open infile %s\n",argv[ARG_INFILE]);
+		error++;
+		goto exit;
+	}
+    outsize = psf_sndSize(ifd);
+	if(outsize <= 0){
+		fprintf(stderr,"chorder: infile is empty!\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+    inframe = (float*) malloc(nframes * inprops.chans * sizeof(float));
+	if(inframe==NULL){
+		puts("No memory!\n");
+		error++;
+		goto exit;
+	}
+    /* final validate and parse of charstring */
+    max_inchar = rootchar;
+    for(i=0;i < nchars;i++){
+        unsigned int thischar = argstring[i];
+//        printf("reading char %c (%d)\n",thischar,thischar);
+        unsigned int chindex;
+        if(thischar != '0' && (thischar < rootchar || thischar > maxchar)){
+            printf("illegal character in order string: %c\n",thischar);
+            goto exit;
+        }
+        if(thischar =='0'){
+//            printf("setting channel %d to zero.\n",i);
+            orderptr[i] = NULL;
+            nzeros++;
+        }
+        else{
+            if(thischar > max_inchar)
+                max_inchar = thischar;
+            chindex = thischar - rootchar;
+            orderptr[i] = &inframe[chindex];
+        }
+    }
+    if(nzeros==nchars)
+        printf("Warning: order string is all zeros - a silent file will be made!\n");
+    else{    
+        /* count inclusively! */
+        if(inprops.chans < (max_inchar - rootchar + 1)){
+            printf("File has %d channels; order string defines non-existent channels.\n",inprops.chans);
+            printf("For this file, maximum character is %c\n",rootchar+inprops.chans-1);
+            goto exit;
+        }
+    }
+	/* check file extension of outfile name, so we use correct output file format*/
+	outformat = psf_getFormatExt(argv[ARG_OUTFILE]);
+	if(outformat == PSF_FMT_UNKNOWN){
+		printf("outfile name %s has unsupported extension.\n"
+			"Use any of .wav, .aiff, .aif, .afc, .aifc, .amb\n",argv[ARG_OUTFILE]);
+		error++;
+		goto exit;
+	}
+	inprops.format = outformat;
+	outprops = inprops;
+	outprops.chans = nchars;
+    if(!is_legalsize(outsize,&outprops)){
+        fprintf(stderr,"error: outfile size exceeds capacity of format.\n");
+        return 1;
+    }
+    /* any speaker assignment etc invalidated! */
+    if(outformat == PSF_STDWAVE) {
+        outprops.chformat = MC_STD;
+        outprops.format =  PSF_WAVE_EX;
+    }
+    
+    if(outformat==PSF_WAVE_EX){
+        int matched = 0;
+        for(i=0;i < N_BFORMATS;i++)	{
+            if(inprops.chans == bformats[i]){
+                matched = 1;
+                break;
+            }
+        }
+        if(!matched){
+            printf("WARNING: No B-format definition for %d-channel file.\n",outprops.chans);
+        }
+        outprops.chformat = MC_BFMT;
+        outprops.format =  PSF_WAVE_EX;
+    }
+    
+    outframe = malloc(sizeof(float) * nchars);
+    
+	peaks  =  (PSF_CHPEAK*) malloc(outprops.chans * sizeof(PSF_CHPEAK));
+	if(peaks == NULL){
+		puts("No memory!\n");
+		error++;
+		goto exit;
+	}
+	ofd = psf_sndCreate(argv[ARG_OUTFILE],&outprops,0,0,PSF_CREATE_RDWR);
+	if(ofd < 0){
+		printf("Error: unable to create outfile %s\n",argv[ARG_OUTFILE]);
+		error++;
+		goto exit;
+	}
+	
+    halfsec = inprops.srate / 2;
+	framepos = 0;
+	printf("processing....\n");									
+	
+	while ((framesread = psf_sndReadFloatFrames(ifd,inframe,1)) > 0){
+        float val;
+        for(i=0;i < nchars;i++){
+            if(orderptr[i] == NULL)
+                val = 0.0f;
+            else
+                val = *orderptr[i];
+            outframe[i] = val;
+        }
+		
+
+		if(psf_sndWriteFloatFrames(ofd,outframe,1) != 1){
+			printf("Error writing to outfile\n");
+			error++;
+			break;
+		}
+        if((framepos % halfsec) == 0){
+			printf("%.2lf secs\r",(double) framepos / (double) outprops.srate);
+            fflush(stdout);
+        }
+		framepos++;
+	}
+
+	if(framesread < 0)	{
+		printf("Error reading infile. Outfile is incomplete.\n");
+		error++;
+	}
+	printf("\n%.4lf secs\nWritten %d frames to %s\n",(double)framepos / (double) outprops.srate,framepos,argv[ARG_OUTFILE]);
+		
+	if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+		printf("PEAK values:\n");
+		for(i=0; i < outprops.chans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+                printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                       val,dbval,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) outprops.srate);
+            }
+            else{
+                printf("CH %d: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+                       val,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) outprops.srate); 
+            }
+        }
+	}
+	printf("\n");
+exit:	 	
+	if(ifd >= 0)
+		psf_sndClose(ifd);
+	if(ofd >= 0)
+		psf_sndClose(ofd);
+	if(inframe)
+		free(inframe);
+    if(outframe)
+        free(outframe);
+	if(peaks)
+		free(peaks);
+
+	psf_finish();
+	return error;
+}

+ 760 - 0
dev/externals/mctools/chxformat.c

@@ -0,0 +1,760 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* chxformat.c */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+#include <limits.h>
+#include <portsf.h>
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+enum {ARG_PROGNAME, ARG_INFILE,ARG_NARGS};
+enum {GUID_PCM,GUID_IEEE,GUID_AMB_PCM,GUID_AMB_IEEE};
+
+char* guidnames[] = {"PCM","PCM FLOAT","AMB PCM","AMB FLOAT"};
+
+
+#define REVDWBYTES(t)	( (((t)&0xff) << 24) | (((t)&0xff00) << 8) | (((t)&0xff0000) >> 8) | (((t)>>24) & 0xff) )
+#define REVWBYTES(t)	( (((t)&0xff) << 8) | (((t)>>8) &0xff) )
+#define TAG(a,b,c,d)	( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) )
+
+#ifdef linux
+#define POS64(x) (x.__pos)
+#else
+#define POS64(x) (x)
+#endif
+
+#define WAVE_FORMAT_PCM			(0x0001)
+#define sizeof_WFMTEX  (40)
+typedef struct _GUID 
+{ 
+    unsigned int        Data1; 
+    unsigned short       Data2; 
+    unsigned short       Data3; 
+    unsigned char        Data4[8]; 
+} GUID; 
+
+
+typedef struct  {
+	WORD  wFormatTag; 
+    WORD  nChannels; 
+    DWORD nSamplesPerSec; 
+    DWORD nAvgBytesPerSec; 
+    WORD  nBlockAlign; 
+    WORD  wBitsPerSample; 
+
+} WAVEFORMAT;
+
+
+typedef struct { 
+    WORD  wFormatTag; 
+    WORD  nChannels; 
+    DWORD nSamplesPerSec; 
+    DWORD nAvgBytesPerSec; 
+    WORD  nBlockAlign; 
+    WORD  wBitsPerSample; 
+    WORD  cbSize; 
+} WAVEFORMATEX; 
+
+typedef struct {
+    WAVEFORMATEX    Format;				/* 18 bytes */
+    union {
+        WORD wValidBitsPerSample;       /* bits of precision  */
+        WORD wSamplesPerBlock;          /* valid if wBitsPerSample==0 */
+        WORD wReserved;                 /* If neither applies, set to */
+                                        /* zero. */
+    } Samples;
+    DWORD    dwChannelMask;				/* which channels are */
+                                        /* present in stream  */
+    GUID     SubFormat;
+} WAVEFORMATEXTENSIBLE;
+
+static const GUID  KSDATAFORMAT_SUBTYPE_PCM = {0x00000001,0x0000,0x0010,
+								{0x80,
+								0x00,
+								0x00,
+								0xaa,
+								0x00,
+								0x38,
+								0x9b,
+								0x71}};
+
+static const GUID  KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = {0x00000003,0x0000,0x0010,
+								{0x80,
+								0x00,
+								0x00,
+								0xaa,
+								0x00,
+								0x38,
+								0x9b,
+								0x71}};
+
+static const GUID SUBTYPE_AMBISONIC_B_FORMAT_PCM = { 0x00000001, 0x0721, 0x11d3, 
+												{ 0x86,
+												0x44,
+												0xc8,
+												0xc1,
+												0xca,
+												0x0,
+												0x0,
+												0x0 } };
+
+
+static const GUID SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT = { 0x00000003, 0x0721, 0x11d3, 
+												{ 0x86,
+												0x44,
+												0xc8,
+												0xc1,
+												0xca,
+												0x0,
+												0x0,
+												0x0 } };
+
+
+#define WAVE_FORMAT_IEEE_FLOAT	(0x0003)
+#define WAVE_FORMAT_EXTENSIBLE	(0xfffe)
+
+static int compare_guids(const GUID *gleft, const GUID *gright)
+{
+	const char *left = (const char *) gleft, *right = (const char *) gright;
+	return !memcmp(left,right,sizeof(GUID));
+}
+
+
+static int wavDoRead(FILE* fp, void* buf, DWORD nBytes)
+{
+	DWORD got = 0;	
+	if((got = fread(buf,sizeof(char),nBytes,fp)) != nBytes) {
+        return 1;
+    }
+	return 0;
+}
+
+static int byte_order()					
+{						    
+  int   one = 1;
+  char* endptr = (char *) &one;
+  return (*endptr);
+}
+
+static void fmtSwapBytes(WAVEFORMATEX  *pfmt)
+{	
+	pfmt->wFormatTag	= (WORD) REVWBYTES(pfmt->wFormatTag);
+	pfmt->nChannels		= (WORD) REVWBYTES(pfmt->nChannels);
+	pfmt->nSamplesPerSec	= REVDWBYTES(pfmt->nSamplesPerSec);
+	pfmt->nAvgBytesPerSec	= REVDWBYTES(pfmt->nAvgBytesPerSec);
+	pfmt->nBlockAlign	= (WORD) REVWBYTES(pfmt->nBlockAlign);
+	pfmt->wBitsPerSample	= (WORD) REVWBYTES(pfmt->wBitsPerSample);	
+}
+
+
+
+void printmaskinfo()
+{
+    printf("WAVEX Speaker positions:\n");
+
+    
+printf(
+"FRONT LEFT             0x1\n"
+"FRONT RIGHT            0x2\n"
+"FRONT CENTER           0x4\n"
+"LOW FREQUENCY          0x8\n"
+"BACK LEFT              0x10\n"
+"BACK RIGHT             0x20\n"
+"FRONT LEFT OF CENTER   0x40\n"
+"FRONT RIGHT OF CENTER  0x80\n"
+"BACK CENTER            0x100\n"
+"SIDE LEFT              0x200\n"
+"SIDE RIGHT             0x400\n"
+"TOP CENTER             0x800\n"
+"TOP FRONT LEFT         0x1000\n"
+"TOP FRONT CENTER       0x2000\n"
+"TOP FRONT RIGHT        0x4000\n"
+"TOP BACK LEFT          0x8000\n"
+"TOP BACK CENTER        0x10000\n"
+"TOP BACK RIGHT         0x20000\n"
+       );
+printf("The value 0x80000000 is reserved.\n");
+    
+printf("Standard layouts:\n"
+
+"Mono       0x40        (64)\n"
+"Stereo     0x03         (3)\n"
+"Quad       0x33        (51)\n"
+"LCRS       0x107      (263)\n"
+"5.0        0x37        (55)\n"
+"5.1        0x3f        (63)\n"
+"7.1        0xff       (255)\n"
+"Cube       0x2d033 (184371)\n"
+       ); 
+}
+
+void usage(void)
+{
+    printf("CDP MCTOOLS: CHXFORMAT v1.0.1beta (c) RWD,CDP 2009\n");
+    printf("change GUID and/or speaker mask in WAVEX header of infile.\n");
+    printf("usage: chxformat [-m | [[-t] [-gGUID] [-sMASK]] filename\n");
+    printf(
+           " -gGUID : change GUID type between PCM and AMB.\n"
+           "          Plain WAVEX: GUID = 1\n"
+           "          AMB:         GUID = 2\n"
+           " -sMASK : change speaker position mask.\n"
+           "          MASK = 0:  unset channel mask\n"
+           "             else set to MASK\n"
+           "          MASK may be given in decimal or hex (prefix '0x').\n"
+           " -m     : (not in combination with other options)\n"
+           " NOTE: speaker positions are only supported for WAVEX PCM files.\n"
+           "       If GUID is set to 2, the -s option should not be used. Any existing\n"
+           "       speaker positions will be set to zero.\n"
+           " Type chxformat -m to see list of WAVEX mask values.\n"
+           " -t     : Test only: do not modify file.\n"
+           "  If only infile given, program prints current GUID type and speaker mask.\n"
+           "  In test mode, program checks file, prints current channel mask as binary,\n"
+           "   and new mask in binary, if -s option set.\n"
+           "  Otherwise: program modifies infile (\"destructively\") - use with care!\n"
+           );
+    
+}
+
+void binprintf(int val,int skipzeroes)
+{
+    unsigned int nbits = sizeof(int) * CHAR_BIT;
+    unsigned int i = 0;
+    unsigned int mask = 1 << (nbits-1); /* i.e. 0x80000000; */
+    // skip leading zeroes
+    if(skipzeroes){
+        for(;i < nbits;i++){
+            if(val&mask)
+                break;
+            mask>>=1;
+        }
+    }
+    for(;i < nbits;i++){
+        if(i > 0 && i%8 == 0)
+            printf(" ");
+        printf("%d",(val & mask) ? 1 : 0);
+        mask >>= 1;
+    }
+}
+
+int countbits(int val)
+{
+    unsigned int nbits = sizeof(int) * CHAR_BIT;
+    unsigned int i = 0;
+    int count = 0;
+    unsigned int mask = 1 << (nbits-1); /* i.e. 0x80000000; */
+    for(;i< nbits;i++){
+        if(val & mask)
+            count++;
+        mask >>= 1;
+    }
+    return count;
+}
+
+int isdec(int ch){
+    if(ch >= '0' && ch <= '9')
+        return 1;
+//    printf("isdec fail: %d\n",ch);
+    return 0;
+}
+
+int ishex(int ch){
+    
+    if((ch >='A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'))
+        return 1;
+//     printf("ishex fail: %c\n",ch);
+    return 0;
+}
+
+int validate_mask(const char* mask)
+{
+    int is_dec = 1,is_hex = 1;
+    size_t i,len;
+    char* pch;
+    if(mask==NULL)
+        return 0;
+    len = strlen(mask);
+    if(len==0)
+        return 0;
+    
+    pch = (char*) mask;
+    /*try hex */
+    if(len > 2 && *pch =='0'){
+        pch++;
+        if(*pch=='x' || *pch =='X'){ // prefix found
+            pch++;
+//            printf("got hex prefix\n");
+            for(i = 0;i < len-2;i++){
+//                printf("testing %d \n",pch[i]);
+                if(!(isdec(pch[i]) || ishex(pch[i]))){
+                    is_hex = 0;
+                    break;
+                }
+            }
+            if(is_hex)
+                return 1;
+        }
+        // not hex, maybe decimal
+    }
+    pch = (char*) mask;
+    for(i=0;i < len;i++){
+        if(!isdec(pch[i])){
+            is_dec = 0;
+            break;
+        }
+    }
+    return is_dec;
+}
+
+
+
+int main (int argc, char**argv)
+{
+    int do_changeguid = 0;
+    int in_guidtype =0;
+    int guidtoset = 0;
+    int do_changemask = 0;
+    unsigned int speakermask = 0;
+    int fmtfound = 0;
+    int test = 0;
+    int src_is_amb = 0;
+    FILE* fp  = NULL;
+    char* maskstring = NULL;
+    psf_format outformat;
+    psf_format new_outtype;
+    DWORD tag;
+    DWORD size;
+    fpos_t bytepos;
+    DWORD fmtoffset = 0;
+    DWORD guidoffset = 0;
+    DWORD maskoffset = 0;
+	WORD cbSize;
+    WORD validbits;
+    DWORD chmask;
+    WAVEFORMATEXTENSIBLE fmt;
+    int is_little_endian = byte_order();
+    
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.0.1b\n");
+        return 0;
+    }
+    
+    if(argc<2){
+        usage();
+        return 1;
+    }
+    while(argv[1][0]=='-'){
+		switch(argv[1][1]){
+            case 'm':
+                if(argc > 2){
+                    printf("cannot use -m with other options\n");
+                    return 1;
+                }
+                else{
+                    printmaskinfo();
+                    return 0;
+                }
+                break;
+            case 'g':
+                if(do_changeguid){
+                    printf("Cannot use -g option more than once!\n");
+                    return 1;
+                }
+                guidtoset = atoi(&argv[1][2]);
+                if(guidtoset < 1 || guidtoset > 2) {
+                    printf("bad value for -g option - use 1 or 2 only.\n");
+                    return 1;
+                }
+                do_changeguid = 1;
+                break;
+            case 's':
+                if(do_changemask){
+                    printf("Cannot use -s option more than once!\n");
+                    return 1;
+                }
+                maskstring =  &argv[1][2];
+                if(validate_mask(maskstring)==0){
+                    printf("Bad format for mask argument.\n"
+                           "Value must be decimal, or hex with 0x prefix.\n");
+                    return 1;
+                }
+                    
+                do_changemask = 1;
+                break;
+            case 't':
+                if(test==1){
+                    printf("You only need to set -t once!\n");
+                }
+                else
+                    printf("Test mode: no changes will be made.\n");
+                test = 1;
+                
+                break;
+            default:
+                printf("illegal option %s\n",argv[1]);
+                return 1;
+        }
+        argc--;
+        argv++;
+    }
+    if(argc != 2){
+        printf("infile argument required.\n");
+        usage();
+        return 1;
+    }
+    psf_init();
+    /* nitty-gritty to read header */
+    outformat = psf_getFormatExt(argv[ARG_INFILE]);
+	if(!(outformat == PSF_STDWAVE|| outformat==PSF_WAVE_EX)){
+		printf("file mustbe WAVEX format with .wav or .amb extension.\n");
+        return 1;
+	}
+    
+    fp = fopen(argv[ARG_INFILE],"rb+");
+    if(fp==NULL){
+        printf("unable to open infile %s\n",argv[ARG_INFILE]);
+        return 1;
+    }
+    if(wavDoRead(fp,(char *)&tag,sizeof(DWORD))
+		|| wavDoRead(fp,(char *) &size,sizeof(DWORD))) {
+		printf("read error 1\n");
+        return 1;
+    }
+	if(!is_little_endian)
+		size = REVDWBYTES(size);
+	else
+		tag = REVDWBYTES(tag);
+	if(tag != TAG('R','I','F','F')){
+		printf("not a RIFF file\n");
+        return 1;
+    }
+	if(size < (sizeof(WAVEFORMAT) + 3 * sizeof(WORD))){
+		printf("file has bad header.\n");
+        return 1;
+    }
+
+	if(wavDoRead(fp,(char *)&tag,sizeof(DWORD))) {
+		printf("read error 2\n");
+        return 1;
+    }
+	if(is_little_endian)
+		tag = REVDWBYTES(tag);
+	if(tag != TAG('W','A','V','E')){
+		printf("Not a WAVE file.\n");
+        return 1;    
+    }
+	for(;;){
+        if(fmtfound) 
+            break;
+		if(wavDoRead(fp,(char *)&tag,sizeof(DWORD))
+				|| wavDoRead(fp,(char *) &size,sizeof(DWORD))) {
+			printf("read error 3\n");
+            return 1;
+        }
+		if(!is_little_endian)
+			size = REVDWBYTES(size);
+		else
+			tag = REVDWBYTES(tag);
+		switch(tag){
+		case(TAG('f','m','t',' ')):
+			if( size < sizeof(WAVEFORMAT)){
+				printf("file has bad format.\n");
+                return 1;
+            }
+            
+			if(size > sizeof_WFMTEX) {
+				printf("file has unsupported WAVE format.\n");
+                return 1;
+            }
+			if(fgetpos(fp,&bytepos)) {
+			    printf("seek error\n");
+                return 1;
+            }
+			fmtoffset = (DWORD) POS64(bytepos);
+			if(wavDoRead(fp,(char *) &fmt.Format,sizeof(WAVEFORMAT))){				
+				printf("read error 4\n");
+                return 1;
+			}
+			if(!is_little_endian)		
+				fmtSwapBytes(&fmt.Format);	
+			/* calling function decides if format is supported*/
+			if(size > sizeof(WAVEFORMAT)) {
+				if(wavDoRead(fp,(char*)&cbSize,sizeof(WORD))){
+					printf("read error 5\n");
+                    return 1;
+                }
+				if(!is_little_endian)		
+					cbSize = (WORD) REVWBYTES(cbSize);
+                if(cbSize==0){
+                    printf("file is plain WAVE format.\n");
+                    return 1;
+                }
+				if(fmt.Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE){
+					if(cbSize != 22) {
+						printf("not a recognized WAVEX file.\n");
+                        return 1;
+					}
+				}				
+				if(wavDoRead(fp,(char *) &validbits,sizeof(WORD))){
+					printf("read error 6\n");
+                    return 1;
+                }
+                
+				if(!is_little_endian)
+                    validbits = REVWBYTES(validbits);
+                fmt.Samples.wValidBitsPerSample = (WORD) validbits;
+				if(wavDoRead(fp,(char *) &chmask,sizeof(DWORD))) {
+					printf("read error 7\n");
+                    return 1;
+                }
+				if(!is_little_endian)
+                    chmask = REVDWBYTES(chmask);
+                fmt.dwChannelMask = chmask;
+				if(wavDoRead(fp,(char *) &(fmt.SubFormat),sizeof(GUID))) {
+					printf("read error 8 \n");
+                    return 1;
+                }
+				if(!is_little_endian){
+					fmt.SubFormat.Data1 = REVDWBYTES(fmt.SubFormat.Data1);
+					fmt.SubFormat.Data2 = (WORD) REVWBYTES(fmt.SubFormat.Data2);
+					fmt.SubFormat.Data3 = (WORD) REVWBYTES(fmt.SubFormat.Data3);	
+				}
+				/* if we get a good GUID, we are ready to make changes! */
+                
+				if(compare_guids(&(fmt.SubFormat),&(KSDATAFORMAT_SUBTYPE_PCM))) {
+                    in_guidtype = GUID_PCM;
+                    if(test)
+                        printf("Current GUID: KSDATAFORMAT_SUBTYPE_PCM.\n");
+                }
+                else if(compare_guids(&(fmt.SubFormat),&(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))) {
+                    in_guidtype = GUID_IEEE;
+                    if(test)
+                        printf("Current GUID: KSDATAFORMAT_SUBTYPE_IEEE_FLOAT.\n");
+                }
+                else if(compare_guids(&(fmt.SubFormat),&(SUBTYPE_AMBISONIC_B_FORMAT_PCM))) {
+                    in_guidtype = GUID_AMB_PCM;
+                    src_is_amb = 1;
+                    if(test)
+                        printf("Current GUID: SUBTYPE_AMBISONIC_B_FORMAT_PCM.\n");
+                }
+                else if(compare_guids(&(fmt.SubFormat),&(SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))){
+                    in_guidtype = GUID_AMB_IEEE;
+                    src_is_amb = 1;
+                    if(test)
+                        printf("Current GUID: SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT.\n");
+                }
+                else {
+                    printf("unrecognized WAVE_EX GUID.\n");
+                    return 1;
+                }				
+			}
+            else {
+                printf("WAVEX format required.\n"
+                       "Use copysfx to convert to WAVEX format.\n");
+                return 1;
+            }
+            fmtfound = 1;			
+			break;
+		case TAG('d','a','t','a'):
+            if(!fmtfound){
+                printf("bad WAVE file: no fmt chunk found!\n");
+                return 1;
+            }                 
+        default:
+			/* unknown chunk - skip */
+            if(!fmtfound) {
+                if(fseek(fp,size,SEEK_CUR)){
+                    printf("seek error\n");
+                    return 1;
+                }
+            }
+			break;
+		}
+	}
+    if(!fmtfound){
+         printf("no fmt chunk found!\n");
+         return 1;
+    }
+    
+    maskoffset = fmtoffset + sizeof(WAVEFORMAT) + sizeof(WORD)*2;
+    guidoffset = maskoffset + sizeof(DWORD);
+    
+    if(!(do_changeguid || do_changemask)){
+        /* display what we know */
+        printf("Wordsize     : %d\n",validbits);
+        printf("Channels     : %d\n",fmt.Format.nChannels);
+        printf("GUID         : %s\n",guidnames[in_guidtype]);
+        if(chmask==0)
+            printf("Channel mask : 0\n");
+        else
+            printf("Channel mask : 0x%06x (%d)\n",(unsigned int) chmask,(int) chmask);
+        if(chmask){
+            printf("Channel mask (binary): ");
+            binprintf(chmask,1);
+            printf("There are %d speaker positions set.\n",countbits(chmask));
+            
+        }
+        printf("\n");
+    }
+    else {
+        int bits,is_same = 0;
+
+        /* check all settings before making any changes */
+        if(do_changemask){
+            // be strict!
+            if(src_is_amb && guidtoset != 1){
+                printf("-s flag only supported for PCM files (AMB speaker mask must be zero).\n"
+                       "Exiting.\n");
+                return 1;
+            }
+            if(strncmp(maskstring,"0x",2)==0)
+                sscanf(maskstring,"%x", &speakermask);
+            else
+                sscanf(maskstring,"%u", &speakermask);
+            bits = countbits(speakermask);
+            /* can't do much if a silly huge value given */
+            if(speakermask < 0 || speakermask >= 0x40000){
+                printf("Mask value out of range!\n");
+                return 1;
+            }
+            if(bits > fmt.Format.nChannels){
+                printf("Error: %d positions requested for %d channels: \n",bits,fmt.Format.nChannels);
+                binprintf(speakermask,1);
+                printf("\n");
+                return 1;
+            }
+            if(bits && bits < fmt.Format.nChannels){
+                printf("Warning: %d requested positions less than channels in file.\n",bits);
+            }
+        }
+                
+        if(do_changeguid){
+            GUID nuguid;
+            
+            // set float or pcm GUID as required.
+            // no copy to same: only convert if types are different
+            switch(guidtoset){
+            case 1:       // plain wavex - the easy iption
+                if(in_guidtype == GUID_AMB_PCM){
+                    nuguid = KSDATAFORMAT_SUBTYPE_PCM;
+                }
+                else if(in_guidtype == GUID_AMB_IEEE) {
+                    nuguid = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+                }
+                else
+                    is_same = 1;
+                new_outtype = PSF_STDWAVE;
+                break;
+            case 2:  // convert to amb - must zero speaker flags
+                if(in_guidtype == GUID_PCM)
+                    nuguid = SUBTYPE_AMBISONIC_B_FORMAT_PCM;
+                else if(in_guidtype == GUID_IEEE)
+                    nuguid = SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT;
+                else
+                    is_same = 1;
+                // set mask to zero if setting AMB format
+                if(is_same==0) {
+                    do_changemask = 1;
+                    maskstring = "0";
+                    speakermask = 0;
+                }
+                new_outtype = PSF_WAVE_EX;    
+                break;
+            }
+            if(is_same){
+                printf("new GUID identical - no change made.\n");
+            }
+            else {
+                int err;
+                //make the change!
+                if(!is_little_endian){
+                    nuguid.Data1 = REVDWBYTES(nuguid.Data1);
+					nuguid.Data2 = (WORD) REVWBYTES(nuguid.Data2);
+					nuguid.Data3 = (WORD) REVWBYTES(nuguid.Data3);
+                }
+                if(!test){
+                    if(fseek(fp,guidoffset,SEEK_SET) !=0){
+                        printf("seek error updating channelmask. exiting.\n");
+                        return 1;
+                    }
+                    err = fwrite((char*) &nuguid,1,sizeof(GUID),fp);
+                    if(err != sizeof(GUID)){
+                        printf("Error updating GUID. File may have inconsistent header.\n");
+                        return 1;
+                    }
+                    printf("new GUID set.\n");
+                    
+                }
+            }
+            
+        }
+        if(do_changemask){
+            /* read user mask value */
+            /* TODO: full parse, trap bad characters */
+            if(chmask==speakermask){
+                if(speakermask > 0)
+                    printf("Requested mask is already set. Data not modified.\n");
+            }
+            else {
+                DWORD writemask;
+                int err;
+                
+                if(speakermask > 0){
+                    printf("new mask = %d (",speakermask);
+                    binprintf(speakermask,1);
+                    printf(")\n");
+                }
+                if(fseek(fp,maskoffset,SEEK_SET) !=0){
+                    printf("seek error updating channelmask. exiting.\n");
+                    return 1;
+                }
+                writemask = speakermask;
+                if(!is_little_endian)
+                    writemask = REVDWBYTES(speakermask);
+                if(!test){
+                    err = fwrite((char*) &writemask,1,sizeof(DWORD),fp);
+                    if(err != sizeof(DWORD)){
+                        printf("Error updating mask. File may have inconsistent header.\n");
+                        return 1;
+                    }
+                    printf("New mask set.\n");
+                }
+            }
+                
+        }
+        if(outformat == PSF_STDWAVE && new_outtype==PSF_WAVE_EX)
+            printf("File extension should be changed to amb.\n");
+        else if(outformat == PSF_WAVE_EX && new_outtype == PSF_STDWAVE)
+            printf("File extension should be changed to wav.\n");
+    }
+    fseek(fp,0,SEEK_END);
+    fclose(fp);
+    return 0;
+}
+
+
+    

+ 604 - 0
dev/externals/mctools/copysf.c

@@ -0,0 +1,604 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/*
+ *	copysfx: version of copysfx using portsf
+ */
+/* Oct 2009: added cube */
+/* Dec 2009 1.9.1. fixed horrible bug failing to convert to WAVE_EX! */
+/* March 2012 corrected wave type arg parsing  */
+/* August 2012 updated portsf to correct SPKRS_MONO */
+/* Nov 2013 added MC_SURR_6_1 */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#ifdef _WIN32
+#include <malloc.h>			//RWD.6.5.99
+#endif
+#include <string.h>
+#include <math.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/timeb.h>
+#include <portsf.h>
+
+#define VERSION "Revision: 2.1.1 2020 "
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+enum {OPT_STD_WAVE,OPT_WAVEX_GENERIC,OPT_WAVEX,OPT_WAVEX_LCRS,OPT_WAVEX_SURROUND,OPT_WAVEX_BFORMAT,OPT_WAVEX_5_0,OPT_WAVEX_7_1,OPT_WAVEX_CUBE,OPT_WAVEX_6_1,};
+/*
+The number of channels defines the order of the soundfield:
+ 3 channel = h   = 1st order horizontal
+ 4 channel = f   = 1st order 3-D
+ 5 channel = hh  = 2nd order horizontal
+ 6 channel = fh  = 2nd order horizontal + 1st order height (formerly
+called 2.5 order)
+ 7 channel = hhh = 3rd order horizontal
+ 8 channel = fhh = 3rd order horizontal + 1st order height
+ 9 channel = ff  = 2nd order 3-D
+11 channel = ffh = 3rd order horizontal + 2nd order height
+16 channel = fff = 3rd order 3-D
+*/
+#define N_BFORMATS (10)
+static const int bformats[N_BFORMATS] = {2,3,4,5,6,7,8,9,11,16};
+
+int get_sampsize(psf_stype type)
+{
+    int size = 0;
+    switch(type){
+		case PSF_SAMP_8:
+			size = 1;
+			break;
+		case PSF_SAMP_16:
+			size = 2;
+			break;
+		case PSF_SAMP_24:
+			size = 3;
+			break;
+		case PSF_SAMP_32:
+		case PSF_SAMP_IEEE_FLOAT:
+			size = 4;
+			break;
+		default:
+			break;
+    }
+    return size;
+}
+
+
+
+void
+usage()
+{
+	fprintf(stderr,"\n\nCDP MCTOOLS: COPYSFX  (c) RWD,CDP %s\n",VERSION);
+	fprintf(stderr,"\tcopy/convert soundfiles\n");
+	fprintf(stderr,"usage: copysfx [-d][-h][-sN] [-tN] infile outfile\n");
+	fprintf(stderr,"-d   : apply TPDF dither to 16bit outfile.\n"
+                   "-s   : force output sample type to type N.\n");
+	fprintf(stderr,"      Available sample types:\n"
+                   "      1  : 16bit integers (shorts)\n"
+                   "      2  : 32bit integer  (longs)\n"
+                   "      3  : 32bit floating-point\n"
+                   "      4  : 24bit integer 'packed' \n"
+                   "      Default: format of infile.\n");
+				   
+	fprintf(stderr,"-h   : write mimimum header (no extra data).\n"
+				   "       Default: include PEAK data.\n"
+            );
+/*	fprintf(stderr,"-i   : interpret 32bit files as floats (use with care!)\n"); */
+	fprintf(stderr,"-tN  : write outfile format as type N\n");
+	fprintf(stderr,"Possible formats:\n"
+					"0   : standard soundfile (.wav, .aif, .afc, .aifc)\n"
+					"1   : generic WAVE_EX (no speaker assignments)\n"
+					"2   : WAVE_EX mono/stereo/quad(LF,RF,LR,RR) - infile nchans must match\n"
+					"3   : WAVE_EX quad surround (L,C,R,S)       - infile must be quad\n"
+					"4   : WAVE_EX 5.1 format surround           - infile must be 6-channel\n"
+					"5   : WAVE_EX Ambisonic B-format (W,X,Y,Z...) - file extension .amb supported \n"
+                    "6   : WAVE_EX 5.0 Surround                  - infile must be 5-channel\n"
+                    "7   : WAVE_EX 7.1 Surround                  - infile must be 8-channel\n"
+                    "8   : WAVE_EX Cube Surround                 - infile must be 8-channel\n"
+                    "9   : WAVE_EX 6.1 Surround  (new in v2.1.0) - infile must be 7-channel\n"
+					"default in all cases: outfile has format of infile\n"
+					"NB: types 1 to 9 are for WAV format only\n"
+                    "See also CHXFORMAT: destructively change WAVE_EX GUID and/or speaker mask.\n"
+					);	
+}
+
+
+
+int
+main(int argc, char *argv[])
+{
+	unsigned long size,i;
+	unsigned long channels,srate;
+	//RWD.6.5.99
+	PSF_PROPS  inprops,outprops; 
+	int force_wave = 0,rc = 0;
+    psf_stype force_stype = 0;
+	int opt_wave_type = -1;
+	int min_header = 0;
+	int interpret_floats = 0;
+	int res;	
+	char *create_msg = NULL;
+    int do_dither = 0;
+    psf_format  outformat = PSF_FMT_UNKNOWN;
+	unsigned long update_size;
+	PSF_CHPEAK  *peaks = NULL;
+	MYLONG peaktime;
+	char* ext = NULL;
+	int have_amb_ext = 0;
+    int ifd;		/* the input file */
+    int ofd;		/* the output file */
+    float *sampleframe = NULL;
+	double outsize_bytes;
+	double maxsize = pow(2.0,32.0) - 200.0;  /* some safety margin! */
+	
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("2.0.3\n");
+        return 0;
+    }
+
+	if(psf_init()) {		
+		printf("failed to init psfsys\n");
+		exit(1);
+	}
+
+	if(argc < 3){
+		usage();
+		exit(1);
+	}
+
+	printf("\nCDP MCTOOLS: COPYSFX v2.0.3 (c) RWD,CDP 2011\n");
+
+	while(argv[1][0]=='-'){
+		int sflag = 0;
+		switch(argv[1][1]){
+        case 'd':
+            do_dither = 1;
+            break;
+		case('t'):
+			if(argv[1][2]=='\0'){
+				fprintf(stderr,"-t flag requires parameter\n");
+				usage();
+				exit(1);
+			}
+			opt_wave_type = atoi(&(argv[1][2]));
+			if((opt_wave_type < 0) || opt_wave_type > OPT_WAVEX_CUBE){
+				fprintf(stderr,"wave type out of range\n");
+				usage();
+				exit(1);
+			}
+			force_wave = 1;
+			break;		
+		case('s'):
+			if(argv[1][2]=='\0'){
+				fprintf(stderr,"-s flag requires parameter\n");
+				usage();
+				exit(1);
+			}
+			if(force_stype >0){
+				fprintf(stderr,"copysfx: error: -s flag may only be used once!\n");
+				usage();
+				exit(1);
+			}
+			sflag = atoi(&(argv[1][2]));
+			if(sflag < 1 || sflag > 6){
+				fprintf(stderr,"-s parameter out of range\n");
+				usage();
+				exit(1);
+			}
+			switch(sflag){
+			case(1):
+				force_stype = PSF_SAMP_16;
+				break;
+			case(2):
+				force_stype = PSF_SAMP_32;
+				break;
+			case(3):
+				force_stype = PSF_SAMP_IEEE_FLOAT;
+				break;
+			case(4):
+				force_stype = PSF_SAMP_24;
+				break;			
+			default:
+				fprintf(stderr,"internal error: unmatched sampletype parameter!\n");
+				break;
+			}
+			break;
+		case('h'):
+            min_header = 1;    
+			break;
+#ifdef NOTDEF
+		case('i'):
+			interpret_floats = 1;
+			break;
+#endif
+		default:
+			fprintf(stderr,"unknown flag option %s\n",argv[1]);
+			usage();
+			exit(1);
+			
+		}
+		argc--; argv++;
+	}
+
+	if(argc < 3){
+		usage();
+		exit(1);
+	}
+
+	if((ifd = psf_sndOpen(argv[1],&inprops,0)) < 0) {
+		fprintf(stderr, "copysfx: can't open input SFfile %s:\n\t",
+				argv[1]);
+		exit(1);
+	}
+		
+	size = psf_sndSize(ifd);
+	channels = inprops.chans;
+	sampleframe = (float *) malloc(channels * sizeof(float));
+	if(sampleframe==NULL){
+		psf_sndClose(ifd);
+		puts("no memory for sample buffer\n");
+		exit(1);
+	}
+	
+	srate = inprops.srate;
+	update_size = (unsigned long)((double)srate * 0.5);
+	outprops = inprops;
+	/* if -i flag used, infile is floats, therefore we write outfile as floats,
+	 * UNLESS we also have outtype coercion!
+	 */
+	if(interpret_floats)
+		outprops.samptype = PSF_SAMP_IEEE_FLOAT;
+
+	if(inprops.format== PSF_WAVE_EX){		
+		printf("opened WAVE-EX file:\n");
+		switch(inprops.chformat){
+		
+		case(MC_STD):
+			printf("\tno speaker assignments defined\n");		
+			break;
+		case(MC_MONO):
+			printf("\tMONO\n");
+			break;
+		case(MC_STEREO):
+			printf("\tSTEREO\n");
+			break;		
+		case(MC_QUAD):
+			printf("\tGeneric quad format: LF-RF-LR-RR\n");			
+			break;
+		case(MC_LCRS):
+			printf("\tQuad Surround: L-C-R-S format\n");			
+			break;
+		case(MC_BFMT):
+			printf("\tAmbisonic B-Format\n");
+			break;
+		case(MC_DOLBY_5_1):
+			printf("\t5.1 surround\n");
+			break;
+        case(MC_SURR_5_0):
+			printf("\t5.0 surround\n");
+			break;
+		case(MC_SURR_6_1):
+            printf("\t6.1 Surround\n");
+            break;
+        case(MC_SURR_7_1):
+            printf("\t7.1 Surround\n");
+            break;
+        case(MC_CUBE):
+            printf("\tCube Surround\n");
+            break;
+		default:
+			printf("\tunrecognized speaker positions\n");
+			break;						
+		}
+		if(min_header==1)
+			printf("WARNING: minimum header is not recommended for WAVE_EX files\n");
+	}
+
+	peaks = (PSF_CHPEAK *) calloc(channels,sizeof(PSF_CHPEAK));
+	if(peaks==NULL){
+		puts("no memory for fpeak data buffer\n");
+		psf_sndClose(ifd);
+		exit(1);
+	}
+
+	//read infile peak data, if it exists, and report to user	
+	res = psf_sndReadPeaks(ifd,peaks,  &peaktime);
+	if(res ==0)	{
+		printf("no peak data in this infile\n");
+	}
+	else if(res < 0){
+		fprintf(stderr,"error reading infile peak data\n");
+		psf_sndClose(ifd);
+		exit(1);
+	}
+	else {
+		time_t t_peaktime = (time_t) peaktime;
+		printf("Infile PEAK data:\n\tcreation time: %s\n", ctime(&t_peaktime));
+		for(i=0;i < channels; i++)
+#ifdef CPLONG64
+			printf("CH %ld: %.4lf at frame %u:\t%.4lf secs\n",
+#else
+            printf("(32) CH %ld: %.4lf at frame %lu:\t%.4lf secs\n",
+#endif
+				i,peaks[i].val,peaks[i].pos,(double) (peaks[i].pos) / (double)srate);
+	}
+	
+	if(force_stype > PSF_SAMP_UNKNOWN)		
+		outprops.samptype = force_stype;
+
+	outsize_bytes = (double) size * outprops.chans * get_sampsize(outprops.samptype);
+    if(outsize_bytes > maxsize){
+        printf("output file size %.0f MB exceeds 4GB: cannot proceed.\n",outsize_bytes / 1048576.0);
+        exit(1);
+    }
+	
+	if(force_wave){
+		int i,matched;
+		//check file extension...
+		switch(opt_wave_type){
+		case(OPT_STD_WAVE):
+			outprops.chformat = STDWAVE;
+			outprops.format = PSF_STDWAVE;
+			create_msg = "creating standard WAVE file\n";
+			break;
+		case(OPT_WAVEX_GENERIC):
+			inprops.chformat = MC_STD;
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating STD WAVE_EX file\n";
+			break;
+		case(OPT_WAVEX):
+			switch(inprops.chans){
+			case(1):
+				outprops.chformat = MC_MONO;				
+				outprops.format = PSF_WAVE_EX;
+				create_msg = "creating MONO WAVE_EX file\n";
+				break;
+			case(2):
+				outprops.chformat = MC_STEREO;				
+				outprops.format = PSF_WAVE_EX;
+				create_msg = "creating STEREO WAVE_EX file\n";
+				break;
+			case(4):
+				outprops.chformat = MC_QUAD;			
+				outprops.format = PSF_WAVE_EX;
+				create_msg = "creating QUAD WAVE_EX file\n";
+				break;
+			default:
+				fprintf(stderr,"infile nchans incompatible with requested WAVE-EX format\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);				
+			}
+			break;
+		case(OPT_WAVEX_LCRS):
+			if(inprops.chans != 4){
+				fprintf(stderr,"infile must have four channels\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);
+			}
+			outprops.chformat = MC_LCRS;
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating LCRS-surround WAVE_EX file\n";
+			break;
+		case(OPT_WAVEX_SURROUND):
+			if(inprops.chans != 6){
+				fprintf(stderr,"infile must have six channels\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);
+			}
+			outprops.chformat = MC_DOLBY_5_1;			
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating 5.1 surround WAVE_EX file\n";
+			break;			
+		case(OPT_WAVEX_BFORMAT):
+			matched = 0;
+			for(i=0;i < N_BFORMATS;i++)	{
+				if(inprops.chans == bformats[i]){
+					matched = 1;
+					break;
+				}
+			}
+			if(!matched){
+				printf("WARNING: No Bformat definition for %d-channel file.\n",inprops.chans);
+			}
+			outprops.chformat = MC_BFMT;			
+			outprops.format = inprops.format = PSF_WAVE_EX;
+			create_msg = "creating AMBISONIC B-FORMAT WAVE_EX file\n";
+			break;
+        case(OPT_WAVEX_5_0):
+            if(inprops.chans != 5){
+				fprintf(stderr,"infile must have five channels\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);
+			}
+			outprops.chformat = MC_SURR_5_0;			
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating 5.0 surround WAVE_EX file\n";
+			break;
+				
+        case(OPT_WAVEX_7_1):
+            if(inprops.chans != 8){
+				fprintf(stderr,"infile must have eight channels\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);
+			}
+			outprops.chformat = MC_SURR_7_1;			
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating 7.1 surround WAVE_EX file\n";
+			break;
+        case OPT_WAVEX_CUBE:
+            if(inprops.chans != 8){
+				fprintf(stderr,"infile must have eight channels\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);
+			}
+			outprops.chformat = MC_CUBE;			
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating 5.0 surround WAVE_EX file\n";
+			break;			
+        case(OPT_WAVEX_6_1):
+            if(inprops.chans != 7){
+				fprintf(stderr,"infile must have seven channels\n");
+				usage();
+				psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);
+				exit(1);
+			}
+			outprops.chformat = MC_SURR_6_1;			
+			outprops.format = PSF_WAVE_EX;
+			create_msg = "creating 6.1 surround WAVE_EX file\n";
+			break;	    
+		default:
+			 printf("copysfx: Program error: impossible wave_ex type\n");
+			 psf_sndClose(ifd);
+				if(peaks)
+					free(peaks);				
+			 exit(1);
+			 
+		}
+	}
+	//ignore all that if user wants aiff!
+	//informat = inprops.format;
+	ext = strrchr(argv[2],'.');
+	if(ext && stricmp(ext,".amb")==0)
+		have_amb_ext = 1;
+
+	if(have_amb_ext){
+		if(!(outprops.format == PSF_WAVE_EX && outprops.chformat == MC_BFMT)){
+			fprintf(stderr,"Error: .amb extension only allowed for WAVE_EX B-Format file.\n");
+			exit(1);			
+		} 
+	}
+    outformat  = psf_getFormatExt(argv[2]);
+
+	if((ofd = psf_sndCreate(argv[2],&outprops,0,min_header,PSF_CREATE_RDWR)) < 0){	
+		fprintf(stderr, "copysfx: can't create output file %s:\n\t",argv[2]);		
+		psf_sndClose(ifd);
+		fprintf(stderr,"\n");
+		if(peaks)
+			free(peaks);				
+		exit(1);
+	}
+    if(do_dither)
+        psf_sndSetDither(ofd,PSF_DITHER_TPDF);
+
+	if(force_wave){
+		if(outprops.format==PSF_WAVE_EX){
+			if(outformat > PSF_WAVE_EX)
+                printf("WARNING: extended formats require .wav file format:\n\t - creating standard file\n");		
+			else
+			    printf("%s\n",create_msg);	
+		}
+	}	
+	printf("copying...\n");    
+    for(i=0;i < size;i++){
+        /* salve to CEP users: need interpret_floats somewhere...? */
+        if((psf_sndReadFloatFrames(ifd, sampleframe, 1)) != 1){
+            
+            fprintf(stderr,"copysfx: error reading from infile\n");
+            psf_sndClose(ifd);
+            psf_sndClose(ofd);
+            free(sampleframe);
+            if(peaks)
+                free(peaks);
+            exit(1);
+        }
+        if(psf_sndWriteFloatFrames(ofd, sampleframe,1)!=1){
+            fprintf(stderr,"copysfx: error writing to outfile\n");
+            psf_sndClose(ifd);
+            psf_sndClose(ofd);
+            free(sampleframe);
+            if(peaks)
+                free(peaks);
+            exit(1);			
+        }
+        if((i / channels) % update_size == 0) {	 
+            printf("%.2lf secs\r",(double) (i / channels) / (double) srate);
+            fflush(stdout);
+        }
+    }
+    printf("%.4lf secs\r",(double) (i / channels) / (double) srate);
+    	
+	if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+		printf("Outfile PEAK values:\n");
+		for(i=0; i < (unsigned long) inprops.chans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+#ifdef CPLONG64
+                printf("CH %ld: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+#else
+                printf("CH %ld: %.6f (%.2lfdB) at frame %lu:\t%.4f secs\n",i,
+#endif
+                       val,dbval,peaks[i].pos,(double)peaks[i].pos / (double) inprops.srate);
+            }
+            else{
+#ifdef CPLONG64
+                printf("CH %ld: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+#else        
+                printf("CH %ld: %.6f (-infdB) at frame %lu:\t%.4f secs\n",i,
+#endif
+                       val,peaks[i].pos,(double)peaks[i].pos / (double) inprops.srate); 
+            }
+        }
+	}
+	if(psf_sndClose(ifd) < 0) {		
+		rc++;
+	}
+
+	if(psf_sndClose(ofd) < 0) {		
+		rc++;
+	}
+    if(sampleframe)
+		free(sampleframe);
+	if(peaks)
+		free(peaks);	
+	psf_finish();
+	return rc;
+}
+
+
+

+ 400 - 0
dev/externals/mctools/fmdcode.c

@@ -0,0 +1,400 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+//fmdcode.c  : decode .amb file to various speaker layouts
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <memory.h>
+#include <sys/types.h>
+#include <sys/timeb.h>
+#include <portsf.h>
+#include "fmdcode.h"
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+/*
+ Channel order is WXYZ,RSTUV,KLMNOPQ
+ 
+ The number of channels defines the order of the soundfield:
+ 2 channel = W+Y =  "Mid-Side" 
+ 3 channel = h   = 1st order horizontal
+ 4 channel = f   = 1st order 3-D
+ 5 channel = hh  = 2nd order horizontal
+ 6 channel = fh  = 2nd order horizontal + 1st order height (formerly
+                                                            called 2.5 order)
+ 7 channel = hhh = 3rd order horizontal
+ 8 channel = fhh = 3rd order horizontal + 1st order height
+ 9 channel = ff  = 2nd order 3-D
+ 11 channel = ffh = 3rd order horizontal + 2nd order height
+ 16 channel = fff = 3rd order 3-D
+ 
+ 
+ Horizontal   Height  Soundfield   Number of    Channels
+ order 	      order 	  type      channels 	
+ 1 	         0 	       horizontal 	  3 	    WXY
+ 1 	         1 	      full-sphere 	  4 	    WXYZ
+ 2 	         0 	       horizontal 	  5 	    WXY....UV
+ 2 	         1 	       mixed-order    6 	    WXYZ...UV
+ 2 	         2 	      full-sphere     9 	    WXYZRSTUV
+ 3           0 	       horizontal 	  7 	    WXY....UV.....PQ
+ 3 	         1         mixed-order 	  8 	    WXYZ...UV.....PQ
+ 3 	         2 	       mixed-order 	 11 	    WXYZRSTUV.....PQ
+ 3 	         3 	      full-sphere 	 16 	    WXYZRSTUVKLMNOPQ
+
+ */
+
+
+enum {ARG_PROGNAME, ARG_INFILE,ARG_OUTFILE, ARG_LAYOUT,ARG_NARGS};
+#define N_BFORMATS (10)
+enum {FM_MONO,FM_STEREO,FM_SQUARE,FM_QUAD,FM_PENT,DM_5_0,DM_5_1,FM_HEX,FM_OCT1,FM_OCT2,FM_CUBE,FM_QUADCUBE,FM_NLAYOUTS};
+
+
+//static const int bformats[N_BFORMATS] = {2,3,4,5,6,7,8,9,11,16};
+static const int layout_chans[] = {1,2,4,4,5,5,6,6,8,8,8,8};
+
+void usage(void)
+{
+   printf(
+    "usage: fmdcode [-x][-w] infile outfile layout\n"
+	"       -w    :   write plain WAVE outfile format\n"
+    "                (.wav default - use generic wavex format).\n"
+    "       -x    : write std WAVEX speaker positions to header\n"
+    "               (applies to compatible layouts only; requires .wav extension).\n"
+	"   layout    : one of the choices below.\n"
+    "       Output channel order is anticlockwise from centre front\n"
+    "            except where indicated.\n"
+    "   Layouts indicated with * are compatible with WAVEX speaker position order. \n"
+    "   Available speaker layouts:\n"
+    "   1    :  *  mono (= W signal only)\n"
+    "   2    :  *  stereo (quasi mid/side, = W +- Y)\n"
+    "   3    :     square\n"
+    "   4    :  *  quad FL,FR,RL,RR order\n"
+    "   5    :     pentagon\n"
+    "   6    :  *  5.0 surround (WAVEX order)\n"
+    "   7    :  *  5.1 surround (WAVEX order, silent LFE)\n"
+    "   8    :     hexagon\n"
+    "   9    :     octagon 1 (front pair, 45deg)\n"
+    "   10   :     octagon 2 (front centre speaker)\n"
+    "   11   :     cube (as 3, low-high interleaved. Csound-compatible.)\n"
+    "   12   :  *  cube (as 4, low quad followed by high quad).\n"
+    " NOTE: no shelf filters or NF compensation used.\n");
+}
+
+int main(int argc,char *argv[])
+{
+	int i,ifd, ofd;
+	int layout,inorder = 1;
+    int got,halfsec;
+	unsigned int framepos;
+    int inchans,outchans;
+    int outsize;
+    int write_speakerpositions = 0;
+    MYLONG peaktime;
+    psf_channelformat chformat = MC_STD;
+    psf_format  outformat;
+	char *sfname;
+    float *frame = NULL;
+    fmhcopyfunc copyfunc;
+    fmhdecodefunc decodefunc = NULL;
+	int write_wavex = 1;
+	ABFSAMPLE abfsample;
+	PSF_PROPS props;
+	PSF_CHPEAK *peaks = NULL;
+	float abfframe[16];
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.0b\n");
+        return 0;
+    }
+    
+	if(argc < 3){
+		printf("\nCDP MCTOOLS: FMDCODE v 1.0beta: RWD,CDP 2009\n"
+				"Plain multi-layout decoder for .amb files.\n"
+                "Regular layouts use standard Furse-Malham in-phase coefficients.\n" 
+                "5.x surround coefficients (maxre) from David Moore.\n");
+        usage();
+		return 1;
+	}
+	while(argv[1][0] =='-'){		
+		switch(argv[1][1]){
+		case('w'):
+			write_wavex = 0;
+			break;
+        case 'x':
+            write_speakerpositions = 1;
+            break;
+		default:
+			fprintf(stderr,"fmdcode: error: illegal flag option %s\n",argv[1]);
+			return 1;
+		}
+		argc--; argv++;
+	}
+	if(argc < ARG_NARGS){
+        
+		usage();
+		return 1;
+	}
+	if(psf_init()) {		
+		printf("failed to init psfsys\n");
+		exit(1);
+	}
+	
+	sfname = argv[ARG_OUTFILE];
+	layout = atoi(argv[ARG_LAYOUT]);
+    if(layout < 1 || layout > FM_NLAYOUTS+1){
+        printf("Unsupported layout type.\n");
+        return 1;
+    }
+    
+    
+	ifd = psf_sndOpen(argv[ARG_INFILE],&props,0);
+	if(ifd < 0){
+		fprintf(stderr,"unable toopen infile %s\n",argv[ARG_INFILE]);
+		return 1;
+	}
+    inchans = props.chans;
+    if(inchans > 4) {
+        inorder = 2;
+        printf("%d-channel input: performing 2nd-order decode.\n",inchans);
+    }
+    outsize = psf_sndSize(ifd);
+	if(outsize <= 0){
+		fprintf(stderr,"fmdcode: infile is empty!\n");
+		psf_sndClose(ifd);
+		return 1;
+	}
+    
+    switch(inchans){
+	case 3:
+        copyfunc = fmhcopy_3;
+        break;
+    case 4:
+        copyfunc = fmhcopy_4;       
+        break;
+    case 5:
+        copyfunc = fmhcopy_5;
+        break;
+    case 6:
+        copyfunc = fmhcopy_6;
+        break;
+    case 7:
+        copyfunc = fmhcopy_7;
+        break;
+    case 8:
+        copyfunc = fmhcopy_8;
+        break;
+    case 9:
+        copyfunc = fmhcopy_9;
+        break;
+    case 11:
+        copyfunc = fmhcopy_11;
+        break;
+    case 16:
+        copyfunc = fmhcopy_16;
+        break;
+    default:
+        printf("file has unsupported number of channels (%d)\n",inchans);
+        psf_sndClose(ifd);
+        return 1;
+	}
+    //FM_MONO,FM_STEREO,FM_SQUARE,FM_PENT,FM_SURR,FM_SURR6,FM_HEX,FM_OCT1,FM_OCT2,FM_CUBE
+    switch(layout-1){
+        case FM_MONO:
+            printf("Decoding to Mono\n");
+            decodefunc = fm_i1_mono;
+            if(write_wavex && write_speakerpositions)
+                chformat = MC_MONO;
+            break;
+        case FM_STEREO:
+            printf("Decoding to Stereo\n");
+            decodefunc = fm_i1_stereo;
+            if(write_wavex && write_speakerpositions)
+                chformat = MC_STEREO;
+            break;
+        case FM_SQUARE:
+            printf("Decoding to Square\n");
+            if(inorder == 1)
+               decodefunc = fm_i1_square;
+            else
+               decodefunc = fm_i2_square; 
+            break;
+        case FM_QUAD:
+            printf("Decoding to quad surround (WAVEX order)\n");
+            if(inorder == 1)
+                decodefunc = fm_i1_quad;
+            else
+                decodefunc = fm_i2_quad;
+            if(write_wavex && write_speakerpositions)
+                chformat = MC_QUAD;
+            break;
+        case FM_PENT:
+            printf("Decoding to pentagon\n");
+            if(inorder==1)
+                decodefunc = fm_i1_pent;
+            else
+                decodefunc = fm_i2_pent;
+            break;
+
+        case DM_5_0:
+            printf("Decoding to 5.0 surround (David Moore)\n");
+            if(inorder==1)
+                decodefunc = dm_i1_surr;
+            else
+                decodefunc = dm_i2_surr;
+            if(write_wavex && write_speakerpositions)
+                chformat = MC_SURR_5_0;
+            break;
+        case DM_5_1:
+            printf("Decoding to  5.1 surround (David Moore)\n");
+            if(inorder==1)
+                decodefunc = dm_i1_surr6;
+            else
+                decodefunc = dm_i2_surr6;
+            if(write_wavex && write_speakerpositions)
+                chformat = MC_DOLBY_5_1;
+            break;
+        case FM_HEX:
+            printf("Decoding to Hexagon\n");
+            if(inorder==1)
+                decodefunc = fm_i1_hex;
+            else
+                decodefunc = fm_i2_hex;
+            break;
+        case FM_OCT1:
+            printf("Decoding to Octagon 1\n");
+            if(inorder==1)
+                decodefunc = fm_i1_oct1;
+            else
+                decodefunc = fm_i2_oct1;
+            break;
+        case FM_OCT2:
+            printf("Decoding to Octagon 2\n");
+            if(inorder==1)
+                decodefunc = fm_i1_oct2;
+            else
+                decodefunc = fm_i2_oct2;
+            break;
+        case FM_CUBE:
+            printf("Decoding to Cube (FM interleaved)\n");
+            if(inorder==1)
+                decodefunc = fm_i1_cube;
+            else
+                decodefunc = fm_i2_cube;
+            break; 
+        case FM_QUADCUBE:
+            printf("Decoding to Octagon 1 (WAVEX order)\n");
+            if(inorder==1)
+                decodefunc = fm_i1_cubex;
+            else
+                decodefunc = fm_i2_cubex;
+            if(write_wavex && write_speakerpositions)
+                chformat = MC_CUBE;
+            break;
+    }
+    outformat = psf_getFormatExt(sfname);
+    if(outformat >= PSF_AIFF){
+        if(write_speakerpositions)
+            printf("Warning: -x requires .wav format\n");
+    }
+    outchans = layout_chans[layout-1];
+    frame = malloc(sizeof(float) * outchans);
+    if(frame==NULL){
+        puts("No Memory!\n");
+        return 1;
+    }
+	props.chformat = STDWAVE;
+	props.chans = outchans;
+    if(!is_legalsize(outsize,&props)){
+        fprintf(stderr,"error: outfile size exceeds capacity of format.\n");
+        return 1;
+    }
+    
+    /*TODO: set speaker pos when we can */
+	if(write_wavex){
+		props.chformat = chformat;
+		props.format = PSF_WAVE_EX;
+	}
+
+	ofd = psf_sndCreate(sfname,&props,0,0,PSF_CREATE_RDWR);
+	if(ofd < 0){
+		fprintf(stderr,"can't create outfile %s\n",sfname);
+		psf_sndClose(ifd);
+		return 1;
+	}
+    peaks = (PSF_CHPEAK*)  malloc(sizeof(PSF_CHPEAK) * outchans);
+    memset(peaks,0,sizeof(PSF_CHPEAK) * outchans);
+
+	halfsec = props.srate / 2;
+	framepos = 0;
+	printf("\ndecoding:\n");
+	while((got = psf_sndReadFloatFrames(ifd,abfframe,1))==1){
+        memset(&abfsample,0,sizeof(ABFSAMPLE));
+        copyfunc(&abfsample,abfframe);
+        decodefunc(&abfsample,frame,1);            
+		if(0 > psf_sndWriteFloatFrames(ofd,frame,1)){
+			fprintf(stderr,"error writing to outfile\n");
+			psf_sndClose(ifd);
+			psf_sndClose(ofd);
+			return 1;
+		}
+
+		if((framepos % halfsec) == 0){
+			printf("%.2lf secs\r",(double) framepos / (double) props.srate);
+            fflush(stdout);
+        }
+		framepos++;
+	}
+
+	if(got != 0){
+		fprintf(stderr,"warning: not all data was read\n");
+	}
+	printf("\n%.4lf secs\nWritten %d frames to %s\n",(double)framepos / (double) props.srate,framepos,sfname);
+	
+    if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+        printf("PEAK values:\n");
+        for(i=0; i < outchans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+            
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+                printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                       val,dbval,(unsigned int)peaks[i].pos,(double)peaks[i].pos / (double) props.srate);
+            }
+            else{
+                printf("CH %d: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+                       val,(unsigned int)peaks[i].pos,(double)peaks[i].pos / (double) props.srate); 
+            }
+        }
+    }
+    printf("\n");
+	psf_sndClose(ifd);
+	psf_sndClose(ofd);
+    if(peaks)
+        free(peaks);
+	psf_finish();
+	return 0;
+}

+ 106 - 0
dev/externals/mctools/fmdcode.h

@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* fmdcode.h */
+
+/*
+ Channel order is WXYZ,RSTUV,KLMNOPQ
+ 
+ The number of channels defines the order of the soundfield:
+ 2 channel = UHJ 
+ 3 channel = h   = 1st order horizontal
+ 4 channel = f   = 1st order 3-D
+ 5 channel = hh  = 2nd order horizontal
+ 6 channel = fh  = 2nd order horizontal + 1st order height (formerly
+                                                            called 2.5 order)
+ 7 channel = hhh = 3rd order horizontal
+ 8 channel = fhh = 3rd order horizontal + 1st order height
+ 9 channel = ff  = 2nd order 3-D
+ 11 channel = ffh = 3rd order horizontal + 2nd order height
+ 16 channel = fff = 3rd order 3-D
+ 
+ 
+ Horizontal   Height  Soundfield   Number of    Channels
+ order 	      order 	  type      channels 	
+ 1 	         0 	       horizontal 	  3 	    WXY
+ 1 	         1 	      full-sphere 	  4 	    WXYZ
+ 2 	         0 	       horizontal 	  5 	    WXY....UV
+ 2 	         1 	       mixed-order    6 	    WXYZ...UV
+ 2 	         2 	      full-sphere     9 	    WXYZRSTUV
+ 3           0 	       horizontal 	  7 	    WXY....UV.....PQ
+ 3 	         1         mixed-order 	  8 	    WXYZ...UV.....PQ
+ 3 	         2 	       mixed-order 	 11 	    WXYZRSTUV.....PQ
+ 3 	         3 	      full-sphere 	 16 	    WXYZRSTUVKLMNOPQ
+ */
+
+typedef struct abf_samp {
+	float W;
+	float X;
+	float Y;
+	float Z;
+    float R;
+    float S;
+    float T;
+	float U;
+    float V;
+} ABFSAMPLE;
+
+typedef void (*fmhcopyfunc)(ABFSAMPLE*,const float*);
+
+typedef void (*fmhdecodefunc)(const ABFSAMPLE*, float*,unsigned int);
+//void bfdcode4(float *inbuf,long numframes);
+void fmhcopy_3(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_4(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_5(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_6(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_7(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_8(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_9(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_11(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_16(ABFSAMPLE* abf,const float*buf);
+
+
+// i1 = inphase 1st order, etc
+void fm_i1_mono(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_stereo(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_square(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_square(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_quad(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_quad(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_pent(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_pent(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_surr(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void fm_i1_surr6(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i1_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i1_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void fm_i1_hex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_hex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_oct1(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_oct1(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);

+ 32 - 0
dev/externals/mctools/fmhcube1.txt

@@ -0,0 +1,32 @@
+f left low	<0.5774,0.5774,-0.5774>		0.1768	0.1140	0.1140	-0.1140	0.0000	-0.0369	-0.0369	0.0000	0.0369
+f right	low 	<0.5774,-0.5774,-0.5774>	0.1768	0.1140	-0.1140	-0.1140	0.0000	-0.0369	0.0369	0.0000	-0.0369
+r right low	<-0.5774,-0.5774,-0.5774>	0.1768	-0.1140	-0.1140	-0.1140	0.0000	0.0369	0.0369	0.0000	0.0369
+r left low	<-0.5774,0.5774,-0.5774>	0.1768	-0.1140	0.1140	-0.1140	0.0000	0.0369	-0.0369	0.0000	-0.0369
+f left high	<0.5774,0.5774,0.5774>		0.1768	0.1140	0.1140	0.1140	0.0000	0.0369	0.0369	0.0000	0.0369
+f right high	<0.5774,-0.5774,0.5774>		0.1768	0.1140	-0.1140	0.1140	0.0000	0.0369	-0.0369	0.0000	-0.0369
+r right high	<-0.5774,-0.5774,0.5774>	0.1768	-0.1140	-0.1140	0.1140	0.0000	-0.0369	-0.0369	0.0000	0.0369
+r left high	<-0.5774,0.5774,0.5774>		0.1768	-0.1140	0.1140	0.1140	0.0000	-0.0369	0.0369	0.0000	-0.0369
+
+
+Csound order					W	  X	  Y       Z      R         S      T        U       V
+f left low	<0.5774,0.5774,-0.5774>		0.1768	 0.1140	 0.1140	-0.1140	0.0000	-0.0369	-0.0369	0.0000	 0.0369
+f left high	<0.5774,0.5774,0.5774>		0.1768	 0.1140	 0.1140	 0.1140	0.0000	 0.0369	 0.0369	0.0000	 0.0369
+r left low	<-0.5774,0.5774,-0.5774>	0.1768	-0.1140	 0.1140	-0.1140	0.0000	 0.0369	-0.0369	0.0000	-0.0369
+r left high	<-0.5774,0.5774,0.5774>		0.1768	-0.1140	 0.1140	 0.1140	0.0000	-0.0369	 0.0369	0.0000	-0.0369
+r right low	<-0.5774,-0.5774,-0.5774>	0.1768	-0.1140	-0.1140	-0.1140	0.0000	 0.0369	 0.0369	0.0000	 0.0369
+r right high	<-0.5774,-0.5774,0.5774>	0.1768	-0.1140	-0.1140	 0.1140	0.0000	-0.0369	-0.0369	0.0000	 0.0369
+f right	low 	<0.5774,-0.5774,-0.5774>	0.1768	 0.1140	-0.1140	-0.1140	0.0000	-0.0369	 0.0369	0.0000	-0.0369
+f right high	<0.5774,-0.5774,0.5774>		0.1768	 0.1140	-0.1140	 0.1140	0.0000	 0.0369	-0.0369	0.0000	-0.0369
+
+WAVEX ORDER, LOW + HIGH
+
+f left low	<0.5774,0.5774,-0.5774>		0.1768	 0.1140	 0.1140	-0.1140	0.0000	-0.0369	-0.0369	0.0000	 0.0369
+f right	low 	<0.5774,-0.5774,-0.5774>	0.1768	 0.1140	-0.1140	-0.1140	0.0000	-0.0369	 0.0369	0.0000	-0.0369
+r left low	<-0.5774,0.5774,-0.5774>	0.1768	-0.1140	 0.1140	-0.1140	0.0000	 0.0369	-0.0369	0.0000	-0.0369
+r right low	<-0.5774,-0.5774,-0.5774>	0.1768	-0.1140	-0.1140	-0.1140	0.0000	 0.0369	 0.0369	0.0000	 0.0369
+
+f left high	<0.5774,0.5774,0.5774>		0.1768	 0.1140	 0.1140	 0.1140	0.0000	 0.0369	 0.0369	0.0000	 0.0369
+f right high	<0.5774,-0.5774,0.5774>		0.1768	 0.1140	-0.1140	 0.1140	0.0000	 0.0369	-0.0369	0.0000	-0.0369
+r left high	<-0.5774,0.5774,0.5774>		0.1768	-0.1140	 0.1140	 0.1140	0.0000	-0.0369	 0.0369	0.0000	-0.0369
+r right high	<-0.5774,-0.5774,0.5774>	0.1768	-0.1140	-0.1140	 0.1140	0.0000	-0.0369	-0.0369	0.0000	 0.0369
+

+ 712 - 0
dev/externals/mctools/fmhfuncs.c

@@ -0,0 +1,712 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* fmhfuncs.c */
+#include "fmdcode.h"
+
+/* TODO: expand to handle numframes frames? */
+
+void fmhcopy_3(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf;
+}
+
+void fmhcopy_4(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf;
+}
+
+void fmhcopy_5(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+void fmhcopy_6(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+// following discard 3rd order chans
+void fmhcopy_7(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+void fmhcopy_8(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+// these identical for 2nd order horiz max, but may be expanded later!
+void fmhcopy_9(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->R = *buf++;
+    abf->S = *buf++;
+    abf->T = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+void fmhcopy_11(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->R = *buf++;
+    abf->S = *buf++;
+    abf->T = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+void fmhcopy_16(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->R = *buf++;
+    abf->S = *buf++;
+    abf->T = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+/********** DECODE FUNCS *************/
+/* TODO: complete support for numframes > 1 */
+
+void fm_i1_mono(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+    int i;	
+	float *p_out = outbuf;
+	double aw;
+    for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.7071;
+		*p_out++ = (float) aw;  		  
+	}
+}
+
+void fm_i1_stereo(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+    int i;	
+	float *p_out = outbuf;
+	double aw,ay;
+    for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.7071;
+		ay = (double) inbuf->Y * 0.5;		
+		
+		*p_out++ = (float) (aw +  ay);  
+		*p_out++ = (float) (aw  - ay);  
+	}
+}
+
+void fm_i1_square(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.35355;
+		ax = (double) inbuf->X * 0.17677;
+		ay = (double) inbuf->Y * 0.17677;		
+		
+		*p_out++ = (float) (aw + ax + ay);  //FL
+		*p_out++ = (float) (aw - ax + ay);  //RL
+		*p_out++ = (float) (aw - ax - ay);  //RR
+		*p_out++ = (float) (aw + ax - ay);  //FR
+	}
+}
+void fm_i2_square(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;		
+	float *p_out = outbuf;	
+	double aw,ax,ay,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.3536;
+		ax = (double) inbuf->X * 0.2434;
+		ay = (double) inbuf->Y * 0.2434;		
+		av = (double) inbuf->V * 0.0964;
+		*p_out++ = (float) (aw + ax + ay + av);  //FL
+		*p_out++ = (float) (aw - ax + ay - av ); //RL
+		*p_out++ = (float) (aw - ax - ay + av);  //RR
+		*p_out++ = (float) (aw + ax - ay - av);  //FR
+	}
+}
+/* ditto, RLRL layout for WAVEX */
+void fm_i1_quad(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.35355;
+		ax = (double) inbuf->X * 0.17677;
+		ay = (double) inbuf->Y * 0.17677;		
+		
+		*p_out++ = (float) (aw + ax + ay);  //FL
+        *p_out++ = (float) (aw + ax - ay);  //FR
+		*p_out++ = (float) (aw - ax + ay);  //RL
+		*p_out++ = (float) (aw - ax - ay);  //RR
+		
+	}
+}
+void fm_i2_quad(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;		
+	float *p_out = outbuf;	
+	double aw,ax,ay,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.3536;
+		ax = (double) inbuf->X * 0.2434;
+		ay = (double) inbuf->Y * 0.2434;		
+		av = (double) inbuf->V * 0.0964;
+		*p_out++ = (float) (aw + ax + ay + av);  //FL
+        *p_out++ = (float) (aw + ax - ay - av);  //FR
+		*p_out++ = (float) (aw - ax + ay - av ); //RL
+		*p_out++ = (float) (aw - ax - ay + av);  //RR
+		
+	}
+}
+
+
+//front pair angle 72deg
+void fm_i1_pent(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2828;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + (ax*0.1618) + (ay*0.1176));  //FL
+		*p_out++ = (float) (aw - (ax*0.0618) + (ay*0.1902));  
+		*p_out++ = (float) (aw - (ax*0.2));  
+		*p_out++ = (float) (aw - (ax*0.0618) - (ay*0.1902));  
+        *p_out++ = (float) (aw + (ax*0.1618) - (ay*0.1176)); //FR
+	}
+}
+
+void fm_i2_pent(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2828;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;	
+        au = (double) inbuf->U;
+        av = (double) inbuf->V;
+		
+		*p_out++ = (float) (aw + (ax*0.2227) + (ay*0.1618) + (au*0.0238) + (av * 0.0733));  
+		*p_out++ = (float) (aw - (ax*0.0851) + (ay*0.2619) - (au*0.0624) - (av * 0.0453));  
+		*p_out++ = (float) (aw - (ax*0.2753)               + (au * 0.0771)              );  
+		*p_out++ = (float) (aw - (ax*0.0851) - (ay*0.2619) - (au*0.0624) + (av * 0.0453));  
+        *p_out++ = (float) (aw + (ax*0.2227) - (ay*0.1618) + (au*0.0238) - (av * 0.0733));
+	}
+}
+
+/* FMH only defines 1st order decode */ 
+void fm_i1_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		/* TODO: fix this order! */
+		*p_out++ = (float) ((aw * 0.169)  + (ax*0.0797) + (ay * 0.0891));   //L
+		*p_out++ = (float) ((aw * 0.1635) + (ax*0.0923));                   //C    ///???
+		*p_out++ = (float) ((aw * 0.169)  - (ax*0.0797) - (ay * 0.0891));   //R    ///????
+		*p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) + (ay * 0.1543));   //LS
+        *p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) - (ay * 0.1543));   //RS
+	}
+}
+/* from Bruce Wiggins via Csound */
+void fm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.405) + (ax*0.32) + (ay * 0.31)  + (au * 0.085) + (av * 0.125));   //L
+        *p_out++ = (float) ((aw * 0.405) + (ax*0.32) - (ay * 0.31)  + (au * 0.085) - (av * 0.125));   //R
+		*p_out++ = (float) ((aw * 0.085) + (ax*0.04)                + (au * 0.045)               );   //C
+		*p_out++ = (float) ((aw * 0.635) - (ax*0.335) + (ay * 0.28) - (au * 0.08)  + (av * 0.08));    //LS
+        *p_out++ = (float) ((aw * 0.635) - (ax*0.335) - (ay * 0.28) - (au * 0.08)  - (av * 0.08));    //RS
+	}
+}
+
+/* 5.1 versions - silent LFE */
+/* FMH only defines 1st order decode */ 
+void fm_i1_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) ((aw * 0.169)  + (ax*0.0797) + (ay * 0.0891));   //L
+		*p_out++ = (float) ((aw * 0.1635) + (ax*0.0923));                   //C
+		*p_out++ = (float) ((aw * 0.169)  - (ax*0.0797) - (ay * 0.0891));   //R
+        *p_out++ = 0.0f;                                                    //LFE
+		*p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) + (ay * 0.1543));   //LS
+        *p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) - (ay * 0.1543));   //RS
+	}
+}
+/* from Bruce Wiggins via Csound */
+void fm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.405) + (ax*0.32) + (ay * 0.31)  + (au * 0.085) + (av * 0.125));   //L
+        *p_out++ = (float) ((aw * 0.405) + (ax*0.32) - (ay * 0.31)  + (au * 0.085) - (av * 0.125));   //R
+		*p_out++ = (float) ((aw * 0.085) + (ax*0.04)                + (au * 0.045)               );   //C
+        *p_out++ = 0.0f;                                                                              //LFE
+		*p_out++ = (float) ((aw * 0.635) - (ax*0.335) + (ay * 0.28) - (au * 0.08)  + (av * 0.08));    //LS
+        *p_out++ = (float) ((aw * 0.635) - (ax*0.335) - (ay * 0.28) - (au * 0.08)  - (av * 0.08));    //RS
+	}
+}
+
+// 1st order 5.0
+void dm_i1_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+        
+		*p_out++ = (float) ((aw * 0.4597)  + (ax*0.4536) + (ay * 0.3591));   //L
+        *p_out++ = (float)  ((aw * 0.4597)  + (ax*0.4536) - (ay * 0.3591));  //R 
+		*p_out++ = 0.0f;                                                     //C
+		
+		*p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) + (ay * 0.4606));    //LS
+        *p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) - (ay * 0.4606));    //RS
+    }
+}
+//1st order 5.1
+void dm_i1_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+        
+		*p_out++ = (float) ((aw * 0.4597)  + (ax*0.4536) + (ay * 0.3591));   //L
+        *p_out++ = (float)  ((aw * 0.4597)  + (ax*0.4536) - (ay * 0.3591));  //R 
+		*p_out++ = 0.0f;                                                     //C
+		*p_out++ = 0.0f;                                                     //LFE
+		*p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) + (ay * 0.4606));    //LS
+        *p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) - (ay * 0.4606));    //RS
+    }
+}
+// 2nd order 5.0
+void dm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) + (ay * 0.3487) + (au * 0.0828) + (av*0.1489));  //L
+        *p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) - (ay * 0.3487) + (au * 0.0828) - (av*0.1489));  //R 
+		*p_out++ = (float) ((aw * 0.0804)  + (ax * 0.1327));                                              //C
+		*p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) + (ay * 0.4089) - (au * 0.0567));                 //LS
+        *p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) - (ay * 0.4089) - (au * 0.0567));                 //RS
+    }
+}
+// 2nd order 5.1
+void dm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) + (ay * 0.3487) + (au * 0.0828) + (av*0.1489));  //L
+        *p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) - (ay * 0.3487) + (au * 0.0828) - (av*0.1489));  //R 
+		*p_out++ = (float) ((aw * 0.0804)  + (ax * 0.1327));                                              //C
+		*p_out++ = 0.0f;                                                                                  //LFE
+		*p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) + (ay * 0.4089) - (au * 0.0567));                 //LS
+        *p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) - (ay * 0.4089) - (au * 0.0567));                 //RS
+    }
+}
+
+
+void fm_i1_hex(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2357;
+		ax = (double) inbuf->X * 0.1443;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + ax + (ay * 0.0833));  //FL
+		*p_out++ = (float) (aw      + (ay * 0.1667));  //SL
+		*p_out++ = (float) (aw - ax + (ay * 0.0833));  //RL
+		*p_out++ = (float) (aw - ax - (ay * 0.0833));  //RR
+        *p_out++ = (float) (aw      - (ay * 0.1667));  //SR
+        *p_out++ = (float) (aw + ax - (ay * 0.0833));  //FR
+	}
+}
+void fm_i2_hex(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2357;
+		ax = (double) inbuf->X * 0.1987;
+		ay = (double) inbuf->Y;
+		au = (double) inbuf->U;
+        av = (double) inbuf->V * 0.0556;
+		
+		*p_out++ = (float) (aw + ax + (ay * 0.1147) + (au * 0.0321) + av);  //FL
+		*p_out++ = (float) (aw      + (ay * 0.2294) - (au * 0.0643)     );  //SL
+		*p_out++ = (float) (aw - ax + (ay * 0.1147) + (au * 0.0321) - av);  //RL
+		*p_out++ = (float) (aw - ax - (ay * 0.1147) + (au * 0.0321) + av);  //RR
+        *p_out++ = (float) (aw      - (ay * 0.2294) - (au * 0.0643)     );  //SR
+        *p_out++ = (float) (aw + ax - (ay * 0.1147) + (au * 0.0321) - av);  //FR
+	}
+}
+
+void fm_i1_oct1(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + (ax * 0.1155) + (ay * 0.0478));  
+		*p_out++ = (float) (aw + (ax * 0.0478) + (ay * 0.1155));  
+		*p_out++ = (float) (aw - (ax * 0.0478) + (ay * 0.1155));  
+		*p_out++ = (float) (aw - (ax * 0.1155) + (ay * 0.0478));  
+        *p_out++ = (float) (aw - (ax * 0.231)  - (ay * 0.0957));  
+        *p_out++ = (float) (aw - (ax * 0.0478) - (ay * 0.1155));  
+        *p_out++ = (float) (aw + (ax * 0.0478) - (ay * 0.1155));  
+        *p_out++   = (float) (aw + (ax * 0.1155) - (ay * 0.0478));  
+	}
+}
+void fm_i2_oct1(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.17677;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;
+		au = (double) inbuf->U * 0.03417;
+		av = (double) inbuf->V * 0.03417;
+        
+		*p_out++ = (float) (aw + (ax * 0.15906) + (ay * 0.06588) + au + av);  
+		*p_out++ = (float) (aw + (ax * 0.06588) + (ay * 0.15906) - au + av);  
+		*p_out++ = (float) (aw - (ax * 0.06588) + (ay * 0.15906) - au - av);  
+		*p_out++ = (float) (aw - (ax * 0.15906) + (ay * 0.06588) + au - av);  
+        *p_out++ = (float) (aw - (ax * 0.15906) - (ay * 0.06588) + au + av);  
+        *p_out++ = (float) (aw - (ax * 0.06588) - (ay * 0.15906) - au + av);  
+        *p_out++ = (float) (aw + (ax * 0.06588) - (ay * 0.15906) - au - av);  
+        *p_out++ = (float) (aw + (ax * 0.15906) - (ay * 0.06588) + au - av);  
+	}
+}
+
+void fm_i1_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + (ax * 0.125)                 );  
+		*p_out++ = (float) (aw + (ax * 0.0884) + (ay * 0.0884));  
+		*p_out++ = (float) (aw                 + (ay * 0.125) );  
+		*p_out++ = (float) (aw - (ax * 0.0884) + (ay * 0.0884));  
+        *p_out++ = (float) (aw - (ax * 0.125)                 );  
+        *p_out++ = (float) (aw - (ax * 0.0884) - (ay * 0.0884));  
+        *p_out++ = (float) (aw                 - (ay * 0.125) );  
+        *p_out++ = (float) (aw + (ax * 0.0884) - (ay * 0.0884));  
+	}
+}
+void fm_i2_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;
+		au = (double) inbuf->U * 0.0482;
+		av = (double) inbuf->V * 0.0482;
+        
+		*p_out++ = (float) (aw + (ax * 0.1721)                 + au     );  
+		*p_out++ = (float) (aw + (ax * 0.1217) + (ay * 0.1217)      + av);  
+		*p_out++ = (float) (aw                 + (ay * 0.1721) - au     );  
+		*p_out++ = (float) (aw - (ax * 0.1217) + (ay * 0.1217)      - av);  
+        *p_out++ = (float) (aw - (ax * 0.1721)                 + au     );  
+        *p_out++ = (float) (aw - (ax * 0.1217) - (ay * 0.1217)      + av);  
+        *p_out++ = (float) (aw                 - (ay * 0.1721) - au     );  
+        *p_out++ = (float) (aw + (ax * 0.1217) - (ay * 0.1217)      - av);  
+	}
+}
+
+/* csound order; low/high anti-clockwise. 
+FMH page order, 4 low folowed by 4 high , clockwise! */
+void fm_i1_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,az;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.17677;
+		ax = (double) inbuf->X * 0.07216;
+		ay = (double) inbuf->Y * 0.07216;
+		az = (double) inbuf->Z * 0.07216;
+		
+		*p_out++ = (float) (aw + ax + ay - az);  // FL low
+		*p_out++ = (float) (aw + ax + ay + az);  // FL hi
+        
+		*p_out++ = (float) (aw - ax + ay - az);  // RL low
+		*p_out++ = (float) (aw - ax + ay + az);  //    hi
+        
+        *p_out++ = (float) (aw - ax - ay - az);  // RR low
+        *p_out++ = (float) (aw - ax - ay + az);  //   hi
+        
+        *p_out++ = (float) (aw + ax - ay - az);  // FR low
+        *p_out++ = (float) (aw + ax - ay + az);  //    hi
+	}
+}
+void fm_i2_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,az,as,at,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X * 0.114;
+		ay = (double) inbuf->Y * 0.114;
+        az = (double) inbuf->Z * 0.114;
+        as = (double) inbuf->S * 0.0369;
+        at = (double) inbuf->T * 0.0369;
+		av = (double) inbuf->V * 0.0369;
+        
+		*p_out++ = (float) (aw + ax + ay - az - as - at + av); //FL low 
+		*p_out++ = (float) (aw + ax + ay + az + as + at + av); //   hi 
+		
+        *p_out++ = (float) (aw - ax + ay - az + as - at - av); //RL low
+		*p_out++ = (float) (aw - ax + ay + az - as + at - av);  
+        
+        *p_out++ = (float) (aw - ax - ay - az + as + at + av); // RR low
+        *p_out++ = (float) (aw - ax - ay + az - as - at + av);  
+        
+        *p_out++ = (float) (aw + ax - ay - az - as + at - av);  // FR low
+        *p_out++ = (float) (aw + ax - ay + az + as - at - av);   
+	}
+}
+/* ditto, wavex order */
+/* Front L, front R, Back L, Back R; top Front L, Top Fr R, Top Back L, Top back R */
+void fm_i1_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,az;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.17677;
+		ax = (double) inbuf->X * 0.07216;
+		ay = (double) inbuf->Y * 0.07216;
+		az = (double) inbuf->Z * 0.07216;
+		
+		*p_out++ = (float) (aw + ax + ay - az);  // FL low
+        *p_out++ = (float) (aw + ax - ay - az);  // FR low
+        *p_out++ = (float) (aw - ax + ay - az);  // RL low
+        *p_out++ = (float) (aw - ax - ay - az);  // RR low
+        
+		*p_out++ = (float) (aw + ax + ay + az);  // FL hi
+        *p_out++ = (float) (aw + ax - ay + az);  // FR hi
+		*p_out++ = (float) (aw - ax + ay + az);  // RL hi
+        *p_out++ = (float) (aw - ax - ay + az);  // RR hi
+	}
+}
+void fm_i2_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,az,as,at,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X * 0.114;
+		ay = (double) inbuf->Y * 0.114;
+        az = (double) inbuf->Z * 0.114;
+        as = (double) inbuf->S * 0.0369;
+        at = (double) inbuf->T * 0.0369;
+		av = (double) inbuf->V * 0.0369;
+        
+		*p_out++ = (float) (aw + ax + ay - az - as - at + av);  // FL low
+        *p_out++ = (float) (aw + ax - ay - az - as + at - av);  // FR low
+        *p_out++ = (float) (aw - ax + ay - az + as - at - av);  // RL low
+        *p_out++ = (float) (aw - ax - ay - az + as + at + av);  // RR low
+		
+        *p_out++ = (float) (aw + ax + ay + az + as + at + av);  // FL  hi 
+		*p_out++ = (float) (aw + ax - ay + az + as - at - av);  // FR  hi
+		*p_out++ = (float) (aw - ax + ay + az - as + at - av);  // RL  hi 
+        *p_out++ = (float) (aw - ax - ay + az - as - at + av);  // RR  hi 
+	}
+}
+
+
+#ifdef NOTDEF
+void bfdcode4(float *inbuf,long numframes)
+{
+	int i;	
+	float *p_buf = inbuf;	
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double)(p_buf[0]) ;
+		ax = (double)(p_buf[1]) * 0.707;
+		ay = (double)(p_buf[2]) * 0.707;		
+		//decode frame
+		*p_buf++ = (float)(0.3333 * (aw + ax + ay)); //FL
+		*p_buf++ = (float)(0.3333 * (aw + ax - ay)); //FR
+		*p_buf++ = (float)(0.3333 * (aw - ax + ay)); //RL
+		*p_buf++ = (float)(0.3333 * (aw - ax - ay));  //RR
+	}
+}
+
+
+/* handle 3ch in to 4ch out! */
+
+void bfdcode324(float *inbuf,float*outbuf,long numframes)
+{
+	int i;	
+	float *p_buf = inbuf;
+	float * p_outbuf = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		int j;
+		aw = (double)(*p_buf++) ;
+		ax = (double)(*p_buf++) * 0.707;
+		ay = (double)(*p_buf++) * 0.707;
+        
+		//decode frame
+		*p_outbuf++ = (float)(0.3333 * (aw + ax + ay));
+		*p_outbuf++ = (float)(0.3333 * (aw + ax - ay));
+		*p_outbuf++ = (float)(0.3333 * (aw - ax + ay));
+		*p_outbuf++ = (float)(0.3333 * (aw - ax - ay));
+	}
+}
+#endif

+ 504 - 0
dev/externals/mctools/interlx.c

@@ -0,0 +1,504 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/*TODO: fix bug writing header when using -x with .amb extension (omits cbSize setting) */
+
+/*interlx.c */
+/* v1.3. nov 2005; support placeholder arg for silent channel */
+/* v 1.7 beta ; added surr 5.0; updated sfsys with bit-correct 24bit copy */
+/* v 1.8 March 2009 updated sfsys  for AIFC int24 suport */
+
+/* OCT 2009 portsf(64) version. int24 aifc supported for reading. */
+/* v2.0.1 Jan 2010: Corrected usage message to refer to outfile.  */
+/* Nov 2013 added MC_SURR_6_1 */
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <memory.h>
+#include <string.h>
+#include <ctype.h>
+#include "portsf.h"
+
+/*
+The number of channels defines the order of the soundfield:
+ 3 channel = h   = 1st order horizontal
+ 4 channel = f   = 1st order 3-D
+ 5 channel = hh  = 2nd order horizontal
+ 6 channel = fh  = 2nd order horizontal + 1st order height (formerly called 2.5 order)
+ 7 channel = hhh = 3rd order horizontal
+ 8 channel = fhh = 3rd order horizontal + 1st order height
+ 9 channel = ff  = 2nd order 3-D
+11 channel = ffh = 3rd order horizontal + 2nd order height
+16 channel = fff = 3rd order 3-D
+*/
+
+#define N_BFORMATS (10)
+static const int bformats[N_BFORMATS] = {2,3,4,5,6,7,8,9,11,16};
+#define MAX_INFILES (16)	//should keep most people happy! Won't get much more on a cmdline anyway
+
+enum {OPT_STD_WAVE,OPT_WAVEX_GENERIC,OPT_WAVEX,OPT_WAVEX_LCRS,OPT_WAVEX_SURROUND,OPT_WAVEX_BFORMAT,
+   OPT_SURR_5_0,OPT_WAVEX_7_1,OPT_WAVEX_CUBE,OPT_WAVEX_6_1, OPT_MAXOPTS};
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+#ifndef max
+#define max(x,y) ((x) > (y) ? (x) : (y))
+#endif
+
+void
+usage()
+{
+	fprintf(stderr,"\nCDP MCTOOLS: INTERLX v2.1.0 (c) RWD,CDP 2009,2013\n"
+			"Interleave mono or stereo files into a multi-channel file\n"
+			"Usage: interlx [-tN] outfile infile1 infile2 [infile3...]\n"
+			
+			"       Up to %d files may be interleaved.\n"						
+			"       Output format is taken from infile1.\n"
+			"       Files must match sample rate and number of channels,\n"
+			"          but can have different sample types.\n"
+			"       To create a silent channel, for infile2 onwards,\n"
+			"          use 0 (zero) as filename. Infile1 must be a soundfile.\n"
+			"       NB: Speaker-positions in WAVE_EX infiles are ignored\n"
+			"       Note that the same infile can be listed multiple times,\n"
+			"          for example, to write a mono file as stereo, quad, etc.\n"
+			"       The .amb B-Format extension is supported: \n"
+			"          the program warns if channel count is anomalous.\n"
+			"       recognised Bformat channel counts: 3,4,5,6,7,8,9,11,16.\n"
+            "   -tN  : write outfile format as type N\n"
+	        "    Available formats:\n"
+			"    0   : (default) standard soundfile (.wav, .aif, .afc, .aifc)\n"
+			"    1   : generic WAVE_EX (no speaker assignments)\n"
+			"    2   : WAVE_EX mono/stereo/quad(LF,RF,LR,RR)   - total chans must match.\n"
+			"    3   : WAVE_EX quad surround (L,C,R,S)         - total chans must be 4.\n"
+			"    4   : WAVE_EX 5.1 format surround             - total chans must be 6.\n"
+			"    5   : WAVE_EX Ambisonic B-format (W,X,Y,Z...) - extension .amb recommended.\n"
+            "    6   : WAVE_EX 5.0 surround                    - total chans must be 5.\n"
+            "    7   : WAVE_EX 7.1 Surround                    - total chans must be 8.\n"
+            "    8   : WAVE_EX Cube Surround                   - total chans must be 8.\n"
+            "    9   : WAVE_EX 6.1 surround (new in v 2.1.0)   - total chans must be 7.\n"
+			"          in all cases: outfile has sample format of infile1\n"
+			"          NB: types 1 to %d are for WAV format only\n"			
+			,MAX_INFILES,OPT_MAXOPTS-1);
+	
+}
+	
+
+void cleanup(int *sflist)
+{
+
+	int i;
+	for(i=0;i < MAX_INFILES; i++)
+		if(sflist[i] >= 0)
+			psf_sndClose(sflist[i]);
+	psf_finish();
+}
+
+int main(int argc, char *argv[])
+{
+
+	long outframesize,thissize;
+	int i,ofd;
+	int ifdlist[MAX_INFILES];
+	//int force_stype = -1,out_stype;
+    int force_wave = 0;
+	int infilearg,inchans;
+	int num_infiles = 0;
+	int halfsec;
+    MYLONG peaktime;
+	float *outframe	= NULL,*inframe = NULL;
+	PSF_PROPS firstinprops,inprops;
+	PSF_CHPEAK *fpeaks = NULL;
+    int wave_type = -1;
+    char *create_msg = NULL;
+    psf_format informat = PSF_STDWAVE;
+	char* p_dot = NULL;		/* to find extension of outfile */
+	
+	for(i=0;i < MAX_INFILES;i++)
+		ifdlist[i] = -1;
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("2.0.1.\n");
+        return 0;
+    }
+    
+	if(argc < 4) {
+		fprintf(stderr,"interlx: insufficient arguments\n");
+		usage();
+		exit(1);
+	}
+
+	while(argv[1][0] =='-'){
+		
+		switch(argv[1][1]){
+        case('t'):
+			if(argv[1][2]=='\0'){
+				fprintf(stderr,"-t flag requires parameter\n");
+				usage();
+				exit(1);
+			}
+			wave_type = atoi(&(argv[1][2]));
+			if((wave_type < 0) || wave_type >= OPT_MAXOPTS){
+				fprintf(stderr,"wave type out of range\n");
+				usage();
+				exit(1);
+			}
+			force_wave = 1;
+			break;
+		default:
+			fprintf(stderr,"\nabfpan: error: illegal flag option %s",argv[1]);
+			exit(1);
+		}
+
+		argc--; argv++;
+	}
+
+	if(argc < 4){
+		fprintf(stderr,"interlx error: at least two infiles required!\n");
+		usage();
+		exit(1);
+	}
+
+	if(psf_init()){
+		printf("Startup failure.\n");
+		return  1;
+	}
+	
+	//open first infile and get properties
+	ifdlist[0] = psf_sndOpen(argv[2],&firstinprops,0);
+	if(ifdlist[0] < 0){
+		fprintf(stderr,"unable to open infile %s\n",argv[2]);
+		cleanup(ifdlist);
+		return 1;
+	}
+
+/* we don't know how to deal with speaker positions yet, so disregard these
+	if(firstinprops.chformat > MC_STD){
+		printf(stderr,"Warning,interlx: ignoring source file speaker positions\n");
+	}
+*/
+	outframesize = psf_sndSize(ifdlist[0]);
+	if(outframesize < 0){
+		fprintf(stderr,"unable to read size of infile %s\n",argv[2]);
+		cleanup(ifdlist);
+		return 1;
+	}
+	inchans = firstinprops.chans;
+	/*we can always allow more channels if someone really needs it! */
+	if(!(inchans==1 || inchans==2)){
+		fprintf(stderr,"interlx: error: infile %s has %d channels\n"
+				"\t(only mono and stereo files can be used)\n",argv[2],inchans);
+		cleanup(ifdlist);
+		return 1;
+	}
+	
+	num_infiles = 1;
+	printf("interleaving %d-channel files,sample rate = %d\n",inchans,firstinprops.srate);
+
+	infilearg = 3;
+	while(argv[infilearg] != NULL){
+		if(strcmp(argv[infilearg],"0")==0){
+			ifdlist[num_infiles] = -1;           // mark silent channel
+		}
+		else{
+
+			if((ifdlist[num_infiles] = psf_sndOpen(argv[infilearg],&inprops,0)) < 0){
+				fprintf(stderr,"cannot open infile %s\n",argv[infilearg]);
+				cleanup(ifdlist);
+				return 1;
+			}
+			if(inprops.chans != firstinprops.chans){
+				fprintf(stderr,"interlx: error: channel mismatch from infile %s\n",argv[infilearg]);
+				cleanup(ifdlist);
+				return 1;
+			}
+
+			if(inprops.srate != firstinprops.srate){
+			   fprintf(stderr,"interlx: error: sample rate mismatch from infile %s\n",argv[infilearg]);
+				cleanup(ifdlist);
+				return 1;
+			}
+
+			thissize = psf_sndSize(ifdlist[num_infiles]);
+			if(thissize < 0){
+				fprintf(stderr,"unable to read size of infile %s\n",argv[infilearg]);
+				cleanup(ifdlist);
+				return 1;
+			}			
+			outframesize = max(outframesize,thissize);
+		}
+		
+		infilearg++;
+		num_infiles++;
+		if(num_infiles > MAX_INFILES){
+			fprintf(stderr,"Sorry! too many infiles. Maximum accepted is %d.\n",MAX_INFILES);
+			cleanup(ifdlist);
+			exit(1);
+		}
+
+	}
+
+	
+	inframe = malloc(inchans * sizeof(float));
+	if(inframe==NULL){
+		puts("interlx: error: no memory for input buffer!\n");
+		cleanup(ifdlist);
+		return 1;
+	}
+
+	firstinprops.chans *= num_infiles;
+	outframe = (float *) malloc(firstinprops.chans * sizeof(float));
+	if(outframe==NULL){
+		puts("\ninterlx: error: no memory for output buffer!\n");
+		cleanup(ifdlist);
+		return 1;
+	}
+
+	fpeaks = (PSF_CHPEAK *) calloc(firstinprops.chans,sizeof(PSF_CHPEAK));
+	if(fpeaks==NULL){
+		puts("interlx: error: no memory for internal PEAK buffer\n");
+		cleanup(ifdlist);
+		return 1;
+	}
+    if(force_wave){
+		int i,matched;
+		
+		switch(wave_type){
+        case(OPT_WAVEX_GENERIC):
+			inprops.chformat = MC_STD;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating STD WAVE_EX file";
+			break;
+		case(OPT_WAVEX):
+			switch(firstinprops.chans){
+			case(1):
+				firstinprops.chformat = MC_MONO;
+				informat = PSF_WAVE_EX;
+				create_msg = "creating MONO WAVE_EX file";
+				break;
+			case(2):
+				firstinprops.chformat = MC_STEREO;
+				informat = PSF_WAVE_EX;
+				create_msg = "creating STEREO WAVE_EX file";
+				break;
+			case(4):
+				firstinprops.chformat = MC_QUAD;
+				informat = PSF_WAVE_EX;
+				create_msg = "creating QUAD WAVE_EX file";
+				break;
+			default:
+				fprintf(stderr,"infile nchans incompatible with requested WAVE-EX format\n");
+				usage();
+				cleanup(ifdlist);
+				return 1;				
+			}
+			break;
+		case(OPT_WAVEX_LCRS):
+			if(firstinprops.chans != 4){
+				fprintf(stderr,"result must have four channels\n");
+				usage();
+				cleanup(ifdlist);
+				return 1;
+			}
+			firstinprops.chformat = MC_LCRS;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating LCRS-surround WAVE_EX file";
+			break;
+		case(OPT_WAVEX_SURROUND):
+			if(firstinprops.chans != 6){
+				fprintf(stderr,"result must have six channels\n");
+				usage();
+				cleanup(ifdlist);
+				exit(1);
+			}
+			firstinprops.chformat = MC_DOLBY_5_1;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating 5.1 surround WAVE_EX file";
+			break;
+            
+        case(OPT_SURR_5_0):
+			if(firstinprops.chans != 5){
+				fprintf(stderr,"result must have five channels.\n");
+				usage();
+				cleanup(ifdlist);
+				return 1;
+			}
+			firstinprops.chformat = MC_SURR_5_0;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating 5.0 surround WAVE_EX file";
+			break;
+
+		case(OPT_WAVEX_BFORMAT):
+			matched = 0;
+			for(i=0;i < N_BFORMATS;i++)	{
+				if(firstinprops.chans == bformats[i]){
+					matched = 1;
+					break;
+				}
+			}
+			if(!matched){
+				printf("WARNING: No Bformat definition for %d-channel file.\n",inprops.chans);
+			}
+			firstinprops.chformat = MC_BFMT;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating AMBISONIC B-FORMAT WAVE_EX file";
+			break;
+        case OPT_WAVEX_7_1:
+            if(firstinprops.chans != 8){
+				fprintf(stderr,"result must have  channels\n");
+				usage();
+				cleanup(ifdlist);
+				return 1;
+			}
+			firstinprops.chformat = MC_SURR_7_1;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating 7.1 surround WAVE_EX file";
+			break;
+        case OPT_WAVEX_CUBE:
+            if(firstinprops.chans != 8){
+				fprintf(stderr,"result must have  channels\n");
+				usage();
+				cleanup(ifdlist);
+				return 1;
+			}
+			firstinprops.chformat = MC_CUBE;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating cube surround WAVE_EX file";
+			break;
+		case OPT_WAVEX_6_1:
+            if(firstinprops.chans != 7){
+				fprintf(stderr,"result must have  channels\n");
+				usage();
+				cleanup(ifdlist);
+				return 1;
+			}
+			firstinprops.chformat = MC_SURR_6_1;
+			informat = PSF_WAVE_EX;
+			create_msg = "creating 6.1 surround WAVE_EX file";
+			break;
+		default:
+            inprops.chformat = STDWAVE;
+			informat = PSF_STDWAVE;
+			create_msg = "creating plain sound file";
+			break;
+		}		
+	}
+	
+	/*  want to avoid WAVE_EX if just plain WAVE possible */
+	firstinprops.format = informat;
+		/*firstinprops.chformat = MC_STD;*/		/* RWD April 2006 do this here? */
+	
+	p_dot = strrchr(argv[1],'.');
+	if(stricmp(++p_dot,"amb")==0) {
+		int i;
+		int matched = 0;
+		firstinprops.chformat = MC_BFMT;
+		for(i=0;i < N_BFORMATS;i++)	{
+			if(firstinprops.chans == bformats[i]){
+				matched = 1;
+				break;
+			}
+		}
+		if(!matched)
+			printf("\nWARNING: channel count %d unknown for BFormat.\n",firstinprops.chans);
+
+	}
+    if(!is_legalsize(outframesize,&firstinprops)){
+        fprintf(stderr,"error: outfile size %ld exceeds capacity of format.\n",outframesize);
+        return 1;
+    }
+    printf("\n%s: %d channels, %ld frames.\n",create_msg,firstinprops.chans,outframesize);
+	ofd = psf_sndCreate(argv[1],&firstinprops,0,0,PSF_CREATE_RDWR);
+	
+	
+	if(ofd < 0){
+		fprintf(stderr,"interlx: error: unable to create outfile %s.\n",argv[1]);
+		cleanup(ifdlist);
+		return 1;
+	}
+
+	halfsec = firstinprops.srate / 2;
+	for(i=0;i < outframesize; i++){		// frame loop
+		float *p_framesamp,*p_filesamp;
+		int j;
+		
+		p_framesamp = outframe;
+		memset((char *)outframe,0,firstinprops.chans * sizeof(float));
+
+		for(j=0;j < num_infiles;j++) {	//file loop
+			int k,got;
+            
+			memset((char *)inframe,0,inchans * sizeof(float));
+			if(ifdlist[j] < 0){
+				got = inchans; // placeholder - write silent channel
+			}
+			else{
+				if((got = psf_sndReadFloatFrames(ifdlist[j],inframe,1)) < 0){
+					fprintf(stderr,"interlx: error reading from infile %s\n",argv[2+j]);
+					psf_sndClose(ofd);					
+					cleanup(ifdlist);
+					return 1;
+				}
+			}
+			if(got==1){
+				p_filesamp = inframe;
+				for(k=0;k < inchans;k++)	//channel loop
+					*p_framesamp++	= *p_filesamp++;
+			}
+			else
+				p_framesamp += inchans;
+		}
+		
+		if(psf_sndWriteFloatFrames(ofd,outframe,1) < 0){
+			fprintf(stderr,"interlx: error writing to outfile\n");
+			psf_sndClose(ofd);            
+            cleanup(ifdlist);
+            return 1;
+		}
+        if(i % halfsec==0) {
+			printf("%.2lf secs\r",(double)i / (double) firstinprops.srate);
+            fflush(stdout);
+        }
+	}
+	printf("%.4lf secs\nWritten %ld sample frames to %s\n",(double)outframesize / (double)firstinprops.srate,outframesize,argv[1]);
+	if(psf_sndReadPeaks( ofd,fpeaks,&peaktime)){
+        printf("PEAK data:\n");
+        for(i = 0; i < firstinprops.chans; i++) {
+            double val, dbval;
+            val = (double) fpeaks[i].val;
+            dbval = 20.0 * log10(val);
+            printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                   val,dbval,(unsigned int) fpeaks[i].pos,(double)fpeaks[i].pos / (double) firstinprops.srate);
+        }
+    }
+	
+	printf("\n");
+	psf_sndClose(ofd);
+	free(inframe);
+	free(outframe);
+    if(fpeaks)
+        free(fpeaks);
+	cleanup(ifdlist);
+    
+	return 0;
+}

+ 698 - 0
dev/externals/mctools/njoin.c

@@ -0,0 +1,698 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* njoin.c: concantenate files with optional spacing */
+/* 12 Dec 2006 v 0.7: fixed bug in read_filelist: trap leading spaces on line */
+/* OCT 2009: v1.0 support tilde-prefixed path under unix */
+/* Jan 2010 v1.0.1 fixed bug processing lots of files and running out of portsf slots */
+/* Nov 2013 recognise MC_SURR_6_1 */
+/* Mar 2021  fix small file format type mismatch error (line 543 */
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <memory.h>
+#include <string.h>
+#include <assert.h>
+#ifdef unix
+#include <glob.h>
+#endif
+#include "portsf.h"
+
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+#define F_MAXLEN (1024) 
+/* For CERN will need to increase this a lot! */
+#define MAXFILES (512)
+
+
+enum {ARG_PROGNAME, ARG_FLIST, ARG_NARGS};
+enum {ARG_OUTFILE = ARG_NARGS};
+
+int read_filelist(FILE* ifp, char* p_flist[]);
+void cleanup(int ifd, int ofd,char* flist[], int nfiles);
+
+#ifdef unix
+char* CreatePathByExpandingTildePath(char* path)
+{
+    glob_t globbuf;
+    char **v;
+    char *expandedPath = NULL, *result = NULL;
+    
+    assert(path != NULL);
+    
+    if (glob(path, GLOB_TILDE, NULL, &globbuf) == 0) //success
+    {
+        v = globbuf.gl_pathv; //list of matched pathnames
+        expandedPath = v[0]; //number of matched pathnames, gl_pathc == 1
+        
+        result = (char*)calloc( strlen(expandedPath) + 1,sizeof(char)); //the extra char is for the null-termination
+        if(result)
+            strncpy(result, expandedPath, strlen(expandedPath) + 1); //copy the null-termination as well
+        
+        globfree(&globbuf);
+    }
+    
+    return result;
+}
+#endif
+
+void
+usage()
+{
+	fprintf(stderr,"\nCDP MCTOOLS: NJOIN v1.1.1 (c) RWD,CDP 2006,2010,2013,2021\n"
+			"concatenate multiple files into a single file\n"
+			"Usage: njoin [-sSECS | -SSECS][-cCUEFILE][-x] filelist.txt [outfile] \n"						
+			"       filelist.txt: text file containing list of sfiles\n"
+			"                     in order. One file per line. \n"
+			"                     Channel spec (if present) must be the same,\n"
+			"                     but files with no spec assumed compatible.\n"
+			"       -cCUEFILE   : if outfile used, generate cue textfile as CUEFILE.\n"
+			"       -sSECS      : separate files with silence of SECS seconds\n"
+			"       -SSECS      : as above, but no silence before first file.\n"
+			"                     Default: files are joined with no gap.\n"
+            "      -x           : strict: allow only CD-compatible files:\n"
+            "                     Must use sr=44100, minimum duration 4 secs.\n"
+			"       NB: Files must match sample rate and number of channels,\n"
+			"        but can have different sample types.\n"
+			"       Output sample format taken from file with highest precision.\n"
+			"       If no outfile given: program scans files and prints report.\n"
+#ifdef unix
+            "       Unix systems:  ~/ notation for home dir supported for file paths.\n"
+#endif
+			);	
+}
+
+void cleanup(int ifd, int ofd,char* flist[], int nfiles)
+{
+	int i;
+	for(i=0;i < nfiles; i++) {		
+		if(flist[i])
+			free(flist[i]);
+	}
+	if(ifd >=0)
+		psf_sndClose(ifd);
+	if(ofd >=0)
+		psf_sndClose(ofd);	
+}
+/*SHORT8,SHORT16,FLOAT32,INT_32,INT2424,INT2432,INT2024,INT_MASKED*/
+static int wordsize[] = {1,2,4,4,3,4,3};
+
+/*return 0 for props2 same or less, 1 for props2 higher*/
+int compare_precision(const PSF_PROPS* props1,const PSF_PROPS* props2)
+{
+	int retval = 0;
+	switch(props1->samptype){
+	case(PSF_SAMP_8):
+		if(props2->samptype != props1->samptype)
+			retval = 1;
+		break;
+	case(PSF_SAMP_16):
+		if(props2->samptype > props1->samptype)
+			retval = 1;
+		break;
+	case(PSF_SAMP_IEEE_FLOAT):
+		/* only higher prec is 32bit int */
+		if(props2->samptype== PSF_SAMP_32)
+			retval = 1;
+		break;
+	case(PSF_SAMP_32):
+		/* nothing higher than this!*/
+		break;
+	case(PSF_SAMP_24):
+	//case(INT2432): // NB illegal for almost all formats!
+	//case(INT2024):
+		if(props2->samptype == PSF_SAMP_IEEE_FLOAT || props2->samptype == PSF_SAMP_32)
+			retval = 1;
+		break;
+	default:  
+		break;
+	}
+	return retval;
+}
+
+const char* stype_as_string(const PSF_PROPS* props)
+{
+	const char* msg;
+	switch(props->samptype){
+	case(PSF_SAMP_8):
+		msg = "8-bit";
+		break;
+	case(PSF_SAMP_16):
+		msg = "16-bit";
+		break;
+	case(PSF_SAMP_IEEE_FLOAT):
+		msg = "32-bit floats";
+		break;
+	case(PSF_SAMP_32):
+		msg = "32-bit integer";
+		break;
+	case(PSF_SAMP_24):
+		msg = "24-bit";
+		break;
+	default:
+		msg = "unknown WAVE_EX sample size!";
+		break;
+	}
+	return msg;
+}
+//STDWAVE,MC_STD,MC_MONO,MC_STEREO,MC_QUAD,MC_LCRS,MC_BFMT,MC_DOLBY_5_1,MC_WAVE_EX 
+const char* chformat_as_string(const PSF_PROPS* props)
+{
+	const char* msg;
+	switch(props->chformat){
+	case MC_STD:
+		msg = "Generic WAVE-EX";
+		break;
+	case MC_MONO:
+		msg = "WAVE_EX Mono";
+		break;
+	case MC_STEREO:
+		msg = "WAVE_EX Stereo";
+		break;
+	case MC_QUAD:
+		msg = "WAVE_EX Quad";
+		break;
+	case MC_LCRS:
+		msg = "WAVE_EX LCRS Surround";
+		break;
+	case MC_BFMT:
+		msg = "WAVE_EX B-Format";
+		break;
+	case MC_DOLBY_5_1:
+		msg = "WAVE_EX Dolby 5.1";
+		break;
+	case MC_SURR_6_1:
+	    msg =  "6.1 surround";
+	    break;
+    case MC_SURR_5_0:
+        msg = "5.0 surround";
+        break;
+    case MC_SURR_7_1:
+        msg = "7.1 Surround";
+        break;
+    case MC_CUBE:
+        msg = "Cube Surround";
+        break;
+	case MC_WAVE_EX:
+		msg = "WAVE-EX Custom Multi-Channel";
+		break;
+    default:  // STDWAVE
+        msg = "Standard soundfile";
+        break;
+	}
+
+	return msg;
+}
+
+int read_filelist(FILE* ifp, char* p_flist[])
+{
+	char buf[F_MAXLEN];
+	long len;
+	int nfiles = 0;
+#ifdef _DEBUG
+	assert(ifp);
+	assert(p_flist);
+#endif
+	if(ifp==NULL || p_flist == NULL)
+		return -1;
+	while (fgets(buf,F_MAXLEN-1,ifp)){
+		char* pbuf = buf;
+		while(*pbuf == ' ')
+			pbuf++;
+		len = strlen(pbuf);
+		if(len > 1){	// line has at least a eol byte
+			p_flist[nfiles] = malloc(len+1);
+			strcpy(p_flist[nfiles],pbuf);
+			if(p_flist[nfiles][len-1] == 0x0A)
+				p_flist[nfiles][len-1] = '\0';
+			nfiles++;
+		}
+		if(feof(ifp))
+			break;
+		if(ferror(ifp))
+			return -1;
+	}	
+	return nfiles;
+}
+ 
+int strict_check(PSF_PROPS* props,unsigned long dur)
+{
+    int ret = 0;
+    unsigned long mindur = 4 * 44100;
+    
+    if(props->srate==44100 && dur >= mindur && props->chans==2)
+        ret = 1;
+    return ret;
+}
+
+int main(int argc, char* argv[])
+{
+	int i = 0,j,ofd = -1;
+	int ifd = -1;
+	char* flist[MAXFILES];
+	char* cuefilename = NULL;
+	FILE* cuefp = NULL;
+	int num_infiles = 0;
+	float *inframe = NULL;
+    float*space_frame = NULL;
+	PSF_PROPS inprops, thisinprops,outprops;
+	PSF_CHPEAK *fpeaks = NULL;
+	double space_secs = 0.0;
+	long space_frames = 0;
+    long thisdur = 0;
+	double totaldur = 0.0;
+	FILE* fp = NULL;
+	int formatsrc = 0;
+	unsigned int max_datachunk = 0xFFFFFFFFU - 1024U;   /* check Ok for PEAK chunk */
+	double maxdur;
+	double blockdur = 0.25;  /* match buffersize to srate, so we get tidy upodate msgs */
+	long buflen,block_frames;
+	unsigned long written;
+	int error = 0;
+	int do_process = 1;
+	int have_s = 0, have_S = 0;
+    int strict  =0;
+    int strict_failures = 0;
+    char* fname;
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.1.0\n");
+        return 0;
+    }
+    
+	if(argc < ARG_NARGS){
+		fprintf(stderr,"njoin: insufficient arguemnts\n");
+		usage();
+		return 1;
+	}
+	while(argv[1][0] =='-'){	
+		switch(argv[1][1]){
+		case('c'):
+			if(argv[1][2]== '\0'){
+				fprintf(stderr,"-c flag needs filename.\n");
+				return 1;
+			}
+			cuefilename = &(argv[1][2]);
+			break;
+		case('s'):
+			if(have_S){
+				fprintf(stderr,"njoin: cannot have both -s and -S.\n");
+				return 1;
+			}
+			space_secs = atof(&argv[1][2]);
+			if(space_secs < 0.0){
+				fprintf(stderr,"njoin: -tSECS cannot be negative!\n");
+				return 1;
+			}
+			have_s = 1;
+			break;
+		case('S'):
+			if(have_s){
+				fprintf(stderr,"njoin: cannot have both -s and -S.\n");
+				return 1;
+			}
+			space_secs = atof(&argv[1][2]);
+			if(space_secs < 0.0){
+				fprintf(stderr,"njoin: -tSECS cannot be negative!\n");
+				return 1;
+			}
+			have_S = 1;
+			break;
+        case 'x':
+            strict = 1;
+            break;
+		default:
+			fprintf(stderr,"\nnjoin: illegal flag option %s",argv[1]);
+			exit(1);
+		}
+		argc--; argv++;
+	}
+
+	if(argc < ARG_NARGS){
+		fprintf(stderr,"njoin: insufficient arguemnts\n");
+		usage();
+		return 1;
+	}
+	
+	if(argc==ARG_NARGS)
+		do_process = 0;
+	/********** READ filelist *********/
+
+	fp = fopen(argv[ARG_FLIST],"r");
+	if(fp==NULL){
+		fprintf(stderr,"njoin: Unable to open input file %s\n",argv[ARG_FLIST]);
+		return 1;
+	}
+	
+	memset(flist,0,MAXFILES * sizeof(char*));
+	num_infiles = read_filelist(fp, flist);
+	if(num_infiles < 0){
+		fprintf(stderr,"njoin: file error reading filelist %s\n",argv[ARG_FLIST]);
+		fclose(fp);
+		return 1;
+	}
+	if(num_infiles ==0){
+		fprintf(stderr,"njoin: filelist is empty!\n");
+		fclose(fp);
+		return 1;
+	}
+	if(num_infiles ==1){
+		fprintf(stderr,"njoin: only one file listed - nothing to do!\n");
+		fclose(fp);
+		return 1;
+	}
+	fclose(fp); fp = NULL;
+
+#ifdef _DEBUG
+	fprintf(stderr, "file list contains %d files: \n",num_infiles);	
+	for(i=0;i < num_infiles; i++)
+		fprintf(stderr,"%s\n",flist[i]);
+#endif
+
+	/********* open and check all soundfiles ***********/
+	fprintf(stderr,"checking files...\n");
+	
+	if(psf_init()){
+		fprintf(stderr,"njoin: startup failure.\n");
+		return 1;
+	}
+    i = 0;
+#ifdef unix
+    fname = CreatePathByExpandingTildePath(flist[i]);
+    /* must free pointer later */
+#else
+    fname = flist[i];
+#endif
+	//open first infile and get properties
+	ifd = psf_sndOpen(fname,&inprops,0);
+	if(ifd < 0){
+		fprintf(stderr,"unable to open infile %s.\n",fname);
+		cleanup(ifd,ofd,flist,num_infiles);
+		return 1;
+	}
+	thisdur = psf_sndSize(ifd);
+    if(strict){
+        if(!strict_check(&inprops,thisdur)){
+            fprintf(stderr,"Strict: file %s is not CD-compatible.\n",fname);
+            strict_failures++;
+        }
+    }
+	if(thisdur==0){
+		fprintf(stderr,"WARNING: file 1 empty: %s\n",fname);
+	}
+	else  {	
+		totaldur += (double) thisdur / inprops.srate;
+	}
+	psf_sndClose(ifd);
+#ifdef unix
+    free(fname);
+#endif
+	ifd = -1;
+	/* scan firther files, find max precision */
+	/* drop out if channel formats different */
+	for(i=1; i <	num_infiles; i++){
+#ifdef unix
+        fname = CreatePathByExpandingTildePath(flist[i]);
+        /* must free pointer later */
+#else
+        fname = flist[i];
+#endif
+        
+        
+		ifd = psf_sndOpen(fname,&thisinprops,0);
+		if(ifd < 0){
+			fprintf(stderr,"unable to open infile %s.\n",fname);
+			cleanup(ifd,ofd,flist,num_infiles);
+			exit(1);
+		}
+        thisdur = psf_sndSize(ifd);
+        if(strict){
+            if(!strict_check(&thisinprops,thisdur)){
+                fprintf(stderr,"Strict: file %s is not CD-compatible.\n",fname);
+                strict_failures++;
+            }
+        }
+		if(inprops.chans != thisinprops.chans){
+			fprintf(stderr,"njoin: channel mismatch in file %s",fname);
+			cleanup(ifd,ofd,flist,num_infiles);
+#ifdef unix
+            free(fname);
+#endif
+			return 1;
+		}
+		if(inprops.srate != thisinprops.srate){
+			fprintf(stderr,"njoin: sample rate mismatch in file %s",fname);
+			cleanup(ifd,ofd,flist,num_infiles);
+#ifdef unix
+            free(fname);
+#endif
+			return 1;
+		}
+		/* allow old multichannel files to be compatible with everything! */
+		if(! (inprops.chformat==(psf_channelformat)PSF_STDWAVE || thisinprops.chformat==(psf_channelformat)PSF_STDWAVE)){
+			if(inprops.chformat != thisinprops.chformat){
+				fprintf(stderr,"njoin: channel format mismatch in file %s",fname);
+				cleanup(ifd,ofd,flist,num_infiles);
+#ifdef unix
+                free(fname);
+#endif
+				return 1;
+			}
+		}
+		else {
+			/* one file is generic: promote format if possible*/
+			if(thisinprops.chformat > inprops.chformat)
+				inprops.chformat = thisinprops.chformat;
+		}
+
+		/* compare wordlength precision */
+		if(compare_precision(&inprops,&thisinprops)) {
+			inprops = thisinprops;
+			formatsrc = i;
+		}
+		thisdur = psf_sndSize(ifd);
+		if(thisdur==0){
+			fprintf(stderr,"WARNING: file %d empty: %s\n",i+1,fname);
+		}
+		else  {	
+			totaldur += (double) thisdur / thisinprops.srate;
+		}
+		psf_sndClose(ifd);
+		ifd = -1;
+#ifdef unix
+        free(fname);
+#endif
+	}
+    if(strict_failures){ 
+        fprintf(stderr,"Strict: %d files are CD-incompatible. Exiting.\n",strict_failures);
+        return 1;
+    }
+    
+	fprintf(stderr, "output format taken from file %d:\n\t%s\n",formatsrc+1,flist[formatsrc]);
+	fprintf(stderr, "sample type: %s\n",stype_as_string(&inprops));  
+	fprintf(stderr,"channel format: %s\n",chformat_as_string(&inprops));
+
+	maxdur = (double)(max_datachunk/ inprops.chans / wordsize[inprops.samptype]) / inprops.srate;
+	/*TODO: make sure we allow for size of PEAK chunk */
+	fprintf(stderr, "Max duration available for this format: %f secs.\n",maxdur);
+	if(have_S)
+		fprintf(stderr,"Total outfile length including spacing: %f secs\n", totaldur + (num_infiles-1) * space_secs);
+	else
+		fprintf(stderr,"Total outfile length including spacing: %f secs\n", totaldur + (num_infiles) * space_secs);
+
+	if(do_process == 0){
+		if(totaldur > maxdur)
+			fprintf(stderr, "Error: total duration exceeds capacity of file format.\n");
+		cleanup(ifd,ofd,flist,num_infiles);
+		return 0;
+	}
+
+	if(totaldur > maxdur){
+		fprintf(stderr, "Sorry! Total duration exceeds capacity of file format.\nProcess aborted.\n");
+		cleanup(ifd,ofd,flist,num_infiles);
+		return 1;
+	}
+    
+	/* if here, OK! We can make the file */
+    printf("processing files...\n");
+	outprops = inprops;
+	/* try to make a legal wave file! */
+	if((outprops.chans > 2 || outprops.samptype > PSF_SAMP_IEEE_FLOAT)
+		 && (outprops.format==PSF_STDWAVE))
+        outprops.chformat = /* PSF_WAVE_EX */ MC_STD;       //RWD 10:03:21
+    block_frames = (long)(blockdur * outprops.srate);
+	buflen = block_frames * outprops.chans;
+	inframe = malloc(buflen * sizeof(float));
+	if(inframe==NULL){
+		puts("No memory!\n");
+		cleanup(ifd,ofd,flist,num_infiles);
+		return 1;
+	}
+	//setup PEAK data
+	fpeaks = (PSF_CHPEAK *) calloc(outprops.chans,sizeof(PSF_CHPEAK));
+	if(fpeaks==NULL){
+		puts("njoin: error: no memory for internal PEAK buffer\n");
+		cleanup(ifd,ofd,flist,num_infiles);
+		return 1;
+	}
+
+	if(cuefilename){
+		cuefp = fopen(cuefilename, "w");
+		if(cuefp == NULL){
+			fprintf(stderr, "WARNING: unable to create cue file %s.\n",cuefilename);
+			cuefilename = NULL;
+		}
+	}
+
+    space_frame = calloc(sizeof(float),outprops.chans);
+    
+	ofd = psf_sndCreate(argv[ARG_OUTFILE],&outprops,0,0,PSF_CREATE_RDWR);
+	if(ofd < 0){
+		fprintf(stderr,"njoin: Cannot create outfile %s\n",argv[ARG_OUTFILE]);
+		cleanup(ifd,ofd,flist,num_infiles);
+		return 1;
+	}
+	fprintf(stderr, "generating outfile...\n");
+	written = 0;
+	if(cuefp) {
+		//fprintf(cuefp,"FILE %s WAVE\n",snd_getfilename(ofd));
+        fprintf(cuefp,"FILE %s WAVE\n",argv[ARG_OUTFILE]);
+		fprintf(cuefp,"\tTRACK 01 AUDIO\n");
+				fprintf(cuefp,"\t\tINDEX 01 00:00:00\n");
+	}
+	space_frames = (long) (space_secs * outprops.srate + 0.5);
+	/* add leading space ? */
+	if(have_s && space_frames > 0){
+		for(j=0; j < space_frames; j++) {
+			if(psf_sndWriteFloatFrames(ofd,space_frame,1) < 0){
+				fprintf(stderr,"njoin: error writing outfile\n");
+				cleanup(ifd,ofd,flist,num_infiles);
+				free(inframe);
+				free(fpeaks);
+				return 1;
+			}
+		}
+		written += space_frames;
+	}
+	for(i=0; i < num_infiles; i++){
+		long got, put;
+        PSF_PROPS fprops; // dummy - not needed 
+#ifdef unix
+        fname = CreatePathByExpandingTildePath(flist[i]);
+        /* must free pointer later */
+        /*RWD TODO: may fail with null return if file does not exist */
+#else
+        
+        fname = flist[i];
+#endif        
+		ifd = psf_sndOpen(fname,&fprops,0);
+		if(ifd < 0){
+			fprintf(stderr,"unable to open infile %s.\n",fname);
+			error++;
+			break;
+		} 
+        
+		do {			
+			got = psf_sndReadFloatFrames(ifd,inframe,block_frames);
+			if(got < 0){
+				fprintf(stderr,"njoin: error reading file %s\n",fname);
+				error++;
+				break;
+			}
+			
+			put = psf_sndWriteFloatFrames(ofd,inframe,got);
+			if(put != got){
+				fprintf(stderr,"njoin: error writing outfile\n");
+				error++;
+				break;
+			}
+			written += got;
+			fprintf(stderr,"%.2f\r",(double) written / outprops.srate);
+		} while (got > 0);
+		if(error)
+			break;
+		
+		/* add space */
+		if(i < num_infiles - 1){
+			/* update cue file */
+			if(cuefp){
+				double pos = (double)(psf_sndTell(ofd)) / outprops.srate;
+				int mins = (int)(pos / 60.0);
+				int secs = (int)(pos - mins);
+				int frames = (int) ((pos - (60.0 * mins + secs)) * 75.0);
+
+				fprintf(cuefp,"\tTRACK %.2d AUDIO\n",i+2);
+				fprintf(cuefp,"\t\tINDEX 01 %.2d:%.2d:%.2d\n",mins,secs,frames); 
+			}
+			
+			for(j=0; j < space_frames ; j++) {
+				if(psf_sndWriteFloatFrames(ofd,space_frame,1) < 0){
+					fprintf(stderr,"njoin: error writing outfile\n");
+					error++;
+					break;
+				}
+			}
+		}
+		if(error)
+			break;
+		written += space_frames;
+#ifdef unix
+        free(fname);
+#endif
+        /*RWD Jan 2010 MUST close the file or we may run out of portsf slots! */
+        psf_sndClose(ifd);
+        ifd = -1;
+	}
+
+	if(error){
+		fprintf(stderr,"Error: Outfile incomplete.\n");
+//		sndunlink(ofd);
+	}
+	else {
+		fprintf(stderr, "Done.\nWritten %ld frames to outfile\n",written);
+		if(psf_sndReadPeaks(ofd,fpeaks,NULL) > 0){
+            long i;
+            double peaktime;
+            printf("PEAK information:\n");	
+			for(i=0;i < inprops.chans;i++){
+                double val = fpeaks[i].val;
+				peaktime = (double) fpeaks[i].pos / (double) inprops.srate;
+                if(val==0.0)
+                    printf("CH %ld:\t%.4f           at %.4f secs\n", i+1, val,peaktime);
+                else
+                    printf("CH %ld:\t%.4f (%.2fdB) at %.4f secs\n", i+1, val, 20.0*log10(val),peaktime);
+			}
+        }
+	}
+	if(inframe)
+		free(inframe);
+	if(fpeaks)
+		free(fpeaks);
+	if(cuefp)
+		fclose(cuefp);
+	cleanup(ifd,ofd,flist,num_infiles);
+	psf_finish();
+	return 0;
+}

+ 333 - 0
dev/externals/mctools/nmix.c

@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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.
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//nmix.c
+//Oct 2009 updated to use portsf
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <memory.h>
+#include <sys/timeb.h>
+#include "portsf.h"
+
+#ifdef unix
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+//usage: nmix [-oOFFSET]  [-f] infile1 infile2 outfile
+void usage() {
+    printf("\nCDP MCTOOLS: NMIX V2.0.1 (c) RWD,CDP 1999,2009\n"
+           "mix two multi-channel files\n"
+           "usage:\n"
+           "nmix [-d][-f][-oOFFSET] infile1 infile2 outfile\n"
+           "     -d      : apply TPDF dither (16bit format output only).\n"
+           "     -f      : set output sample type to floats.\n"
+           "                Default: outfile type is that of infile 1\n"
+           "     -oOFFSET:  start infile2 at OFFSET seconds.\n"
+           "Files must have the same channel count.\n"
+           "WAVE-EX files must have the same speaker layout\n");
+
+    exit(0);
+}
+
+#define BUFLEN (1024)
+
+int main(int argc, char *argv[])
+{
+    int i,ifd1 = -1,ifd2=-1,ofd=-1;
+    int force_floats = 0;
+    int do_dither = 0;
+    float ampfac = 0.0;
+    long len_in1, len_in2,outlen;
+    double offset = 0.0;
+    long offsetframes = 0,framecount = 0;
+    long chans;
+    long sr;
+    long in1_sofar,in2_sofar;
+    int halfsec;
+    MYLONG peaktime;
+    PSF_PROPS props_in1,props_in2;
+    float *frame_in1 = NULL, *frame_in2 = NULL, *outframe = NULL;
+    PSF_CHPEAK *peaks = NULL;
+
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("2.0.1\n");
+        return 0;
+    }
+
+    if(argc < 4)
+        usage();
+
+    while(argv[1][0]=='-'){
+        char *valstr;
+        double val;
+        switch(argv[1][1]){
+        case 'd':
+            do_dither = 1;
+            break;
+        case('f'):
+            force_floats = 1;
+            break;
+        case('o'):
+            if(argv[1][2]=='\0'){
+                fprintf(stderr,"-o flag needs a number\n");
+                exit(1);
+            }
+            valstr = &argv[1][2];
+            val=atof(valstr);
+            if(val < 0.0){
+
+                fprintf(stderr,"offset must be >= 0\n");
+                exit(1);
+            }
+            if(val > 0.0)
+                offset = val;
+            break;
+
+        default:
+            fprintf(stderr,"incorrect flag option %c\n",argv[1][1]);
+            exit(1);
+        }
+        argc--; argv++;
+    }
+
+    if(argc < 4)
+        usage();
+    if(force_floats && do_dither)
+        fprintf(stderr,"Warning: dither option ignored for floats format.\n");
+
+    psf_init();
+
+    //open soundfiles: no auto-rescaling
+    if((ifd1 = psf_sndOpen(argv[1],&props_in1,0)) < 0){
+        fprintf(stderr,"Cannot open soundfile %s\n",argv[1]);
+        goto cleanup;
+    }
+
+    if((ifd2 = psf_sndOpen(argv[2],&props_in2,0)) < 0){
+        fprintf(stderr,"Cannot open soundfile %s \n",argv[2]);
+        goto cleanup;
+    }
+
+    if(props_in1.chans != props_in2.chans){
+        fprintf(stderr,"files do not have the same number of channels\n");
+        goto cleanup;
+    }
+
+    if(props_in1.srate != props_in2.srate){
+        fprintf(stderr,"files do not have the same sample rate\n");
+        goto cleanup;
+
+    }
+
+    if(props_in1.chformat != props_in2.chformat){
+        fprintf(stderr,"files do not have the same channel format\n");
+        goto cleanup;
+    }
+
+
+    sr = props_in1.srate;
+    chans  = props_in1.chans;
+    ampfac = 0.5f;                                  //just mixing 2 files...
+    if(offset > 0.0){
+        offsetframes = (long) (offset * (double) sr);
+    }
+    /* now we can set up frame arrays */
+
+    frame_in1 = (float *) calloc(chans, sizeof(float));
+    frame_in2 = (float *) calloc(chans, sizeof(float));
+    outframe = (float *) calloc(chans, sizeof(float));
+
+    if(frame_in1==NULL || frame_in2==NULL || outframe==NULL ){
+        puts("\nno memory for frame buffers");
+        goto cleanup;
+    }
+
+    len_in1 = psf_sndSize(ifd1);
+    if(len_in1==0){
+        fprintf(stderr,"infile %s is empty!\n",argv[1]);
+        goto cleanup;
+    }
+    len_in2 = psf_sndSize(ifd2);
+    if(len_in2==0){
+        fprintf(stderr,"infile %s is empty!\n",argv[2]);
+        goto cleanup;
+    }
+    if(len_in1 < 0){
+        fprintf(stderr,"system problem: cannot read size of infile %s\n",argv[1]);
+        goto cleanup;
+    }
+
+    if(len_in2 < 0){
+        fprintf(stderr,"system problem: cannot read size of infile %s\n",argv[2]);
+        goto cleanup;
+    }
+
+
+
+    outlen = len_in2 + offsetframes;
+    if(len_in1 > outlen)
+        outlen = len_in1;
+
+#ifdef _DEBUG
+    printf("DEBUG: outfile size expected to be %d frames\n",outlen);
+#endif
+    //setup PEAK data
+    peaks = (PSF_CHPEAK *) calloc(props_in1.chans,sizeof(PSF_CHPEAK));
+    if(peaks==NULL){
+        puts("nmix: error: no memory for internal PEAK buffer\n");
+        goto cleanup;
+    }
+    if(force_floats)
+        props_in1.samptype = PSF_SAMP_IEEE_FLOAT;
+
+
+    if(!is_legalsize(outlen,&props_in1)){
+        fprintf(stderr,"error: outfile size exceeds capacity of format.\n");
+        return 1;
+    }
+
+
+    if((ofd = psf_sndCreate(argv[3],&props_in1,0,0,PSF_CREATE_RDWR)) < 0){
+        fprintf(stderr,"unable to create outfile %s\n",argv[3]);
+        goto cleanup;
+    }
+    if(do_dither)
+        psf_sndSetDither(ofd,PSF_DITHER_TPDF);
+    halfsec = sr / 2;
+    //OK now we can do it....
+    printf("\nmixing....\n");
+
+    in1_sofar = in2_sofar = 0;
+    if(offsetframes > 0){
+        for(i=0;i < offsetframes; i++){
+            int got,j;
+            got = psf_sndReadFloatFrames(ifd1,frame_in1,1);
+            if(got != 1){
+                fprintf(stderr,"error reading from infile 1\n");
+                goto cleanup;
+            }
+            for(j=0;j < chans; j++) {
+                frame_in1[j] *= ampfac;
+            }
+            if((psf_sndWriteFloatFrames(ofd,frame_in1,1)) !=1){
+                fprintf(stderr,"\nerror writing to outfile\n");
+                goto cleanup;
+            }
+            if(framecount % halfsec==0)
+                printf("%.2lf secs\r",(double)framecount / (double) sr);
+
+            framecount++;
+        }
+    }
+    in1_sofar = offsetframes;
+    //now we are mixing two files...
+    for(i= offsetframes; i < outlen; i++){
+        int got, j;
+        //clear frame blocks
+        memset(frame_in1,0, chans * sizeof(float));
+        memset(frame_in2,0, chans * sizeof(float));
+        //if we  have data, fill frame and scale
+        if(in1_sofar < len_in1){
+            got = psf_sndReadFloatFrames(ifd1,frame_in1,1);
+            if(got != 1){
+                fprintf(stderr,"\nerror reading from infile 1\n");
+                goto cleanup;
+            }
+            in1_sofar++;
+            for(j=0;j < chans; j++)
+                frame_in1[j] *= ampfac;
+        }
+
+
+        if(in2_sofar < len_in2){
+            got = psf_sndReadFloatFrames(ifd2,frame_in2,1);
+            if(got != 1){
+                fprintf(stderr,"\nerror reading from infile 1\n");
+                goto cleanup;
+            }
+
+            in2_sofar++;
+
+            for(j=0;j < chans; j++)
+                frame_in2[j] *= ampfac;
+
+        }
+
+        //mix and write
+        for(j=0;j < chans; j++) {
+            outframe[j] = frame_in1[j] + frame_in2[j];
+
+        }
+        if(psf_sndWriteFloatFrames(ofd,outframe,1) < 0){
+            fprintf(stderr,"\nerror writing to outfile\n");
+            goto cleanup;
+        }
+        if(framecount % halfsec==0) {
+            printf("%.2lf secs\r",(double)framecount / (double) sr);
+            fflush(stdout);
+        }
+        framecount++;
+    }
+    printf("%.4lf secs\nWritten %ld sample frames to %s\n",(double)framecount / (double)sr,framecount,argv[3]);
+    if(psf_sndReadPeaks( ofd,peaks,&peaktime)){
+        printf("PEAK values:\n");
+        for(i=0; i < chans; i++){
+            double val, dbval;
+            val = (double) peaks[i].val;
+
+            if(val > 0.0){
+                dbval = 20.0 * log10(val);
+                printf("CH %d: %.6f (%.2lfdB) at frame %u:\t%.4f secs\n",i,
+                       val,dbval,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props_in1.srate);
+            }
+            else{
+                printf("CH %d: %.6f (-infdB) at frame %u:\t%.4f secs\n",i,
+                       val,(unsigned int) peaks[i].pos,(double)peaks[i].pos / (double) props_in1.srate);
+            }
+        }
+    }
+
+
+
+ cleanup:
+    if(ifd1 >=0)
+        psf_sndClose(ifd1);
+    if(ifd2 >=0)
+        psf_sndClose(ifd2);
+    if(ofd >=0)
+        psf_sndClose(ofd);
+    if(peaks)
+        free(peaks);
+    if(frame_in1 != NULL)
+        free(frame_in1);
+
+    if(frame_in2 != NULL)
+        free(frame_in2);
+    if(outframe != NULL)
+        free(outframe);
+
+
+    psf_finish();
+    return 0;
+}

+ 320 - 0
dev/externals/mctools/rmsinfo.cpp

@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+// rmsinfo
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <portsf.h>
+#include <math.h>
+#include <signal.h>
+#ifdef WIN32
+# if _MSC_VER  && _MSC_VER <= 1200
+# include <new.h>
+# endif
+#endif
+
+
+#ifdef unix
+/* in portsf.lib */
+extern "C" {
+    int stricmp(const char *a, const char *b);
+}
+#endif
+
+enum {ARG_NAME, ARG_INFILE,ARG_NARGS};
+
+enum {CH_RMS_POWER,CH_AMPSUM,CH_BISUM,CH_NORM_RMS,CH_NORM_AMPSUM};
+
+typedef struct {
+    double rmspower;
+    double abssum;
+    double bisum;
+    double norm_rms;
+    double norm_abssum;
+} CH_RMSINFO;
+
+#define BUFLEN (1024)
+
+static int scanning(1);
+
+void runhandler(int sig)
+{
+	if(sig == SIGINT){
+		scanning = 0;
+    }
+}
+
+void usage(){
+    printf("\nCDP MCTOOLS: RMSINFO v1.0.1 (c) RWD, CDP 2009\n");
+    printf("Scans infile and reports rms and average loudness (power) of infile,\n"
+           " relative to digital peak (0dBFS)\n"
+           );
+    printf("Usage: rmsinfo [-n] infile [startpos [endpos]]\n"
+           "Standard output shows:\n"
+           "     RMS level\n"
+           "     Average level\n"
+           "     DC level (bipolar average)\n"
+           "-n : Include equivalent 0dBFS-normalised RMS and AVG levels.\n"
+           );
+    printf("Optional arguments:\n"
+           "startpos  :  start file scan from <startpos> seconds.\n"
+           "endpos    :  finish file scan at <endpos> seconds.\n"
+           );
+    printf("To stop a scan early, use CTRL-C.\n"
+           "Program will report levels up to that point.\n\n"
+           );
+}
+#ifdef WIN32
+#if _MSC_VER  && _MSC_VER <= 1200
+
+ int newhandler(size_t size);
+ class bad_alloc{};
+ int newhandler(size_t size)
+ {
+     throw bad_alloc();
+ }
+#endif
+#endif
+
+
+
+int main(int argc, char**argv)  {
+    long inframes,framesread=0,total_framesread;
+    double maxsamp = 0.0,startpos = 0.0,endpos;
+    long startframe = 0,endframe;
+    long halfsecframes = 0;
+    int i,j,ifd = -1;
+    int chans;
+    int do_norm = 0;
+	PSF_PROPS inprops;
+    CH_RMSINFO* rmsinfo = NULL;
+    double* rmsfac  = 0;
+    double* ampsum  = 0;
+    double* ampsumb = 0;
+    double* inbuf   = 0;
+    double* nrmsfac = 0;
+    double* nampsum = 0;
+    
+    
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("1.0.1\n");
+        return 0;
+    }
+#ifdef WIN32    
+# if _MSC_VER  && _MSC_VER <= 1200
+     _set_new_handler( newhandler );
+# endif
+#endif
+    if(psf_init()){
+		puts("unable to start portsf\n");
+		return 1;
+	}
+    if(argc < 2){		 
+		usage();
+		return(1);
+	}
+    while(argv[1][0]=='-'){
+		switch(argv[1][1]){
+        case 'n':
+            do_norm = 1;
+            break;
+        default:
+            fprintf(stderr, "Unrecognised flag option %s\n",argv[1]);
+            return 1;
+        }
+        argc--; argv++;
+    }
+    if(argc < 2){		 
+		usage();
+		return(1);
+	}
+    if((ifd = psf_sndOpen(argv[ARG_INFILE],&inprops, 0)) < 0){
+		fprintf(stderr,"\nUnable to open input soundfile %s",argv[ARG_INFILE]);
+		return(1);
+	}
+	inframes = psf_sndSize(ifd);  // m/c frames
+    endframe = inframes;
+    
+	if(inframes <= 0)
+        return 0;
+	if(argc >= 3) {
+        long lpos;
+        startpos = atof(argv[ARG_INFILE+1]);
+        if(startpos < 0.0){
+            fprintf(stderr,"Error: startpos must be positive\n");
+            return 1;
+        }
+        lpos = (long)( startpos * inprops.srate);
+        if(lpos > inframes){
+            fprintf(stderr,"Error: startpos value beyond end of file.\n");
+            return 1;
+        }
+        startframe = lpos;
+    }
+    if(argc >= 4) {
+        long lpos;
+        endpos = atof(argv[ARG_INFILE+2]);
+        
+        lpos = (long)(endpos * inprops.srate);
+        if(lpos > inframes){
+            fprintf(stderr,"Warning: endpos value too large - reset to end of file.\n");
+            return 1;
+        }
+        endframe = lpos;
+        if(!(endframe > startframe)){
+            fprintf(stderr,"Error: endpos must be beyond startpos.\n");
+            return 1;
+        }
+    }
+    if(startframe)
+        printf("Starting at frame %ld, ending at frame %ld\n",startframe, endframe);
+    
+    chans   = inprops.chans;
+    try {
+        inbuf   = new double[BUFLEN * chans];
+        rmsinfo = new CH_RMSINFO[chans];
+        rmsfac  = new double[chans];
+        ampsum  = new double[chans];
+        ampsumb = new double[chans];
+        nrmsfac = new double[chans];
+        nampsum = new double[chans];
+    }
+    catch(...){
+        fputs("no memory!\n",stderr);
+        return 1;
+    }
+    for(i=0; i < chans; i++){
+        rmsfac[i]  = 0.0;
+        ampsum[i]  = 0.0;
+        ampsumb[i] = 0.0;
+        nrmsfac[i] = 0.0;
+        nampsum[i] = 0.0;
+    }
+    halfsecframes = inprops.srate / 2; 
+    signal(SIGINT,runhandler);
+    long wanted = endframe - startframe;
+    printf("Scanning %ld frames (%.3lf secs):\n",wanted, (double)wanted / inprops.srate);
+    total_framesread = 0;
+    if(startframe) {
+        if(psf_sndSeek(ifd,startframe,PSF_SEEK_SET)){
+            fprintf(stderr,"File Seek error.\n");
+            return 1;
+        }
+    }
+        
+	while((framesread = psf_sndReadDoubleFrames(ifd,inbuf,BUFLEN)) > 0){
+        double fval;
+        for(i = 0;i < framesread;i++) {
+            for(j = 0; j < chans; j++){
+                double val = inbuf[i*chans + j];
+                fval = fabs(val);
+                maxsamp = fval >  maxsamp ? fval : maxsamp;
+                ampsum[j]   += fval;
+                rmsfac[j]   += val*val; 
+                ampsumb[j]  += val;
+            }
+            total_framesread++;
+            if(scanning==0)
+                break;
+            if(total_framesread == wanted) 
+                break;
+            if((total_framesread % halfsecframes) == 0){
+                printf("%.2lf\r",total_framesread / (double) inprops.srate);
+                fflush(stdout);
+            }
+        }
+        if(total_framesread == wanted) {
+            break;
+        }
+    }
+    if(framesread < 0){
+        fprintf(stderr,"Error reading file.\n");
+        return 1;
+    }
+    for(i=0;i < chans;i++){
+        rmsfac[i]  /= total_framesread;
+        rmsfac[i]   = sqrt(rmsfac[i]);
+        ampsum[i]  /= total_framesread;
+        ampsumb[i] /= total_framesread;
+    }
+
+    double normfac = 1.0 / maxsamp;
+    if(scanning==0)
+        printf("\nScan stopped.\n");
+    if(total_framesread < inframes){
+        printf("Scanned %ld frames (%.2lf secs).\n",total_framesread,total_framesread / (double)inprops.srate);
+    }
+    
+    printf("Maximum sample = %lf (%.2lfdB)\n",maxsamp,20.0 * log10(maxsamp));
+    printf("Maximum normalisation factor = %.4f\n",normfac);
+    
+    for(i=0;i < chans;i++){
+        rmsinfo[i].rmspower    = rmsfac[i];
+        rmsinfo[i].abssum      = ampsum[i];
+        rmsinfo[i].bisum       = ampsumb[i];
+        rmsinfo[i].norm_rms    = normfac * rmsfac[i];
+        rmsinfo[i].norm_abssum = normfac * ampsum[i];
+    }
+    if(do_norm){
+        printf("\t   RMS LEVEL\t    AVG  \t   NET DC\t   NORM RMS\t  NORM AVG\n");
+        printf("CH\t AMP\t DB\t AMP\t DB\t AMP\t DB\t AMP\t DB\t AMP\t DB     \n");
+    }
+    else{
+        printf("\t   RMS LEVEL\t    AVG  \t   NET DC\n");
+        printf("CH\t AMP\t DB\t AMP\t DB\t AMP\t DB\n"); 
+    }
+    for(i=0;i < chans;i++){
+        double d1,d2,d3,d4,d5;
+        
+        d1 = 20*log10(rmsfac[i]);
+        d2 = 20*log10(ampsum[i]);
+        d3 = 20*log10(fabs(ampsumb[i]));
+        d4 = 20*log10(normfac * rmsfac[i]);
+        d5 = 20*log10(normfac * ampsum[i]);
+        if(do_norm){
+            printf("%d\t%.5lf\t%.2lf\t%.5lf\t%.2lf\t%+.4lf\t%.2lf\t%.5lf\t%.2lf\t%.5lf\t%.2lf\n",i+1,
+               rmsinfo[i].rmspower,d1,
+               rmsinfo[i].abssum,d2,
+               rmsinfo[i].bisum,d3,
+               rmsinfo[i].norm_rms,d4,
+               rmsinfo[i].norm_abssum,d5
+            );
+        }
+        else {
+            printf("%d\t%.5lf\t%.2lf\t%.5lf\t%.2lf\t%+.4lf\t%.2lf\n",i+1,
+                   rmsinfo[i].rmspower,d1,
+                   rmsinfo[i].abssum,d2,
+                   rmsinfo[i].bisum,d3
+            );
+        }
+    }
+        
+    delete [] inbuf;
+    delete [] rmsfac;
+    delete [] ampsum;
+    delete [] ampsumb;
+    delete [] rmsinfo;
+    psf_sndClose(ifd);
+    psf_finish();
+
+	return 0;
+}

+ 378 - 0
dev/externals/mctools/sfprops.c

@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* sfprops.c: display primary soundfile properties 
+ * uses sfsysEx.lib: recognizes WAVE-EX formats
+ * part of the CDP MCTOOLS suite
+ */
+//RWD.6.99 use new funcs to report 24bit formats, etc
+//last update: 22.6.99 enumerate PEAK chans from 1, link with latest sfsysEx
+/* Nov28 2001: rebuild with sfsysEx recognizing stupid QuickTime AIFC floats with 16bit size! */
+/*Dec 2005 support .amb extension */
+/*April 2006: build with updated sfsys to read PEAK chunk after data chunk (Thanks to Sony!)*/
+/* OCt 2009 TODO: sort out 64bit platform issues (peaktime etc) */
+/* FEB 2010: decl filesize etc as unsigned to read huge file sizes! */
+/* Nov 2013 added MC_SURR_6_1 */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+#include <time.h>
+#include <sfsys.h>
+#include <chanmask.h>
+
+#ifdef unix
+
+int stricmp(const char *a, const char *b)
+{
+    while(*a != '\0' && *b != '\0') {
+        int ca = islower(*a) ? toupper(*a) : *a;
+        int cb = islower(*b) ? toupper(*b) : *b;
+        
+        if(ca < cb)
+            return -1;
+        if(ca > cb)
+            return 1;
+        
+        a++;
+        b++;
+    }
+    if(*a == '\0' && *b == '\0')
+        return 0;
+    if(*a != '\0')
+        return 1;
+    return -1;
+}
+#endif
+
+typedef struct wave_ex_speaker {
+    int mask;
+    char name[28];
+} WAVE_EX_SPEAKER;
+
+
+static const WAVE_EX_SPEAKER speakers[NUM_SPEAKER_POSITIONS] = {
+    {SPEAKER_FRONT_LEFT,"Front Left"},
+    {SPEAKER_FRONT_RIGHT,"Front Right"},
+    {SPEAKER_FRONT_CENTER,"Front Centre"},
+    {SPEAKER_LOW_FREQUENCY,"Low Frequency"},
+    {SPEAKER_BACK_LEFT,"Back Left"},
+    {SPEAKER_BACK_RIGHT,"Back Right"},
+    {SPEAKER_FRONT_LEFT_OF_CENTER,"Front Centre-Left"},
+    {SPEAKER_FRONT_RIGHT_OF_CENTER,"Front Centre-Right"},
+    {SPEAKER_BACK_CENTER,"Back Centre"},
+    {SPEAKER_SIDE_LEFT,"Side Left"},
+    {SPEAKER_SIDE_RIGHT,"Side Right"},
+    {SPEAKER_TOP_CENTER,"Top Centre"},
+    {SPEAKER_TOP_FRONT_LEFT,"Front Top Left"},
+    {SPEAKER_TOP_FRONT_CENTER,"Front Top Centre"},
+    {SPEAKER_TOP_FRONT_RIGHT,"Front Top Right"},
+    {SPEAKER_TOP_BACK_LEFT,"Back Top Left"},
+    {SPEAKER_TOP_BACK_CENTER,"Back Top Centre"},
+    {SPEAKER_TOP_BACK_RIGHT,"Back Top Right"}
+};
+
+void usage(){
+    fprintf(stderr,"CDP MCTOOLS: SFPROPS v2.2.0 (c) RWD,CDP,1999,2009,2010,2013\n"
+                    "Display soundfile details, with WAVE-EX speaker positions\n"
+                    "\n\tusage: sfprops infile\n");
+}
+
+ 
+
+int main(int argc, char **argv)
+{
+
+    int i,ifd;
+    unsigned int nframes,filesize; /* FEB 2010 */
+    double srate;
+    SFPROPS props = {0};
+    const char *name = NULL;
+    CHPEAK *peaks = NULL;
+    int res,peaktime,speakermask = 0;
+    float fmaxamp;
+    int lmaxamp;
+    
+    /* CDP version number */
+    if(argc==2 && (stricmp(argv[1],"--version")==0)){
+        printf("2.2.0.\n");
+        return 0;
+    }
+    
+    if(argc< 2){
+        usage();
+        exit(1);
+    }
+    if(sflinit("sfprops")){
+        fprintf(stderr,"SFPROPS: unable to initialize CDP Sound Filing System\n");
+        exit(1);
+    }
+    if((ifd = sndopenEx(argv[1],0,CDP_OPEN_RDONLY)) < 0){
+        fprintf(stderr,"SFPROPS: unable to open infile %s: %s\n",argv[1], sferrstr());
+        exit(1);
+    }
+
+    if(!snd_headread(ifd,&props)){
+        fprintf(stderr,"SFPROPS: unable to read infile header\n");
+        exit(1);
+    }
+
+    srate = (double) props.srate;
+    filesize = sndsizeEx(ifd);
+    nframes = filesize/ props.chans;        /*assume soundfile for now */
+    name = snd_getfilename(ifd);
+    printf("Properties of %s:\n",name);
+    printf("File type:  ");
+    switch(props.type){
+    case(wt_wave):
+        printf("soundfile\nFormat         :  ");
+
+        switch(props.format){
+        case(WAVE):
+            printf("Standard WAVE format\n");
+            break;
+        case(WAVE_EX):
+            printf("MS WAVE-FORMAT-EXTENSIBLE\n");
+            printf("SPEAKER CONFIGURATION:\t");
+
+            switch(props.chformat){
+            //case(MC_STD):
+            //  printf("unassigned (generic format)");
+            //  break;
+            case(MC_MONO):
+                printf("Mono\n");
+                break;
+            case(MC_STEREO):
+                printf("Stereo\n");
+                break;
+            case(MC_QUAD):
+                printf("Rectangular Quad\n");
+                break;
+            case(MC_LCRS):
+                printf("Quad Surround\n");
+                break;
+            case(MC_BFMT):
+                printf("Ambisonic B-Format\n");
+                break;
+            case(MC_DOLBY_5_1):
+                printf("5.1 (Dolby) Surround\n");
+                break;
+            case(MC_SURR_6_1):
+                printf("6.1 Surround\n");
+                break;
+            case(MC_SURR_7_1):
+                printf("7.1 Surround\n");
+                break;
+            case(MC_CUBE):
+                printf("Cube Surround\n");
+                break;
+            default:
+                printf("Special speaker assignments\n");
+                break;
+            }
+            speakermask = sndgetchanmask(ifd);
+            if(speakermask < 0)
+                fprintf(stderr,"Unable to read speakermask from WAVE_EX header\n");
+            else {
+                //try to figure out the mask
+                int assigned = 0;
+                int shift = 0;
+                int this_channel = 1;
+                printf("Speaker Mask = %d (0x%x)\n",speakermask,(unsigned int) speakermask);
+                while(assigned < props.chans){
+                    if(speakers[shift].mask & speakermask){
+                        printf("Channel %d: %s\n",this_channel++,speakers[shift].name);
+                        assigned++;
+                    }
+                    if(++shift == NUM_SPEAKER_POSITIONS)
+                        break;
+                }
+                if(assigned < props.chans)
+                    printf("Remaining channels not assigned speaker locations.\n");
+
+            }
+            break;
+                
+        case(AIFF):
+            printf("AIFF format\n");
+            break;
+        case(AIFC):
+            printf("AIFC format\n");
+            break;
+        default:
+            printf("unknown format\n");
+            break;
+        }
+        printf("Sample Rate    :  %d\n",props.srate);
+        printf("Channels       :  %d\n",props.chans);
+        printf("Sample Frames  :  %d\n",nframes);
+        printf("sample type:   :  ");
+        switch(props.samptype){
+        case(SHORT8):
+            printf("8-bit\n");
+            break;
+        case(SHORT16):
+            printf("16-bit\n");
+            break;
+        case(FLOAT32):
+            printf("32bit floats\n");
+            break;
+        case(INT_32):
+            printf("32bit (integer)\n");
+            break;
+        case(INT2424):
+            printf("24bit (packed)\n");
+            break;
+        case(INT2432):
+            printf("24bit in 32bit words\n");
+            break;
+        case(INT2024):
+            printf("20bit in 24bit words\n");
+            break;
+        case(INT_MASKED):
+            printf("non-standard WAVE_EX format\n");
+            //fet more info....
+            break;
+        default:
+            printf("sorry: don't recognize word format!\n");
+            break;
+
+        }
+        printf("duration       :  %.4lf secs\n",(double)nframes / srate);
+        //this is the problem: we never decided what type maxamp is, officially!
+        if(props.samptype==FLOAT32){
+            if(sndgetprop(ifd,"maxamp",(char *)&fmaxamp,sizeof(float)) == sizeof(float)){
+                printf("CDP maxamp     :  %.4lf\n",fmaxamp);    
+            }
+        }
+        else{
+            if(sndgetprop(ifd,"maxamp",(char *)&lmaxamp,sizeof(int)) == sizeof(int)){
+                printf("CDP maxamp     :  %d\n",lmaxamp);   
+            }
+        }
+        peaks = (CHPEAK *) calloc(props.chans,sizeof(CHPEAK));
+        if(peaks==NULL){
+            puts("sfprops: no memory for fpeak data buffer\n");
+            exit(1);
+        }
+        else{
+            time_t thistime;
+            res = sndreadpeaks(ifd,props.chans,peaks, (int *) &peaktime);
+            thistime = (time_t) peaktime;
+            if(res ==0)
+                printf("no peak data in this infile\n");
+            else if(res < 0){
+                fprintf(stderr,"sfprops: WARNING: error reading infile peak data\n");
+                
+            }
+            else {      
+                printf("PEAK data:\n\tcreation time: %s\n", ctime(&thistime));
+                //for(i=0;i < props.chans; i++)
+                //  printf("CH %d: %.4lf at frame %d:\t%.4lf secs\n",
+                //  i+1,peaks[i].value,peaks[i].position,(double) (peaks[i].position) / srate);
+                for(i=0; i < props.chans; i++){
+                    double val, dbval;
+                    val = (double) peaks[i].value;
+                    
+                    if(val > 0.0){
+                        dbval = 20.0 * log10(val);
+                        printf("CH %d: %.6f (%.2lfdB) at frame %9d:\t%.4f secs\n",i,
+                               val,dbval,peaks[i].position,(double)(peaks[i].position / (double) srate));
+                    }
+                    else{
+                        printf("CH %d: %.6f (-infdB)  \t\t:\t%.4f secs\n",
+                               i,
+                               val, (double)(peaks[i].position / (double) srate)); 
+                    }
+                }
+            }
+        }
+        
+        break;
+    case(wt_analysis):
+        printf("CDP pvoc analysis file.\n");
+        printf("Channel Format:       Amplitude,Frequency\n");
+        printf("Orig rate:            %d\n",props.origrate);
+        printf("Analysis Window Size: %d\n",props.winlen);
+        printf("Analysis channels:    %d\n",props.chans/2);
+        printf("Window Overlap:       %d\n",props.decfac);
+        printf("Analysis rate:        %.4f\n",props.arate);
+        printf("Frame count:          %d\n",filesize / (props.chans));
+        printf("Data size (floats):   %d\n",filesize);
+        printf("Duration (secs):      %.3lf\n",
+            ((filesize / props.chans) * props.decfac) / (double) props.origrate);
+        break;
+    case(wt_formant):
+        printf("CDP formant data\n");
+        printf("Specenvcnt:           %d\n",props.specenvcnt);
+        printf("Analysis Window Size: %d\n",props.winlen);
+        printf("Channels:             %d\n",props.chans);
+        printf("Frame count:          %d\n",filesize);
+        printf("Orig rate:            %d\n",props.origrate);        
+        printf("Window Overlap:       %d\n",props.decfac);
+        printf("Analysis rate:        %.4f\n",props.arate);
+        printf("Orig Chans:          %d\n",props.origchans);        
+        printf("Duration (secs):      %.3lf\n",(filesize /props.specenvcnt)/ props.arate );
+        break;
+    case(wt_transposition):
+        printf("CDP transposition data\n");
+        printf("Orig sample rate:     %d\n",props.origrate);
+        printf("Analysis Window Size: %d\n",props.winlen);
+        printf("Channels:             %d\n",props.chans);
+        printf("Window Overlap:       %d\n",props.decfac);
+        printf("Analysis rate:        %.4f\n",props.arate);
+        printf("Orig Chans:          %d\n",props.origchans);
+        printf("Data size (floats):   %d\n",filesize);
+        printf("Duration (secs):      %.3lf\n",
+            ((filesize / props.chans) * props.decfac) / (double) props.origrate);
+        break;
+    case(wt_pitch):
+        printf("CDP pitch data\n");
+        printf("Orig sample rate:     %d\n",props.origrate);
+        printf("Analysis Window Size: %d\n",props.winlen);
+        printf("Channels:             %d\n",props.chans);
+        printf("Window Overlap:       %d\n",props.decfac);
+        printf("Analysis rate:        %.4f\n",props.arate);
+        printf("Orig Chans:          %d\n",props.origchans);
+        printf("Data size (floats):   %d\n",filesize);
+        printf("Duration (secs):      %.3lf\n",
+            ((filesize / props.chans) * props.decfac) / (double) props.origrate);
+        break;
+    case(wt_binenv):
+        printf("CDP binary envelope data\n");
+        printf("envelope window size: %f msecs\n",props.window_size);
+        printf("sample rate:          %d\n",props.srate);
+        printf("Channels:             %d\n",props.chans);
+        printf("Points:               %d\n",filesize);
+        printf("Duration (secs):      %.3f\n",filesize * (props.window_size * 0.001));
+        break;
+    default:
+        printf("internal error! unlisted soundfile type\n");
+        break;
+    }
+
+    sndcloseEx(ifd);
+//  sffinish();
+    return 0;
+}
+
+
+

+ 5 - 0
dev/externals/paprogs/CMakeLists.txt

@@ -0,0 +1,5 @@
+
+add_subdirectory(listaudevs)
+add_subdirectory(paplay)
+add_subdirectory(pvplay)
+add_subdirectory(recsf)

BIN
dev/externals/paprogs/dx9mgw.zip


+ 26 - 0
dev/externals/paprogs/listaudevs/CMakeLists.txt

@@ -0,0 +1,26 @@
+if(APPLE)
+  set(CMAKE_C_FLAGS "-O2 -Wall -mmacosx-version-min=10.5 -Dunix -fomit-frame-pointer -funroll-loops")
+  include_directories ( /Developer/Headers/FlatCarbon )
+  find_library(COREAUDIOLIB CoreAudio)
+  find_library(AUDIOTOOLBOX AudioToolbox)
+  find_library(AULIB AudioUnit)
+  find_library(CARBONLIB Carbon)
+  set(EXTRA_LIBRARIES1 ${COREAUDIOLIB} ${AUDIOTOOLBOX} ${AULIB} ${CARBONLIB} ${EXTRA_LIBRARIES})
+else()
+  if(MINGW)
+    set(CMAKE_C_FLAGS "-O3 -DWIN32 -D_WIN32 -fomit-frame-pointer  -funroll-loops")
+    set(EXTRA_LIBRARIES1 winmm dsound winspool ${EXTRA_LIBRARIES})
+  else()
+    set(CMAKE_C_FLAGS "-O3 -Wall -Dlinux -Dunix -fomit-frame-pointer -funroll-loops")
+    set(EXTRA_LIBRARIES1 jack asound portsf pthread ${EXTRA_LIBRARIES})
+  endif()
+endif()
+
+link_directories(../../include ../portaudio/lib/.libs)
+
+include_directories(../../../include ../include ../portaudio/include ../portaudio/src/common )
+
+add_executable(listaudevs devs.c)
+target_link_libraries(listaudevs portaudio.a  ${EXTRA_LIBRARIES1})
+
+my_install(listaudevs)

+ 69 - 0
dev/externals/paprogs/listaudevs/devs.c

@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1983-2020 Richard Dobson and Composers Desktop Project Ltd
+ * http://www.rwdobson.com
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* devs.c : display list of installed audio devices */  
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _WIN32
+# include <windows.h>
+#endif
+#include <portaudio.h>
+
+int show_devices(void);
+
+int main(void)
+{
+    return show_devices();
+}
+
+int show_devices(void)
+{
+        PaDeviceIndex numDevices,p;
+        const    PaDeviceInfo *pdi;
+        PaError  err;
+        int nOutputDevices = 0;
+
+        Pa_Initialize();
+        numDevices =  Pa_GetDeviceCount();
+        if( numDevices < 0 )
+        {
+            printf("ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
+            err = numDevices;
+            return err;
+        }
+        //printf("Number of devices = %d\n", numDevices );
+        printf("Device\tInput\tOutput\tName\n");
+        
+        for( p=0; p<numDevices; p++ )
+        {
+            pdi = Pa_GetDeviceInfo( p );    
+            nOutputDevices++;
+            if( p == Pa_GetDefaultOutputDevice() ) 
+                printf("*");
+            else
+                printf(" ");
+            printf("%d\t%d\t%d\t%s\n",p,
+                pdi->maxInputChannels,
+                pdi->maxOutputChannels,
+                pdi->name);         
+        }
+        Pa_Terminate();
+        return 0;
+}

+ 32 - 0
dev/externals/paprogs/listaudevs/orig_Makefile

@@ -0,0 +1,32 @@
+# OSX makefile for listaudevs © Richard Dobson Feb 1 2014
+
+CC = gcc
+OPT = -O3
+#OPT = -g
+# change this path as needed
+PADIR = ../mctools/portaudio
+PAINC = $(PADIR)/include
+PACOM = $(PADIR)/src/common
+
+PALIB = $(PADIR)/lib/libportaudio.a
+CFLAGS = $(OPT)  -g -mmacosx-version-min=10.5 -arch i386 -Dunix -DMAC  -DPA_USE_COREAUDIO -I$(PAINC)
+IOLINK =  -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
+PROG=listaudevs  
+
+.c.o:
+	$(CC) $(CFLAGS) -c $<
+
+	 
+$(PROG):	devs.o 
+	$(CC) $(CFLAGS) devs.o -o $(PROG) $(IOLINK)  $(PALIB)
+
+
+clean: 
+	rm  devs.o
+veryclean:	clean
+	rm $(PROG)
+
+
+
+
+

BIN
dev/externals/paprogs/pa_stable_v19_20140130.tgz


+ 37 - 0
dev/externals/paprogs/palinuxbuild.txt

@@ -0,0 +1,37 @@
+palinuxbuild.txt:
+
+Portaudio is required by the audio programs (paplay, pvplay, recsf, listaudevs).
+If the required libportaudio.a is not detected, the top level build script 
+(makeprograms.sh)  will skip this stage.
+
+The audio program makefiles assume availability and use of both alsa and jack.
+
+The supplied source archive is the latest v19 stable release 2014.
+
+To build, unpack pa--tgz in situ; this will create a portaudio directory. 
+Run configure with these options:
+
+./configure --with-alsa --with-jack
+
+Then run make as usual to build, 
+
+Do not perform run 'make install' unless you are happy for it to replace your current system portaudio libs.
+
+The CDP makefiles look for the local lib/.libs folder for libportaudio.a
+
+To build the audio programs, either:
+
+run the Makefile in each program directory:
+
+make install -f Makefile.linux
+
+or run the top level makeprograms.sh script.
+
+NB "install" above merely copies the binaries into the local Release directory under dev/.
+
+
+
+
+
+
+

+ 44 - 0
dev/externals/paprogs/pamacbuild.txt

@@ -0,0 +1,44 @@
+pamacbuild.txt:
+
+Use this combination command to configure portaudio to build as a (single architecture) 
+static library on OS X, required by the audio programs (paplay, pvplay, recsf, listaudevs).
+
+The CDP programs build only for the 32bit architecture (-arch i386), 
+as they have not yet been fully tested for correctness with a 64bit architecture.
+
+Portaudio tends to assume all architectures are available, but this is not always the case 
+from Xcode 4.x onwards (e.g. no ppc support).
+
+You may need to edit the Makefile (or configure.in) by hand to add or exclude architectures. 
+
+You will likely need to type the commands below directly, in Terminal. Cutting and pasting from a text
+ editor (possibly using Unicode) may result in a config error.
+ 
+On a 32bit OS type:
+
+CFLAGS=$CFLAGS -mmacosx-version-min=10.4  ./configure --enable-shared=no --enable-mac-universal=no 
+
+If building on a 64bit machine, omit --enable-mac-universal=no and  make sure to add -arch i386 
+to the CFLAGS if not present, removing any which are not supported or needed, e.g:
+
+CFLAGS="$CFLAGS -arch i386 -arch x86_64"
+
+(the quotation marks are required if the CFLAGS string contains multiple options separated by spaces). 
+
+Then run make as usual to build. 
+
+The CDP makefiles look for the local lib/.libs folder for libportaudio.a
+There is no need to run sudo make install
+
+This is to avoid a couple of warnings when compiling pa_mac-core.c.
+The macosx version setting is to prevent warnings  about deprecated APIs.
+The configure script specifies -Werror ("treat warnings as errors"), 
+which means that any such warning stops the build.
+
+The command --enable-shared=no also seems to be needed, otherwise (for some reason) 
+the linker fails to find the Pa_Util functions.
+
+Newer builds of portaudio can of course be used; they may obviate some or all of the above issues; but may introduce new ones too!
+
+
+

+ 74 - 0
dev/externals/paprogs/pamingwbuild.txt

@@ -0,0 +1,74 @@
+How to buld Portaudio static library for Windows, using MinGW. 
+
+This is required by the audio programs (paplay, pvplay, recsf, listaudevs)
+
+This assumes MinGW is already installed. This has been developed using the standard MinGW distribution; it has not been tested with the 
+Either or both ASIO and Directx support is needed for building the programs.
+
+An unpacked portaudio folder is provided, based on the latest release
+(see http://www.portaudio.com). It has a modified configure.in file to plug gaps in the default 
+portaudio configure setup.
+
+
+1. If ASIO support is desired, obtain the SDK from the Steinberg site (we are not allowed to distribute it ourselves).
+See: http://www.steinberg.net/en/company/developer.html
+
+It is convenient to put the unpacked directory ASIOSDK2 inside the portaudio folder, for ease of reference,
+and especially if it is shared with other projects, but other locations are possible, including /usr/local. 
+See the web page referenced at the bottom of this document.
+
+2. DirectSound support
+
+Unzip dx9mgw.zip into (e.g.) your MinGW home directory. This is the location assumed in the following instructions.
+
+Source of this sdk: http://alleg.sourceforge.net/files/dx9mgw.zip
+(see https://www.allegro.cc/forums/thread/610763)
+
+These examples assume the user name is "Richard". of course, replace this as needed with your MinGW user name
+ 
+Portaudio configure has to be told which APIs to activate, and the paths to the SDKs for those APIs.
+
+cd to the portaudio directory (inside dev/externals/paprogs)
+
+ASIO only configure (NB long lines here):
+
+$ ./configure --with-host_os=mingw --with-winapi=asio --without-jack --enable-shared=no --enable-debug-output=no --with-asiodir=./ASIOSDK2
+
+
+dsound only configure:
+
+$ ./configure --with-host_os=mingw --with-winapi=directx --without-jack --enable-shared=no --enable-debug-output=no --with-dxdir=/home/Richard/dx9mgw 
+
+
+Both (recommended):
+
+$ ./configure --with-host_os=mingw --with-winapi=directx,asio --without-jack --enable-shared=no --enable-debug-output=no --with-dxdir=/home/Richard/dx9mgw --with-asiodir=./ASIOSDK2
+
+Thjis generates the Makefile which we will use to build portaudio
+
+3. Modify the Makefile
+
+Add the define -DPAWIN_USE_WDMKS_DEVICE_INFO to CFLAGS and CXXFLAGS
+
+Add the object file src/os/win/pa_win_wdmks_utils.o  to the OTHER_OJBJS list
+
+
+The standard configure does not set up the exact combination we need, for multichannel device support.
+
+
+
+And finally:
+
+$ make
+
+Note: only the static library libportaudio.a is built.
+The makefiles for the audio programs look for this in the local hidden directory (lib/.libs).
+There is no need to run [sudo] make install, which would overwrite any existing copy.
+
+
+See also here, for an extended discussion of how to build portaudio with MinGW:
+
+https://www.assembla.com/spaces/portaudio/wiki/Notes_about_building_PortAudio_with_MinGW
+
+Richard Dobson Feb 2014
+

+ 30 - 0
dev/externals/paprogs/paplay/CMakeLists.txt

@@ -0,0 +1,30 @@
+if(APPLE)
+  set(CMAKE_C_FLAGS "-O2 -Wall -mmacosx-version-min=10.5 -Dunix -fomit-frame-pointer -funroll-loops")
+  include_directories ( /Developer/Headers/FlatCarbon )
+  find_library(COREAUDIOLIB CoreAudio)
+  find_library(AUDIOTOOLBOX AudioToolbox)
+  find_library(AULIB AudioUnit)
+  find_library(CARBONLIB Carbon)
+  find_library(AAIOLIB names libaaio.a paths /usr/local/lib)
+  set(EXTRA_LIBRARIES1 portsf pthread ${AAIOLIB} ${COREAUDIOLIB} ${AUDIOTOOLBOX} ${AULIB} ${CARBONLIB} ${EXTRA_LIBRARIES})
+  
+else()
+  if(MINGW)
+    set(CMAKE_C_FLAGS "-O3 -DWIN32 -D_WIN32 -DUSE_ASIO -fomit-frame-pointer -funroll-loops")
+    set(EXTRA_LIBRARIES1 winmm dsound winspool ${EXTRA_LIBRARIES})
+  else()
+    set(CMAKE_C_FLAGS "-O3 -Wall -Dlinux -Dunix -fomit-frame-pointer -funroll-loops")
+    set(EXTRA_LIBRARIES1 jack asound portsf pthread ${EXTRA_LIBRARIES})
+  endif()
+endif()
+
+
+
+link_directories (../../lib ../portaudio/lib/.libs  /usr/local/lib)
+
+include_directories(../../include ../include ../portaudio/include ../portaudio/src/common /usr/local/include)
+
+add_executable(paplay paplay.c fmhfuncs.c)
+target_link_libraries(paplay portaudio.a  ${EXTRA_LIBRARIES1})
+
+my_install(paplay)

+ 106 - 0
dev/externals/paprogs/paplay/fmdcode.h

@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* fmdcode.h */
+
+/*
+ Channel order is WXYZ,RSTUV,KLMNOPQ
+ 
+ The number of channels defines the order of the soundfield:
+ 2 channel = UHJ 
+ 3 channel = h   = 1st order horizontal
+ 4 channel = f   = 1st order 3-D
+ 5 channel = hh  = 2nd order horizontal
+ 6 channel = fh  = 2nd order horizontal + 1st order height (formerly
+                                                            called 2.5 order)
+ 7 channel = hhh = 3rd order horizontal
+ 8 channel = fhh = 3rd order horizontal + 1st order height
+ 9 channel = ff  = 2nd order 3-D
+ 11 channel = ffh = 3rd order horizontal + 2nd order height
+ 16 channel = fff = 3rd order 3-D
+ 
+ 
+ Horizontal   Height  Soundfield   Number of    Channels
+ order 	      order 	  type      channels 	
+ 1 	         0 	       horizontal 	  3 	    WXY
+ 1 	         1 	      full-sphere 	  4 	    WXYZ
+ 2 	         0 	       horizontal 	  5 	    WXY....UV
+ 2 	         1 	       mixed-order    6 	    WXYZ...UV
+ 2 	         2 	      full-sphere     9 	    WXYZRSTUV
+ 3           0 	       horizontal 	  7 	    WXY....UV.....PQ
+ 3 	         1         mixed-order 	  8 	    WXYZ...UV.....PQ
+ 3 	         2 	       mixed-order 	 11 	    WXYZRSTUV.....PQ
+ 3 	         3 	      full-sphere 	 16 	    WXYZRSTUVKLMNOPQ
+ */
+
+typedef struct abf_samp {
+	float W;
+	float X;
+	float Y;
+	float Z;
+    float R;
+    float S;
+    float T;
+	float U;
+    float V;
+} ABFSAMPLE;
+
+typedef void (*fmhcopyfunc)(ABFSAMPLE*,const float*);
+
+typedef void (*fmhdecodefunc)(const ABFSAMPLE*, float*,unsigned int);
+//void bfdcode4(float *inbuf,long numframes);
+void fmhcopy_3(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_4(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_5(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_6(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_7(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_8(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_9(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_11(ABFSAMPLE* abf,const float*buf);
+void fmhcopy_16(ABFSAMPLE* abf,const float*buf);
+
+
+// i1 = inphase 1st order, etc
+void fm_i1_mono(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_stereo(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_square(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_square(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_quad(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_quad(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_pent(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_pent(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_surr(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void fm_i1_surr6(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i1_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i1_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void dm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes);
+void fm_i1_hex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_hex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_oct1(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_oct1(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i1_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);
+void fm_i2_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes);

+ 712 - 0
dev/externals/paprogs/paplay/fmhfuncs.c

@@ -0,0 +1,712 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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. 
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+ 
+/* fmhfuncs.c */
+#include "fmdcode.h"
+
+/* TODO: expand to handle numframes frames? */
+
+void fmhcopy_3(ABFSAMPLE* abf,const float *buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf;
+}
+
+void fmhcopy_4(ABFSAMPLE* abf,const float *buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf;
+}
+
+void fmhcopy_5(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+void fmhcopy_6(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+// following discard 3rd order chans
+void fmhcopy_7(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+void fmhcopy_8(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+// these identical for 2nd order horiz max, but may be expanded later!
+void fmhcopy_9(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->R = *buf++;
+    abf->S = *buf++;
+    abf->T = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+void fmhcopy_11(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->R = *buf++;
+    abf->S = *buf++;
+    abf->T = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+void fmhcopy_16(ABFSAMPLE* abf,const float*buf)
+{
+    abf->W = *buf++;
+    abf->X = *buf++;
+    abf->Y = *buf++;
+    abf->Z = *buf++;
+    abf->R = *buf++;
+    abf->S = *buf++;
+    abf->T = *buf++;
+    abf->U = *buf++;
+    abf->V = *buf;
+}
+
+/********** DECODE FUNCS *************/
+/* TODO: complete support for numframes > 1 */
+
+void fm_i1_mono(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+    unsigned int i;	
+	float *p_out = outbuf;
+	double aw;
+    for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.7071;
+		*p_out++ = (float) aw;  		  
+	}
+}
+
+void fm_i1_stereo(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+    unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ay;
+    for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.7071;
+		ay = (double) inbuf->Y * 0.5;		
+		
+		*p_out++ = (float) (aw +  ay);  
+		*p_out++ = (float) (aw  - ay);  
+	}
+}
+
+void fm_i1_square(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.35355;
+		ax = (double) inbuf->X * 0.17677;
+		ay = (double) inbuf->Y * 0.17677;		
+		
+		*p_out++ = (float) (aw + ax + ay);  //FL
+		*p_out++ = (float) (aw - ax + ay);  //RL
+		*p_out++ = (float) (aw - ax - ay);  //RR
+		*p_out++ = (float) (aw + ax - ay);  //FR
+	}
+}
+void fm_i2_square(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;		
+	float *p_out = outbuf;	
+	double aw,ax,ay,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.3536;
+		ax = (double) inbuf->X * 0.2434;
+		ay = (double) inbuf->Y * 0.2434;		
+		av = (double) inbuf->V * 0.0964;
+		*p_out++ = (float) (aw + ax + ay + av);  //FL
+		*p_out++ = (float) (aw - ax + ay - av ); //RL
+		*p_out++ = (float) (aw - ax - ay + av);  //RR
+		*p_out++ = (float) (aw + ax - ay - av);  //FR
+	}
+}
+/* ditto, RLRL layout for WAVEX */
+void fm_i1_quad(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.35355;
+		ax = (double) inbuf->X * 0.17677;
+		ay = (double) inbuf->Y * 0.17677;		
+		
+		*p_out++ = (float) (aw + ax + ay);  //FL
+        *p_out++ = (float) (aw + ax - ay);  //FR
+		*p_out++ = (float) (aw - ax + ay);  //RL
+		*p_out++ = (float) (aw - ax - ay);  //RR
+		
+	}
+}
+void fm_i2_quad(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;		
+	float *p_out = outbuf;	
+	double aw,ax,ay,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.3536;
+		ax = (double) inbuf->X * 0.2434;
+		ay = (double) inbuf->Y * 0.2434;		
+		av = (double) inbuf->V * 0.0964;
+		*p_out++ = (float) (aw + ax + ay + av);  //FL
+        *p_out++ = (float) (aw + ax - ay - av);  //FR
+		*p_out++ = (float) (aw - ax + ay - av ); //RL
+		*p_out++ = (float) (aw - ax - ay + av);  //RR
+		
+	}
+}
+
+
+//front pair angle 72deg
+void fm_i1_pent(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2828;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + (ax*0.1618) + (ay*0.1176));  //FL
+		*p_out++ = (float) (aw - (ax*0.0618) + (ay*0.1902));  
+		*p_out++ = (float) (aw - (ax*0.2));  
+		*p_out++ = (float) (aw - (ax*0.0618) - (ay*0.1902));  
+        *p_out++ = (float) (aw + (ax*0.1618) - (ay*0.1176)); //FR
+	}
+}
+
+void fm_i2_pent(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2828;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;	
+        au = (double) inbuf->U;
+        av = (double) inbuf->V;
+		
+		*p_out++ = (float) (aw + (ax*0.2227) + (ay*0.1618) + (au*0.0238) + (av * 0.0733));  
+		*p_out++ = (float) (aw - (ax*0.0851) + (ay*0.2619) - (au*0.0624) - (av * 0.0453));  
+		*p_out++ = (float) (aw - (ax*0.2753)               + (au * 0.0771)              );  
+		*p_out++ = (float) (aw - (ax*0.0851) - (ay*0.2619) - (au*0.0624) + (av * 0.0453));  
+        *p_out++ = (float) (aw + (ax*0.2227) - (ay*0.1618) + (au*0.0238) - (av * 0.0733));
+	}
+}
+
+/* FMH only defines 1st order decode */ 
+void fm_i1_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		/* TODO: fix this order! */
+		*p_out++ = (float) ((aw * 0.169)  + (ax*0.0797) + (ay * 0.0891));   //L
+		*p_out++ = (float) ((aw * 0.1635) + (ax*0.0923));                   //C    ///???
+		*p_out++ = (float) ((aw * 0.169)  - (ax*0.0797) - (ay * 0.0891));   //R    ///????
+		*p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) + (ay * 0.1543));   //LS
+        *p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) - (ay * 0.1543));   //RS
+	}
+}
+/* from Bruce Wiggins via Csound */
+void fm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.405) + (ax*0.32) + (ay * 0.31)  + (au * 0.085) + (av * 0.125));   //L
+        *p_out++ = (float) ((aw * 0.405) + (ax*0.32) - (ay * 0.31)  + (au * 0.085) - (av * 0.125));   //R
+		*p_out++ = (float) ((aw * 0.085) + (ax*0.04)                + (au * 0.045)               );   //C
+		*p_out++ = (float) ((aw * 0.635) - (ax*0.335) + (ay * 0.28) - (au * 0.08)  + (av * 0.08));    //LS
+        *p_out++ = (float) ((aw * 0.635) - (ax*0.335) - (ay * 0.28) - (au * 0.08)  - (av * 0.08));    //RS
+	}
+}
+
+/* 5.1 versions - silent LFE */
+/* FMH only defines 1st order decode */ 
+void fm_i1_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) ((aw * 0.169)  + (ax*0.0797) + (ay * 0.0891));   //L
+		*p_out++ = (float) ((aw * 0.1635) + (ax*0.0923));                   //C
+		*p_out++ = (float) ((aw * 0.169)  - (ax*0.0797) - (ay * 0.0891));   //R
+        *p_out++ = 0.0f;                                                    //LFE
+		*p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) + (ay * 0.1543));   //LS
+        *p_out++ = (float) ((aw * 0.4563) - (ax*0.1259) - (ay * 0.1543));   //RS
+	}
+}
+/* from Bruce Wiggins via Csound */
+void fm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.405) + (ax*0.32) + (ay * 0.31)  + (au * 0.085) + (av * 0.125));   //L
+        *p_out++ = (float) ((aw * 0.405) + (ax*0.32) - (ay * 0.31)  + (au * 0.085) - (av * 0.125));   //R
+		*p_out++ = (float) ((aw * 0.085) + (ax*0.04)                + (au * 0.045)               );   //C
+        *p_out++ = 0.0f;                                                                              //LFE
+		*p_out++ = (float) ((aw * 0.635) - (ax*0.335) + (ay * 0.28) - (au * 0.08)  + (av * 0.08));    //LS
+        *p_out++ = (float) ((aw * 0.635) - (ax*0.335) - (ay * 0.28) - (au * 0.08)  - (av * 0.08));    //RS
+	}
+}
+
+// 1st order 5.0
+void dm_i1_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+        
+		*p_out++ = (float) ((aw * 0.4597)  + (ax*0.4536) + (ay * 0.3591));   //L
+        *p_out++ = (float)  ((aw * 0.4597)  + (ax*0.4536) - (ay * 0.3591));  //R 
+		*p_out++ = 0.0f;                                                     //C
+		
+		*p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) + (ay * 0.4606));    //LS
+        *p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) - (ay * 0.4606));    //RS
+    }
+}
+//1st order 5.1
+void dm_i1_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+        
+		*p_out++ = (float) ((aw * 0.4597)  + (ax*0.4536) + (ay * 0.3591));   //L
+        *p_out++ = (float)  ((aw * 0.4597)  + (ax*0.4536) - (ay * 0.3591));  //R 
+		*p_out++ = 0.0f;                                                     //C
+		*p_out++ = 0.0f;                                                     //LFE
+		*p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) + (ay * 0.4606));    //LS
+        *p_out++ = (float) ((aw * 0.5662) - (ax*0.3681) - (ay * 0.4606));    //RS
+    }
+}
+// 2nd order 5.0
+void dm_i2_surr(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) + (ay * 0.3487) + (au * 0.0828) + (av*0.1489));  //L
+        *p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) - (ay * 0.3487) + (au * 0.0828) - (av*0.1489));  //R 
+		*p_out++ = (float) ((aw * 0.0804)  + (ax * 0.1327));                                              //C
+		*p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) + (ay * 0.4089) - (au * 0.0567));                 //LS
+        *p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) - (ay * 0.4089) - (au * 0.0567));                 //RS
+    }
+}
+// 2nd order 5.1
+void dm_i2_surr6(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		au = (double) inbuf->U;
+        av = (double) inbuf->V;
+        
+		*p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) + (ay * 0.3487) + (au * 0.0828) + (av*0.1489));  //L
+        *p_out++ = (float) ((aw * 0.3314)  + (ax*0.4097) - (ay * 0.3487) + (au * 0.0828) - (av*0.1489));  //R 
+		*p_out++ = (float) ((aw * 0.0804)  + (ax * 0.1327));                                              //C
+		*p_out++ = 0.0f;                                                                                  //LFE
+		*p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) + (ay * 0.4089) - (au * 0.0567));                 //LS
+        *p_out++ = (float) ((aw * 0.6025) - (ax*0.3627) - (ay * 0.4089) - (au * 0.0567));                 //RS
+    }
+}
+
+
+void fm_i1_hex(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2357;
+		ax = (double) inbuf->X * 0.1443;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + ax + (ay * 0.0833));  //FL
+		*p_out++ = (float) (aw      + (ay * 0.1667));  //SL
+		*p_out++ = (float) (aw - ax + (ay * 0.0833));  //RL
+		*p_out++ = (float) (aw - ax - (ay * 0.0833));  //RR
+        *p_out++ = (float) (aw      - (ay * 0.1667));  //SR
+        *p_out++ = (float) (aw + ax - (ay * 0.0833));  //FR
+	}
+}
+void fm_i2_hex(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.2357;
+		ax = (double) inbuf->X * 0.1987;
+		ay = (double) inbuf->Y;
+		au = (double) inbuf->U;
+        av = (double) inbuf->V * 0.0556;
+		
+		*p_out++ = (float) (aw + ax + (ay * 0.1147) + (au * 0.0321) + av);  //FL
+		*p_out++ = (float) (aw      + (ay * 0.2294) - (au * 0.0643)     );  //SL
+		*p_out++ = (float) (aw - ax + (ay * 0.1147) + (au * 0.0321) - av);  //RL
+		*p_out++ = (float) (aw - ax - (ay * 0.1147) + (au * 0.0321) + av);  //RR
+        *p_out++ = (float) (aw      - (ay * 0.2294) - (au * 0.0643)     );  //SR
+        *p_out++ = (float) (aw + ax - (ay * 0.1147) + (au * 0.0321) - av);  //FR
+	}
+}
+
+void fm_i1_oct1(const ABFSAMPLE *inbuf,float*outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + (ax * 0.1155) + (ay * 0.0478));  
+		*p_out++ = (float) (aw + (ax * 0.0478) + (ay * 0.1155));  
+		*p_out++ = (float) (aw - (ax * 0.0478) + (ay * 0.1155));  
+		*p_out++ = (float) (aw - (ax * 0.1155) + (ay * 0.0478));  
+        *p_out++ = (float) (aw - (ax * 0.231)  - (ay * 0.0957));  
+        *p_out++ = (float) (aw - (ax * 0.0478) - (ay * 0.1155));  
+        *p_out++ = (float) (aw + (ax * 0.0478) - (ay * 0.1155));  
+        *p_out++   = (float) (aw + (ax * 0.1155) - (ay * 0.0478));  
+	}
+}
+void fm_i2_oct1(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.17677;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;
+		au = (double) inbuf->U * 0.03417;
+		av = (double) inbuf->V * 0.03417;
+        
+		*p_out++ = (float) (aw + (ax * 0.15906) + (ay * 0.06588) + au + av);  
+		*p_out++ = (float) (aw + (ax * 0.06588) + (ay * 0.15906) - au + av);  
+		*p_out++ = (float) (aw - (ax * 0.06588) + (ay * 0.15906) - au - av);  
+		*p_out++ = (float) (aw - (ax * 0.15906) + (ay * 0.06588) + au - av);  
+        *p_out++ = (float) (aw - (ax * 0.15906) - (ay * 0.06588) + au + av);  
+        *p_out++ = (float) (aw - (ax * 0.06588) - (ay * 0.15906) - au + av);  
+        *p_out++ = (float) (aw + (ax * 0.06588) - (ay * 0.15906) - au - av);  
+        *p_out++ = (float) (aw + (ax * 0.15906) - (ay * 0.06588) + au - av);  
+	}
+}
+
+void fm_i1_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;		
+		
+		*p_out++ = (float) (aw + (ax * 0.125)                 );  
+		*p_out++ = (float) (aw + (ax * 0.0884) + (ay * 0.0884));  
+		*p_out++ = (float) (aw                 + (ay * 0.125) );  
+		*p_out++ = (float) (aw - (ax * 0.0884) + (ay * 0.0884));  
+        *p_out++ = (float) (aw - (ax * 0.125)                 );  
+        *p_out++ = (float) (aw - (ax * 0.0884) - (ay * 0.0884));  
+        *p_out++ = (float) (aw                 - (ay * 0.125) );  
+        *p_out++ = (float) (aw + (ax * 0.0884) - (ay * 0.0884));  
+	}
+}
+void fm_i2_oct2(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,au,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X;
+		ay = (double) inbuf->Y;
+		au = (double) inbuf->U * 0.0482;
+		av = (double) inbuf->V * 0.0482;
+        
+		*p_out++ = (float) (aw + (ax * 0.1721)                 + au     );  
+		*p_out++ = (float) (aw + (ax * 0.1217) + (ay * 0.1217)      + av);  
+		*p_out++ = (float) (aw                 + (ay * 0.1721) - au     );  
+		*p_out++ = (float) (aw - (ax * 0.1217) + (ay * 0.1217)      - av);  
+        *p_out++ = (float) (aw - (ax * 0.1721)                 + au     );  
+        *p_out++ = (float) (aw - (ax * 0.1217) - (ay * 0.1217)      + av);  
+        *p_out++ = (float) (aw                 - (ay * 0.1721) - au     );  
+        *p_out++ = (float) (aw + (ax * 0.1217) - (ay * 0.1217)      - av);  
+	}
+}
+
+/* csound order; low/high anti-clockwise. 
+FMH page order, 4 low folowed by 4 high , clockwise! */
+void fm_i1_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,az;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.17677;
+		ax = (double) inbuf->X * 0.07216;
+		ay = (double) inbuf->Y * 0.07216;
+		az = (double) inbuf->Z * 0.07216;
+		
+		*p_out++ = (float) (aw + ax + ay - az);  // FL low
+		*p_out++ = (float) (aw + ax + ay + az);  // FL hi
+        
+		*p_out++ = (float) (aw - ax + ay - az);  // RL low
+		*p_out++ = (float) (aw - ax + ay + az);  //    hi
+        
+        *p_out++ = (float) (aw - ax - ay - az);  // RR low
+        *p_out++ = (float) (aw - ax - ay + az);  //   hi
+        
+        *p_out++ = (float) (aw + ax - ay - az);  // FR low
+        *p_out++ = (float) (aw + ax - ay + az);  //    hi
+	}
+}
+void fm_i2_cube(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,az,as,at,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X * 0.114;
+		ay = (double) inbuf->Y * 0.114;
+        az = (double) inbuf->Z * 0.114;
+        as = (double) inbuf->S * 0.0369;
+        at = (double) inbuf->T * 0.0369;
+		av = (double) inbuf->V * 0.0369;
+        
+		*p_out++ = (float) (aw + ax + ay - az - as - at + av); //FL low 
+		*p_out++ = (float) (aw + ax + ay + az + as + at + av); //   hi 
+		
+        *p_out++ = (float) (aw - ax + ay - az + as - at - av); //RL low
+		*p_out++ = (float) (aw - ax + ay + az - as + at - av);  
+        
+        *p_out++ = (float) (aw - ax - ay - az + as + at + av); // RR low
+        *p_out++ = (float) (aw - ax - ay + az - as - at + av);  
+        
+        *p_out++ = (float) (aw + ax - ay - az - as + at - av);  // FR low
+        *p_out++ = (float) (aw + ax - ay + az + as - at - av);   
+	}
+}
+/* ditto, wavex order */
+/* Front L, front R, Back L, Back R; top Front L, Top Fr R, Top Back L, Top back R */
+void fm_i1_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;
+	double aw,ax,ay,az;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.17677;
+		ax = (double) inbuf->X * 0.07216;
+		ay = (double) inbuf->Y * 0.07216;
+		az = (double) inbuf->Z * 0.07216;
+		
+		*p_out++ = (float) (aw + ax + ay - az);  // FL low
+        *p_out++ = (float) (aw + ax - ay - az);  // FR low
+        *p_out++ = (float) (aw - ax + ay - az);  // RL low
+        *p_out++ = (float) (aw - ax - ay - az);  // RR low
+        
+		*p_out++ = (float) (aw + ax + ay + az);  // FL hi
+        *p_out++ = (float) (aw + ax - ay + az);  // FR hi
+		*p_out++ = (float) (aw - ax + ay + az);  // RL hi
+        *p_out++ = (float) (aw - ax - ay + az);  // RR hi
+	}
+}
+void fm_i2_cubex(const ABFSAMPLE *inbuf,float *outbuf,unsigned int numframes)
+{
+	unsigned int i;	
+	float *p_out = outbuf;	
+	double aw,ax,ay,az,as,at,av;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double) inbuf->W * 0.1768;
+		ax = (double) inbuf->X * 0.114;
+		ay = (double) inbuf->Y * 0.114;
+        az = (double) inbuf->Z * 0.114;
+        as = (double) inbuf->S * 0.0369;
+        at = (double) inbuf->T * 0.0369;
+		av = (double) inbuf->V * 0.0369;
+        
+		*p_out++ = (float) (aw + ax + ay - az - as - at + av);  // FL low
+        *p_out++ = (float) (aw + ax - ay - az - as + at - av);  // FR low
+        *p_out++ = (float) (aw - ax + ay - az + as - at - av);  // RL low
+        *p_out++ = (float) (aw - ax - ay - az + as + at + av);  // RR low
+		
+        *p_out++ = (float) (aw + ax + ay + az + as + at + av);  // FL  hi 
+		*p_out++ = (float) (aw + ax - ay + az + as - at - av);  // FR  hi
+		*p_out++ = (float) (aw - ax + ay + az - as + at - av);  // RL  hi 
+        *p_out++ = (float) (aw - ax - ay + az - as - at + av);  // RR  hi 
+	}
+}
+
+
+#ifdef NOTDEF
+void bfdcode4(float *inbuf,long numframes)
+{
+	int i;	
+	float *p_buf = inbuf;	
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		aw = (double)(p_buf[0]) ;
+		ax = (double)(p_buf[1]) * 0.707;
+		ay = (double)(p_buf[2]) * 0.707;		
+		//decode frame
+		*p_buf++ = (float)(0.3333 * (aw + ax + ay)); //FL
+		*p_buf++ = (float)(0.3333 * (aw + ax - ay)); //FR
+		*p_buf++ = (float)(0.3333 * (aw - ax + ay)); //RL
+		*p_buf++ = (float)(0.3333 * (aw - ax - ay));  //RR
+	}
+}
+
+
+/* handle 3ch in to 4ch out! */
+
+void bfdcode324(float *inbuf,float*outbuf,long numframes)
+{
+	int i;	
+	float *p_buf = inbuf;
+	float * p_outbuf = outbuf;
+	double aw,ax,ay;
+	
+	for(i=0;i < numframes; i++){
+		int j;
+		aw = (double)(*p_buf++) ;
+		ax = (double)(*p_buf++) * 0.707;
+		ay = (double)(*p_buf++) * 0.707;
+        
+		//decode frame
+		*p_outbuf++ = (float)(0.3333 * (aw + ax + ay));
+		*p_outbuf++ = (float)(0.3333 * (aw + ax - ay));
+		*p_outbuf++ = (float)(0.3333 * (aw - ax + ay));
+		*p_outbuf++ = (float)(0.3333 * (aw - ax - ay));
+	}
+}
+#endif

+ 1593 - 0
dev/externals/paprogs/paplay/paplay.c

@@ -0,0 +1,1593 @@
+/*
+ * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
+ * http://people.bath.ac.uk/masrwd
+ * http://www.composersdesktop.com
+ * This file is part of the CDP System.
+ * The CDP System 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.
+ *
+ * The CDP System 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 the CDP System; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* paplay.c
+ * Play a soundfile using the Portable Audio api for Max OS X using Core Audio.
+ *
+ • new version using threads and ring buffer, with thanks to Robert Bielik
+*/
+
+/* Dec 2005 support 3ch B-Format, b-format files via portsf */
+/* OCT 2009 much revised, extended b-format decoding options */
+/*     set ch mask to zero on Windows mme/ds.
+       TODO: decide whether/how to enable user to pass chmask of file to driver!
+*/
+/* Apr 2011 build with new portaudio stable v 19 */
+/* July 2012 added "to" option, memory playback mode */
+/* August 2012  restored -x flag */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <assert.h>
+#include <time.h>
+
+#ifdef _WIN32
+#define _WIN32_WINNT 0x0500
+#include <conio.h>
+#include <windows.h>
+#include <process.h>
+// NB: need to have PAWIN_USE_WDMKS_DEVICE_INFO defined
+#include "pa_win_ds.h"
+#endif
+
+#ifdef unix
+
+#include <sys/types.h>
+#include <sys/timeb.h>
+#endif
+
+#include <signal.h>
+
+#ifdef unix
+#include <aaio.h>
+#endif
+
+#ifdef MAC
+#include <libkern/OSAtomic.h>
+#endif
+
+#ifdef unix
+#include <sys/time.h>
+#include <pthread.h>
+/* in portsf.lib */
+extern int stricmp(const char *a, const char *b);
+#endif
+
+#include "portaudio.h"
+#include "pa_ringbuffer.h"
+#include "pa_util.h"
+#include "portsf.h"
+#include "fmdcode.h"
+
+
+
+#ifndef min
+#define min(x,y)  ((x) < (y) ? (x) : (y))
+#endif
+
+// TODO: scale by sample rate
+
+
+#define FRAMES_PER_BUFFER (4096)
+#define RINGBUF_NFRAMES    (32768)
+#define NUM_WRITES_PER_BUFFER   (4)
+
+
+enum {FM_MONO,FM_STEREO,FM_SQUARE,FM_QUAD,FM_PENT,DM_5_0,DM_5_1,FM_HEX,FM_OCT1,FM_OCT2,FM_CUBE,FM_QUADCUBE,FM_NLAYOUTS};
+
+#ifdef _WIN32
+HANDLE ghEvent;
+#endif
+
+
+typedef struct {
+    PaUtilRingBuffer ringbuf;
+    PaStream *stream;
+    PaTime startTime;
+    PaTime lastTime;
+    float *ringbufData;
+    float *inbuf;   //for decoding and other tx; used as temp working buffer for read thread func.
+    /* for memory read func */
+    float *membuf;
+    float** orderptr; // for chan mapping;
+#ifdef _WIN32
+    void *hThread;
+    HANDLE hTimer;
+    HANDLE hTimerCount;
+#else
+#ifdef unix
+    pthread_t hThread;
+#endif
+#endif
+    fmhdecodefunc decodefunc;
+    fmhcopyfunc copyfunc;
+    double gain;
+    unsigned long frames_played;
+    unsigned long current_frame;
+    unsigned long from_frame;
+    unsigned long to_frame;
+    unsigned long memFramelength;
+    unsigned long memFramePos;
+    unsigned long inbuflen;
+    int srate;
+    int inchans;
+    int outchans;
+    int flag;
+    int ifd;
+#ifdef DEBUG
+    int ofd;
+#endif
+    int do_decode;
+    int do_mapping;
+    int play_looped;
+    int finished;
+} psfdata;
+
+static int file_playing;
+static psfdata *g_pdata = NULL;  // for timer interrupt routine
+
+void playhandler(int sig)
+{
+    if(sig == SIGINT)
+        file_playing = 0;
+}
+
+
+#ifdef unix
+void alarm_wakeup (int i)
+{
+    struct itimerval tout_val;
+
+    signal(SIGALRM,alarm_wakeup);
+
+
+    if(file_playing && g_pdata->stream) {
+        //printf("%.4f secs\r",(float)(g_pdata->frames_played /(double) g_pdata->srate));
+        g_pdata->lastTime = Pa_GetStreamTime(g_pdata->stream ) - g_pdata->startTime;
+        printf("%.2f secs\r", g_pdata->lastTime);
+        fflush(stdout);
+    }
+    tout_val.it_interval.tv_sec = 0;
+    tout_val.it_interval.tv_usec = 0;
+    tout_val.it_value.tv_sec = 0;
+    tout_val.it_value.tv_usec = 200000;
+
+    setitimer(ITIMER_REAL, &tout_val,0);
+
+}
+#endif
+
+
+void finishedCallback(void *userData)
+{
+    psfdata *pdata = (psfdata*) userData;
+    //    printf("stream finished!\n");
+    pdata->finished = 1;
+    file_playing = 0;
+
+
+}
+
+
+#ifdef _WIN32
+
+VOID CALLBACK TimerCallback(PVOID lpParam, BOOLEAN TimerOrWaitFired)
+{
+    psfdata *pdata = (psfdata*) lpParam;
+
+    if(file_playing && pdata->stream) {
+        //printf("%.4f secs\r",(float)(g_pdata->frames_played /(double) g_pdata->srate));
+        pdata->lastTime = Pa_GetStreamTime(pdata->stream ) - pdata->startTime;
+        printf("%.2f secs\r", pdata->lastTime);
+        fflush(stdout);
+    }
+
+    SetEvent(ghEvent);
+}
+
+#endif
+/* thread func for file playback */
+/* writes decoded data to ring buffer */
+/* size of element is full m/c frame */
+
+// TODO: unix thread should return void*
+#ifdef unix
+static  int  threadFunctionReadFromRawFile(void* ptr)
+#else
+    static unsigned int __stdcall threadFunctionReadFromRawFile(void* ptr)
+#endif
+{
+    psfdata* pdata = (psfdata*)ptr;
+
+    /* Mark thread started */
+    pdata->flag = 0;
+
+    while (1) {
+        ring_buffer_size_t nElementsProcessed = 0;
+        ring_buffer_size_t elementsInBuffer = PaUtil_GetRingBufferWriteAvailable(&pdata->ringbuf);
+
+        //memset(pdata->inbuf,0,pdata->inbuflen * sizeof(float) * pdata->inchans);
+
+        if (elementsInBuffer >= pdata->ringbuf.bufferSize / 4) {
+            void* ptr[2] = {NULL};
+            ring_buffer_size_t sizes[2] = {0};
+
+            /* By using PaUtil_GetRingBufferWriteRegions, we can write directly into the ring buffer */
+            PaUtil_GetRingBufferWriteRegions(&pdata->ringbuf, elementsInBuffer, &ptr[0], &sizes[0], &ptr[1], &sizes[1]);
+
+            if (file_playing)  {
+                ring_buffer_size_t itemsReadFromFile;
+                int i,j;
+                int framesread = 0;
+                // we work with frames, = constant across inchans and outchans
+                itemsReadFromFile = 0;
+                for(i = 0; i < 2 && (ptr[i] != NULL); i++) {
+                    // NB ringbuf is sized by m/c frames
+                    int frameswanted = sizes[i];
+
+                    pdata->current_frame = psf_sndTell(pdata->ifd);
+                    // read up to end frame if requested
+                    if(pdata->to_frame < pdata->current_frame + frameswanted)
+                        frameswanted = pdata->to_frame - pdata->current_frame;
+
+                    if(frameswanted > 0){
+                        framesread = psf_sndReadFloatFrames(pdata->ifd,pdata->inbuf,frameswanted);
+                        if(framesread < 0){ // read error!
+                            printf("Error reading soundfile\n");
+                            pdata->flag = 1;
+                            file_playing = 0;
+                            break;  // just out of for loop - need to return instead?
+                        }
+                    }
+                    if(framesread == 0){
+                        /* EOF. EITHER: finish, or rewind if looping playback*/
+                        if(pdata->play_looped){
+                            if(psf_sndSeek(pdata->ifd,pdata->from_frame,PSF_SEEK_SET)){
+                                printf("Error looping soundfile\n");
+                                pdata->flag = 1;
+                                file_playing = 0;
+                                break;
+                            }
+                            // sizes[1] especially may well = 0
+                            if(frameswanted==0)
+                                break;
+                            framesread = psf_sndReadFloatFrames(pdata->ifd,pdata->inbuf,frameswanted);
+                            if(framesread < 0){ // read error!
+                                printf("Error reading soundfile\n");
+                                pdata->flag = 1;
+                                file_playing = 0;
+                                break;
+                            }
+                        }
+                        else {
+                            // we must watch the ring buffer to make sure all data has been rendered,
+                            // over several callback blocks
+                            //printf("End of data. playing = %d:\n", file_playing);
+                            //printf("\telements remaining = %d\n",elementsInBuffer);
+                            if(elementsInBuffer == pdata->ringbuf.bufferSize)  {
+                                pdata->flag = 1;
+                                break;
+                                //return 0;
+                            }
+                        }
+                    }
+                    else {
+                        // ringbuf calcs always relative to outchans
+                        itemsReadFromFile += framesread;
+
+                        // now ready to apply decoding or other processing
+
+                        if(pdata->gain != 1.0){
+                            for(j = 0; j < framesread * pdata->inchans; j++)
+                                pdata->inbuf[j]  = (float)(pdata->inbuf[j] * pdata->gain);
+                        }
+                        if(pdata->do_mapping) {
+                            int k;
+                            float val;
+                            float *buf = ptr[i];
+                            float *pchan;
+                            for(j=0; j < framesread; j++){
+                                for(k=0; k < pdata->outchans; k++){
+                                    pchan = pdata->orderptr[k];
+                                    if(pchan == NULL)
+                                        val = 0.0f;
+                                    else
+                                        val = *(pchan + j * pdata->inchans);
+                                    buf[j*pdata->outchans + k] = val;
+                                }
+                            }
+                        }
+                        else if(pdata->do_decode) {
+                            ABFSAMPLE abfsamp;
+
+                            for(j=0; j < framesread; j++){
+                                // single frame only
+                                pdata->copyfunc(&abfsamp,pdata->inbuf + (j * pdata->inchans));
+                                /* BIG TODO: update funcs to process large frame buffer! */
+                                /* NB: ring buffer is effectively defined as raw bytes */
+#ifdef unix
+                                pdata->decodefunc(&abfsamp,ptr[i] + (j * pdata->outchans * sizeof(float)), 1);
+#else
+                                // suppress VC++ complaint of unknown size
+                                pdata->decodefunc(&abfsamp, (float*)(ptr[i]) + (j * pdata->outchans), 1);
+
+#endif
+                                nElementsProcessed++;
+                            }
+                        }
+                        else {  // inchans = outchans
+                            memcpy(ptr[i],pdata->inbuf,framesread * sizeof(float) * pdata->inchans);
+                            nElementsProcessed += framesread;
+                        }
+                    }
+                }
+                //                assert(nElementsProcessed == itemsReadFromFile);
+                if(framesread)
+                    PaUtil_AdvanceRingBufferWriteIndex(&pdata->ringbuf, itemsReadFromFile);
+
+
+            }
+            else {
+                // this code is activated on Ctrl-C. Can do immediate finish by setting flag
+                //               printf("file done\n");
+                pdata->flag = 1;
+                break;
+            }
+        }
+        //  else {
+        //      printf("ringbuf size = %d, elements remaining = %d, playing = %d\n",pdata->ringbuf.bufferSize,elementsInBuffer,file_playing);
+        //  }
+
+        /* Sleep a little while... */
+        Pa_Sleep(10);
+    }
+    return 0;
+}
+
+
+
+#ifdef unix
+// TODO: unix return type should be void*
+typedef int (*threadfunc)(void*);
+#endif
+#ifdef _WIN32
+typedef unsigned int (__stdcall *threadfunc)(void*);
+#endif
+
+
+/* Start up a new thread for given function */
+static PaError startThread( psfdata* pdata, threadfunc fn )
+{
+    pdata->flag = 1;
+#ifdef _WIN32
+    pdata->hThread = (void*)_beginthreadex(NULL, 0, fn, pdata, 0, NULL);
+    if (pdata->hThread == NULL)
+        return paUnanticipatedHostError;
+    /* Wait for thread to startup */
+    while (pdata->flag) {
+        Pa_Sleep(10);
+    }
+    /* Set file thread to a little higher prio than normal */
+    SetThreadPriority(pdata->hThread, THREAD_PRIORITY_ABOVE_NORMAL);
+#else
+
+#if defined(__APPLE__) || defined(__GNUC__)
+    if(pthread_create(&pdata->hThread,NULL,(void*) fn,pdata))
+        return -1;
+    /* Wait for thread to startup */
+    while (pdata->flag) {
+        Pa_Sleep(10);
+    }
+#endif
+#endif
+
+    return paNoError;
+}
+
+#if 0
+static int stopThread( psfdata* pdata )
+{
+    // RWD: just called when all data played; must be called before StopStream
+    //   pdata->flag = 1;
+    /* Wait for thread to stop */
+    //   while (pdata->flag) {
+    //       Pa_Sleep(10);
+    //   }
+#ifdef _WIN32
+    CloseHandle(pdata->hThread);
+    pdata->hThread = 0;
+#else
+
+#if defined(__APPLE__) || defined(__GNUC__)
+    pthread_cancel(pdata->hThread);
+#endif
+#endif
+    return paNoError;
+}
+#endif
+
+static int paplayCallback(const void *inputBuffer, void *outputBuffer,
+                          unsigned long framesPerBuffer,
+                          const PaStreamCallbackTimeInfo* timeInfo,
+                          PaStreamCallbackFlags statusFlags,
+                          void *userData )
+{
+    psfdata *data = (psfdata *)userData;
+    ring_buffer_size_t sampsAvailable = PaUtil_GetRingBufferReadAvailable(&data->ringbuf) * data->outchans;
+    ring_buffer_size_t sampsToPlay = min(sampsAvailable, (ring_buffer_size_t)(framesPerBuffer * data->outchans));
+    float *out = (float*) outputBuffer;
+    int framesToPlay = sampsToPlay/data->outchans;
+    int played;
+    /* outbuf may be NULL on initial startup */
+    if(out == NULL)
+        return paContinue;
+
+    // if framestoplay < framesPerBuffer, need to clean up the remainder
+    memset(out,0,framesPerBuffer * data->outchans * sizeof(float));
+    played = PaUtil_ReadRingBuffer(&data->ringbuf, out, framesToPlay);
+
+    data->frames_played += played;
+    if(data->flag) {
+        //printf("callback - complete\n");
+        return paComplete;
+    }
+    return paContinue;
+}
+
+
+
+static int MemCallback(const    void *inputBuffer, void *outputBuffer,
+                       unsigned long framesPerBuffer,
+                       const PaStreamCallbackTimeInfo* timeInfo,
+                       PaStreamCallbackFlags statusFlags,
+                       void *userData )
+{
+    psfdata *pdata = (psfdata *)userData;
+
+    float *out = (float*) outputBuffer;
+    unsigned long inSamps,outSamps, inSampPos;
+    unsigned long i;
+    unsigned long framesToPlay = framesPerBuffer;
+
+    /* outbuf may be NULL on initial startup */
+    if(out == NULL)
+        return paContinue;
+
+    // if framesToPlay < framesPerBuffer, need to clean up the remainder
+    memset(out,0,framesPerBuffer * pdata->outchans * sizeof(float));
+    inSamps = pdata->memFramelength * pdata->inchans;
+    outSamps = framesPerBuffer * pdata->inchans;
+    inSampPos = pdata->memFramePos * pdata->inchans;
+
+    if(pdata->play_looped){
+        for(i=0;i < outSamps; i++){
+            pdata->inbuf[i] = pdata->membuf[inSampPos++] * pdata->gain;
+            if(inSampPos == inSamps)
+                inSampPos = 0;
+        }
+    }
+    else {
+        for(i=0;i < outSamps; i++){
+            pdata->inbuf[i] = pdata->membuf[inSampPos++] * pdata->gain;
+            if(inSampPos == inSamps)
+                break;
+        }
+        framesToPlay = i / pdata->inchans;
+        for(; i < outSamps;i++){
+            pdata->inbuf[i] = 0.0;
+        }
+
+    }
+    // write to output
+    // everything now in inbuf
+    if(pdata->do_decode) {
+        ABFSAMPLE abfsamp;
+        int j;
+        for(j=0; j < framesToPlay; j++){
+            pdata->copyfunc(&abfsamp,pdata->inbuf + (j * pdata->inchans));
+            pdata->decodefunc(&abfsamp,out + (j * pdata->outchans), 1);
+        }
+    }
+    else {  // inchans = outchans
+        memcpy(out,pdata->inbuf,framesToPlay * sizeof(float) * pdata->inchans);
+    }
+    pdata->memFramePos = inSampPos / pdata->inchans;
+    pdata->frames_played += framesToPlay;
+    if(framesToPlay < framesPerBuffer)
+        pdata->flag = 1;           // end of stream
+    if(pdata->flag) {
+        //printf("\nnewcallback - complete\n");
+        //fflush(stdout);
+        return paComplete;
+    }
+    return paContinue;
+}
+
+
+
+
+static unsigned NextPowerOf2(unsigned val)
+{
+    val--;
+    val = (val >> 1) | val;
+    val = (val >> 2) | val;
+    val = (val >> 4) | val;
+    val = (val >> 8) | val;
+    val = (val >> 16) | val;
+    return ++val;
+}
+
+
+int show_devices(void);
+
+#define N_BFORMATS (10)
+//static const int bformats[N_BFORMATS] = {2,3,4,5,6,7,8,9,11,16};
+//static const int layout_chans[] = {1,2,4,4,5,5,6,6,8,8,8,8};
+
+enum {FLAG_B = 0, FLAG_BM, FLAG_D, FLAG_G, FLAG_H, FLAG_I, FLAG_L, FLAG_M, FLAG_NFLAGS};
+
+
+void usage(void){
+#ifdef WIN32
+    printf("usage:\n  paplay [-BN][-dN][-gN]-hN][-i][-l][-b[N]|-m[S]][-u][-x] infile [from] [to] \n"
+#else
+           printf("usage:\n  paplay [-BN][-dN][-gN]-hN][-i][-l][-b[N]|-m[S]][-u] infile [from] [to]\n"
+#endif
+                  "       -dN  : use output Device N.\n"
+                  "       -gN  : apply gain factor N to input.\n"
+                  "       -BN  : set memory buffer size to N frames (default: %d).\n"
+                  "                N must be a power of 2 (e.g 4096, 8192, 16384 etc).\n"
+                  "       -hN  : set hardware blocksize to N frames (32 < N <= BN/4).\n"
+                  "               (N recommended to be a power of two size. Default: from soundcard).\n"
+                  "               Where set, buffer sizes are doubled internally for sample rates > 48KHz.\n"
+                  "       -i   : play immediately (do not wait for keypress).\n"
+                  "       -l   : loop file continuously, from start-time to end-time.\n"
+                  "       -m[S]: render using channel map string S.\n"
+                  "                Use -m without parameter for usage.\n"
+                  "       -u   : suppress elapsed time updates\n"
+#ifdef WIN32
+                  "       -x   : Apply WAVE_EX infile channel mask to DS audio stream\n"
+                  "              (ignored if -m or -b used)\n"
+#endif
+                  "       from : set start time (secs) for playback and looping. Default: 0.\n"
+                  "       to   : set end time (secs) for playback and looping. Default: EOF.\n"
+                  "       -b[N]: apply 1st-order B-Format decoding to standard soundfile.\n"
+                  "              (file must have at least 3 channels)\n"
+                  "               B-Format files (.amb) will be decoded automatically.\n"
+                  "               N sets speaker layout to one of the following:\n"
+                  "               1    :  *  mono (= W signal only)\n"
+                  "               2    :  *  stereo (quasi mid/side, = W +- Y)\n"
+                  "               3    :     square\n"
+                  "               4    :  *  quad FL,FR,RL,RR order   (default)\n"
+                  "               5    :     pentagon\n"
+                  "               6    :  *  5.0 surround (WAVEX order)\n"
+                  "               7    :  *  5.1 surround (WAVEX order, silent LFE)\n"
+                  "               8    :     hexagon\n"
+                  "               9    :     octagon 1 (front pair, 45deg)\n"
+                  "              10    :     octagon 2 (front centre speaker)\n"
+                  "              11    :     cube (as 3, low-high interleaved. Csound-compatible.)\n"
+                  "              12    :  *  cube (as 4, low quad followed by high quad).\n"
+                  "              Default decode layout is 4 (quad).\n"
+                  "              NB: no decoding is performed if -m flag used.\n"
+                  "paplay reads PEAK chunk if present to rescale over-range floatsam files.\n\n"
+                  ,RINGBUF_NFRAMES);
+           }
+
+        void mapusage(void)
+        {
+            printf( "  PAPLAY channel map mode -mS: Map arbitrary infile channels to output channels\n\n"
+                    "  Order string S = any combination of characters a-z inclusive.\n"
+                    "  Infile channels are mapped in order as a=1,b=2...z=26\n"
+                    "  (For example: channels in a 4-channel file are represented by the\n"
+                    "    characters abcd; any other character is an error).\n"
+                    "  Characters must be lower case, and may be used more than once.\n"
+                    "  Duplicate characters duplicate the corresponding input channel.\n"
+                    "  The zero character (0) may be used to set a silent channel.\n"
+                    "  A maximum of 26 channels is supported for both input and output.\n"
+                    "  The number of characters in S sets the number of output channels,\n"
+                    "    which must be supported by the selected device.\n"
+                    "  NB: -m cannot be combined with -b (B-Format decoding).\n"
+                    "  If channel mapping is used, a B-format file (AMB) \n"
+                    "    will be rendered without decoding.\n"
+                    );
+        }
+
+    /*******************************************************************/
+    int main(int argc,char **argv)
+    {
+        PaStreamParameters outputParameters;
+#ifdef _WIN32
+        /* portaudio sets default channel masks we can't use; we must do all this to set default mask = 0! */
+        PaWinDirectSoundStreamInfo directSoundStreamInfo;
+        //    PaWinMmeStreamInfo winmmeStreamInfo;
+
+#endif
+        PaDeviceInfo *devinfo = NULL;
+        PaStream *stream = NULL;
+        PaStreamCallback *playcallback = paplayCallback;
+        PaError err = paNoError;
+        psfdata sfdata;
+        PSF_CHPEAK *fpeaks = NULL;
+        PSF_PROPS props;
+        // ABFSAMPLE abfsample;
+        // ABFSAMPLE *abf_frame = NULL;
+        int res,inorder = 1;
+        time_t in_peaktime = 0;
+        MYLONG lpeaktime;
+        int waitkey = 1;
+        //int play_looped = 0;
+        double fromdur = 0.0;
+        double totime  = 0.0;
+        int ifd = -1,from_frame = 0, to_frame = 0;
+        unsigned int i=0;
+        PaDeviceIndex device;
+        long filesize;
+        //long framesize = 0;   // Apr 2010 to be scaled by sample rate
+        unsigned long ringframelen = RINGBUF_NFRAMES;  // length of ring buffer in m/c frames
+        unsigned long frames_per_buffer = 0;
+        unsigned long nFramesToPlay = 0;
+        double gain = 1.0;
+        unsigned int inchans,outchans;
+        int layout = 4; // default, quad decode */
+        fmhcopyfunc copyfunc = NULL;
+        fmhdecodefunc decodefunc = NULL;
+        // vars for chorder facilit
+        char* argstring = NULL;
+        unsigned int rootchar = 'a';
+        unsigned int maxchar = 'z';
+        unsigned int  nchars=0,nzeros = 0;
+        unsigned int max_inchar = 0;
+        unsigned int flags[FLAG_NFLAGS] = {0};
+#ifdef WIN32
+        int do_speakermask = 0;
+        int speakermask = 0;
+#endif
+        int do_updatemessages = 1;
+#ifdef unix
+        struct itimerval tout_val;
+        tout_val.it_interval.tv_sec = 0;
+        tout_val.it_interval.tv_usec = 0;
+        tout_val.it_value.tv_sec = 0;
+        tout_val.it_value.tv_usec = 200000;
+#endif
+
+#ifdef _WIN32
+        HANDLE hTimerQueue;
+        ghEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
+        if(ghEvent==NULL){
+            printf("Failed to start internal timer (1).\n");
+            return 1;
+        }
+        hTimerQueue = CreateTimerQueue();
+        if(hTimerQueue == NULL){
+            printf("Failed to start internal timer (2).\n");
+            return 1;
+        }
+#endif
+        /* CDP version number */
+        if(argc==2 && (stricmp(argv[1],"--version")==0)){
+            printf("3.0.1\n");
+            return 0;
+        }
+
+        signal(SIGINT,playhandler);
+
+        sfdata.inbuf = NULL;
+        sfdata.membuf = NULL;
+        sfdata.memFramelength = 0;
+        sfdata.memFramePos = 0;
+        sfdata.ringbufData = NULL;
+        sfdata.orderptr = NULL;
+        sfdata.do_mapping = 0;
+
+        printf("PAPLAY: play multi-channel soundfile. V3.0.1 (c)  RWD,CDP 2012, 2013\n");
+        file_playing = 0;
+        err = Pa_Initialize();
+        if( err != paNoError ) {
+            printf("Failed to initialize Portaudio.\n");
+            return 1;
+        }
+        device =  Pa_GetDefaultOutputDevice();
+
+        if(argc < 2){
+            usage();
+            show_devices();
+            Pa_Terminate();
+            return 1;
+        }
+
+        while(argv[1][0]=='-'){
+            unsigned long userbuflen;
+            switch(argv[1][1]){
+            case('b'):
+                if(flags[FLAG_B]){
+                    printf("error: multiple -b flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(argv[1][2] != '\0'){
+                    layout = atoi(&argv[1][2]);
+                    if(layout < 1 || layout > 12){
+                        fprintf(stderr,"value for -b flag out of range.\n");
+                        Pa_Terminate();
+                        return 1;
+                    }
+                }
+                flags[FLAG_B] = 1;
+                break;
+            case('d'):
+                if(flags[FLAG_D]){
+                    printf("error: multiple -d flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(argv[1][2]=='\0'){
+                    printf("-d flag requires parameter\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                device = atoi(&(argv[1][2]));
+                flags[FLAG_D] = 1;
+                break;
+            case('g'):
+                if(flags[FLAG_G]){
+                    printf("error: multiple -g flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(argv[1][2]=='\0'){
+                    printf("-g flag requires parameter\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                gain = atof(&(argv[1][2]));
+                if(gain <= 0.0){
+                    fprintf(stderr,"gain value must be positive.\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                flags[FLAG_G] = 1;
+                break;
+            case 'h':
+                if(flags[FLAG_H]){
+                    printf("error: multiple -h flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(argv[1][2]=='\0'){
+                    printf("-h flag requires parameter\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                frames_per_buffer = atoi(&(argv[1][2]));
+                if((frames_per_buffer > 0) && (frames_per_buffer < 32)){
+                    printf("-h value too small: must be at least 32.\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                flags[FLAG_H] = 1;
+                break;
+            case('i'):
+                if(flags[FLAG_I]){
+                    printf("error: multiple -i flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                flags[FLAG_I] = 1;
+                waitkey = 0;
+                break;
+            case ('l'):
+                flags[FLAG_L] = 1;
+                break;
+            case 'm':
+                if(flags[FLAG_M]){
+                    printf("error: multiple -m flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(argv[1][2]=='\0'){
+                    mapusage();
+                    Pa_Terminate();
+                    return 1;
+                }
+                argstring = &argv[1][2];
+                nchars = strlen(argstring);
+                if(nchars > 26) {
+                    printf("error: -m order list too long.\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(nchars < 1){
+                    printf("error: -m must specify at least one channel.\n");
+                    Pa_Terminate();
+                    return 1;
+
+                }
+                flags[FLAG_M] = 1;
+                break;
+
+                // RWD Feb 2011: need to support dummy -u flag for compatibility with pvplay
+                // will we actually need to implement it?
+            case 'u':
+                do_updatemessages = 0;
+                break;
+#ifdef WIN32
+            case 'x':
+                do_speakermask = 1;
+                break;
+#endif
+            case 'B':
+                if(flags[FLAG_BM]){
+                    printf("error: multiple -B flags\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                if(argv[1][2]=='\0'){
+                    printf("-B flag requires parameter\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+
+                ringframelen = atoi(&(argv[1][2]));
+                if(ringframelen <= 1024){
+                    printf("-B: framesize value must be >=1024!n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                userbuflen = NextPowerOf2(ringframelen);
+                if(userbuflen != ringframelen){
+                    printf("-B: framesize value must be power of 2 size\n");
+                    Pa_Terminate();
+                    return 1;
+                }
+                flags[FLAG_BM] = 1;
+                break;
+            default:
+                printf("unrecognised flag option\n");
+                Pa_Terminate();
+                return 1;
+            }
+            argv++;  argc--;
+        }
+        // this just cheks flag usage. We render amb files undecoded, if using channel mapping
+        if(flags[FLAG_B] && flags[FLAG_M]){
+            printf("Sorry: cannot use -m with -b\n");
+            Pa_Terminate();
+            return 1;
+        }
+        if(frames_per_buffer > ringframelen/4){
+            printf(" hardware (-h) framesize %lu too large for file buffer (-B) size %lu\n",
+                   frames_per_buffer,ringframelen);
+            Pa_Terminate();
+            return 1;
+        }
+
+        if(argc < 2 || argc > 4){
+            usage();
+            show_devices();
+            Pa_Terminate();
+            return 1;
+        }
+
+        if(argc>=3){
+            fromdur = atof(argv[2]);
+            if(fromdur < 0.0){
+                printf("Error: start position must be positive\n");
+                Pa_Terminate();
+                return 1;
+            }
+        }
+        if(argc==4){
+            totime = atof(argv[3]);
+            if(totime <= fromdur){
+                printf("Error: end time must be after from time\n");
+                Pa_Terminate();
+                return 1;
+            }
+
+
+        }
+        if(psf_init()){
+            printf("Error initializing psfsys\n");
+            goto error;
+        }
+        /* allow auto rescaling of overrange floats via PEAK chunk */
+        ifd = psf_sndOpen(argv[1],&props,1);
+        if(ifd < 0){
+            printf("unable to open soundfile %s\n",argv[1]);
+            goto error;
+        }
+        filesize = psf_sndSize(ifd);
+        if(filesize ==0){
+            printf("Soundfile is empty!\n");
+            goto error;
+        }
+
+#if WIN32
+        if(props.format == PSF_WAVE_EX){
+            if(do_speakermask){
+                if(flags[FLAG_B] || flags[FLAG_M]){
+                    printf("-x flag ignored if -B or -m used\n");
+                }
+                else {
+                    int mask = psf_speakermask(ifd);
+                    if(mask < 0){
+                        printf("could not read speaker mask. Using 0\n");
+                        speakermask = 0;
+                    }
+                    else
+                        speakermask = mask;
+                }
+            }
+        }
+#endif
+        from_frame = (long)(fromdur * props.srate);
+        if(from_frame >= filesize){
+            printf("Error: start is beyond end of file\n");
+            goto error;
+        }
+
+        nFramesToPlay = filesize - from_frame;
+        to_frame = filesize -1;
+        if(totime > 0.0){
+            to_frame = (long)(totime * props.srate);
+            if(to_frame >= filesize){
+                printf("Error: end time is beyond end of file\n");
+                goto error;
+            }
+            //printf("fromframe = %d, toframe = %d\n",(int)from_frame,(int) to_frame);
+            if(to_frame <= from_frame){
+                printf("end time must be later than from time\n");
+                goto error;
+            }
+            nFramesToPlay = to_frame - from_frame;
+            //printf("playing %d frames\n",(int) nFramesToPlay);
+        }
+
+        outchans = inchans = props.chans;
+        /* if using order string, outchans may change arbitrarily;
+           later on we set inchans to outchans,
+           to emulate a plain outchans-sized file
+        */
+        if(flags[FLAG_M]){
+            outchans = nchars;
+        }
+
+        if(props.chformat==MC_BFMT){
+            if(flags[FLAG_M]){
+                printf("-m specified: not decoding B-Format file.\n");
+                flags[FLAG_B] = 0;
+            }
+            else
+                flags[FLAG_B] = 1;
+        }
+
+        // we will not have both do_channel_mapping and do_decode toigether
+        if(flags[FLAG_B] == 1){
+            if(inchans > 4) {
+                inorder = 2;
+                printf("%u-channel input: performing 2nd-order decode.\n",inchans);
+            }
+            switch(inchans){
+            case 3:
+                copyfunc = fmhcopy_3;
+                break;
+            case 4:
+                copyfunc = fmhcopy_4;
+                break;
+            case 5:
+                copyfunc = fmhcopy_5;
+                break;
+            case 6:
+                copyfunc = fmhcopy_6;
+                break;
+            case 9:
+                copyfunc = fmhcopy_9;
+                break;
+            case 11:
+                copyfunc = fmhcopy_11;
+                break;
+            case 16:
+                copyfunc = fmhcopy_16;
+                break;
+            default:
+                fprintf(stderr,"unsupported channel count (%u) for B-format file.\n",inchans);
+                return 1;
+            }
+
+            switch(layout-1){
+            case FM_MONO:
+                printf("Decoding to Mono\n");
+                decodefunc = fm_i1_mono;
+                outchans = 1;
+                break;
+            case FM_STEREO:
+                printf("Decoding to Stereo\n");
+                decodefunc = fm_i1_stereo;
+                outchans = 2;
+                break;
+            case FM_SQUARE:
+                printf("Decoding to Square\n");
+                if(inorder == 1)
+                    decodefunc = fm_i1_square;
+                else
+                    decodefunc = fm_i2_square;
+                outchans = 4;
+                break;
+            case FM_PENT:
+                printf("Decoding to pentagon\n");
+                if(inorder==1)
+                    decodefunc = fm_i1_pent;
+                else
+                    decodefunc = fm_i2_pent;
+                outchans = 5;
+                break;
+            case DM_5_0:
+                printf("Decoding to 5.0 surround (David Moore)\n");
+                if(inorder==1)
+                    decodefunc = dm_i1_surr;
+                else
+                    decodefunc = dm_i2_surr;
+                outchans = 5;
+                break;
+            case DM_5_1:
+                printf("Decoding to  5.1 surround (David Moore)\n");
+                if(inorder==1)
+                    decodefunc = dm_i1_surr6;
+                else
+                    decodefunc = dm_i2_surr6;
+                outchans = 6;
+                break;
+            case FM_HEX:
+                printf("Decoding to Hexagon\n");
+                if(inorder==1)
+                    decodefunc = fm_i1_hex;
+                else
+                    decodefunc = fm_i2_hex;
+                outchans = 6;
+                break;
+            case FM_OCT1:
+                printf("Decoding to Octagon 1\n");
+                if(inorder==1)
+                    decodefunc = fm_i1_oct1;
+                else
+                    decodefunc = fm_i2_oct1;
+                outchans = 8;
+                break;
+            case FM_OCT2:
+                printf("Decoding to Octagon 2\n");
+                if(inorder==1)
+                    decodefunc = fm_i1_oct2;
+                else
+                    decodefunc = fm_i2_oct2;
+                outchans = 8;
+                break;
+            case FM_CUBE:
+                printf("Decoding to Cube (FM interleaved)\n");
+                if(inorder==1)
+                    decodefunc = fm_i1_cube;
+                else
+                    decodefunc = fm_i2_cube;
+                outchans = 8;
+                break;
+            case FM_QUADCUBE:
+                printf("Decoding to Octagon 1 (WAVEX order)\n");
+                if(inorder==1)
+                    decodefunc = fm_i1_cubex;
+                else
+                    decodefunc = fm_i2_cubex;
+                outchans = 8;
+                break;
+            default:
+                //quad
+                printf("Decoding to quad surround (WAVEX order)\n");
+                if(inorder == 1)
+                    decodefunc = fm_i1_quad;
+                else
+                    decodefunc = fm_i2_quad;
+                outchans = 4;
+                break;
+            }
+        }
+
+
+
+        printf("opened %s: %ld frames, %u channels\n",argv[1],filesize,inchans);
+        fpeaks = (PSF_CHPEAK *) calloc(inchans,sizeof(PSF_CHPEAK));
+        if(fpeaks==NULL){
+            puts("no memory for PEAK data\n");
+            goto error;
+        }
+        //lpeaktime = (int) in_peaktime;
+        res = psf_sndReadPeaks(ifd,fpeaks,(MYLONG *) &lpeaktime);
+        if(res==0) {
+            printf("no PEAK data in this soundfile\n");
+        }
+        else if(res < 0){
+            printf("Error reading PEAK data\n");
+            goto error;
+        }
+        else{
+            in_peaktime = (time_t) lpeaktime;
+            printf("PEAK data:\ncreation time: %s",ctime(&in_peaktime));
+
+            for(i=0;i < inchans;i++){
+                printf("CH %d: %.4f at frame %lu: \t%.4f secs\n",
+                       i,fpeaks[i].val,fpeaks[i].pos,(double)(fpeaks[i].pos / (double) props.srate));
+            }
+        }
+        // if doing channel map,  precompute into mem buffer
+        if(nFramesToPlay <= ringframelen){
+            sfdata.membuf =  (float *) PaUtil_AllocateMemory(nFramesToPlay * sizeof(float) * /*inchans*/ outchans);
+            if( sfdata.membuf == NULL )   {
+                puts("Could not allocate memory play buffer.\n");
+                goto error;
+            }
+            sfdata.memFramelength = nFramesToPlay;
+            sfdata.memFramePos = 0;
+            playcallback = MemCallback;
+            printf("RAM block size =  %lu\n",nFramesToPlay);
+
+        }
+        else {
+            // set up ring buffer  NB must be power of 2 size
+            if(props.srate > 48000)
+                ringframelen <<= 1;
+
+            // NB ring buffer sized for decoded data, hence outchans here; otherwise inchans = outchans
+            sfdata.ringbufData = (float *) PaUtil_AllocateMemory( ringframelen * sizeof(float) * outchans); /* From now on, recordedSamples is initialised. */
+            if( sfdata.ringbufData == NULL )   {
+                puts("Could not allocate play buffer.\n");
+                goto error;
+            }
+
+            // number of elements has to be a power of two, so each element has to be a full m/c frame
+            if (PaUtil_InitializeRingBuffer(&sfdata.ringbuf, sizeof(float) * outchans, ringframelen , sfdata.ringbufData) < 0) {
+                puts("Could not initialise play buffer.\n");
+                goto error;
+            }
+            printf("File buffer size = %ld\n",ringframelen);
+
+        }
+
+        // worst case, ring buffer is empty! So need enough space
+        // NB inchans may well be > outchans
+        sfdata.inbuf = (float *) PaUtil_AllocateMemory(ringframelen * sizeof(float) * inchans);
+        if(sfdata.inbuf==NULL){
+            puts("No memory for read buffer\n");
+            goto error;
+        }
+        sfdata.inbuflen = ringframelen;
+
+        if(flags[FLAG_M]) {
+            max_inchar = rootchar;
+
+            sfdata.orderptr = malloc(outchans * sizeof(float*));
+            for(i=0;i < nchars;i++){
+                unsigned int thischar = argstring[i];
+                //          printf("reading char %c (%d)\n",thischar,thischar);
+                unsigned int chindex;
+                if(thischar != '0' && (thischar < rootchar || thischar > maxchar)){
+                    printf("illegal character in order string: %c\n",thischar);
+                    goto error;
+                }
+                if(thischar =='0'){
+                    //            printf("setting channel %d to zero.\n",i);
+                    sfdata.orderptr[i] = NULL;
+                    nzeros++;
+                }
+                else{
+                    if(thischar > max_inchar)
+                        max_inchar = thischar;
+                    chindex = thischar - rootchar;
+                    sfdata.orderptr[i] = sfdata.inbuf + chindex;
+                }
+            }
+            if(nzeros==nchars)
+                printf("Warning: -m order string is all zeros - a silent file will be made!\n");
+            else{
+                /* count inclusively! */
+                if(props.chans < (int)(max_inchar - rootchar + 1)){
+                    printf("File has %d channels; order string defines non-existent channels.\n",props.chans);
+                    printf("For this file, maximum character is %c\n",rootchar + props.chans -1);
+                    goto error;
+                }
+            }
+            outchans = nchars;
+            sfdata.do_mapping = 1;
+
+            // final alloc when infile is read, below
+        }
+
+        if(props.srate > 48000) {
+            frames_per_buffer *= 2;
+            if(frames_per_buffer)
+                printf("Audio buffer size = %lu\n",frames_per_buffer);
+        }
+        sfdata.ifd          = ifd;
+        sfdata.inchans      = inchans;
+        sfdata.outchans     = outchans;
+        sfdata.frames_played  = 0;
+        sfdata.gain         = gain;
+        sfdata.copyfunc     = copyfunc;
+        sfdata.decodefunc   = decodefunc;
+        sfdata.do_decode    = flags[FLAG_B];
+        sfdata.from_frame   = from_frame;
+        if(to_frame > 0)
+            sfdata.to_frame = to_frame;
+        else {
+            sfdata.to_frame = 0;
+        }
+        sfdata.current_frame = 0;
+        sfdata.play_looped  = flags[FLAG_L];
+
+        sfdata.srate = props.srate;
+
+        sfdata.finished = 0;
+        g_pdata = &sfdata;
+
+#ifdef DEBUG
+        {
+            PSF_PROPS outprops = props;
+            outprops.chans = outchans;
+            sfdata.ofd = psf_sndCreate("debug.wav",&outprops,0,0,PSF_CREATE_RDWR);
+            if(sfdata.ofd == -1){
+                printf("Sorry - unable to create debug outfile\n");
+            }
+        }
+#endif
+
+        outputParameters.device = device;   /*Pa_GetDefaultOutputDevice(); */ /* default output device */
+        outputParameters.channelCount = outchans;
+        outputParameters.sampleFormat = paFloat32;             /* 32 bit floating point output */
+        outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+        outputParameters.hostApiSpecificStreamInfo = NULL;
+
+        devinfo = (PaDeviceInfo *) Pa_GetDeviceInfo(device);
+#if defined MAC || defined unix
+        if(devinfo){
+            printf("Using device %d: %s\n",device,devinfo->name);
+        }
+#endif
+
+#ifdef _WIN32
+
+#ifdef NOTDEF
+        if(devinfo){
+            if(apiinfo->type  == paMME ){
+                winmmeStreamInfo.size = sizeof(winmmeStreamInfo);
+                winmmeStreamInfo.hostApiType = paMME;
+                winmmeStreamInfo.version = 1;
+                winmmeStreamInfo.flags = paWinMmeUseChannelMask;
+                winmmeStreamInfo.channelMask = 0;
+                outputParameters.hostApiSpecificStreamInfo = &winmmeStreamInfo;
+# ifdef _DEBUG
+                printf("WIN DEBUG: WinMME device channel mask set to 0.\n");
+# endif
+            }
+        }
+#endif
+
+        if(devinfo) {
+            int apitype = devinfo->hostApi;
+            const PaHostApiInfo *apiinfo = Pa_GetHostApiInfo(apitype);
+            //  if(do_speakermask)
+            //      printf("Using file channel format %d\n",speakermask);
+            printf("Using device %d: %s ",device,devinfo->name);
+
+            if(apiinfo->type  == paDirectSound ){
+                printf("(DS)\n");
+                /* set this IF we are using Dsound device. */
+                directSoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
+                directSoundStreamInfo.hostApiType = paDirectSound;
+                directSoundStreamInfo.version = 2;
+                directSoundStreamInfo.flags = paWinDirectSoundUseChannelMask;
+                directSoundStreamInfo.channelMask = speakermask;
+                outputParameters.hostApiSpecificStreamInfo = &directSoundStreamInfo;
+            }
+            else if(apiinfo->type == paASIO)
+                printf("(ASIO)\n");
+            // else
+            //    printf("API unknown!);
+            else
+                printf("\n");
+        }
+#endif
+
+        err = Pa_OpenStream(
+                            &stream,
+                            NULL,  /* No input */
+                            &outputParameters, /* As above. */
+                            props.srate,
+                            frames_per_buffer,
+                            paClipOff,      /* we won't output out of range samples so don't bother clipping them */
+                            playcallback,
+                            &sfdata );
+
+
+
+        if( err != paNoError ) {
+            printf("Unable to open output device for %u-channel file.\n",outchans);
+            goto error;
+        }
+        err =  Pa_SetStreamFinishedCallback( stream, finishedCallback );
+        if( err != paNoError ) {
+            printf("Unable to set finish callback\n");
+            goto error;
+        }
+        sfdata.stream = stream;
+
+        file_playing = 1; // need this for c/l test below!
+
+        if(waitkey){
+            printf("Press any key to start:\n");
+            while (!kbhit()){
+                if(!file_playing)        //check for instant CTRL-C
+                    goto error;
+            };
+#ifdef _WIN32
+            if(kbhit())
+                _getch();                        //prevent display of char
+#endif
+        }
+
+        // should this go in read thread func too?
+        if(from_frame > 0){
+            if(psf_sndSeek(sfdata.ifd,from_frame,PSF_SEEK_SET))     {
+                printf("Error setting start position\n");
+                goto error;
+            }
+            sfdata.current_frame = from_frame;
+        }
+
+        /* if small block, read it all into memory
+         * if doing channel map, do it here rather in callback; we must set inchans to outchans */
+        if(sfdata.memFramelength > 0){
+            if(flags[FLAG_M]) {
+                unsigned int i,j;
+                int k;
+
+                float **orderptr = NULL;
+                float val;
+                float *tempframebuf = malloc(sizeof(float) * sfdata.memFramelength * props.chans);
+                nzeros = 0;
+                if(tempframebuf==NULL){
+                    puts("no memory for audio data\n");
+                    goto error;
+                }
+                orderptr = malloc(outchans * sizeof(float*));
+                for(i=0;i < nchars;i++){
+                    unsigned int thischar = argstring[i];
+                    unsigned int chindex;
+                    if(thischar != '0' && (thischar < rootchar || thischar > maxchar)){
+                        printf("illegal character in order string: %c\n",thischar);
+                        goto error;
+                    }
+                    if(thischar =='0'){
+                        orderptr[i] = NULL;
+                        nzeros++;
+                    }
+                    else{
+                        if(thischar > max_inchar)
+                            max_inchar = thischar;
+                        chindex = thischar - rootchar;
+                        orderptr[i] = tempframebuf + chindex;
+                    }
+                }
+                if(nzeros==nchars)
+                    printf("Warning: -m order string is all zeros - a silent file will be made!\n");
+                else {
+                    /* count inclusively! */
+                    if(props.chans < (int)(max_inchar - rootchar + 1)){
+                        printf("File has %d channels; order string defines non-existent channels.\n",props.chans);
+                        printf("For this file, maximum character is %c\n",rootchar + props.chans -1);
+                        goto error;
+                    }
+                }
+                if(psf_sndReadFloatFrames(sfdata.ifd,tempframebuf,sfdata.memFramelength) != sfdata.memFramelength) {
+                    printf("Error reading soundfile into memory\n");
+                    goto error;
+                }
+
+
+                for(j=0;j < sfdata.memFramelength; j++) {
+                    for(k = 0; k < sfdata.outchans; k++) {
+                        // find requested input chan
+                        float *pchan = orderptr[k];
+                        if(pchan == NULL)
+                            val = 0.0f;
+                        else
+                            val = *(pchan + j * props.chans);
+                        // and write to stream memory buffer
+                        sfdata.membuf[j * sfdata.outchans + k] = val;
+                    }
+                }
+                // done with these now
+                free(tempframebuf);
+                free(orderptr);
+                sfdata.inchans = sfdata.outchans;
+            }
+            else {  // no fancy stuff, just read straight into mem buffer
+                if(psf_sndReadFloatFrames(sfdata.ifd,sfdata.membuf,sfdata.memFramelength)
+                   != sfdata.memFramelength) {
+                    printf("Error reading soundfile into memory\n");
+                    goto error;
+                }
+            }
+        }
+
+        // set up timer
+#ifdef unix
+        if(do_updatemessages) {
+            setitimer(ITIMER_REAL, &tout_val,0);
+            signal(SIGALRM,alarm_wakeup); /* set the Alarm signal capture */
+        }
+#endif
+
+#ifdef _WIN32
+        // not sure of the best position for this
+        //if(!CreateTimerQueueTimer(&sfdata.hTimer, hTimerQueue,
+        //    (WAITORTIMERCALLBACK) TimerCallback, &sfdata,250,250,0)) {
+        //    printf("failed to start timer (3).\n");
+        //    return 1;
+        // }
+#endif
+        /* Start the file reading thread */
+        sfdata.startTime = Pa_GetStreamTime(stream );
+
+        if(sfdata.memFramelength == 0){
+
+            err = startThread(&sfdata, threadFunctionReadFromRawFile);
+            if( err != paNoError ) goto error;
+        }
+        else {
+            sfdata.flag = 0;
+        }
+
+
+#ifdef _WIN32
+        if(do_updatemessages){
+            if(!CreateTimerQueueTimer(&sfdata.hTimer, hTimerQueue,
+                                      (WAITORTIMERCALLBACK) TimerCallback, &sfdata,200,200,0)) {
+                printf("failed to start timer (3).\n");
+                return 1;
+            }
+        }
+#endif
+        err = Pa_StartStream( stream );
+        if( err != paNoError )
+            goto error;
+
+        printf("Hit CTRL-C to stop.\n");
+        while(!sfdata.finished && file_playing){
+            // nothing to do!
+            Pa_Sleep(10);
+        }
+        // note to programmer: any bug in audio buffer arithmetic will likely cause crash here!
+        err = Pa_StopStream( stream );
+        if( err != paNoError ) {
+            printf("Error stopping stream\n");
+            goto error;
+        }
+
+        /*  read thread should exit always, no need to Stop it here */
+
+
+        err = Pa_CloseStream( stream );
+        if( err != paNoError ) {
+            printf("Error closing stream\n");
+            goto error;
+        }
+        printf("\r%.2f secs\n",(float)(sfdata.lastTime));
+        fflush(stdout);
+        printf("Playback finished.\n");
+    error:
+        Pa_Terminate();
+
+#ifdef _WIN32
+        CloseHandle(ghEvent);
+        DeleteTimerQueue(hTimerQueue);
+#endif
+        if( sfdata.ringbufData )
+            PaUtil_FreeMemory(sfdata.ringbufData);
+        if(sfdata.inbuf)
+            PaUtil_FreeMemory(sfdata.inbuf);
+        if(sfdata.membuf)
+            PaUtil_FreeMemory(sfdata.membuf);
+        if(sfdata.orderptr)
+            free(sfdata.orderptr);
+        if(ifd >=0)
+            psf_sndClose(ifd);
+        if(fpeaks)
+            free(fpeaks);
+#ifdef DEBUG
+        if(sfdata.ofd >=0)
+            psf_sndClose(sfdata.ofd);
+#endif
+        psf_finish();
+
+        return 0;
+    }
+
+    int show_devices(void)
+    {
+        PaDeviceIndex numDevices,p;
+        const    PaDeviceInfo *pdi;
+#ifdef _WIN32
+        const PaHostApiInfo* api_info;
+        const char *apiname;
+#endif
+        PaError  err;
+        int nOutputDevices = 0;
+
+#ifdef USE_ASIO
+        printf("For ASIO multi-channel, you may need to select the highest device no.\n");
+#endif
+        /*Pa_Initialize();*/
+        numDevices =  Pa_GetDeviceCount();
+        if( numDevices < 0 )
+            {
+                printf("ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
+                err = numDevices;
+                return err;
+            }
+#ifdef WIN32
+        printf("Driver\tDevice\tInput\tOutput\tName\n");
+#else
+        printf("Device\tInput\tOutput\tName\n");
+#endif
+        //printf("Number of devices = %d\n", numDevices );
+        for( p = 0; p < numDevices; p++ )
+            {
+                pdi = Pa_GetDeviceInfo( p );
+
+                //#ifdef _WIN32
+                //                      /*RWD: skip, info on inputs */
+                //                      if(pdi->maxOutputChannels == 0)
+                //                              continue;
+                //#endif
+                nOutputDevices++;
+
+                if( p == Pa_GetDefaultOutputDevice() )
+                    printf("*");
+                else
+                    printf(" ");
+#ifdef WIN32
+                api_info = Pa_GetHostApiInfo(pdi->hostApi);
+                apiname = api_info->name;
+                if(strcmp(apiname,"Windows DirectSound")==0)
+                    apiname = "DS ";
+                printf("(%s)\t%d\t%d\t%d\t%s\n",apiname,p,
+                       pdi->maxInputChannels,
+                       pdi->maxOutputChannels,
+                       pdi->name);
+#else
+                printf("%d\t%d\t%d\t%s\n",p,
+                       pdi->maxInputChannels,
+                       pdi->maxOutputChannels,
+                       pdi->name);
+
+
+#endif
+            }
+        /*Pa_Terminate();*/
+        return 0;
+    }

+ 349 - 0
dev/externals/paprogs/portaudio/CMakeLists.txt

@@ -0,0 +1,349 @@
+!# $Id: $
+#
+# For a "How-To" please refer to the Portaudio documentation at:
+# http://www.portaudio.com/trac/wiki/TutorialDir/Compile/CMake
+#
+PROJECT( portaudio )
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF)
+IF(CMAKE_CL_64)
+SET(TARGET_POSTFIX x64)
+IF(PA_CONFIG_LIB_OUTPUT_PATH)
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/x64)
+ENDIF(PA_CONFIG_LIB_OUTPUT_PATH)
+ELSE(CMAKE_CL_64)
+SET(TARGET_POSTFIX x86)
+IF(PA_CONFIG_LIB_OUTPUT_PATH)
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32)
+ENDIF(PA_CONFIG_LIB_OUTPUT_PATH)
+ENDIF(CMAKE_CL_64)
+
+OPTION(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF)
+IF(PA_ENABLE_DEBUG_OUTPUT)
+ADD_DEFINITIONS(-DPA_ENABLE_DEBUG_OUTPUT)
+ENDIF(PA_ENABLE_DEBUG_OUTPUT)
+
+IF(WIN32 AND MSVC)
+OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON)
+IF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
+  FOREACH(flag_var
+		CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+		CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+		CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+		CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+    IF(${flag_var} MATCHES "/MD")
+      STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+    ENDIF(${flag_var} MATCHES "/MD")
+  ENDFOREACH(flag_var)
+ENDIF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
+
+ENDIF(WIN32 AND MSVC)
+
+IF(WIN32)
+OPTION(PA_UNICODE_BUILD "Enable Portaudio Unicode build" ON)
+
+SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_support)
+# Try to find DirectX SDK
+FIND_PACKAGE(DXSDK)
+# Try to find ASIO SDK (assumes that portaudio and asiosdk folders are side-by-side, see
+# http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC)
+FIND_PACKAGE(ASIOSDK)
+
+IF(ASIOSDK_FOUND)
+OPTION(PA_USE_ASIO "Enable support for ASIO" ON)
+ELSE(ASIOSDK_FOUND)
+OPTION(PA_USE_ASIO "Enable support for ASIO" OFF)
+ENDIF(ASIOSDK_FOUND)
+IF(DXSDK_FOUND)
+OPTION(PA_USE_DS "Enable support for DirectSound" ON)
+ELSE(DXSDK_FOUND)
+OPTION(PA_USE_DS "Enable support for DirectSound" OFF)
+ENDIF(DXSDK_FOUND)
+OPTION(PA_USE_WMME "Enable support for MME" ON)
+OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON)
+OPTION(PA_USE_WDMKS "Enable support for WDMKS" ON)
+OPTION(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON)
+MARK_AS_ADVANCED(PA_USE_WDMKS_DEVICE_INFO)
+IF(PA_USE_DS)
+OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON)
+MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+ENDIF(PA_USE_DS)
+ENDIF(WIN32)
+
+# Set variables for DEF file expansion
+IF(NOT PA_USE_ASIO)
+SET(DEF_EXCLUDE_ASIO_SYMBOLS ";")
+ENDIF(NOT PA_USE_ASIO)
+
+IF(NOT PA_USE_WASAPI)
+SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";")
+ENDIF(NOT PA_USE_WASAPI)
+
+IF(PA_USE_WDMKS_DEVICE_INFO)
+ADD_DEFINITIONS(-DPAWIN_USE_WDMKS_DEVICE_INFO)
+ENDIF(PA_USE_WDMKS_DEVICE_INFO)
+
+IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+ADD_DEFINITIONS(-DPAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+ENDIF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+
+#######################################
+IF(WIN32)
+INCLUDE_DIRECTORIES(src/os/win)
+ENDIF(WIN32)
+
+IF(PA_USE_ASIO)
+INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/common)
+INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host)
+INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host/pc)
+
+SET(PA_ASIO_INCLUDES
+  include/pa_asio.h
+)  
+
+SET(PA_ASIO_SOURCES 
+  src/hostapi/asio/pa_asio.cpp
+)  
+
+SET(PA_ASIOSDK_SOURCES
+  ${ASIOSDK_ROOT_DIR}/common/asio.cpp
+  ${ASIOSDK_ROOT_DIR}/host/pc/asiolist.cpp
+  ${ASIOSDK_ROOT_DIR}/host/asiodrivers.cpp
+)
+
+SOURCE_GROUP("hostapi\\ASIO" FILES
+  ${PA_ASIO_SOURCES}
+)
+
+SOURCE_GROUP("hostapi\\ASIO\\ASIOSDK" FILES
+  ${PA_ASIOSDK_SOURCES}
+)
+ENDIF(PA_USE_ASIO)
+
+IF(PA_USE_DS)
+INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(src/os/win)
+
+SET(PA_DS_INCLUDES
+  include/pa_win_ds.h
+  src/hostapi/dsound/pa_win_ds_dynlink.h
+)
+
+SET(PA_DS_SOURCES
+  src/hostapi/dsound/pa_win_ds.c
+  src/hostapi/dsound/pa_win_ds_dynlink.c
+)
+
+SOURCE_GROUP("hostapi\\dsound" FILES
+  ${PA_DS_INCLUDES}
+  ${PA_DS_SOURCES}
+)
+ENDIF(PA_USE_DS)
+
+IF(PA_USE_WMME)
+
+SET(PA_WMME_INCLUDES
+  include/pa_win_wmme.h
+)
+
+SET(PA_WMME_SOURCES
+  src/hostapi/wmme/pa_win_wmme.c
+)
+
+SOURCE_GROUP("hostapi\\wmme" FILES
+  ${PA_WMME_SOURCES}
+)
+ENDIF(PA_USE_WMME)
+
+IF(PA_USE_WASAPI)
+
+SET(PA_WASAPI_INCLUDES
+  include/pa_win_wasapi.h
+)
+
+SET(PA_WASAPI_SOURCES
+  src/hostapi/wasapi/pa_win_wasapi.c
+)
+
+SOURCE_GROUP("hostapi\\wasapi" FILES
+  ${PA_WASAPI_SOURCES}
+)
+ENDIF(PA_USE_WASAPI)
+
+IF(PA_USE_WDMKS)
+
+SET(PA_WDMKS_INCLUDES
+  include/pa_win_wdmks.h
+)
+
+SET(PA_WDMKS_SOURCES
+  src/hostapi/wdmks/pa_win_wdmks.c
+)
+
+SOURCE_GROUP("hostapi\\wdmks" FILES
+  ${PA_WDMKS_SOURCES}
+)
+ENDIF(PA_USE_WDMKS)
+
+SET(PA_SKELETON_SOURCES
+  src/hostapi/skeleton/pa_hostapi_skeleton.c
+)
+
+SOURCE_GROUP("hostapi\\skeleton" 
+  ${PA_SKELETON_SOURCES})
+
+#######################################
+IF(WIN32)
+SET(PA_INCLUDES 
+  include/portaudio.h
+  ${PA_ASIO_INCLUDES}
+  ${PA_DS_INCLUDES}
+  ${PA_WMME_INCLUDES}
+  ${PA_WASAPI_INCLUDES}
+  ${PA_WDMKS_INCLUDES}
+)
+ENDIF(WIN32)
+
+SOURCE_GROUP("include" FILES
+  ${PA_INCLUDES}
+)
+
+SET(PA_COMMON_INCLUDES
+  src/common/pa_allocation.h
+  src/common/pa_converters.h
+  src/common/pa_cpuload.h
+  src/common/pa_debugprint.h
+  src/common/pa_dither.h
+  src/common/pa_endianness.h
+  src/common/pa_hostapi.h
+  src/common/pa_memorybarrier.h
+  src/common/pa_process.h
+  src/common/pa_ringbuffer.h
+  src/common/pa_stream.h
+  src/common/pa_trace.h
+  src/common/pa_types.h
+  src/common/pa_util.h
+)
+
+SET(PA_COMMON_SOURCES
+  src/common/pa_allocation.c
+  src/common/pa_converters.c
+  src/common/pa_cpuload.c
+  src/common/pa_debugprint.c
+  src/common/pa_dither.c
+  src/common/pa_front.c
+  src/common/pa_process.c
+  src/common/pa_ringbuffer.c
+  src/common/pa_stream.c
+  src/common/pa_trace.c
+)
+
+SOURCE_GROUP("common" FILES
+  ${PA_COMMON_INCLUDES}
+  ${PA_COMMON_SOURCES}
+)
+
+SOURCE_GROUP("cmake_generated" FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def
+  ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
+)
+
+IF(WIN32)
+SET(PA_PLATFORM_SOURCES 
+  src/os/win/pa_win_hostapis.c
+  src/os/win/pa_win_util.c
+  src/os/win/pa_win_waveformat.c
+  src/os/win/pa_win_wdmks_utils.c
+  src/os/win/pa_win_coinitialize.c
+  src/os/win/pa_x86_plain_converters.c
+)
+
+SOURCE_GROUP("os\\win" FILES
+  ${PA_PLATFORM_SOURCES}
+)
+ENDIF(WIN32)
+
+INCLUDE_DIRECTORIES( include )
+INCLUDE_DIRECTORIES( src/common )
+
+IF(WIN32 AND MSVC)
+ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
+ENDIF(WIN32 AND MSVC)
+
+ADD_DEFINITIONS(-DPORTAUDIO_CMAKE_GENERATED)
+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
+
+SET(SOURCES_LESS_ASIO_SDK
+  ${PA_COMMON_SOURCES}
+  ${PA_ASIO_SOURCES}
+  ${PA_DS_SOURCES}
+  ${PA_WMME_SOURCES}
+  ${PA_WASAPI_SOURCES}
+  ${PA_WDMKS_SOURCES}
+  ${PA_SKELETON_SOURCES}
+  ${PA_PLATFORM_SOURCES}
+)
+
+IF(PA_UNICODE_BUILD)
+SET_SOURCE_FILES_PROPERTIES(
+  ${SOURCES_LESS_ASIO_SDK}
+  PROPERTIES
+  COMPILE_DEFINITIONS "UNICODE;_UNICODE"
+)
+ENDIF(PA_UNICODE_BUILD)
+
+ADD_LIBRARY(portaudio SHARED
+  ${PA_INCLUDES}
+  ${PA_COMMON_INCLUDES}
+  ${SOURCES_LESS_ASIO_SDK}
+  ${PA_ASIOSDK_SOURCES}
+  ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def
+  ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
+)
+
+ADD_LIBRARY(portaudio_static STATIC
+  ${PA_INCLUDES}
+  ${PA_COMMON_INCLUDES}
+  ${SOURCES_LESS_ASIO_SDK}
+  ${PA_ASIOSDK_SOURCES}
+  ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
+)
+
+# Configure the exports file according to settings
+SET(GENERATED_MESSAGE "CMake generated file, do NOT edit! Use CMake-GUI to change configuration instead.")
+CONFIGURE_FILE( cmake_support/template_portaudio.def ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def @ONLY )
+# Configure header for options (PA_USE_xxx)
+CONFIGURE_FILE( cmake_support/options_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h @ONLY )
+
+IF(WIN32)
+# If we use DirectSound, we need this for the library to be found (if not in VS project settings)
+IF(PA_USE_DS AND DXSDK_FOUND)
+TARGET_LINK_LIBRARIES(portaudio ${DXSDK_DSOUND_LIBRARY})
+ENDIF(PA_USE_DS AND DXSDK_FOUND)
+
+# If we use WDM/KS we need setupapi.lib
+IF(PA_USE_WDMKS)
+TARGET_LINK_LIBRARIES(portaudio setupapi)
+ENDIF(PA_USE_WDMKS)
+
+SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX})
+SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX})
+ENDIF(WIN32)
+
+OPTION(PA_BUILD_TESTS "Include test projects" OFF)
+OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF)
+
+# Prepared for inclusion of test files
+IF(PA_BUILD_TESTS)
+SUBDIRS(test)
+ENDIF(PA_BUILD_TESTS)
+
+# Prepared for inclusion of test files
+IF(PA_BUILD_EXAMPLES)
+SUBDIRS(examples)
+ENDIF(PA_BUILD_EXAMPLES)
+
+#################################
+

+ 240 - 0
dev/externals/paprogs/portaudio/Doxyfile

@@ -0,0 +1,240 @@
+# Doxyfile 1.4.6
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = PortAudio
+PROJECT_NUMBER         = 2.0
+OUTPUT_DIRECTORY       = ./doc/
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = NO
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+BUILTIN_STL_SUPPORT    = NO
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = NO
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = doc/src \
+                         include \
+                         bindings/java \
+                         examples
+FILE_PATTERNS          = *.h \
+                         *.c \
+                         *.cpp \
+                         *.java \
+                         *.dox
+RECURSIVE              = YES
+EXCLUDE                = src/hostapi/wasapi/mingw-include
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = doc/src/images
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = NO
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 1000
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO

+ 243 - 0
dev/externals/paprogs/portaudio/Doxyfile.developer

@@ -0,0 +1,243 @@
+# Doxyfile 1.4.6
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = PortAudio
+PROJECT_NUMBER         = 2.0
+OUTPUT_DIRECTORY       = ./doc/
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = NO
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+BUILTIN_STL_SUPPORT    = NO
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = INTERNAL
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = doc/src \
+                         include \
+                         bindings/java \
+                         examples \          
+                         src \
+                         test \
+                         qa
+FILE_PATTERNS          = *.h \
+                         *.c \
+                         *.cpp \
+                         *.java \
+                         *.dox
+RECURSIVE              = YES
+EXCLUDE                = src/hostapi/wasapi/mingw-include
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = doc/src/images
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = NO
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 1000
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO

+ 81 - 0
dev/externals/paprogs/portaudio/LICENSE.txt

@@ -0,0 +1,81 @@
+Portable header file to contain:
+>>>>>
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * PortAudio API Header File
+ * Latest version available at: http://www.portaudio.com
+ *
+ * Copyright (c) 1999-2006 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however, 
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also 
+ * requested that these non-binding requests be included along with the 
+ * license above.
+ */
+<<<<<
+ 
+
+Implementation files to contain:
+>>>>>
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * Latest version at: http://www.portaudio.com
+ * <platform> Implementation
+ * Copyright (c) 1999-2000 <author(s)>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however, 
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also 
+ * requested that these non-binding requests be included along with the 
+ * license above.
+ */
+<<<<<

+ 22 - 0
dev/externals/paprogs/portaudio/README.configure.txt

@@ -0,0 +1,22 @@
+PortAudio uses "autoconf" tools to generate Makefiles for Linux and Mac platforms.
+The source for these are configure.in and Makefile.in
+If you modify either of these files then please run this command before
+testing and checking in your changes.
+
+   autoreconf -if
+
+Then test a build by doing:
+   
+   ./configure
+   make clean
+   make
+   sudo make install
+
+then check in the related files that are modified.
+These might include files like:
+
+   configure
+   config.guess
+   depcomp
+   install.sh
+   

+ 98 - 0
dev/externals/paprogs/portaudio/README.txt

@@ -0,0 +1,98 @@
+README for PortAudio
+
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * Latest Version at: http://www.portaudio.com
+ *
+ * Copyright (c) 1999-2008 Phil Burk and Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however, 
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also 
+ * requested that these non-binding requests be included along with the 
+ * license above.
+ */
+
+
+PortAudio is a portable audio I/O library designed for cross-platform
+support of audio. It uses either a callback mechanism to request audio 
+processing, or blocking read/write calls to buffer data between the 
+native audio subsystem and the client. Audio can be processed in various 
+formats, including 32 bit floating point, and will be converted to the 
+native format internally.
+
+Documentation:
+	Documentation is available in "/doc/html/index.html"
+	Also see "src/common/portaudio.h" for API spec.
+	Also see http://www.portaudio.com/docs/
+	And see the "test/" directory for many examples of usage
+		(we suggest "test/patest_saw.c" for an example)
+
+For information on compiling programs with PortAudio, please see the
+tutorial at:
+
+  http://portaudio.com/trac/wiki/TutorialDir/TutorialStart
+  
+We have an active mailing list for user and developer discussions.
+Please feel free to join. See http://www.portaudio.com for details.
+
+
+Important Files and Folders:
+    include/portaudio.h     = header file for PortAudio API. Specifies API.	
+    src/common/             = platform independant code, host independant 
+                              code for all implementations.
+    src/os                  = os specific (but host api neutral) code
+    src/hostapi             = implementations for different host apis
+
+
+Host API Implementations:
+    src/hostapi/alsa        = Advanced Linux Sound Architecture (ALSA)
+    src/hostapi/asihpi      = AudioScience HPI
+    src/hostapi/asio        = ASIO for Windows and Macintosh
+    src/hostapi/coreaudio   = Macintosh Core Audio for OS X
+    src/hostapi/dsound      = Windows Direct Sound
+    src/hostapi/jack        = JACK Audio Connection Kit
+    src/hostapi/oss         = Unix Open Sound System (OSS)
+    src/hostapi/wasapi      = Windows Vista WASAPI
+    src/hostapi/wdmks       = Windows WDM Kernel Streaming
+    src/hostapi/wmme        = Windows MultiMedia Extensions (MME)
+
+
+Test Programs:
+    test/pa_fuzz.c         = guitar fuzz box
+    test/pa_devs.c         = print a list of available devices
+    test/pa_minlat.c       = determine minimum latency for your machine
+    test/paqa_devs.c       = self test that opens all devices
+    test/paqa_errs.c       = test error detection and reporting
+    test/patest_clip.c     = hear a sine wave clipped and unclipped
+    test/patest_dither.c   = hear effects of dithering (extremely subtle)
+    test/patest_pink.c     = fun with pink noise
+    test/patest_record.c   = record and playback some audio
+    test/patest_maxsines.c = how many sine waves can we play? Tests Pa_GetCPULoad().
+    test/patest_sine.c     = output a sine wave in a simple PA app
+    test/patest_sync.c     = test syncronization of audio and video
+    test/patest_wire.c     = pass input to output, wire simulator

+ 197 - 0
dev/externals/paprogs/portaudio/SConstruct

@@ -0,0 +1,197 @@
+import sys, os.path
+
+def rsplit(toSplit, sub, max=-1):
+    """ str.rsplit seems to have been introduced in 2.4 :( """
+    l = []
+    i = 0
+    while i != max:
+        try: idx = toSplit.rindex(sub)
+        except ValueError: break
+
+        toSplit, splitOff = toSplit[:idx], toSplit[idx + len(sub):]
+        l.insert(0, splitOff)
+        i += 1
+
+    l.insert(0, toSplit)
+    return l
+
+sconsDir = os.path.join("build", "scons")
+SConscript(os.path.join(sconsDir, "SConscript_common"))
+Import("Platform", "Posix", "ApiVer")
+
+# SConscript_opts exports PortAudio options
+optsDict = SConscript(os.path.join(sconsDir, "SConscript_opts"))
+optionsCache = os.path.join(sconsDir, "options.cache")   # Save options between runs in this cache
+options = Options(optionsCache, args=ARGUMENTS)
+for k in ("Installation Dirs", "Build Targets", "Host APIs", "Build Parameters", "Bindings"):
+    options.AddOptions(*optsDict[k])
+# Propagate options into environment
+env = Environment(options=options)
+# Save options for next run
+options.Save(optionsCache, env)
+# Generate help text for options
+env.Help(options.GenerateHelpText(env))
+
+buildDir = os.path.join("#", sconsDir, env["PLATFORM"])
+
+# Determine parameters to build tools
+if Platform in Posix:
+    threadCFlags = ''
+    if Platform != 'darwin':
+        threadCFlags = "-pthread "
+    baseLinkFlags = threadCFlags
+    baseCxxFlags = baseCFlags = "-Wall -pedantic -pipe " + threadCFlags
+    debugCxxFlags = debugCFlags = "-g"
+    optCxxFlags = optCFlags  = "-O2"
+env.Append(CCFLAGS = baseCFlags)
+env.Append(CXXFLAGS = baseCxxFlags)
+env.Append(LINKFLAGS = baseLinkFlags)
+if env["enableDebug"]:
+    env.AppendUnique(CCFLAGS=debugCFlags.split())
+    env.AppendUnique(CXXFLAGS=debugCxxFlags.split())
+if env["enableOptimize"]:
+    env.AppendUnique(CCFLAGS=optCFlags.split())
+    env.AppendUnique(CXXFLAGS=optCxxFlags.split())
+if not env["enableAsserts"]:
+    env.AppendUnique(CPPDEFINES=["-DNDEBUG"])
+if env["customCFlags"]:
+    env.Append(CCFLAGS=Split(env["customCFlags"]))
+if env["customCxxFlags"]:
+    env.Append(CXXFLAGS=Split(env["customCxxFlags"]))
+if env["customLinkFlags"]:
+    env.Append(LINKFLAGS=Split(env["customLinkFlags"]))
+
+env.Append(CPPPATH=[os.path.join("#", "include"), "common"])
+
+# Store all signatures in one file, otherwise .sconsign files will get installed along with our own files
+env.SConsignFile(os.path.join(sconsDir, ".sconsign"))
+
+env.SConscriptChdir(False)
+sources, sharedLib, staticLib, tests, portEnv, hostApis = env.SConscript(os.path.join("src", "SConscript"),
+        build_dir=buildDir, duplicate=False, exports=["env"])
+
+if Platform in Posix:
+    prefix = env["prefix"]
+    includeDir = os.path.join(prefix, "include")
+    libDir = os.path.join(prefix, "lib")
+    env.Alias("install", includeDir)
+    env.Alias("install", libDir)
+
+    # pkg-config
+
+    def installPkgconfig(env, target, source):
+        tgt = str(target[0])
+        src = str(source[0])
+        f = open(src)
+        try: txt = f.read()
+        finally: f.close()
+        txt = txt.replace("@prefix@", prefix)
+        txt = txt.replace("@exec_prefix@", prefix)
+        txt = txt.replace("@libdir@", libDir)
+        txt = txt.replace("@includedir@", includeDir)
+        txt = txt.replace("@LIBS@", " ".join(["-l%s" % l for l in portEnv["LIBS"]]))
+        txt = txt.replace("@THREAD_CFLAGS@", threadCFlags)
+
+        f = open(tgt, "w")
+        try: f.write(txt)
+        finally: f.close()
+
+    pkgconfigTgt = "portaudio-%d.0.pc" % int(ApiVer.split(".", 1)[0])
+    env.Command(os.path.join(libDir, "pkgconfig", pkgconfigTgt),
+        os.path.join("#", pkgconfigTgt + ".in"), installPkgconfig)
+
+# Default to None, since if the user disables all targets and no Default is set, all targets
+# are built by default
+env.Default(None)
+if env["enableTests"]:
+    env.Default(tests)
+if env["enableShared"]:
+    env.Default(sharedLib)
+
+    if Platform in Posix:
+        def symlink(env, target, source):
+            trgt = str(target[0])
+            src = str(source[0])
+
+            if os.path.islink(trgt) or os.path.exists(trgt):
+                os.remove(trgt)
+            os.symlink(os.path.basename(src), trgt)
+
+        major, minor, micro = [int(c) for c in ApiVer.split(".")]
+        
+        soFile = "%s.%s" % (os.path.basename(str(sharedLib[0])), ApiVer)
+        env.InstallAs(target=os.path.join(libDir, soFile), source=sharedLib)
+        # Install symlinks
+        symTrgt = os.path.join(libDir, soFile)
+        env.Command(os.path.join(libDir, "libportaudio.so.%d.%d" % (major, minor)),
+            symTrgt, symlink)
+        symTrgt = rsplit(symTrgt, ".", 1)[0]
+        env.Command(os.path.join(libDir, "libportaudio.so.%d" % major), symTrgt, symlink)
+        symTrgt = rsplit(symTrgt, ".", 1)[0]
+        env.Command(os.path.join(libDir, "libportaudio.so"), symTrgt, symlink)
+
+if env["enableStatic"]:
+    env.Default(staticLib)
+    env.Install(libDir, staticLib)
+
+env.Install(includeDir, os.path.join("include", "portaudio.h"))
+
+
+if env["enableCxx"]:
+    env.SConscriptChdir(True)
+    cxxEnv = env.Copy()
+    sharedLibs, staticLibs, headers = env.SConscript(os.path.join("bindings", "cpp", "SConscript"),
+            exports={"env": cxxEnv, "buildDir": buildDir}, build_dir=os.path.join(buildDir, "portaudiocpp"), duplicate=False)
+    if env["enableStatic"]:
+        env.Default(staticLibs)
+        env.Install(libDir, staticLibs)
+    if env["enableShared"]:
+        env.Default(sharedLibs)
+        env.Install(libDir, sharedLibs)
+    env.Install(os.path.join(includeDir, "portaudiocpp"), headers)
+
+# Generate portaudio_config.h header with compile-time definitions of which PA
+# back-ends are available, and which includes back-end extension headers
+
+# Host-specific headers
+hostApiHeaders = {"ALSA": "pa_linux_alsa.h",
+                    "ASIO": "pa_asio.h",
+                    "COREAUDIO": "pa_mac_core.h",
+                    "JACK": "pa_jack.h",
+                    "WMME": "pa_winwmme.h",
+                    }
+
+def buildConfigH(target, source, env):
+    """builder for portaudio_config.h"""
+    global hostApiHeaders, hostApis
+    out = ""
+    for hostApi in hostApis:
+        out += "#define PA_HAVE_%s\n" % hostApi
+
+        hostApiSpecificHeader = hostApiHeaders.get(hostApi, None)
+        if hostApiSpecificHeader:
+            out += "#include \"%s\"\n" % hostApiSpecificHeader
+
+        out += "\n"
+    # Strip the last newline
+    if out and out[-1] == "\n":
+        out = out[:-1]
+
+    f = file(str(target[0]), 'w')
+    try: f.write(out)
+    finally: f.close()
+    return 0
+
+# Define the builder for the config header
+env.Append(BUILDERS={"portaudioConfig": env.Builder(
+            action=Action(buildConfigH), target_factory=env.fs.File)})
+
+confH = env.portaudioConfig(File("portaudio_config.h", "include"),
+        File("portaudio.h", "include"))
+env.Default(confH)
+env.Install(os.path.join(includeDir, "portaudio"), confH)
+
+for api in hostApis:
+    if api in hostApiHeaders:
+        env.Install(os.path.join(includeDir, "portaudio"),
+                File(hostApiHeaders[api], "include"))

+ 8620 - 0
dev/externals/paprogs/portaudio/aclocal.m4

@@ -0,0 +1,8620 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <[email protected]>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <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
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<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*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** [email protected]
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </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])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[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
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[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
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+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
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t@_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*) ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <[email protected]> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+	_LT_TAGVAR(link_all_deplibs, $1)=no
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <[email protected]> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd[[12]]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
+
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
+
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3293 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4])
+m4_define([LT_PACKAGE_REVISION], [1.3293])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4'
+macro_revision='1.3293'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
+
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
+
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+# 
+# Copyright © 2004 Scott James Remnant <[email protected]>.
+#
+# 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|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+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.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have 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_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes ],
+		     [pkg_failed=yes])
+ 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
+   	AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	m4_default([$4], [AC_MSG_ERROR(
+[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])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+     	AC_MSG_RESULT([no])
+	m4_default([$4], [AC_MSG_FAILURE(
+[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/>.])[]dnl
+        ])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	$3
+fi[]dnl
+])# PKG_CHECK_MODULES
+

+ 0 - 0
dev/externals/paprogs/portaudio/bin-stamp


BIN
dev/externals/paprogs/portaudio/bin/pa_devs


BIN
dev/externals/paprogs/portaudio/bin/pa_fuzz


BIN
dev/externals/paprogs/portaudio/bin/pa_minlat


BIN
dev/externals/paprogs/portaudio/bin/paex_pink


BIN
dev/externals/paprogs/portaudio/bin/paex_read_write_wire


BIN
dev/externals/paprogs/portaudio/bin/paex_record


BIN
dev/externals/paprogs/portaudio/bin/paex_saw


BIN
dev/externals/paprogs/portaudio/bin/paex_sine


BIN
dev/externals/paprogs/portaudio/bin/paex_write_sine


BIN
dev/externals/paprogs/portaudio/bin/paex_write_sine_nonint


BIN
dev/externals/paprogs/portaudio/bin/paqa_devs


BIN
dev/externals/paprogs/portaudio/bin/paqa_errs


BIN
dev/externals/paprogs/portaudio/bin/paqa_latency


BIN
dev/externals/paprogs/portaudio/bin/patest1


BIN
dev/externals/paprogs/portaudio/bin/patest_buffer


BIN
dev/externals/paprogs/portaudio/bin/patest_callbackstop


BIN
dev/externals/paprogs/portaudio/bin/patest_clip


BIN
dev/externals/paprogs/portaudio/bin/patest_dither


BIN
dev/externals/paprogs/portaudio/bin/patest_hang


BIN
dev/externals/paprogs/portaudio/bin/patest_in_overflow


BIN
dev/externals/paprogs/portaudio/bin/patest_latency


BIN
dev/externals/paprogs/portaudio/bin/patest_leftright


BIN
dev/externals/paprogs/portaudio/bin/patest_longsine


BIN
dev/externals/paprogs/portaudio/bin/patest_many


BIN
dev/externals/paprogs/portaudio/bin/patest_maxsines


BIN
dev/externals/paprogs/portaudio/bin/patest_mono


BIN
dev/externals/paprogs/portaudio/bin/patest_multi_sine


BIN
dev/externals/paprogs/portaudio/bin/patest_out_underflow


BIN
dev/externals/paprogs/portaudio/bin/patest_prime


BIN
dev/externals/paprogs/portaudio/bin/patest_ringmix


BIN
dev/externals/paprogs/portaudio/bin/patest_sine8


BIN
dev/externals/paprogs/portaudio/bin/patest_sine_channelmaps


BIN
dev/externals/paprogs/portaudio/bin/patest_sine_formats


BIN
dev/externals/paprogs/portaudio/bin/patest_sine_srate


BIN
dev/externals/paprogs/portaudio/bin/patest_sine_time


BIN
dev/externals/paprogs/portaudio/bin/patest_start_stop


BIN
dev/externals/paprogs/portaudio/bin/patest_stop


BIN
dev/externals/paprogs/portaudio/bin/patest_stop_playout


BIN
dev/externals/paprogs/portaudio/bin/patest_toomanysines


BIN
dev/externals/paprogs/portaudio/bin/patest_two_rates


BIN
dev/externals/paprogs/portaudio/bin/patest_underflow


BIN
dev/externals/paprogs/portaudio/bin/patest_wire


+ 0 - 0
dev/externals/paprogs/portaudio/bindings/cpp/AUTHORS


+ 31 - 0
dev/externals/paprogs/portaudio/bindings/cpp/COPYING

@@ -0,0 +1,31 @@
+PortAudio Portable Real-Time Audio Library
+Copyright (c) 1999-2006 Ross Bencina and Phil Burk
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files
+(the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+The text above constitutes the entire PortAudio license; however, 
+the PortAudio community also makes the following non-binding requests:
+
+Any person wishing to distribute modifications to the Software is
+requested to send the modifications to the original developer so that
+they can be incorporated into the canonical version. It is also 
+requested that these non-binding requests be included along with the 
+license above.

+ 178 - 0
dev/externals/paprogs/portaudio/bindings/cpp/ChangeLog

@@ -0,0 +1,178 @@
+Note: Because PortAudioCpp is now in the main PortAudio SVN repository, having these per-release changelogs probably doesn't make much sense anymore. Perhaps it's better to just note mayor changes by date from now on.
+
+PortAudioCpp v19 revision 16 06/05/22:
+
+	mblaauw:
+	- Added up-to-date MSVC 6.0 projects created by David Moore. Besides MSVC 6.0 users, MSVC 7.0 users may use these projects and automatically convert them to MSVC 7.0 projects.
+	- Changed the code and projects (MSVC 7.1 only) to be up-to-date with PortAudio's new directory structure.
+	- Added equivalents of the PaAsio_GetInputChannelName() and PaAsio_GetOutputChannelName() functions to the AsioDeviceAdapter wrapper-class (missing functions pointed out by David Moore).
+	- Added code to PortAudio's main SVN repository.
+
+PortAudioCpp v19 revision 15 (unknown release date):
+
+	mblaauw:
+	- Changed some exception handling code in HostApi's constructor.
+	- Added accessors to PortAudio PaStream from PortAudioCpp Stream (their absense being pointed out
+	by Tom Jordan).
+	- Fixed a bug/typo in MemFunToCallbackInterfaceAdapter::init() thanks to Fredrik Viklund.
+	- Fixed issue with concrete Stream classes possibly throwing an exception and fixed documentation w.r.t. this.
+	- Moved files to portaudio/binding/cpp/. Made new msvc 7.1 projects to reflect the change and removed msvc 6.0 
+	and 7.0 projects (because I can no longer maintain them myself). Gnu projects will probably need updating.
+
+PortAudioCpp v19 revision 14 03/10/24:
+
+	mblaauw:
+	- Fixed some error handling bugs in Stream and System (pointed out by Tom Jordan).
+	- Updated documentation a little (main page).
+	- Fixed order of members so initializer list was in the right order in 
+	StreamParameters (pointed out by Ludwig Schwardt).
+	- Added new lines at EOF's (as indicated by Ludwig Schwardt).
+
+PortAudioCpp v19 revision 13 03/10/19:
+
+	lschwardt:
+	- Added build files for GNU/Linux.
+	- Fixed bug in Exception where the inherited what() member function (and destructor) had looser 
+	exception specification (namely no exception specification, i.e. could throw anything) than 
+	the std::exception base class's what() member function (which had throw(), i.e. no-throw guarantee).
+	- Changed the iterators so that they have a set of public typedefs instead of deriving the C++ standard 
+	library std::iterator<> struct. G++ 2.95 doesn't support std::exception<> and composition-by-aggregation 
+	is prefered over composition-by-inheritance in this case.
+	- Changed some minor things to avoid G++ warning messages.
+
+	mblaauw:
+	- Renamed this file (/WHATSNEW.txt) to /CHANGELOG.
+	- Renamed /PA_ISSUES.txt to /PA_ISSUES.
+	- Added /INSTALL file with some build info for GNU/Linux and VC6.
+	- Added MSVC 6.0 projects for building PortAudioCpp as a staticly or dynamically linkable library.
+	- Moved build files to /build/(gnu/ or vc6/).
+	- Moved Doxygen configuration files to /doc/ and output to /doc/api_reference/.
+	- Added a /doc/README with some info how to generate Doxygen documentation.
+
+PortAudioCpp v19 revision 12 03/09/02:
+
+	mblaauw:
+	- Updated code to reflect changes on V19-devel CVS branch.
+	- Fixed some typos in the documentation.
+
+PortAudioCpp v19 revision 11 03/07/31:
+
+	mblaauw:
+	- Renamed SingleDirecionStreamParameters to DirectionSpecificStreamParameters.
+	- Implemented BlockingStream.
+	- Updated code to reflect recent changes to PortAudio V19-devel.
+	- Fixed a potential memory leak when an exception was thrown in the HostApi 
+	constructor.
+	- Renamed ``Latency'' to ``BufferSize'' in AsioDeviceAdapter.
+	- Updated class documentation.
+
+PortAudioCpp v19 revision 10 03/07/18:
+
+	mblaauw:
+	- SingleDirectionStreamParameters now has a (static) null() method.
+	- StreamParameters uses references for the direction-specific stream parameters 
+	instead of pointers (use null() method (above) instead of NULL).
+	- StreamParameters and SingleDirectionStreamParameters must now be fully specified 
+	and now default values are used (because this was not very useful in general and 
+	only made things more complex).
+	- Updated documentation.
+
+PortAudioCpp v19 revision 09 03/06/25:
+
+	mblaauw:
+	- Changed some things in SingleDirectionStreamParameters to ease it's usage.
+	- Placed all SingleDirectionStreamParameters stuff into a separate file.
+	+ Totally redid the callback stuff, now it's less ackward and supports C++ functions.
+
+PortAudioCpp v19 revision 08 03/06/20:
+
+	mblaauw:
+	- Made deconstructors for Device and HostApi private.
+	+ Added a AsioDeviceWrapper host api specific device extension class.
+	- Refactored Exception into a Exception base class and PaException and PaCppException 
+	derived classes.
+	- Added ASIO specific device info to the devs.cxx example.
+	- Fixed a bug in System::hostApiCount() and System::defaultHostApi().
+	+ Moved Device::null to System::nullDevice.
+	- Fixed some bugs in Device and System.
+
+PortAudioCpp v19 revision 07 03/06/08:
+
+	mblaauw:
+	- Updated some doxy comments.
+	+ Renamed CbXyz to CallbackXyz.
+	+ Renamed all ``configurations'' to ``parameters''.
+	+ Renamed HalfDuplexStreamConfiguration to SingleDirectionStreamConfiguration.
+	- Renamed SingleDirectionStreamParameters::streamParameters() to 
+	SingleDirectionStreamParameters::paSteamParameters.
+	- Added a non-constant version of SingleDirectionStreamParameters::paStreamParameters().
+	- A few improvements to SingleDirectionStreamParameters.
+	- Allowed AutoSystem to be created without initializing the System singleton 
+	(using a ctor flag).
+	- Added a BlockingStream class (not implemented for now).
+	- Fixed many bugs in the implementation of the iterators.
+	- Fixed a bug in Device::operator==().
+	+ Added a C++ version of the patest_sine.c test/example.
+	- Added a ctor for StreamParameters for a default half-duplex stream.
+	- Added SingleDirectionStreamParameters::setDevice() and setNumChannels().
+	- Renamed System::numHostApis() to System::hostApiCount().
+	+ Rewrote the iterators and related classes. They are now fully STL compliant. The System now 
+	has a static array of all HostApis and all Devices. Only the System can create HostApis and 
+	Devices and they are non-copyable now. All HostApis and Devices are now passed by-reference.
+	- Renamed (System::) getVersion() to version() and getVersionText() to versionText().
+	- Renamed (Device::) numXyzChannels() to maxXyzChannels().
+	- Changed some stuff in StreamParameters.
+	+ Added a C++ version of the patest_devs.c test/example.
+
+PortAudioCpp v19 revision 06 03/06/04:
+
+	mblaauw:
+	+ Added this file to the project (roughly, a `+' denotes a major change, a `-' a minor change).
+	- Added System::deviceByIndex(), useful when a Device's index is stored for instance.
+	- Renamed System::hostApiFromTypeId() to System::hostApiByTypeId().
+	- Updated and added some Doxygen documentation.
+	- Made Stream::usedIntputLatency(), Stream::usedOutputLatency() and 
+	Stream::usedSampleRate() throw an paInternalError equivalent exception instead of paBadStreamPtr.
+	- Changed exception handling in Stream::open() functions. They now follow the PA error handling 
+	mechanism better and a couple of bugs regarding ownership of objects were fixed.
+	- Renamed Device::isDefaultXyzDevice() to Device::isSystemDefaultXyzDevice().
+	- Added Device::isHostApiDefaultXyzDevice().
+	- Added StreamConfiguration::unsetFlag().
+	- Removed CUSTOM from SampleDataFormat.
+	- System::hostApiByTypeId() now throws an paInternalError if the type id was out-of-range; this 
+	is a temporary work-around (see comments).
+	- Changed CbInterface to use paCallbackFun() instead of operator()().
+	- Renamed ``object'' to ``instance'' in CbMemFunAdapter.hxx.
+	- Added StreamConfiguration::setXyzHostApiSpecificSampleFormat().
+	- Added StreamConfiguration::isXyzSampleFormatHostApiSpecific().
+	- Changed error handling in System::terminate(), it can now throw an Exception.
+	- Added error handling in System::defaultHostApi().
+	- Added error handling in System::hostApisEnd().
+	- Changed some (but probably not all) C casts to C++ casts to avoid confusion with a 
+	certain Python person.
+	- Renamed RaiiSystem to AutoSystem (class and file) as this is a come common convention.
+	- Renamed System::numDevices() to System::deviceCount() to be more compatible with PortAudio 
+	(although PortAudio uses Pa_CountDevices() instead, see comment).
+	- Renamed HostApi::numDevices() to HostApi::deviceCount().
+	- Changed INC_ to INCLUDED_ in the header multiple include guards.
+	- Changed the order of functions in the StreamConfiguration class' header.
+	- Written some more info in PortAudioCpp.hxx (Doxygen).
+	- Added CallbackStream.hxx and CallbackStream.cxx files.
+	+ Refactored StreamConfiguration to remove the duplication which was there. There is now a 
+	HalfDuplexStreamConfiguration class. Also made some improvements to these classes while 
+	doing the refactoring.
+	+ Moved all code files to source/portaudiocpp/ and changed includes.
+	+ Moved all header files to include/portaudiocpp/ to easy a binary build if needed. The project 
+	must be set to have .../include/ as a path to look for includes.
+	+ Refactored the Stream class into a Stream base class and a CallbackStream derived class.
+	- Renamed Stream::usingXyz() to Stream::xyz().
+	- Updated some doxy comments.
+	- Changed ``using namespace portaudio'' in .cxx files to ``namespace portaudio { ... }''.
+
+PortAudioCpp v19 revision 05 03/04/09:
+
+	mblaauw:
+	- Initial release on the PortAudio mailinglist.
+
+
+

+ 365 - 0
dev/externals/paprogs/portaudio/bindings/cpp/INSTALL

@@ -0,0 +1,365 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

+ 0 - 0
dev/externals/paprogs/portaudio/bindings/cpp/NEWS


+ 0 - 0
dev/externals/paprogs/portaudio/bindings/cpp/README


+ 65 - 0
dev/externals/paprogs/portaudio/bindings/cpp/SConscript

@@ -0,0 +1,65 @@
+import os.path
+
+Import("env", "buildDir")
+env.Append(CPPPATH="include")
+
+ApiVer = "0.0.12"
+Major, Minor, Micro = [int(c) for c in ApiVer.split(".")]
+
+sharedLibs = []
+staticLibs = []
+Import("Platform", "Posix")
+if Platform in Posix:
+    env["SHLIBSUFFIX"] = ".so.%d.%d.%d" % (Major, Minor, Micro)
+    soFile = "libportaudiocpp.so"
+    if Platform != 'darwin':
+        env.AppendUnique(SHLINKFLAGS="-Wl,-soname=%s.%d" % (soFile, Major))
+
+    # Create symlinks
+    def symlink(env, target, source):
+        trgt = str(target[0])
+        src = str(source[0])
+        if os.path.islink(trgt) or os.path.exists(trgt):
+            os.remove(trgt)
+        os.symlink(os.path.basename(src), trgt)
+    lnk0 = env.Command(soFile + ".%d" % (Major), soFile + ".%d.%d.%d" % (Major, Minor, Micro), symlink)
+    lnk1 = env.Command(soFile, soFile + ".%d" % (Major), symlink)
+    sharedLibs.append(lnk0)
+    sharedLibs.append(lnk1)
+
+src = [os.path.join("source", "portaudiocpp", "%s.cxx" % f) for f in ("BlockingStream", "CallbackInterface", \
+    "CallbackStream", "CFunCallbackStream","CppFunCallbackStream", "Device",
+    "DirectionSpecificStreamParameters", "Exception", "HostApi", "InterfaceCallbackStream",
+    "MemFunCallbackStream", "Stream", "StreamParameters", "System", "SystemDeviceIterator",
+    "SystemHostApiIterator")]
+env.Append(LIBS="portaudio", LIBPATH=buildDir)
+sharedLib = env.SharedLibrary("portaudiocpp", src, LIBS=["portaudio"])
+staticLib = env.Library("portaudiocpp", src, LIBS=["portaudio"])
+sharedLibs.append(sharedLib)
+staticLibs.append(staticLib)
+
+headers = Split("""AutoSystem.hxx                         
+                   BlockingStream.hxx                     
+                   CallbackInterface.hxx                  
+                   CallbackStream.hxx
+                   CFunCallbackStream.hxx                 
+                   CppFunCallbackStream.hxx               
+                   Device.hxx                             
+                   DirectionSpecificStreamParameters.hxx  
+                   Exception.hxx                           
+                   HostApi.hxx
+                   InterfaceCallbackStream.hxx
+                   MemFunCallbackStream.hxx
+                   PortAudioCpp.hxx
+                   SampleDataFormat.hxx
+                   Stream.hxx
+                   StreamParameters.hxx
+                   SystemDeviceIterator.hxx
+                   SystemHostApiIterator.hxx
+                   System.hxx
+                   """)
+if env["PLATFORM"] == "win32":
+    headers.append("AsioDeviceAdapter.hxx") 
+headers = [File(os.path.join("include", "portaudiocpp", h)) for h in headers]
+
+Return("sharedLibs", "staticLibs", "headers")

+ 9438 - 0
dev/externals/paprogs/portaudio/bindings/cpp/aclocal.m4

@@ -0,0 +1,9438 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <[email protected]>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <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
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<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*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** [email protected]
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </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])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[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
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[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
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+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
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t@_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*) ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <[email protected]> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+	_LT_TAGVAR(link_all_deplibs, $1)=no
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <[email protected]> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd[[12]]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
+
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
+
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3293 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4])
+m4_define([LT_PACKAGE_REVISION], [1.3293])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4'
+macro_revision='1.3293'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
+
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.11.1], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+			     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+		  [_AM_DEPENDENCIES(CC)],
+		  [define([AC_PROG_CC],
+			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+		  [_AM_DEPENDENCIES(CXX)],
+		  [define([AC_PROG_CXX],
+			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+		  [_AM_DEPENDENCIES(OBJC)],
+		  [define([AC_PROG_OBJC],
+			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer],
+      [USE_MAINTAINER_MODE=$enableval],
+      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+  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, 2009  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <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
+

+ 0 - 0
dev/externals/paprogs/portaudio/bindings/cpp/build/gnu/OUT_OF_DATE


+ 57 - 0
dev/externals/paprogs/portaudio/bindings/cpp/build/gnu/aclocal.m4

@@ -0,0 +1,57 @@
+
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN(PKG_CHECK_MODULES, [
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     echo "*** The pkg-config script could not be found. Make sure it is"
+     echo "*** in your path, or set the PKG_CONFIG environment variable"
+     echo "*** to the full path to pkg-config."
+     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        AC_MSG_CHECKING(for $2)
+
+        if $PKG_CONFIG --exists "$2" ; then
+            AC_MSG_RESULT(yes)
+            succeeded=yes
+
+            AC_MSG_CHECKING($1_CFLAGS)
+            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+            AC_MSG_RESULT($$1_CFLAGS)
+
+            AC_MSG_CHECKING($1_LIBS)
+            $1_LIBS=`$PKG_CONFIG --libs "$2"`
+            AC_MSG_RESULT($$1_LIBS)
+        else
+            $1_CFLAGS=""
+            $1_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but 
+            ## do set a variable so people can do so.
+            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+            ifelse([$4], ,echo $$1_PKG_ERRORS,)
+        fi
+
+        AC_SUBST($1_CFLAGS)
+        AC_SUBST($1_LIBS)
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     ifelse([$3], , :, [$3])
+  else
+     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+  fi
+])
+
+

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott