From: cristy Date: Thu, 21 Jan 2010 16:46:08 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~10090 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43596fe3aaf81c58ecb20333abf372b1408d1951;p=imagemagick --- diff --git a/config/configure.xml b/config/configure.xml index 8de558c3d..719666f78 100644 --- a/config/configure.xml +++ b/config/configure.xml @@ -10,7 +10,7 @@ - + diff --git a/configure b/configure index 1977e218d..273c6ff6b 100755 --- a/configure +++ b/configure @@ -1188,6 +1188,7 @@ enable_bounds_checking enable_osx_universal_binary with_threads enable_openmp +enable_opencl enable_largefile enable_shared enable_static @@ -1909,6 +1910,7 @@ Optional Features: --enable-osx-universal-binary build universal binary on OS X [[default=no]] --disable-openmp do not use OpenMP + --disable-opencl do not use OpenCL --disable-largefile omit support for large files --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] @@ -7424,13 +7426,22 @@ MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS" # Enable support for OpenCL -ac_ext=c +# Check whether --enable-opencl was given. +if test "${enable_opencl+set}" = set; then : + enableval=$enable_opencl; disable_opencl=$enableval +else + disable_opencl='yes' +fi + + +if test "$disable_opencl" = 'yes'; then + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the Microsoft C compiler" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the Microsoft C compiler" >&5 $as_echo_n "checking whether we are using the Microsoft C compiler... " >&6; } if test "${ax_cv_c_compiler_ms+set}" = set; then : $as_echo_n "(cached) " >&6 @@ -7460,13 +7471,13 @@ ax_cv_c_compiler_ms=$ax_compiler_ms fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_ms" >&5 $as_echo "$ax_cv_c_compiler_ms" >&6; } -if test X$ax_compiler_ms = Xno; then : + if test X$ax_compiler_ms = Xno; then : CL_CFLAGS="${PTHREAD_CFLAGS}"; CL_LIBS="${PTHREAD_LIBS} -lm" fi -ax_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CL_CFLAGS $CPPFLAGS" -for ac_header in CL/cl.h OpenCL/cl.h + ax_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CL_CFLAGS $CPPFLAGS" + for ac_header in CL/cl.h OpenCL/cl.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -7480,9 +7491,9 @@ fi done -CPPFLAGS=$ax_save_CPPFLAGS + CPPFLAGS=$ax_save_CPPFLAGS -for ac_header in windows.h + for ac_header in windows.h do : ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" if test "x$ac_cv_header_windows_h" = x""yes; then : @@ -7497,41 +7508,41 @@ done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenCL library" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenCL library" >&5 $as_echo_n "checking for OpenCL library... " >&6; } if test "${ax_cv_check_cl_libcl+set}" = set; then : $as_echo_n "(cached) " >&6 else ax_cv_check_cl_libcl=no -case $host_cpu in - x86_64) ax_check_cl_libdir=lib64 ;; - *) ax_check_cl_libdir=lib ;; -esac -ax_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CL_CFLAGS $CPPFLAGS" -ax_save_LIBS=$LIBS -LIBS="" -ax_check_libs="-lOpenCL -lCL -lclparser" -for ax_lib in $ax_check_libs; do - if test X$ax_compiler_ms = Xyes; then : + case $host_cpu in + x86_64) ax_check_cl_libdir=lib64 ;; + *) ax_check_cl_libdir=lib ;; + esac + ax_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CL_CFLAGS $CPPFLAGS" + ax_save_LIBS=$LIBS + LIBS="" + ax_check_libs="-lOpenCL -lCL -lclparser" + for ax_lib in $ax_check_libs; do + if test X$ax_compiler_ms = Xyes; then : ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'` else ax_try_lib=$ax_lib fi - LIBS="$ax_try_lib $CL_LIBS $ax_save_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + LIBS="$ax_try_lib $CL_LIBS $ax_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# if defined(HAVE_WINDOWS_H) && defined(_WIN32) -# include -# endif -# ifdef HAVE_CL_CL_H -# include -# elif defined(HAVE_OPENCL_CL_H) -# include -# else -# error no CL.h -# endif + # if defined(HAVE_WINDOWS_H) && defined(_WIN32) + # include + # endif + # ifdef HAVE_CL_CL_H + # include + # elif defined(HAVE_OPENCL_CL_H) + # include + # else + # error no CL.h + # endif int main () { @@ -7544,19 +7555,19 @@ if ac_fn_c_try_link "$LINENO"; then : ax_cv_check_cl_libcl=$ax_try_lib; break else ax_check_cl_nvidia_flags="-L/usr/$ax_check_cl_libdir/nvidia" LIBS="$ax_try_lib $ax_check_cl_nvidia_flags $CL_LIBS $ax_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# if defined(HAVE_WINDOWS_H) && defined(_WIN32) -# include -# endif -# ifdef HAVE_CL_CL_H -# include -# elif defined(HAVE_OPENCL_CL_H) -# include -# else -# error no CL.h -# endif + # if defined(HAVE_WINDOWS_H) && defined(_WIN32) + # include + # endif + # ifdef HAVE_CL_CL_H + # include + # elif defined(HAVE_OPENCL_CL_H) + # include + # else + # error no CL.h + # endif int main () { @@ -7569,19 +7580,19 @@ if ac_fn_c_try_link "$LINENO"; then : ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_nvidia_flags"; break else ax_check_cl_dylib_flag='-framework OpenCL -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries' LIBS="$ax_try_lib $ax_check_cl_dylib_flag $CL_LIBS $ax_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# if defined(HAVE_WINDOWS_H) && defined(_WIN32) -# include -# endif -# ifdef HAVE_CL_CL_H -# include -# elif defined(HAVE_OPENCL_CL_H) -# include -# else -# error no CL.h -# endif + # if defined(HAVE_WINDOWS_H) && defined(_WIN32) + # include + # endif + # ifdef HAVE_CL_CL_H + # include + # elif defined(HAVE_OPENCL_CL_H) + # include + # else + # error no CL.h + # endif int main () { @@ -7601,23 +7612,23 @@ rm -f core conftest.err conftest.$ac_objext \ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -done + done -if test "X$ax_cv_check_cl_libcl" = Xno -a X$no_x = Xyes; then : + if test "X$ax_cv_check_cl_libcl" = Xno -a X$no_x = Xyes; then : LIBS='-framework OpenCL' - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# if defined(HAVE_WINDOWS_H) && defined(_WIN32) -# include -# endif -# ifdef HAVE_CL_CL_H -# include -# elif defined(HAVE_OPENCL_CL_H) -# include -# else -# error no CL.h -# endif + # if defined(HAVE_WINDOWS_H) && defined(_WIN32) + # include + # endif + # ifdef HAVE_CL_CL_H + # include + # elif defined(HAVE_OPENCL_CL_H) + # include + # else + # error no CL.h + # endif int main () { @@ -7633,25 +7644,26 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -LIBS=$ax_save_LIBS -CPPFLAGS=$ax_save_CPPFLAGS + LIBS=$ax_save_LIBS + CPPFLAGS=$ax_save_CPPFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cl_libcl" >&5 $as_echo "$ax_cv_check_cl_libcl" >&6; } -if test "X$ax_cv_check_cl_libcl" = Xno; then : + if test "X$ax_cv_check_cl_libcl" = Xno; then : no_cl=yes; CL_CFLAGS=""; CL_LIBS="" else CL_LIBS="$ax_cv_check_cl_libcl $CL_LIBS"; $as_echo "#define _OPENCL 1" >>confdefs.h fi -ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi @@ -8181,13 +8193,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:8184: $ac_compile\"" >&5) + (eval echo "\"\$as_me:8196: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:8187: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:8199: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:8190: output\"" >&5) + (eval echo "\"\$as_me:8202: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -9378,7 +9390,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 9381 "configure"' > conftest.$ac_ext + echo '#line 9393 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -11463,11 +11475,11 @@ else -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:11466: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11478: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11470: \$? = $ac_status" >&5 + echo "$as_me:11482: \$? = $ac_status" >&5 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. @@ -11802,11 +11814,11 @@ else -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:11805: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11817: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11809: \$? = $ac_status" >&5 + echo "$as_me:11821: \$? = $ac_status" >&5 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. @@ -11907,11 +11919,11 @@ else -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:11910: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11922: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11914: \$? = $ac_status" >&5 + echo "$as_me:11926: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11962,11 +11974,11 @@ else -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:11965: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11977: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11969: \$? = $ac_status" >&5 + echo "$as_me:11981: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14332,7 +14344,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 14335 "configure" +#line 14347 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14428,7 +14440,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 14431 "configure" +#line 14443 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16384,11 +16396,11 @@ else -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:16387: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16399: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16391: \$? = $ac_status" >&5 + echo "$as_me:16403: \$? = $ac_status" >&5 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. @@ -16483,11 +16495,11 @@ else -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:16486: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16498: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16490: \$? = $ac_status" >&5 + echo "$as_me:16502: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16535,11 +16547,11 @@ else -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:16538: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16550: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16542: \$? = $ac_status" >&5 + echo "$as_me:16554: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17947,7 +17959,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17950 "configure" +#line 17962 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/configure.ac b/configure.ac index 98b5d5526..87a95b0c1 100755 --- a/configure.ac +++ b/configure.ac @@ -335,7 +335,7 @@ case "$host" in LDFLAGS="$LDFLAGS -L/sw/lib" fi dnl OS X universal binary support, requires --disable-dependency-tracking - AC_ARG_ENABLE(osx-universal-binary, + AC_ARG_ENABLE([osx-universal-binary], AC_HELP_STRING([--enable-osx-universal-binary], [build universal binary on OS X [[default=no]]]), [build_osxuniversal="${enableval}"], [build_osxuniversal=no]) @@ -386,7 +386,7 @@ MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS" AC_SUBST(OPENMP_CFLAGS) # Enable support for OpenCL -AX_CHECK_CL +AX_CHECK_CL([C]) CFLAGS="$CL_CFLAGS $CFLAGS" LIBS="$CL_LIBS $LIBS" AC_SUBST(CL_CFLAGS) diff --git a/m4/ax_check_cl.m4 b/m4/ax_check_cl.m4 index 5eafeaee2..a1f2cbb88 100644 --- a/m4/ax_check_cl.m4 +++ b/m4/ax_check_cl.m4 @@ -39,72 +39,80 @@ AC_DEFUN([AX_CHECK_CL], AC_REQUIRE([AC_PROG_SED])dnl AC_REQUIRE([ACX_PTHREAD])dnl -AC_LANG_PUSH([C]) -AX_LANG_COMPILER_MS -AS_IF([test X$ax_compiler_ms = Xno], - [CL_CFLAGS="${PTHREAD_CFLAGS}"; CL_LIBS="${PTHREAD_LIBS} -lm"]) - -ax_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CL_CFLAGS $CPPFLAGS" -AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h]) -CPPFLAGS=$ax_save_CPPFLAGS - -AC_CHECK_HEADERS([windows.h]) - -m4_define([AX_CHECK_CL_PROGRAM], - [AC_LANG_PROGRAM([[ -# if defined(HAVE_WINDOWS_H) && defined(_WIN32) -# include -# endif -# ifdef HAVE_CL_CL_H -# include -# elif defined(HAVE_OPENCL_CL_H) -# include -# else -# error no CL.h -# endif]], - [[clCreateContextFromType(0,0,0,0,0)]])]) - -AC_CACHE_CHECK([for OpenCL library], [ax_cv_check_cl_libcl], -[ax_cv_check_cl_libcl=no -case $host_cpu in - x86_64) ax_check_cl_libdir=lib64 ;; - *) ax_check_cl_libdir=lib ;; -esac -ax_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CL_CFLAGS $CPPFLAGS" -ax_save_LIBS=$LIBS -LIBS="" -ax_check_libs="-lOpenCL -lCL -lclparser" -for ax_lib in $ax_check_libs; do - AS_IF([test X$ax_compiler_ms = Xyes], - [ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'`], - [ax_try_lib=$ax_lib]) - LIBS="$ax_try_lib $CL_LIBS $ax_save_LIBS" -AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], - [ax_cv_check_cl_libcl=$ax_try_lib; break], - [ax_check_cl_nvidia_flags="-L/usr/$ax_check_cl_libdir/nvidia" LIBS="$ax_try_lib $ax_check_cl_nvidia_flags $CL_LIBS $ax_save_LIBS" - AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], - [ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_nvidia_flags"; break], - [ax_check_cl_dylib_flag='-framework OpenCL -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries' LIBS="$ax_try_lib $ax_check_cl_dylib_flag $CL_LIBS $ax_save_LIBS" - AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], - [ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_dylib_flag"; break])])]) -done - -AS_IF([test "X$ax_cv_check_cl_libcl" = Xno -a X$no_x = Xyes], - [LIBS='-framework OpenCL' - AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], - [ax_cv_check_cl_libcl=$LIBS])]) - -LIBS=$ax_save_LIBS -CPPFLAGS=$ax_save_CPPFLAGS]) - -AS_IF([test "X$ax_cv_check_cl_libcl" = Xno], - [no_cl=yes; CL_CFLAGS=""; CL_LIBS=""], - [CL_LIBS="$ax_cv_check_cl_libcl $CL_LIBS"; AC_DEFINE([_OPENCL], [1], - [Define this for the OpenCL Accelerator])]) -AC_LANG_POP([C]) +AC_ARG_ENABLE([opencl], + [AC_HELP_STRING([--disable-opencl], + [do not use OpenCL])], + [disable_opencl=$enableval], + [disable_opencl='yes']) +if test "$disable_opencl" = 'yes'; then + AC_LANG_PUSH([$1]) + AX_LANG_COMPILER_MS + AS_IF([test X$ax_compiler_ms = Xno], + [CL_CFLAGS="${PTHREAD_CFLAGS}"; CL_LIBS="${PTHREAD_LIBS} -lm"]) + + ax_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CL_CFLAGS $CPPFLAGS" + AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h]) + CPPFLAGS=$ax_save_CPPFLAGS + + AC_CHECK_HEADERS([windows.h]) + + m4_define([AX_CHECK_CL_PROGRAM], + [AC_LANG_PROGRAM([[ + # if defined(HAVE_WINDOWS_H) && defined(_WIN32) + # include + # endif + # ifdef HAVE_CL_CL_H + # include + # elif defined(HAVE_OPENCL_CL_H) + # include + # else + # error no CL.h + # endif]], + [[clCreateContextFromType(0,0,0,0,0)]])]) + + AC_CACHE_CHECK([for OpenCL library], [ax_cv_check_cl_libcl], + [ax_cv_check_cl_libcl=no + case $host_cpu in + x86_64) ax_check_cl_libdir=lib64 ;; + *) ax_check_cl_libdir=lib ;; + esac + ax_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CL_CFLAGS $CPPFLAGS" + ax_save_LIBS=$LIBS + LIBS="" + ax_check_libs="-lOpenCL -lCL -lclparser" + for ax_lib in $ax_check_libs; do + AS_IF([test X$ax_compiler_ms = Xyes], + [ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'`], + [ax_try_lib=$ax_lib]) + LIBS="$ax_try_lib $CL_LIBS $ax_save_LIBS" + AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], + [ax_cv_check_cl_libcl=$ax_try_lib; break], + [ax_check_cl_nvidia_flags="-L/usr/$ax_check_cl_libdir/nvidia" LIBS="$ax_try_lib $ax_check_cl_nvidia_flags $CL_LIBS $ax_save_LIBS" + AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], + [ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_nvidia_flags"; break], + [ax_check_cl_dylib_flag='-framework OpenCL -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries' LIBS="$ax_try_lib $ax_check_cl_dylib_flag $CL_LIBS $ax_save_LIBS" + AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], + [ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_dylib_flag"; break])])]) + done + + AS_IF([test "X$ax_cv_check_cl_libcl" = Xno -a X$no_x = Xyes], + [LIBS='-framework OpenCL' + AC_LINK_IFELSE([AX_CHECK_CL_PROGRAM], + [ax_cv_check_cl_libcl=$LIBS])]) + + LIBS=$ax_save_LIBS + CPPFLAGS=$ax_save_CPPFLAGS]) + + AS_IF([test "X$ax_cv_check_cl_libcl" = Xno], + [no_cl=yes; CL_CFLAGS=""; CL_LIBS=""], + [CL_LIBS="$ax_cv_check_cl_libcl $CL_LIBS"; AC_DEFINE([_OPENCL], [1], + [Define this for the OpenCL Accelerator])]) + AC_LANG_POP([$1]) +fi + AC_SUBST([CL_CFLAGS]) AC_SUBST([CL_LIBS]) ])dnl