shithub: sox

Download patch

ref: 9b2998acbda42e8fb7c0da279c8e0e88994bf0dc
parent: 16fcc452e6ee97c261d9c30c1045ab31b144decb
author: cbagwell <cbagwell>
date: Fri Jan 1 19:16:54 EST 2010

Enable glob support on mingw build.

--- a/configure.ac
+++ b/configure.ac
@@ -42,15 +42,26 @@
     using_libltdl=$with_libltdl
 fi
 
+using_win32_ltdl="no"
 if test "$using_libltdl" != "no"; then
-  AC_CHECK_HEADERS(ltdl.h,
-                   AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
-                                using_libltdl=no), using_libltdl=no)
+  case $target in
+    *doesntworkmingw*)
+    AC_DEFINE([HAVE_WIN32_LTDL_H], 1, [Define to 1 to use internal win32 ltdl])
+    LIBLTDL=""
+    using_win32_ltdl="yes"
+    ;;
+    *)
+     AC_CHECK_HEADERS(ltdl.h,
+		     AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
+				  using_libltdl=no), using_libltdl=no)
+    ;;
+  esac
 fi
 if test "$using_libltdl" = yes; then
-   AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
+  AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
 fi
-AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes)
+AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes -a x$using_win32_ltdl = xno)
+AM_CONDITIONAL(HAVE_WIN32_LTDL, test x$using_win32_ltdl = xyes)
 AC_SUBST(LIBLTDL)
 
 AC_LIBTOOL_DLOPEN
@@ -82,6 +93,17 @@
 AM_CONDITIONAL(HAVE_PKGCONFIG, test x$using_pkgconfig = xyes)
 AC_SUBST(PKGCONFIGDIR, $with_pkgconfigdir)
 
+using_win32_glob="no"
+case $target in
+  *mingw*)
+  using_win32_glob="yes"
+   ;;
+esac
+if test "$using_win32_glob" = yes; then
+   AC_DEFINE([HAVE_WIN32_GLOB_H], 1, [Define to 1 to use win32 glob])
+fi
+AM_CONDITIONAL(HAVE_WIN32_GLOB, test x$using_win32_glob = xyes)
+
 dnl Debugging
 AC_MSG_CHECKING([whether to make a debug build])
 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [make a debug build]))
@@ -143,7 +165,7 @@
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h termios.h glob.h)
+AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h termios.h glob.h)
 
 dnl Checks for library functions.
 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen)
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,11 @@
 AM_LDFLAGS = -avoid-version -module
 AM_CPPFLAGS += -DPKGLIBDIR="\"$(pkglibdir)\""
 endif
+if HAVE_WIN32_LTDL
+# Must match line above.
+AM_LDFLAGS = -avoid-version -module
+AM_CPPFLAGS += -DPKGLIBDIR="\"$(pkglibdir)\""
+endif
 
 # Pass flags from --enable-silent-libtool
 LIBTOOL = @LIBTOOL@ @LIBTOOLFLAGS@
@@ -35,6 +40,9 @@
 include_HEADERS = sox.h
 nodist_include_HEADERS = soxstdint.h
 sox_SOURCES = sox.c
+if HAVE_WIN32_GLOB
+sox_SOURCES += win32-glob.c win32-glob.h
+endif
 sox_LDADD = libsox.la
 example0_SOURCES = example0.c
 example1_SOURCES = example1.c
@@ -87,6 +95,10 @@
 
 libsox_la_CFLAGS = @WARN_CFLAGS@
 libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@
+
+if HAVE_WIN32_LTDL
+  libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h
+endif
 
 if HAVE_LIBLTDL
   libsox_la_CFLAGS += $(LTDLINCL) 
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -194,7 +194,7 @@
       if [ "${from_skip}x" = "x" ] ; then
         getFormat $1;
         ($time ${bindir}/sox${EXEEXT} $verbose -D tmp.sox $formatFlags -t $1 - 2> tmp.read) | \
-        ($time ${bindir}/sox${EXTEXT} $verbose -t $1 -c $channels -r $rate - -t sox /dev/null 2> tmp.write)
+        ($time ${bindir}/sox${EXEEXT} $verbose -t $1 -c $channels -r $rate - -t sox /dev/null 2> tmp.write)
         echo "TIME `printf %4s $formatText` write=`stderr_time tmp.write`s read=`stderr_time tmp.read`s"
       fi
       shift