diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2008-11-25 03:44:36 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2008-11-25 03:44:36 +0000 |
| commit | 19691ca73aa8b9f8ec1b86dac1b425b6258b242d (patch) | |
| tree | f1181059eab3ceca14a83761348452210d55a0c5 | |
| parent | Add an option to the preferences to _only_ snap the node closest to the mouse... (diff) | |
| download | inkscape-19691ca73aa8b9f8ec1b86dac1b425b6258b242d.tar.gz inkscape-19691ca73aa8b9f8ec1b86dac1b425b6258b242d.zip | |
Fixed OpenMP dependency to be optional.
(bzr r6900)
| -rw-r--r-- | configure.ac | 20 | ||||
| -rw-r--r-- | src/display/nr-filter-gaussian.cpp | 14 |
2 files changed, 29 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 37c4ddb04..d33502000 100644 --- a/configure.ac +++ b/configure.ac @@ -144,10 +144,16 @@ dnl ****************************** dnl Check for OpenMP dnl ****************************** -AX_OPENMP(,AC_MSG_ERROR([Inkscape requires OpenMP support to build])) -dnl We have it, now set up the flags -CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" -AC_CHECK_HEADER(omp.h) +AX_OPENMP([openmp_ok=yes],[openmp_ok=no]) +AC_MSG_CHECKING([for OpenMP support]) +dnl a bit odd, but AX_OPENMP does its own check message, so we're not wrapping it at the moment +AC_MSG_RESULT([$openmp_ok]) +if test "x$openmp_ok" = "xyes"; then + dnl We have it, now set up the flags + CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" + AC_CHECK_HEADER(omp.h) +fi + dnl ****************************** dnl Check for libpng @@ -672,7 +678,11 @@ if test "x$cairo_pdf" = "xyes"; then fi dnl Shouldn't we test for libpng and libz? -INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp" +if test "x$openmp_ok" = "xyes"; then + INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp" +else + INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz" +fi AC_CHECK_HEADER(popt.h, [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"], diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 4cbd7957d..d92a7f7f3 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -19,7 +19,9 @@ #include <cstdlib> #include <glib.h> #include <limits> +#if HAVE_OPENMP #include <omp.h> +#endif //HAVE_OPENMP #include "2geom/isnan.h" @@ -271,9 +273,15 @@ filter2D_IIR(PT *const dest, int const dstr1, int const dstr2, int const n1, int const n2, IIRValue const b[N+1], double const M[N*N], IIRValue *const tmpdata[], int const num_threads) { +#if HAVE_OPENMP #pragma omp parallel for num_threads(num_threads) +#endif // HAVE_OPENMP for ( int c2 = 0 ; c2 < n2 ; c2++ ) { +#if HAVE_OPENMP unsigned int tid = omp_get_thread_num(); +#else + unsigned int tid = 0; +#endif // HAVE_OPENMP // corresponding line in the source and output buffer PT const * srcimg = src + c2*sstr2; PT * dstimg = dest + c2*dstr2 + n1*dstr1; @@ -334,7 +342,9 @@ filter2D_FIR(PT *const dst, int const dstr1, int const dstr2, // Past pixels seen (to enable in-place operation) PT history[scr_len+1][PC]; +#if HAVE_OPENMP #pragma omp parallel for num_threads(num_threads) private(history) +#endif // HAVE_OPENMP for ( int c2 = 0 ; c2 < n2 ; c2++ ) { // corresponding line in the source buffer @@ -548,7 +558,11 @@ int FilterGaussian::render(FilterSlot &slot, FilterUnits const &units) double const deviation_x_org = _deviation_x * NR::expansionX(trans); double const deviation_y_org = _deviation_y * NR::expansionY(trans); int const PC = NR_PIXBLOCK_BPP(in); +#if HAVE_OPENMP int const NTHREADS = std::max(1,std::min(8,prefs->getInt("/options/threading/numthreads",omp_get_num_procs()))); +#else + int const NTHREADS = 1; +#endif // HAVE_OPENMP // Subsampling constants int const quality = prefs->getInt("/options/blurquality/value"); |
