shithub: sox

Download patch

ref: 84eaacb54fd2e61154ccd95328d8a8ec5096eae1
parent: 33837263e0f67be7cf1c64e49c04293acebc5f00
author: Ulrich Klauer <ulrich@chirlu.de>
date: Thu Apr 5 19:06:37 EDT 2012

Require OpenMP >= 3.0

Only use OpenMP if at least version 3.0 is available.

As OpenMP development in Microsoft Visual C++ has stalled at version
2.0, remove references to it from the readme files.

This also uses the AC_OPENMP macro in configure.ac to determine the
compiler flags required for OpenMP support, thereby both simplifying
configure.ac and potentially enabling OpenMP support with compilers
other than gcc.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,10 +109,10 @@
 optional(HAVE_AMRNB amrnb/sp_dec.h amrnb Decoder_Interface_init amr-nb)
 optional(HAVE_AMRWB amrwb/dec.h amrwb D_IF_init amr-wb)
 if(CMAKE_COMPILER_IS_GNUCC)
-  optional(HAVE_OPENMP omp.h gomp omp_get_thread_num "")
-  if(HAVE_OPENMP)
+  optional(HAVE_GOMP omp.h gomp omp_get_thread_num "")
+  if(HAVE_GOMP)
     add_definitions(-fopenmp)
-  endif(HAVE_OPENMP)
+  endif(HAVE_GOMP)
 endif(CMAKE_COMPILER_IS_GNUCC)
 optional(HAVE_ID3TAG id3tag.h id3tag id3_file_open "")
 optional(HAVE_SNDIO sndio.h sndio sio_open sndio)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
   14.3.0   O -s/-u/-f              -e
   14.3.0   O -A/-U/-o/-i/-a/-g     -e
   14.4.0   E swap with parameters  remix
+  14.4.1   OpenMP < 3.0            OpenMP >= 3.0
 
 Previously deprecated features (to be removed in future):
 
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
+AC_PREREQ(2.62)
+
 AC_INIT(SoX, 14.4.1git, sox-devel@lists.sourceforge.net)
 
 m4_ifdef([AC_CONFIG_MACRO_DIR], [AC_CONFIG_MACRO_DIR([m4])])
@@ -204,30 +206,11 @@
 AC_SUBST(LIBLTDL)
 
 
