configure.ac 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2009, 2010, 2011 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. AC_INIT([StarPU],0.4, [starpu-bugs@lists.gforge.inria.fr], starpu)
  17. AC_CONFIG_SRCDIR(include/starpu.h)
  18. AC_CONFIG_AUX_DIR([build-aux])
  19. AC_CANONICAL_SYSTEM
  20. AM_INIT_AUTOMAKE([-Wall -Werror foreign])
  21. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  22. AC_PREREQ(2.60)
  23. AC_PROG_CC
  24. AC_PROG_CPP
  25. AC_PROG_SED
  26. AC_PROG_LN_S
  27. AC_PROG_F77
  28. AC_LIBTOOL_WIN32_DLL
  29. AC_PROG_LIBTOOL([win32-dll])
  30. AC_PROG_INSTALL
  31. AC_PROG_MKDIR_P
  32. AC_PROG_LN_S
  33. AC_HEADER_STDC
  34. AC_C_RESTRICT
  35. AC_PATH_PROGS([STARPU_MS_LIB], [lib])
  36. AC_ARG_VAR([STARPU_MS_LIB], [Path to Microsoft's Visual Studio `lib' tool])
  37. AM_CONDITIONAL([STARPU_HAVE_MS_LIB], [test "x$STARPU_MS_LIB" != "x"])
  38. case "$target" in
  39. *-*-mingw*|*-*-cygwin*)
  40. starpu_windows=yes
  41. libext=a
  42. AC_DEFINE(STARPU_HAVE_WINDOWS, [], [Define this on windows.])
  43. ;;
  44. esac
  45. AM_CONDITIONAL([STARPU_HAVE_WINDOWS], [test "x$starpu_windows" = "xyes"])
  46. # on Darwin, GCC targets i386 by default, so we don't have atomic ops
  47. AC_CHECK_SIZEOF([void *])
  48. if test x$SIZEOF_VOID_P = x4; then
  49. case "$target" in
  50. i386-*darwin*) CFLAGS+=" -march=i686 " ;;
  51. esac
  52. fi
  53. # This will be useful for program which use CUDA (and .cubin files) which need
  54. # some path to the CUDA code at runtime.
  55. AC_DEFINE_UNQUOTED(STARPU_BUILD_DIR, "$PWD", [location of StarPU build directory])
  56. AC_SUBST(STARPU_BUILD_DIR, $PWD)
  57. case "${srcdir}" in
  58. /*) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo ${srcdir})", [location of StarPU sources])
  59. AC_SUBST(STARPU_SRC_DIR, "$(eval echo ${srcdir})") ;;
  60. *) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})", [location of StarPU sources])
  61. AC_SUBST(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})") ;;
  62. esac
  63. AC_CHECK_LIB([pthread], [pthread_create])
  64. AC_COMPILE_IFELSE(
  65. AC_LANG_PROGRAM([[
  66. #include <pthread.h>
  67. ]], [[ pthread_t t; pthread_create(&t, NULL, NULL, NULL); ]]),,
  68. AC_MSG_ERROR([pthread_create unavailable]))
  69. AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
  70. AC_HAVE_LIBRARY([wsock32])
  71. AC_CHECK_FUNCS([sysconf])
  72. AC_CHECK_FUNC([pthread_spin_lock], have_pthread_spin_lock=yes, have_pthread_spin_lock=no)
  73. if test x$have_pthread_spin_lock = xyes; then
  74. AC_DEFINE(HAVE_PTHREAD_SPIN_LOCK,[],[pthread_spin_lock is available])
  75. fi
  76. # yes, that's non portable, but it's still better than sched_setaffinity
  77. AC_CHECK_FUNCS(pthread_setaffinity_np)
  78. # There is no posix_memalign on Mac OS X, only memalign
  79. AC_CHECK_FUNCS([posix_memalign], [AC_DEFINE([STARPU_HAVE_POSIX_MEMALIGN], [1], [Define to 1 if you have the `posix_memalign' function.])])
  80. AC_CHECK_FUNCS([memalign], [AC_DEFINE([STARPU_HAVE_MEMALIGN], [1], [Define to 1 if you have the `memalign' function.])])
  81. # Some systems don't have drand48
  82. AC_CHECK_FUNC([drand48], have_drand48=yes, have_drand48=no)
  83. # Maybe the user still does not want to use the provided drand48
  84. AC_ARG_ENABLE(default-drand48, [AS_HELP_STRING([--disable-default-drand48],
  85. [Do not use the default version of drand48])],
  86. enable_default_drand48=$enableval, enable_default_drand48=yes)
  87. if test x$have_drand48 = xyes -a x$enable_default_drand48 = xyes ; then
  88. AC_DEFINE([starpu_srand48(seed)],[srand48(seed)],[srand48 equivalent function])
  89. AC_DEFINE([starpu_drand48()],[drand48()],[drand48 equivalent function])
  90. AC_DEFINE([starpu_erand48(xsubi)],[erand48(xsubi)],[erand48 equivalent function])
  91. else
  92. AC_DEFINE([starpu_srand48(seed)],[srand(seed)],[srand48 equivalent function])
  93. AC_DEFINE([starpu_drand48()],[((double)(rand()) / RAND_MAX)],[drand48 equivalent function])
  94. AC_DEFINE([starpu_erand48(xsubi)],[starpu_drand48()],[erand48 equivalent function])
  95. fi
  96. AC_CHECK_HEADERS([malloc.h], [AC_DEFINE([STARPU_HAVE_MALLOC_H], [1], [Define to 1 if you have the <malloc.h> header file.])])
  97. # This defines HAVE_SYNC_VAL_COMPARE_AND_SWAP
  98. STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP
  99. # This defines HAVE_SYNC_BOOL_COMPARE_AND_SWAP
  100. STARPU_CHECK_SYNC_BOOL_COMPARE_AND_SWAP
  101. # This defines HAVE_SYNC_FETCH_AND_ADD
  102. STARPU_CHECK_SYNC_FETCH_AND_ADD
  103. # This defines HAVE_SYNC_FETCH_AND_OR
  104. STARPU_CHECK_SYNC_FETCH_AND_OR
  105. # This defines HAVE_SYNC_LOCK_TEST_AND_SET
  106. STARPU_CHECK_SYNC_LOCK_TEST_AND_SET
  107. # This defines HAVE_SYNC_SYNCHRONIZE
  108. STARPU_CHECK_SYNC_SYNCHRONIZE
  109. CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE "
  110. AC_SEARCH_LIBS([set_mempolicy],[numa],[enable_libnuma=yes],[enable_libnuma=no])
  111. AC_MSG_CHECKING(whether libnuma is available)
  112. AC_MSG_RESULT($enable_libnuma)
  113. if test x$enable_libnuma = xyes; then
  114. AC_DEFINE(STARPU_HAVE_LIBNUMA,[],[libnuma is available])
  115. fi
  116. ###############################################################################
  117. # #
  118. # CPUs settings #
  119. # #
  120. ###############################################################################
  121. AC_MSG_CHECKING(maximum number of CPUs)
  122. AC_ARG_ENABLE(nmaxcpus, [AS_HELP_STRING([--enable-nmaxcpus=<number>],
  123. [maximum number of CPUs])],
  124. nmaxcpus=$enableval, nmaxcpus=16)
  125. AC_MSG_RESULT($nmaxcpus)
  126. # TODO: rename to STARPU_MAXCPUS for coherency with CUDA/OpenCL?
  127. AC_DEFINE_UNQUOTED(STARPU_NMAXCPUS, [$nmaxcpus], [Maximum number of CPUs supported])
  128. AC_MSG_CHECKING(whether CPUs should be used)
  129. AC_ARG_ENABLE(cpu, [AS_HELP_STRING([--disable-cpu],
  130. [do not use the CPU(s)])],
  131. enable_cpu=$enableval, enable_cpu=yes)
  132. AC_MSG_RESULT($enable_cpu)
  133. AC_SUBST(STARPU_USE_CPU, $enable_cpu)
  134. AM_CONDITIONAL(STARPU_USE_CPU, test x$enable_cpu = xyes)
  135. if test x$enable_cpu = xyes; then
  136. AC_DEFINE(STARPU_USE_CPU, [1], [CPU driver is activated])
  137. fi
  138. # How many parallel worker can we support ?
  139. nmaxcombinedworkers=`expr 2 \* $nmaxcpus`
  140. AC_DEFINE_UNQUOTED(STARPU_NMAX_COMBINEDWORKERS,
  141. [$nmaxcombinedworkers], [Maximum number of worker combinations])
  142. ###############################################################################
  143. # #
  144. # CUDA settings #
  145. # #
  146. ###############################################################################
  147. AC_MSG_CHECKING(maximum number of CUDA devices)
  148. AC_ARG_ENABLE(maxcudadev, [AS_HELP_STRING([--enable-maxcudadev=<number>],
  149. [maximum number of CUDA devices])],
  150. nmaxcudadev=$enableval, nmaxcudadev=4)
  151. AC_MSG_RESULT($nmaxcudadev)
  152. AC_DEFINE_UNQUOTED(STARPU_MAXCUDADEVS, [$nmaxcudadev],
  153. [maximum number of CUDA devices])
  154. AC_ARG_ENABLE(cuda, [AS_HELP_STRING([--disable-cuda],
  155. [do not use CUDA device(s)])],, [enable_cuda=maybe])
  156. #AC_MSG_CHECKING(whether CUDA is available)
  157. AC_ARG_WITH(cuda-dir,
  158. [AS_HELP_STRING([--with-cuda-dir=<path>],
  159. [specify CUDA installation directory (default is /usr/local/cuda/)])],
  160. [
  161. cuda_dir="$withval"
  162. # in case this was not explicit yet
  163. enable_cuda=yes
  164. ], cuda_dir=/usr/local/cuda/)
  165. AC_ARG_WITH(cuda-include-dir,
  166. [AS_HELP_STRING([--with-cuda-include-dir=<path>],
  167. [specify where CUDA headers are installed])],
  168. [
  169. cuda_include_dir="$withval"
  170. # in case this was not explicit yet
  171. enable_cuda=yes
  172. ], [cuda_include_dir=no])
  173. AC_ARG_WITH(cuda-lib-dir,
  174. [AS_HELP_STRING([--with-cuda-lib-dir=<path>],
  175. [specify where CUDA libraries are installed])],
  176. [
  177. cuda_lib_dir="$withval"
  178. # in case this was not explicit yet
  179. enable_cuda=yes
  180. ], [cuda_lib_dir=no])
  181. if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
  182. ! test -d "$cuda_dir" && test -d "/c/cuda" && cuda_dir=/c/cuda
  183. ! test -d "$cuda_dir" && test -d "/cygdrive/c/cuda" && cuda_dir=/cygdrive/c/cuda
  184. if test x$cuda_include_dir = xno; then
  185. cuda_include_dir="$cuda_dir/include/"
  186. fi
  187. if test -d "$cuda_include_dir"; then
  188. CPPFLAGS="${CPPFLAGS} -I$cuda_include_dir "
  189. STARPU_CUDA_CPPFLAGS="-I$cuda_include_dir"
  190. NVCCFLAGS="${NVCCFLAGS} -I$cuda_include_dir "
  191. fi
  192. # do we have a valid CUDA setup ?
  193. have_valid_cuda=yes
  194. AC_CHECK_HEADER([cuda.h],,[have_valid_cuda=no])
  195. # we are looking for the proper option in LDFLAGS, so we save the
  196. # current value of LDFLAGS so that we can add new things in it and
  197. # restore it in case it's not working.
  198. SAVED_LDFLAGS="${LDFLAGS}"
  199. if test x$cuda_lib_dir = xno; then
  200. found_cudalib=no
  201. if test -d "$cuda_dir/lib/"; then
  202. LDFLAGS="${SAVED_LDFLAGS} -L$cuda_dir/lib/ "
  203. STARPU_CUDA_LDFLAGS="-L$cuda_dir/lib/"
  204. AC_HAVE_LIBRARY([cuda],[found_cudalib=yes],[found_cudalib=no])
  205. fi
  206. if test x$found_cudalib=xno -a -d "$cuda_dir/lib64/"; then
  207. LDFLAGS="${SAVED_LDFLAGS} -L$cuda_dir/lib64/ "
  208. STARPU_CUDA_LDFLAGS="-L$cuda_dir/lib64/"
  209. fi
  210. else
  211. if test -d "$cuda_lib_dir"; then
  212. LDFLAGS="${LDFLAGS} -L$cuda_lib_dir "
  213. STARPU_CUDA_LDFLAGS="-L$cuda_lib_dir "
  214. fi
  215. fi
  216. AC_HAVE_LIBRARY([cuda],[],[have_valid_cuda=no])
  217. # To detect if we have a recent enough CUDA lib
  218. AC_HAVE_LIBRARY([cudart],[],[have_valid_cuda=no])
  219. # we also check that CUBLAS is available
  220. AC_HAVE_LIBRARY([cublas],,[have_valid_cuda=no])
  221. # in case CUDA was explicitely required, but is not available, this is an error
  222. if test x$enable_cuda = xyes -a x$have_valid_cuda = no; then
  223. AC_MSG_ERROR([cannot find CUDA])
  224. fi
  225. # now we enable CUDA if and only if a proper setup is available
  226. enable_cuda=$have_valid_cuda
  227. fi
  228. AC_MSG_CHECKING(whether CUDA should be used)
  229. AC_MSG_RESULT($enable_cuda)
  230. AC_SUBST(STARPU_USE_CUDA, $enable_cuda)
  231. AM_CONDITIONAL(STARPU_USE_CUDA, test x$enable_cuda = xyes)
  232. if test x$enable_cuda = xyes; then
  233. AC_DEFINE(STARPU_USE_CUDA, [1], [CUDA support is activated])
  234. # On Darwin, the libstdc++ dependency is not automatically added by nvcc
  235. # case "$target" in
  236. # *-*darwin*) AC_HAVE_LIBRARY([stdc++], []) ;;
  237. # #*-*darwin*) AC_HAVE_LIBRARY([stdc++], [STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"]) ;;
  238. # esac
  239. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcuda"
  240. AC_SUBST(STARPU_CUDA_LDFLAGS)
  241. AC_SUBST(STARPU_CUDA_CPPFLAGS)
  242. #in case this is a 64bit setup, we tell nvcc to use a -m64 flag
  243. AC_CHECK_SIZEOF([void *])
  244. if test x$SIZEOF_VOID_P = x8; then
  245. NVCCFLAGS="${NVCCFLAGS} -m64"
  246. AC_SUBST(NVCCFLAGS)
  247. fi
  248. AC_PATH_PROG([NVCC], [nvcc], [nvcc], [$cuda_dir/bin:$PATH:/usr/local/bin:/usr/bin:/bin], [AC_MSG_WARN(Cannot find nvcc.)])
  249. fi
  250. enable_magma=no
  251. if test x$enable_cuda = xyes; then
  252. # Should we use the MAGMA library (instead or in addition to CUBLAS)
  253. magma_dir=/usr/local # default
  254. enable_magma=maybe
  255. AC_ARG_WITH(magma, [AS_HELP_STRING([--with-magma=<path>],
  256. [specify that MAGMA should be used and its installation directory])],
  257. [
  258. if test x$withval = xyes; then
  259. # No path was specified but MAGMA is explicitely enabled
  260. enable_magma=yes
  261. else
  262. if test x$withval = xno; then
  263. # MAGMA is explicitely disabled
  264. enable_magma=no
  265. else
  266. # MAGMA is enabled and the PATH is given in $withval
  267. enable_magma=yes
  268. magma_dir="$withval"
  269. fi
  270. fi
  271. ], [])
  272. # Do we have a valid MAGMA setup ?
  273. if test x$enable_magma = xyes -o x$enable_magma = xmaybe; then
  274. SAVED_LDFLAGS="${LDFLAGS}"
  275. SAVED_CPPFLAGS="${CPPFLAGS}"
  276. if test -d "$magma_dir/lib/"; then
  277. LDFLAGS="${SAVED_LDFLAGS} -L$magma_dir/lib/ "
  278. have_valid_magma=yes
  279. AC_CHECK_LIB(magmablas, main,,[have_valid_magma=no])
  280. AC_CHECK_LIB(magma, magmablas_sgemm,,[have_valid_magma=no])
  281. fi
  282. if test -d "$magma_dir/include/"; then
  283. CPPFLAGS="${SAVED_CPPFLAGS} -I$magma_dir/include/ "
  284. AC_CHECK_HEADER([magmablas.h],,[have_valid_magma=no])
  285. #AC_CHECK_HEADER([magma.h],,[have_valid_magma=no])
  286. fi
  287. if test x$have_valid_magma = xno; then
  288. # If MAGMA was explicitely required, this is an error
  289. if test x$enable_magma = xyes; then
  290. AC_MSG_ERROR([cannot find MAGMA])
  291. fi
  292. # Restore old flags and don't use MAGMA
  293. LDFLAGS="${SAVED_LDFLAGS}"
  294. CPPFLAGS="${SAVED_CPPFLAGS}"
  295. enable_magma=no
  296. else
  297. enable_magma=yes
  298. fi
  299. else
  300. have_valid_magma=no
  301. enable_magma=no
  302. fi
  303. fi
  304. AC_MSG_CHECKING(whether MAGMA should be used)
  305. AC_MSG_RESULT($enable_magma)
  306. if test x$enable_magma = xyes; then
  307. AC_DEFINE(STARPU_HAVE_MAGMA, [1], [use MAGMA library])
  308. fi
  309. # cufftDoubleComplex may not be available on an old CUDA setup
  310. AC_CHECK_TYPE(cufftDoubleComplex,
  311. [have_cufftdoublecomplex=yes],
  312. [have_cufftdoublecomplex=no], [#include <cufft.h>])
  313. AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
  314. if test x$have_cufftdoublecomplex = xyes; then
  315. AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
  316. fi
  317. # The CURAND library is only available since CUDA 3.2
  318. have_curand=$enable_cuda
  319. if test x$enable_cuda = xyes; then
  320. AC_HAVE_LIBRARY([curand],[],[have_curand=no])
  321. fi
  322. AC_MSG_CHECKING(whether CURAND is available)
  323. AC_MSG_RESULT($have_curand)
  324. if test x$have_curand = xyes; then
  325. AC_DEFINE(STARPU_HAVE_CURAND,[1], [CURAND is available])
  326. fi
  327. ###############################################################################
  328. # #
  329. # OpenCL settings #
  330. # #
  331. ###############################################################################
  332. AC_MSG_CHECKING(maximum number of OpenCL devices)
  333. AC_ARG_ENABLE(maxopencldev, [AS_HELP_STRING([--enable-maxopencldev=<number>],
  334. [maximum number of OPENCL devices])],
  335. nmaxopencldev=$enableval, nmaxopencldev=8)
  336. AC_MSG_RESULT($nmaxopencldev)
  337. AC_DEFINE_UNQUOTED(STARPU_MAXOPENCLDEVS, [$nmaxopencldev],
  338. [maximum number of OPENCL devices])
  339. AC_ARG_ENABLE(opencl, [AS_HELP_STRING([--disable-opencl],
  340. [do not use OpenCL device(s)])],, [enable_opencl=maybe])
  341. #AC_MSG_CHECKING(whether OpenCL is available)
  342. AC_ARG_WITH(opencl-dir,
  343. [AS_HELP_STRING([--with-opencl-dir=<path>],
  344. [specify OpenCL installation directory (default is /usr)])],
  345. [
  346. opencl_dir="$withval"
  347. # in case this was not explicit yet
  348. enable_opencl=yes
  349. ], opencl_dir=/usr)
  350. AC_ARG_WITH(opencl-include-dir,
  351. [AS_HELP_STRING([--with-opencl-include-dir=<path>],
  352. [specify where OpenCL headers are installed])],
  353. [
  354. opencl_include_dir="$withval"
  355. # in case this was not explicit yet
  356. enable_opencl=yes
  357. ], [opencl_include_dir=no])
  358. AC_ARG_WITH(opencl-lib-dir,
  359. [AS_HELP_STRING([--with-opencl-lib-dir=<path>],
  360. [specify where OpenCL libraries are installed])],
  361. [
  362. opencl_lib_dir="$withval"
  363. # in case this was not explicit yet
  364. enable_opencl=yes
  365. ], [opencl_lib_dir=no])
  366. if test x$enable_opencl = xyes -o x$enable_opencl = xmaybe; then
  367. if test x$opencl_include_dir = xno; then
  368. opencl_include_dir="$opencl_dir/include"
  369. fi
  370. if test -d "$opencl_include_dir" && test "$opencl_include_dir" != "/usr/include" ; then
  371. CPPFLAGS="${CPPFLAGS} -I$opencl_include_dir "
  372. fi
  373. # do we have a valid OpenCL setup ?
  374. have_valid_opencl=yes
  375. AC_CHECK_HEADER([CL/cl.h],,[have_valid_opencl=no])
  376. # we are looking for the proper option in LDFLAGS, so we save the
  377. # current value of LDFLAGS so that we can add new things in it and
  378. # restore it in case it's not working.
  379. SAVED_LDFLAGS="${LDFLAGS}"
  380. if test x$opencl_lib_dir = xno; then
  381. # Default location
  382. opencl_lib_dir="$opencl_dir/lib/"
  383. fi
  384. if test -d "$opencl_lib_dir"; then
  385. LDFLAGS="${SAVED_LDFLAGS} -L$opencl_lib_dir "
  386. fi
  387. AC_HAVE_LIBRARY([OpenCL],[],[have_valid_opencl=no])
  388. # in case OpenCL was explicitely required, but is not available, this is an error
  389. if test x$enable_opencl = xyes -a x$have_valid_opencl = no; then
  390. AC_MSG_ERROR([cannot find OpenCL])
  391. fi
  392. # now we enable OpenCL if and only if a proper setup is available
  393. enable_opencl=$have_valid_opencl
  394. fi
  395. AC_MSG_CHECKING(whether OpenCL should be used)
  396. AC_MSG_RESULT($enable_opencl)
  397. AC_SUBST(STARPU_USE_OPENCL, $enable_opencl)
  398. AM_CONDITIONAL(STARPU_USE_OPENCL, test x$enable_opencl = xyes)
  399. if test x$enable_opencl = xyes; then
  400. AC_DEFINE(STARPU_USE_OPENCL, [1], [OpenCL support is activated])
  401. CPPFLAGS="${CPPFLAGS} -DSTARPU_OPENCL_DATADIR=${datarootdir}/starpu/opencl"
  402. AC_SUBST(STARPU_OPENCL_DATAdir, "$(eval echo ${datarootdir}/starpu/opencl/examples)")
  403. else
  404. LDFLAGS="${SAVED_LDFLAGS}"
  405. fi
  406. ###############################################################################
  407. # #
  408. # Cell settings #
  409. # #
  410. ###############################################################################
  411. #TODO fix the default dir
  412. AC_ARG_ENABLE(gordon, [AS_HELP_STRING([--enable-gordon],
  413. [use Cell SPUs])],, enable_gordon=maybe)
  414. if test x$enable_gordon = xyes -o x$enable_gordon = xmaybe; then
  415. AC_ARG_WITH(gordon-dir, [AS_HELP_STRING([--with-gordon-dir=<path>],
  416. [specify Gordon installation directory (default is /usr/local/)])],
  417. [
  418. gordon_dir="$withval"
  419. enable_gordon=yes
  420. ], gordon_dir=/usr/local/)
  421. # do we have a valid Gordon setup ?
  422. have_valid_gordon=yes
  423. # can we use dynamic code loading facilities ?
  424. AC_CHECK_LIB(elf, elf_memory,, [have_valid_gordon=no])
  425. AC_CHECK_LIB(spe2, spe_context_create,,[have_valid_gordon=no])
  426. AC_CHECK_FUNC(spe_in_mbox_write, [], [have_valid_gordon=no])
  427. PKG_PROG_PKG_CONFIG
  428. if test -d "$gordon_dir"; then
  429. PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$gordon_dir"
  430. fi
  431. AC_SUBST(PKG_CONFIG_PATH)
  432. PKG_CHECK_MODULES([GORDON], [libgordon], [], have_valid_gordon=no)
  433. CPPFLAGS="${CPPFLAGS} ${GORDON_CFLAGS}"
  434. LIBS="${LIBS} ${GORDON_LIBS}"
  435. # AC_CHECK_FUNC(gordon_init, [gordon], [have_valid_gordon=no])
  436. # in case Gordon was explicitely required, but is not available, this is an error
  437. if test x$enable_gordon = xyes -a x$have_valid_gordon = no; then
  438. AC_MSG_ERROR([cannot find Gordon])
  439. fi
  440. # now we enable Gordon if and only if a proper setup is available
  441. enable_gordon=$have_valid_gordon
  442. fi
  443. AC_MSG_CHECKING(whether GORDON should be used)
  444. AC_MSG_RESULT($enable_gordon)
  445. AC_SUBST(STARPU_USE_GORDON, $enable_gordon)
  446. AM_CONDITIONAL(STARPU_USE_GORDON, test x$enable_gordon = xyes)
  447. if test x$enable_gordon = xyes; then
  448. AC_DEFINE(STARPU_USE_GORDON, [1], [Cell support is enabled])
  449. GORDON_REQUIRES=gordon
  450. fi
  451. AC_SUBST(GORDON_REQUIRES)
  452. AC_MSG_CHECKING(whether blocking drivers should be disabled)
  453. AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--disable-blocking-drivers], [disable blocking drivers])],
  454. enable_blocking=$enableval, enable_blocking=$enable_gordon)
  455. AC_MSG_RESULT($enable_blocking)
  456. if test x$enable_blocking = xno; then
  457. AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
  458. fi
  459. ###############################################################################
  460. # #
  461. # Debug and Performance analysis tools #
  462. # #
  463. ###############################################################################
  464. AC_MSG_CHECKING(whether debug mode should be enabled)
  465. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debug mode])],
  466. enable_debug=$enableval, enable_debug=no)
  467. AC_MSG_RESULT($enable_debug)
  468. if test x$enable_debug = xyes; then
  469. CFLAGS=" -O0 "
  470. else
  471. CFLAGS=" -O3 "
  472. fi
  473. CFLAGS+=" -gdwarf-2 -g3 "
  474. AC_MSG_CHECKING(whether extra checks should be performed)
  475. AC_ARG_ENABLE(fast, [AS_HELP_STRING([--enable-fast],
  476. [do not enforce assertions])],
  477. enable_fast=$enableval, enable_fast=no)
  478. AC_MSG_RESULT($enable_fast)
  479. if test x$enable_fast = xyes; then
  480. AC_DEFINE(STARPU_NO_ASSERT, [1], [disable assertions])
  481. fi
  482. AC_MSG_CHECKING(whether debug messages should be displayed)
  483. AC_ARG_ENABLE(verbose, [AS_HELP_STRING([--enable-verbose],
  484. [display verbose debug messages])],
  485. enable_verbose=$enableval, enable_verbose=no)
  486. AC_MSG_RESULT($enable_verbose)
  487. if test x$enable_verbose = xyes; then
  488. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  489. fi
  490. AC_MSG_CHECKING(whether coverage testing should be enabled)
  491. AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],
  492. [enable coverage checking])],
  493. enable_coverage=$enableval, enable_coverage=no)
  494. AC_MSG_RESULT($enable_coverage)
  495. AC_SUBST(COVERAGE, $enable_coverage)
  496. AM_CONDITIONAL(STARPU_COVERAGE_ENABLED, [test "x$enable_coverage" = "xyes"])
  497. if test x$enable_coverage = xyes; then
  498. CPPFLAGS="${CPPFLAGS} --coverage"
  499. LDFLAGS="${LDFLAGS} --coverage"
  500. fi
  501. # shall we use FxT to generate trace of the execution ?
  502. AC_MSG_CHECKING(whether fxt traces should be generated)
  503. AC_ARG_WITH(fxt, [AS_HELP_STRING([--with-fxt[=<dir>]], [generate fxt traces])],
  504. [
  505. if test x$withval != xno; then
  506. use_fxt=yes
  507. if test x$withval = xyes; then
  508. AC_MSG_RESULT(yes)
  509. use_fxt_from_system=yes
  510. else
  511. # use specified path
  512. # TODO check if the dir is actually containing FxT
  513. use_fxt_from_system=no
  514. fxtdir=$withval
  515. AC_MSG_RESULT(yes using $fxtdir)
  516. AC_SUBST(FXTDIR, $fxtdir)
  517. fi
  518. else
  519. use_fxt=no
  520. AC_MSG_RESULT(no)
  521. fi
  522. ],
  523. [
  524. use_fxt=no
  525. AC_MSG_RESULT(no)
  526. ])
  527. AC_SUBST(STARPU_USE_FXT, $use_fxt)
  528. AM_CONDITIONAL(STARPU_USE_FXT, test x$use_fxt = xyes)
  529. if test x$use_fxt = xyes; then
  530. AC_DEFINE(STARPU_USE_FXT, [1], [enable FxT traces])
  531. AC_DEFINE(CONFIG_FUT, [1], [enable FUT traces])
  532. AC_SUBST(USE_FXTDIR_FROM_USER,$use_fxt_from_system)
  533. if test x$use_fxt_from_system = xno; then
  534. CPPFLAGS="${CPPFLAGS} -I$fxtdir/include/ "
  535. LDFLAGS="${LDFLAGS} -L$fxtdir/lib/ "
  536. fi
  537. # if we use monotonic clocks, FxT uses -lrt
  538. AC_CHECK_LIB(rt, clock_gettime,,AC_MSG_ERROR([cannot find clock_gettime]))
  539. AC_CHECK_LIB(fxt, fut_setup,,AC_MSG_ERROR([cannot find fxt lib]))
  540. AC_CHECK_HEADER([fxt/fxt.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  541. AC_CHECK_HEADER([fxt/fut.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  542. fi
  543. AC_MSG_CHECKING(whether performance debugging should be enabled)
  544. AC_ARG_ENABLE(perf-debug, [AS_HELP_STRING([--enable-perf-debug],
  545. [enable performance debugging])],
  546. enable_perf_debug=$enableval, enable_perf_debug=no)
  547. AC_MSG_RESULT($enable_perf_debug)
  548. AC_SUBST(STARPU_PERF_DEBUG, $enable_perf_debug)
  549. if test x$enable_perf_debuf = xyes; then
  550. AC_DEFINE(STARPU_PERF_DEBUG, [1], [enable performance debug])
  551. CPPFLAGS="${CPPFLAGS} -pg "
  552. LDFLAGS="${LDFLAGS} -pg "
  553. fi
  554. AC_MSG_CHECKING(whether performance model debugging should be enabled)
  555. AC_ARG_ENABLE(model-debug, [AS_HELP_STRING([--enable-model-debug],
  556. [enable performance model debugging])],
  557. enable_model_debug=$enableval, enable_model_debug=no)
  558. AC_MSG_RESULT($enable_model_debug)
  559. if test x$enable_model_debug = xyes; then
  560. AC_DEFINE(STARPU_MODEL_DEBUG, [1], [enable performance model debug])
  561. fi
  562. AC_MSG_CHECKING(whether statistics should be generated)
  563. AC_ARG_ENABLE(stats, [AS_HELP_STRING([--enable-stats],
  564. [enable statistics])],
  565. enable_stats=$enableval, enable_stats=no)
  566. AC_MSG_RESULT($enable_stats)
  567. AC_SUBST(STATS, $enable_stats)
  568. AC_SUBST(STARPU_DATA_STATS, $enable_stats)
  569. if test x$enable_stats = xyes; then
  570. AC_DEFINE(STARPU_DATA_STATS, [1], [enable statistics])
  571. fi
  572. AC_CHECK_HEADERS([glpk.h])
  573. AC_HAVE_LIBRARY([glpk])
  574. ###############################################################################
  575. # #
  576. # Miscellaneous options for StarPU #
  577. # #
  578. ###############################################################################
  579. AC_MSG_CHECKING(how many buffers can be manipulated per task)
  580. AC_ARG_ENABLE(maxbuffers, [AS_HELP_STRING([--enable-maxbuffers=<nbuffers>],
  581. [maximum number of buffers per task])],
  582. nmaxbuffers=$enableval, nmaxbuffers=8)
  583. AC_MSG_RESULT($nmaxbuffers)
  584. AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
  585. [how many buffers can be manipulated per task])
  586. # We have one memory node shared by all CPU workers, one node per GPU, and
  587. # currently the Cell driver is using the same memory node as the CPU.
  588. maxnodes=1
  589. if test x$enable_cuda = xyes ; then
  590. # we could have used nmaxcudadev + 1, but this would certainly give an
  591. # odd number.
  592. maxnodes=`expr $maxnodes + $nmaxcudadev`
  593. fi
  594. if test x$enable_opencl = xyes ; then
  595. # we could have used nmaxcudadev + 1, but this would certainly give an
  596. # odd number.
  597. maxnodes=`expr $maxnodes + $nmaxopencldev`
  598. fi
  599. # todo: set maxnodes to the next power of 2 greater than maxnodes
  600. AC_MSG_CHECKING(maximum number of memory nodes)
  601. AC_MSG_RESULT($maxnodes)
  602. AC_DEFINE_UNQUOTED(STARPU_MAXNODES, [$maxnodes],
  603. [maximum number of memory nodes])
  604. AC_MSG_CHECKING(whether allocation cache should be used)
  605. AC_ARG_ENABLE(allocation-cache, [AS_HELP_STRING([--enable-allocation-cache],
  606. [enable data allocation cache])],
  607. enable_allocation_cache=$enableval, enable_allocation_cache=no)
  608. AC_MSG_RESULT($enable_allocation_cache)
  609. if test x$enable_allocation_cache = xyes; then
  610. AC_DEFINE(STARPU_USE_ALLOCATION_CACHE, [1], [enable data allocation cache])
  611. fi
  612. AC_ARG_WITH(perf-model-dir, [AS_HELP_STRING([--with-perf-model-dir=<dir>], [specify where performance models shoulds be stored])],
  613. [
  614. if test x$withval = xno; then
  615. AC_MSG_ERROR(--without-perf-model-dir is not a valid option)
  616. fi
  617. perf_model_dir="$withval"
  618. have_explicit_perf_model_dir=yes
  619. AC_DEFINE_UNQUOTED(STARPU_PERF_MODEL_DIR, ["$perf_model_dir"], [performance models location])
  620. ], [
  621. # by default, we put the performance models in
  622. # $HOME/.starpu/sampling/
  623. have_explicit_perf_model_dir=no
  624. perf_model_dir="\$HOME/.starpu/sampling/"
  625. ]
  626. )
  627. AC_MSG_CHECKING(using explicit performance model location)
  628. AC_MSG_RESULT($have_explicit_perf_model_dir)
  629. AC_MSG_CHECKING(performance models location)
  630. AC_MSG_RESULT($perf_model_dir)
  631. # On many multicore CPUs, clock cycles are not synchronized
  632. AC_CHECK_LIB([rt], [clock_gettime])
  633. AC_CHECK_FUNCS([clock_gettime])
  634. # Compute the maximum number of workers (we round it to 16 for alignment
  635. # purposes).
  636. nmaxworkers=`expr 16 \* \( \( $nmaxcpus + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  637. AC_MSG_CHECKING(Maximum number of workers)
  638. AC_MSG_RESULT($nmaxworkers)
  639. AC_DEFINE_UNQUOTED(STARPU_NMAXWORKERS, [$nmaxworkers], [Maximum number of workers])
  640. ###############################################################################
  641. # #
  642. # MPI #
  643. # #
  644. ###############################################################################
  645. AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc[=<path to mpicc>]],
  646. [Path of the mpicc compiler])],
  647. [
  648. if test x$withval = xyes; then
  649. AC_MSG_ERROR(--with-mpicc must be given a pathname)
  650. else
  651. mpicc_path=$withval
  652. fi
  653. ],
  654. [
  655. # nothing was specified: default value is used
  656. AC_PATH_PROG(mpicc_path, mpicc, [no], [])
  657. ])
  658. # We test if the MPICC compiler exists
  659. if test ! -x $mpicc_path; then
  660. #MPICC does not exists or is not executable
  661. AC_MSG_RESULT(The mpicc compiler is not valid)
  662. use_mpi=no
  663. else
  664. use_mpi=yes
  665. fi
  666. AC_MSG_CHECKING(mpicc path)
  667. AC_MSG_RESULT($mpicc_path)
  668. AC_SUBST(MPICC, $mpicc_path)
  669. if test x$use_mpi = xyes; then
  670. cc_or_mpicc=$mpicc_path
  671. else
  672. cc_or_mpicc=$CC
  673. fi
  674. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  675. # If the user specifically asks for it, or if we are in a developer checkout, we enable mpi check
  676. AC_ARG_ENABLE(mpi-check, AC_HELP_STRING([--enable-mpi-check], [Enable execution of MPI testcases]))
  677. running_mpi_check=0
  678. if test -d "$srcdir/.svn" ; then
  679. running_mpi_check=yes
  680. fi
  681. if test x$enable_mpi_check = xyes ; then
  682. running_mpi_check=yes
  683. fi
  684. if test x$enable_mpi_check = xno ; then
  685. running_mpi_check=no
  686. fi
  687. # Check if mpiexec is available
  688. AC_ARG_WITH(mpiexec, [AS_HELP_STRING([--with-mpiexec[=<path to mpiexec>]],
  689. [Path of mpiexec])],
  690. [
  691. if test x$withval = xyes; then
  692. AC_MSG_ERROR(--with-mpiexec must be given a pathname)
  693. else
  694. mpiexec_path=$withval
  695. fi
  696. ],
  697. [
  698. # nothing was specified: look in the path
  699. AC_PATH_PROG(mpiexec_path, mpiexec, [no], [$(dirname $mpicc_path):$PATH])
  700. ])
  701. AC_MSG_CHECKING(whether mpiexec is available)
  702. AC_MSG_RESULT($mpiexec_path)
  703. # We test if MPIEXEC exists
  704. if test ! -x $mpiexec_path; then
  705. #MPIEXEC does not exists or is not executable
  706. AC_MSG_RESULT(The mpiexec script is not valid)
  707. running_mpi_check=no
  708. mpiexec_path=""
  709. fi
  710. AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
  711. if test x$use_mpi = xyes; then
  712. AC_MSG_CHECKING(whether MPI tests should be run)
  713. AC_MSG_RESULT($running_mpi_check)
  714. AC_SUBST(MPIEXEC,$mpiexec_path)
  715. fi
  716. AC_MSG_CHECKING(whether the StarPU MPI library should be generated)
  717. AC_MSG_RESULT($use_mpi)
  718. AC_SUBST(USE_MPI, $use_mpi)
  719. AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
  720. if test x$use_mpi = xyes; then
  721. AC_DEFINE(STARPU_USE_MPI,[],[whether the StarPU MPI library is available])
  722. fi
  723. ###############################################################################
  724. # #
  725. # Examples #
  726. # #
  727. ###############################################################################
  728. AC_ARG_ENABLE(opengl-render, [AS_HELP_STRING([--enable-opengl-render],
  729. [enable OpenGL rendering of some examples])],
  730. enable_opengl_render=$enableval, enable_opengl_render=no)
  731. if test x$enable_opengl_render = xyes; then
  732. AC_CHECK_LIB(glut, glutInit,,AC_MSG_ERROR([cannot find glut]))
  733. AC_CHECK_LIB(GL, glXCreateContext,,AC_MSG_ERROR([cannot find GL]))
  734. AC_CHECK_LIB(GLU, gluLookAt,,AC_MSG_ERROR([cannot find GLU]))
  735. AC_DEFINE(STARPU_OPENGL_RENDER, [1], [enable OpenGL rendering of some examples])
  736. fi
  737. AC_MSG_CHECKING(whether OpenGL rendering is enabled)
  738. AC_SUBST(STARPU_OPENGL_RENDER, $enable_opengl_render)
  739. AC_MSG_RESULT($enable_opengl_render)
  740. have_x11=yes
  741. AC_CHECK_LIB(X11, XOpenDisplay,,[have_x11=no])
  742. if test x$have_x11 = xyes; then
  743. AC_DEFINE(STARPU_HAVE_X11, [1], [enable X11])
  744. fi
  745. # In case there are BLAS kernels that are used by the example applications
  746. # we may specify which library to use. Note that this is not used for StarPU
  747. # itself.
  748. blas_lib=maybe
  749. AC_ARG_ENABLE(blas-lib,
  750. [ --enable-blas-lib[=blaslibname]:
  751. none [default]: no BLAS lib is used
  752. atlas: use ATLAS library
  753. goto: use GotoBLAS library],
  754. [
  755. if test "x$enableval" = "xatlas" ; then
  756. blas_lib=atlas
  757. elif test "x$enableval" = "xgoto" ; then
  758. blas_lib=goto
  759. elif test "x$enableval" = "xnone" ; then
  760. blas_lib=none
  761. elif test x$enableval = xno; then
  762. blas_lib=none
  763. else
  764. echo
  765. echo "Error!"
  766. echo "Unknown BLAS library"
  767. exit -1
  768. fi
  769. ])
  770. if test x$blas_lib = xmaybe -o x$blas_lib = xgoto; then
  771. AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS lib location])],
  772. [
  773. blas_lib=goto
  774. gotodir=$withval
  775. AC_SUBST(GOTODIR, $gotodir)
  776. CPPFLAGS="${CPPFLAGS} -I$gotodir/ "
  777. LDFLAGS="${LDFLAGS} -L$gotodir/ "
  778. ]
  779. )
  780. if test x$blas_lib = xgoto; then
  781. AC_CHECK_LIB(gfortran, main,,)
  782. # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
  783. AC_CHECK_LIB(goto2, sgemm_,, [havegoto2=no])
  784. if test x$havegoto2 = xno; then
  785. AC_CHECK_LIB(goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]))
  786. fi
  787. AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
  788. fi
  789. fi
  790. if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
  791. AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS lib location])],
  792. [
  793. AC_MSG_CHECKING(STARPU_ATLAS location)
  794. blas_lib=atlas
  795. atlasdir=$withval
  796. AC_MSG_RESULT($atlasdir)
  797. AC_SUBST(ATLASDIR, $atlasdir)
  798. CPPFLAGS="${CPPFLAGS} -I$atlasdir/include/ "
  799. LDFLAGS="${LDFLAGS} -L$atlasdir/lib/ "
  800. ]
  801. )
  802. if test x$blas_lib = xatlas; then
  803. # test whether STARPU_ATLAS is actually available
  804. AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
  805. AC_CHECK_LIB(atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
  806. AC_CHECK_LIB(cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
  807. AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
  808. fi
  809. fi
  810. if test x$blas_lib = xmaybe; then
  811. # Should we use MKL ?
  812. AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
  813. [
  814. CPPFLAGS="${CPPFLAGS} $withval"
  815. blas_lib=mkl
  816. ])
  817. AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
  818. [
  819. LDFLAGS="${LDFLAGS} $withval"
  820. blas_lib=mkl
  821. ])
  822. if test x$blas_lib=xmkl; then
  823. AC_DEFINE(STARPU_MKL, [1], [use MKL library])
  824. fi
  825. fi
  826. if test x$blas_lib = xmaybe; then
  827. #perhaps it is possible to use some BLAS lib from the system
  828. use_system_blas=no
  829. AC_SEARCH_LIBS([sgemm_],[blas],use_system_blas=yes,,)
  830. if test x$use_system_blas = xyes; then
  831. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
  832. blas_lib=system
  833. else
  834. blas_lib=none
  835. fi
  836. fi
  837. AM_CONDITIONAL(ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
  838. AM_CONDITIONAL(GOTO_BLAS_LIB, test x$blas_lib = xgoto)
  839. AM_CONDITIONAL(MKL_BLAS_LIB, test x$blas_lib = xmkl)
  840. AM_CONDITIONAL(SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
  841. AM_CONDITIONAL(NO_BLAS_LIB, test x$blas_lib = xnone)
  842. AC_MSG_CHECKING(which BLAS lib should be used)
  843. AC_MSG_RESULT($blas_lib)
  844. AC_SUBST(BLAS_LIB,$blas_lib)
  845. have_fftw=no
  846. have_fftwf=no
  847. have_fftwl=no
  848. PKG_CHECK_MODULES([FFTW], [fftw3], [
  849. AC_DEFINE([STARPU_HAVE_FFTW], [1], [Define to 1 if you have the libfftw3 library.])
  850. AC_SUBST([STARPU_HAVE_FFTW], [1])
  851. have_fftw=yes
  852. ], [:])
  853. AM_CONDITIONAL(STARPU_HAVE_FFTW, [test x$have_fftw = xyes])
  854. PKG_CHECK_MODULES([FFTWF], [fftw3f], [
  855. AC_DEFINE([STARPU_HAVE_FFTWF], [1], [Define to 1 if you have the libfftw3f library.])
  856. AC_SUBST([STARPU_HAVE_FFTWF], [1])
  857. have_fftwf=yes
  858. ], [:])
  859. AM_CONDITIONAL(STARPU_HAVE_FFTWF, [test x$have_fftwf = xyes])
  860. PKG_CHECK_MODULES([FFTWL], [fftw3l], [
  861. AC_DEFINE([STARPU_HAVE_FFTWL], [1], [Define to 1 if you have the libfftw3l library.])
  862. AC_SUBST([HAVE_FFTWFL], [1])
  863. have_fftwl=yes
  864. ], [:])
  865. AM_CONDITIONAL(STARPU_HAVE_FFTWL, [test x$have_fftwl = xyes])
  866. AC_ARG_WITH([hwloc], [AS_HELP_STRING([--without-hwloc], [Disable hwloc (enabled by default)])])
  867. SAVED_LDFLAGS="${LDFLAGS}"
  868. SAVED_CPPFLAGS="${CPPFLAGS}"
  869. AS_IF([test "x$with_hwloc" != "xno"], [
  870. PKG_CHECK_MODULES([HWLOC],[hwloc], [
  871. have_valid_hwloc=yes
  872. have_pkgconfig_hwloc=yes], [
  873. have_valid_hwloc=no
  874. have_pkgconfig_hwloc=no])
  875. AS_IF([test "$have_valid_hwloc" = "no"], [
  876. hwloc_dir="$withval"
  877. CPPFLAGS="${SAVED_CPPFLAGS} -I$hwloc_dir/include"
  878. AC_CHECK_HEADER([hwloc.h],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  879. LDFLAGS="${SAVED_LDFLAGS} -L$hwloc_dir/lib"
  880. AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  881. ])
  882. ])
  883. AS_IF([test "$have_valid_hwloc" = "yes"], [
  884. AC_DEFINE([STARPU_HAVE_HWLOC], [1], [Define to 1 if you have the hwloc library.])
  885. HWLOC_REQUIRES=hwloc
  886. AC_SUBST([STARPU_HAVE_HWLOC], [1])
  887. AS_IF([test "$have_pkgconfig_hwloc" = "no"], [
  888. HWLOC_CFLAGS="-I$hwloc_dir/include"
  889. HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"])
  890. ])
  891. LDFLAGS="${SAVED_LDFLAGS}"
  892. CPPFLAGS="${SAVED_CPPFLAGS}"
  893. AC_MSG_CHECKING(whether hwloc should be used)
  894. AC_MSG_RESULT($have_valid_hwloc)
  895. AC_SUBST(HWLOC_REQUIRES)
  896. # is the header file f77.h available ?
  897. have_f77_h=yes
  898. AC_CHECK_HEADER([f77.h],,[have_f77_h=no])
  899. AC_MSG_CHECKING(whether header file f77.h is available)
  900. AC_MSG_RESULT($have_f77_h)
  901. AC_SUBST(STARPU_HAVE_F77_H, $have_f77_h)
  902. AM_CONDITIONAL(STARPU_HAVE_F77_H, test x$have_f77_h = xyes)
  903. if test x$have_f77_h = xyes; then
  904. AC_DEFINE([STARPU_HAVE_F77_H], [1], [Define to 1 if you have the <f77.h> header file.])
  905. fi
  906. AC_CONFIG_COMMANDS([executable-scripts], [chmod +x ]tests/regression/regression.sh)
  907. AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
  908. AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h)
  909. AC_OUTPUT([
  910. Makefile
  911. src/Makefile
  912. tools/Makefile
  913. libstarpu.pc
  914. examples/Makefile
  915. examples/starpufft/Makefile
  916. examples/stencil/Makefile
  917. tests/Makefile
  918. doc/Makefile
  919. mpi/Makefile
  920. ])