Integrated IRIX patch (getopt stuff) from Michael Pruett <michael@68k.org>


git-svn-id: http://svn.xiph.org/trunk/speex@5836 0101bb08-14d6-0310-b084-bc0e0c8e3800
diff --git a/ChangeLog b/ChangeLog
index 10db298..b93377f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-02-18 Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
+	Integrated IRIX patch (getopt stuff) from Michael Pruett <michael@68k.org> 
+
+2004-02-18 Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
+	Changed the Makefile.am so that KDevelop can parse SUBDIRS correctly 
+
 2002/03/27 Jean-Marc Valin:
 Working encoder and decoder for both narrowband and wideband.
 
diff --git a/configure.in b/configure.in
index 8b9463a..80f45de 100644
--- a/configure.in
+++ b/configure.in
@@ -52,7 +52,15 @@
 AC_SUBST(src)
 
 AC_CHECK_LIB(m, sin)
-AC_CHECK_LIB(gnugetopt, getopt_long)
+
+# Check for getopt_long; if not found, use included source.
+AC_CHECK_FUNCS([getopt_long],,
+[# FreeBSD has a gnugetopt library.
+  AC_CHECK_LIB([gnugetopt],[getopt_long],
+[AC_DEFINE([HAVE_GETOPT_LONG])],
+[# Use the GNU replacement.
+AC_LIBOBJ(getopt)
+AC_LIBOBJ(getopt1)])])
 
 AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ac3d1f..f6b8de1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in. -*-Makefile-*-
 
-# $Id: Makefile.am,v 1.10 2003/05/30 02:09:30 jm Exp $
+# $Id: Makefile.am,v 1.11 2004/02/18 06:59:40 jm Exp $
 
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
@@ -18,7 +18,11 @@
 bin_PROGRAMS = speexenc speexdec
 
 speexenc_SOURCES = speexenc.c wav_io.c
-speexenc_LDADD = $(top_builddir)/libspeex/libspeex.la $(OGG_LDFLAGS) $(OGG_LIBS)
+speexenc_LDADD = $(top_builddir)/libspeex/libspeex.la \
+	$(OGG_LDFLAGS) $(OGG_LIBS) \
+	@LTLIBOBJS@
 
 speexdec_SOURCES = speexdec.c wav_io.c
-speexdec_LDADD = $(top_builddir)/libspeex/libspeex.la $(OGG_LDFLAGS) $(OGG_LIBS)
+speexdec_LDADD = $(top_builddir)/libspeex/libspeex.la \
+	$(OGG_LDFLAGS) $(OGG_LIBS) \
+	@LTLIBOBJS@
diff --git a/src/speexdec.c b/src/speexdec.c
index 1a6f9a3..657a4fa 100644
--- a/src/speexdec.c
+++ b/src/speexdec.c
@@ -34,6 +34,9 @@
 #include <unistd.h>
 #include <getopt.h>
 #endif
+#ifndef HAVE_GETOPT_LONG
+#include "getopt_win.h"
+#endif
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/src/speexenc.c b/src/speexenc.c
index 0cee523..7a43a88 100644
--- a/src/speexenc.c
+++ b/src/speexenc.c
@@ -34,6 +34,9 @@
 #include <unistd.h>
 #include <getopt.h>
 #endif
+#ifndef HAVE_GETOPT_LONG
+#include "getopt_win.h"
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>