-dnl Check for GOMP library
-AC_MSG_CHECKING([whether to use GOMP])
-AC_ARG_ENABLE(gomp,
-    AC_HELP_STRING([--disable-gomp], [Don't use GOMP.]),,enable_gomp=yes)
-AC_MSG_RESULT($enable_gomp)
-if test "$enable_gomp" = "yes"; then
-    EXTRA_GOMP_LIBS=""  
-    case $target in
-      *mingw32*)
-      EXTRA_GOMP_LIBS="-lpthread"
-      ;;
-    esac
-    AC_CHECK_HEADERS(omp.h,
-		     AC_CHECK_LIB(gomp, omp_get_thread_num, GOMP_LIBS="$GOMP_LIBS -lgomp $EXTRA_GOMP_LIBS", enable_gomp=no, $EXTRA_GOMP_LIBS), enable_gomp=no)
-fi
-if test "$enable_gomp" = yes; then
-   AC_DEFINE(HAVE_OPENMP, 1, [Define to 1 if you have GOMP.])
-   CFLAGS="$CFLAGS -fopenmp"
-fi
-AM_CONDITIONAL(HAVE_OPENMP, test x$enable_gomp = xyes)
-AC_SUBST(GOMP_LIBS)
+dnl Check for OpenMP
+AC_OPENMP
+CFLAGS="$CFLAGS $OPENMP_CFLAGS"
 
 
-
 dnl Check for magic library
 AC_ARG_WITH(magic,
     AC_HELP_STRING([--without-magic],
@@ -689,7 +672,6 @@
 echo "ladspa effects.............$using_ladspa"
 echo "magic support..............$using_magic"
 echo "png support................$using_png"
-echo "GOMP support...............$enable_gomp"
 echo
 echo "Configure finished.  Do 'make -s && make install' to compile and install SoX."
 echo
--- a/msvc10/Readme.txt
+++ b/msvc10/Readme.txt
@@ -6,9 +6,6 @@
 ladspa, and pulseaudio. LAME (libmp3lame.dll or lame_enc.dll), MAD (libmad.dll
 or cygmad-0.dll), libsndfile (libsndfile-1.dll), and AMR support
 (libamrnb-3.dll, libamrwb-3.dll) are loaded at runtime if they are available.
-OpenMP support is available only if using Visual Studio Professional or
-higher - it is not available if you build SoX via Visual Studio 2010 Express or
-via the Microsoft Windows SDK.
 
 How to build:
 
@@ -61,15 +58,11 @@
    edit the soxconfig.h file (sox\msvc10\sox\soxconfig.h), and you'll have to
    manually remove the entries for the unwanted projects.
 
-5. If using Visual Studio Professional or above and you want OpenMP support,
-   enable it in the project settings for the LibSox and SoX projects
-   (Configuration Properties, C/C++, Language, Open MP Support, set to Yes).
+5. If using Visual Studio, build the solution using the GUI.
 
-6. If using Visual Studio, build the solution using the GUI.
-
    If using the Windows SDK, run: msbuild SoX.sln
 
-7. The resulting executable files will be in sox\msvc10\Debug or
+6. The resulting executable files will be in sox\msvc10\Debug or
    sox\msvc10\Release. The resulting sox.exe will dynamically link to
    libmp3lame.dll, libmad.dll, libsndfile-1.dll, libamrnb-3.dll, and
    libamrwb-3.dll if they are available, but will run without them (though the
@@ -91,13 +84,6 @@
   to make use of the automatic gain control and noise filtering components that
   are part of the speex codec package. Support for the speex codec may be added
   later.
-
-- If you enable Open MP support, you will need vcomp100.dll either installed on
-  your machine or copied into the directory next to sox.exe. If you have Open
-  MP support in your copy of Visual Studio, this file can be found here:
-
-  c:\Program Files\Microsoft Visual Studio 10.0\
-     vc\redist\x86\Microsoft.VC100.OPENMP
 
 - The included projects do not enable SSE2. You can enable this in the project
   properties under Configuration Properties, C/C++, Code Generation, Enable
--- a/msvc10/SoX/soxconfig.h
+++ b/msvc10/SoX/soxconfig.h
@@ -113,10 +113,6 @@
 #define HAVE_WIN32_GLOB_H 1
 #define HAVE_WIN32_LTDL_H 1
 
-#ifdef _OPENMP
-#define HAVE_OPENMP 1
-#endif
-
 #ifndef __cplusplus
 #define inline __inline
 #endif
--- a/msvc9/LibSoX.vcproj
+++ b/msvc9/LibSoX.vcproj
@@ -51,7 +51,6 @@
 				EnableFunctionLevelLinking="true"
 				FloatingPointModel="2"
 				RuntimeTypeInfo="false"
-				OpenMP="true"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
@@ -122,7 +121,6 @@
 				EnableFunctionLevelLinking="true"
 				FloatingPointModel="2"
 				RuntimeTypeInfo="false"
-				OpenMP="true"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
--- a/msvc9/Readme.txt
+++ b/msvc9/Readme.txt
@@ -57,18 +57,6 @@
   are part of the speex codec package. Support for the speex codec may be added
   later.
 
-- The included libsox project enables OpenMP support. You can disable this
-  in the libsox project properties under Configuration Properties, C/C++,
-  Language, OpenMP support. If you don't disable it, you will need
-  vcomp90.dll and Microsoft.VC90.OpenMP.manifest either installed on your
-  machine or copied into the directory next to sox.exe. If you have OpenMP
-  support in your copy of Visual Studio, these files can be found here:
-
-  c:\Program Files\Microsoft Visual Studio 9.0\
-     vc\redist\x86\Microsoft.VC90.OPENMP
-
-  Note that some editions of Visual Studio might not include OpenMP support.
-
 - The included projects do not enable SSE2. You can enable this in the project
   properties under Configuration Properties, C/C++, Code Generation, Enable
   Enhanced Instruction Set. Note that some editions of Visual Studio might
--- a/msvc9/SoX.vcproj
+++ b/msvc9/SoX.vcproj
@@ -51,7 +51,6 @@
 				EnableFunctionLevelLinking="true"
 				FloatingPointModel="2"
 				RuntimeTypeInfo="false"
-				OpenMP="true"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
@@ -140,7 +139,6 @@
 				EnableFunctionLevelLinking="true"
 				FloatingPointModel="2"
 				RuntimeTypeInfo="false"
-				OpenMP="true"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
--- a/msvc9/Sox/soxconfig.h
+++ b/msvc9/Sox/soxconfig.h
@@ -97,10 +97,6 @@
 #define HAVE_WIN32_GLOB_H 1
 #define HAVE_WIN32_LTDL_H 1
 
-#ifdef _OPENMP
-#define HAVE_OPENMP 1
-#endif
-
 #ifndef __cplusplus
 #define inline __inline
 #endif
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,10 +90,6 @@
 libsox_la_LIBADD += @MAGIC_LIBS@
 endif
 
-if HAVE_OPENMP
-libsox_la_LIBADD += @GOMP_LIBS@
-endif
-
 libsox_la_CFLAGS = @WARN_CFLAGS@
 libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@
 
--- a/src/soxconfig.h.cmake
+++ b/src/soxconfig.h.cmake
@@ -28,7 +28,6 @@
 #cmakedefine HAVE_MKSTEMP             1
 #cmakedefine HAVE_MP3                 1
 #cmakedefine HAVE_OGG_VORBIS          1
-#cmakedefine HAVE_OPENMP              1
 #cmakedefine HAVE_OSS                 1
 #cmakedefine HAVE_PNG                 1
 #cmakedefine HAVE_POPEN               1
--- a/src/soxomp.h
+++ b/src/soxomp.h
@@ -1,5 +1,14 @@
 #include "soxconfig.h"
 
+#ifdef _OPENMP
+  #if _OPENMP >= 200805 /* OpenMP 3.0 */
+    #define HAVE_OPENMP 1
+  #endif
+  #if _OPENMP >= 201107 /* OpenMP 3.1 */
+    #define HAVE_OPENMP_3_1 1
+  #endif
+#endif
+
 #ifdef HAVE_OPENMP
   #include <omp.h>
 #else