configure.ac 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  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])],
  160. [
  161. cuda_dir="$withval"
  162. # in case this was not explicit yet
  163. enable_cuda=yes
  164. ], cuda_dir=no)
  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. AC_DEFUN([STARPU_CHECK_CUDA],
  182. [
  183. __cuda_dir=$1
  184. if test "$__cuda_dir" != "no" ; then
  185. AC_MSG_CHECKING(whether CUDA is available in $__cuda_dir)
  186. else
  187. AC_MSG_CHECKING(whether CUDA is available)
  188. fi
  189. AC_MSG_RESULT()
  190. SAVED_LDFLAGS="${LDFLAGS}"
  191. if test "$__cuda_dir" != "no" ; then
  192. STARPU_CUDA_LDFLAGS="-L${__cuda_dir}/lib"
  193. LDFLAGS="${SAVED_LDFLAGS} -L${__cuda_dir}/lib"
  194. fi
  195. AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
  196. unset ac_cv_lib_cuda_main
  197. if test "$have_valid_cuda" = "no" ; then
  198. if test "$__cuda_dir" != "no" ; then
  199. STARPU_CUDA_LDFLAGS="-L${__cuda_dir}/lib64"
  200. LDFLAGS="${SAVED_LDFLAGS} -L${__cuda_dir}/lib64"
  201. AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
  202. unset ac_cv_lib_cuda_main
  203. fi
  204. fi
  205. if test "$have_valid_cuda" = "no" ; then
  206. LDFLAGS="${SAVED_LDFLAGS}"
  207. fi
  208. ])
  209. AC_DEFUN([STARPU_CHECK_CUDA_RUNTIME],
  210. [
  211. __cuda_dir=$1
  212. __cuda_include_dir=$2
  213. __cuda_lib_dir=$3
  214. AC_MSG_NOTICE("Checking CUDA RT is available in $__cuda_dir")
  215. SAVED_STARPU_CUDA_LDFLAGS=${STARPU_CUDA_LDFLAGS}
  216. if test "$__cuda_include_dir" = "no" -a "$__cuda_dir" != "no" ; then
  217. __cuda_include_dir="$__cuda_dir/include"
  218. fi
  219. if test "$__cuda_lib_dir" = "no" -a "$__cuda_dir" != "no" ; then
  220. __cuda_lib_dir="$__cuda_dir/lib"
  221. STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
  222. fi
  223. SAVED_CPPFLAGS="$CPPFLAGS"
  224. SAVED_LDFLAGS="${LDFLAGS}"
  225. if test "$__cuda_include_dir" != "no" ; then
  226. CPPFLAGS="${CPPFLAGS} -I$__cuda_include_dir"
  227. fi
  228. AC_CHECK_HEADER([cuda.h],[have_valid_cuda=yes],[have_valid_cuda=no])
  229. unset ac_cv_header_cuda_h
  230. if test "$have_valid_cuda" = "yes" ; then
  231. if test "$__cuda_lib_dir" != "no"; then
  232. LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
  233. fi
  234. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  235. unset ac_cv_lib_cudart_main
  236. if test "$have_valid_cuda" = "no" ; then
  237. if test "$3" = "no" -a "$__cuda_dir" != "no" ; then
  238. __cuda_lib_dir="$__cuda_dir/lib64"
  239. STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
  240. LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
  241. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  242. unset ac_cv_lib_cudart_main
  243. fi
  244. fi
  245. fi
  246. if test "$have_valid_cuda" = "yes" ; then
  247. # we also check that CUBLAS is available
  248. AC_HAVE_LIBRARY([cublas],,[have_valid_cuda=no])
  249. unset ac_cv_lib_cublas_main
  250. fi
  251. if test "$have_valid_cuda" = "no" ; then
  252. CPPFLAGS="${SAVED_CPPFLAGS}"
  253. LDFLAGS="${SAVED_LDFLAGS}"
  254. fi
  255. if test "$have_valid_cuda" = "yes" -a "$__cuda_include_dir" != "no"; then
  256. STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
  257. NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
  258. fi
  259. ])
  260. if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
  261. STARPU_CHECK_CUDA($cuda_dir)
  262. if test "$have_valid_cuda" = "no" ; then
  263. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  264. STARPU_CHECK_CUDA($f)
  265. if test "$have_valid_cuda" = "yes" ; then
  266. break
  267. fi
  268. done
  269. fi
  270. if test "$have_valid_cuda" = "yes" ; then
  271. STARPU_CHECK_CUDA_RUNTIME($cuda_dir, $cuda_include_dir, $cuda_lib_dir)
  272. if test "$have_valid_cuda" = "no" ; then
  273. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  274. STARPU_CHECK_CUDA_RUNTIME($f, "no", "no")
  275. if test "$have_valid_cuda" = "yes" ; then
  276. break
  277. fi
  278. done
  279. fi
  280. fi
  281. # in case CUDA was explicitely required, but is not available, this is an error
  282. if test x$enable_cuda = xyes -a x$have_valid_cuda = no; then
  283. AC_MSG_ERROR([cannot find CUDA])
  284. fi
  285. # now we enable CUDA if and only if a proper setup is available
  286. enable_cuda=$have_valid_cuda
  287. fi
  288. AC_MSG_CHECKING(whether CUDA should be used)
  289. AC_MSG_RESULT($enable_cuda)
  290. AC_SUBST(STARPU_USE_CUDA, $enable_cuda)
  291. AM_CONDITIONAL(STARPU_USE_CUDA, test x$enable_cuda = xyes)
  292. if test x$enable_cuda = xyes; then
  293. AC_DEFINE(STARPU_USE_CUDA, [1], [CUDA support is activated])
  294. # On Darwin, the libstdc++ dependency is not automatically added by nvcc
  295. # case "$target" in
  296. # *-*darwin*) AC_HAVE_LIBRARY([stdc++], []) ;;
  297. # #*-*darwin*) AC_HAVE_LIBRARY([stdc++], [STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"]) ;;
  298. # esac
  299. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcuda"
  300. AC_SUBST(STARPU_CUDA_LDFLAGS)
  301. AC_SUBST(STARPU_CUDA_CPPFLAGS)
  302. #in case this is a 64bit setup, we tell nvcc to use a -m64 flag
  303. AC_CHECK_SIZEOF([void *])
  304. if test x$SIZEOF_VOID_P = x8; then
  305. NVCCFLAGS="${NVCCFLAGS} -m64"
  306. AC_SUBST(NVCCFLAGS)
  307. fi
  308. AC_PATH_PROG([NVCC], [nvcc], [nvcc], [$cuda_dir/bin:$PATH:/usr/local/bin:/usr/bin:/bin], [AC_MSG_WARN(Cannot find nvcc.)])
  309. fi
  310. enable_magma=no
  311. if test x$enable_cuda = xyes; then
  312. # Should we use the MAGMA library (instead or in addition to CUBLAS)
  313. magma_dir=/usr/local # default
  314. enable_magma=maybe
  315. AC_ARG_WITH(magma, [AS_HELP_STRING([--with-magma=<path>],
  316. [specify that MAGMA should be used and its installation directory])],
  317. [
  318. if test x$withval = xyes; then
  319. # No path was specified but MAGMA is explicitely enabled
  320. enable_magma=yes
  321. else
  322. if test x$withval = xno; then
  323. # MAGMA is explicitely disabled
  324. enable_magma=no
  325. else
  326. # MAGMA is enabled and the PATH is given in $withval
  327. enable_magma=yes
  328. magma_dir="$withval"
  329. fi
  330. fi
  331. ], [])
  332. # Do we have a valid MAGMA setup ?
  333. if test x$enable_magma = xyes -o x$enable_magma = xmaybe; then
  334. SAVED_LDFLAGS="${LDFLAGS}"
  335. SAVED_CPPFLAGS="${CPPFLAGS}"
  336. if test -d "$magma_dir/lib/"; then
  337. LDFLAGS="${SAVED_LDFLAGS} -L$magma_dir/lib/ "
  338. have_valid_magma=yes
  339. AC_CHECK_LIB(magmablas, main,,[have_valid_magma=no])
  340. AC_CHECK_LIB(magma, magmablas_sgemm,,[have_valid_magma=no])
  341. fi
  342. if test -d "$magma_dir/include/"; then
  343. CPPFLAGS="${SAVED_CPPFLAGS} -I$magma_dir/include/ "
  344. AC_CHECK_HEADER([magmablas.h],,[have_valid_magma=no])
  345. #AC_CHECK_HEADER([magma.h],,[have_valid_magma=no])
  346. fi
  347. if test x$have_valid_magma = xno; then
  348. # If MAGMA was explicitely required, this is an error
  349. if test x$enable_magma = xyes; then
  350. AC_MSG_ERROR([cannot find MAGMA])
  351. fi
  352. # Restore old flags and don't use MAGMA
  353. LDFLAGS="${SAVED_LDFLAGS}"
  354. CPPFLAGS="${SAVED_CPPFLAGS}"
  355. enable_magma=no
  356. else
  357. enable_magma=yes
  358. fi
  359. else
  360. have_valid_magma=no
  361. enable_magma=no
  362. fi
  363. fi
  364. AC_MSG_CHECKING(whether MAGMA should be used)
  365. AC_MSG_RESULT($enable_magma)
  366. if test x$enable_magma = xyes; then
  367. AC_DEFINE(STARPU_HAVE_MAGMA, [1], [use MAGMA library])
  368. fi
  369. # cufftDoubleComplex may not be available on an old CUDA setup
  370. AC_CHECK_TYPE(cufftDoubleComplex,
  371. [have_cufftdoublecomplex=yes],
  372. [have_cufftdoublecomplex=no], [#include <cufft.h>])
  373. AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
  374. if test x$have_cufftdoublecomplex = xyes; then
  375. AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
  376. fi
  377. # The CURAND library is only available since CUDA 3.2
  378. have_curand=$enable_cuda
  379. if test x$enable_cuda = xyes; then
  380. AC_HAVE_LIBRARY([curand],[],[have_curand=no])
  381. fi
  382. AC_MSG_CHECKING(whether CURAND is available)
  383. AC_MSG_RESULT($have_curand)
  384. if test x$have_curand = xyes; then
  385. AC_DEFINE(STARPU_HAVE_CURAND,[1], [CURAND is available])
  386. fi
  387. ###############################################################################
  388. # #
  389. # OpenCL settings #
  390. # #
  391. ###############################################################################
  392. AC_MSG_CHECKING(maximum number of OpenCL devices)
  393. AC_ARG_ENABLE(maxopencldev, [AS_HELP_STRING([--enable-maxopencldev=<number>],
  394. [maximum number of OPENCL devices])],
  395. nmaxopencldev=$enableval, nmaxopencldev=8)
  396. AC_MSG_RESULT($nmaxopencldev)
  397. AC_DEFINE_UNQUOTED(STARPU_MAXOPENCLDEVS, [$nmaxopencldev],
  398. [maximum number of OPENCL devices])
  399. AC_ARG_ENABLE(opencl, [AS_HELP_STRING([--disable-opencl],
  400. [do not use OpenCL device(s)])],, [enable_opencl=maybe])
  401. #AC_MSG_CHECKING(whether OpenCL is available)
  402. AC_ARG_WITH(opencl-dir,
  403. [AS_HELP_STRING([--with-opencl-dir=<path>],
  404. [specify OpenCL installation directory])],
  405. [
  406. opencl_dir="$withval"
  407. # in case this was not explicit yet
  408. enable_opencl=yes
  409. ], opencl_dir=no)
  410. AC_ARG_WITH(opencl-include-dir,
  411. [AS_HELP_STRING([--with-opencl-include-dir=<path>],
  412. [specify where OpenCL headers are installed])],
  413. [
  414. opencl_include_dir="$withval"
  415. # in case this was not explicit yet
  416. enable_opencl=yes
  417. ], [opencl_include_dir=no])
  418. AC_ARG_WITH(opencl-lib-dir,
  419. [AS_HELP_STRING([--with-opencl-lib-dir=<path>],
  420. [specify where OpenCL libraries are installed])],
  421. [
  422. opencl_lib_dir="$withval"
  423. # in case this was not explicit yet
  424. enable_opencl=yes
  425. ], [opencl_lib_dir=no])
  426. if test x$enable_opencl = xyes -o x$enable_opencl = xmaybe; then
  427. if test x$opencl_include_dir = xno; then
  428. if test x$opencl_dir != xno; then
  429. opencl_include_dir="$opencl_dir/include"
  430. fi
  431. fi
  432. if test -d "$opencl_include_dir" && test "$opencl_include_dir" != "/usr/include" ; then
  433. CPPFLAGS="${CPPFLAGS} -I$opencl_include_dir "
  434. fi
  435. # do we have a valid OpenCL setup ?
  436. have_valid_opencl=yes
  437. AC_CHECK_HEADER([CL/cl.h],,[have_valid_opencl=no])
  438. # we are looking for the proper option in LDFLAGS, so we save the
  439. # current value of LDFLAGS so that we can add new things in it and
  440. # restore it in case it's not working.
  441. SAVED_LDFLAGS="${LDFLAGS}"
  442. if test x$opencl_lib_dir = xno; then
  443. if test x$opencl_dir != xno; then
  444. # Default location
  445. opencl_lib_dir="$opencl_dir/lib/"
  446. fi
  447. fi
  448. if test -d "$opencl_lib_dir"; then
  449. LDFLAGS="${SAVED_LDFLAGS} -L$opencl_lib_dir "
  450. fi
  451. AC_HAVE_LIBRARY([OpenCL],[],[have_valid_opencl=no])
  452. # in case OpenCL was explicitely required, but is not available, this is an error
  453. if test x$enable_opencl = xyes -a x$have_valid_opencl = no; then
  454. AC_MSG_ERROR([cannot find OpenCL])
  455. fi
  456. # now we enable OpenCL if and only if a proper setup is available
  457. enable_opencl=$have_valid_opencl
  458. fi
  459. AC_MSG_CHECKING(whether OpenCL should be used)
  460. AC_MSG_RESULT($enable_opencl)
  461. AC_SUBST(STARPU_USE_OPENCL, $enable_opencl)
  462. AM_CONDITIONAL(STARPU_USE_OPENCL, test x$enable_opencl = xyes)
  463. if test x$enable_opencl = xyes; then
  464. AC_DEFINE(STARPU_USE_OPENCL, [1], [OpenCL support is activated])
  465. CPPFLAGS="${CPPFLAGS} -DSTARPU_OPENCL_DATADIR=${datarootdir}/starpu/opencl"
  466. AC_SUBST(STARPU_OPENCL_DATAdir, "$(eval echo ${datarootdir}/starpu/opencl/examples)")
  467. else
  468. LDFLAGS="${SAVED_LDFLAGS}"
  469. fi
  470. ###############################################################################
  471. # #
  472. # Cell settings #
  473. # #
  474. ###############################################################################
  475. #TODO fix the default dir
  476. AC_ARG_ENABLE(gordon, [AS_HELP_STRING([--enable-gordon],
  477. [use Cell SPUs])],, enable_gordon=maybe)
  478. if test x$enable_gordon = xyes -o x$enable_gordon = xmaybe; then
  479. AC_ARG_WITH(gordon-dir, [AS_HELP_STRING([--with-gordon-dir=<path>],
  480. [specify Gordon installation directory (default is /usr/local/)])],
  481. [
  482. gordon_dir="$withval"
  483. enable_gordon=yes
  484. ], gordon_dir=/usr/local/)
  485. # do we have a valid Gordon setup ?
  486. have_valid_gordon=yes
  487. # can we use dynamic code loading facilities ?
  488. AC_CHECK_LIB(elf, elf_memory,, [have_valid_gordon=no])
  489. AC_CHECK_LIB(spe2, spe_context_create,,[have_valid_gordon=no])
  490. AC_CHECK_FUNC(spe_in_mbox_write, [], [have_valid_gordon=no])
  491. PKG_PROG_PKG_CONFIG
  492. if test -d "$gordon_dir"; then
  493. PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$gordon_dir"
  494. fi
  495. AC_SUBST(PKG_CONFIG_PATH)
  496. PKG_CHECK_MODULES([GORDON], [libgordon], [], have_valid_gordon=no)
  497. CPPFLAGS="${CPPFLAGS} ${GORDON_CFLAGS}"
  498. LIBS="${LIBS} ${GORDON_LIBS}"
  499. # AC_CHECK_FUNC(gordon_init, [gordon], [have_valid_gordon=no])
  500. # in case Gordon was explicitely required, but is not available, this is an error
  501. if test x$enable_gordon = xyes -a x$have_valid_gordon = no; then
  502. AC_MSG_ERROR([cannot find Gordon])
  503. fi
  504. # now we enable Gordon if and only if a proper setup is available
  505. enable_gordon=$have_valid_gordon
  506. fi
  507. AC_MSG_CHECKING(whether GORDON should be used)
  508. AC_MSG_RESULT($enable_gordon)
  509. AC_SUBST(STARPU_USE_GORDON, $enable_gordon)
  510. AM_CONDITIONAL(STARPU_USE_GORDON, test x$enable_gordon = xyes)
  511. if test x$enable_gordon = xyes; then
  512. AC_DEFINE(STARPU_USE_GORDON, [1], [Cell support is enabled])
  513. GORDON_REQUIRES=gordon
  514. fi
  515. AC_SUBST(GORDON_REQUIRES)
  516. AC_MSG_CHECKING(whether blocking drivers should be disabled)
  517. AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--disable-blocking-drivers], [disable blocking drivers])],
  518. enable_blocking=$enableval, enable_blocking=$enable_gordon)
  519. AC_MSG_RESULT($enable_blocking)
  520. if test x$enable_blocking = xno; then
  521. AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
  522. fi
  523. ###############################################################################
  524. # #
  525. # Debug and Performance analysis tools #
  526. # #
  527. ###############################################################################
  528. AC_MSG_CHECKING(whether debug mode should be enabled)
  529. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debug mode])],
  530. enable_debug=$enableval, enable_debug=no)
  531. AC_MSG_RESULT($enable_debug)
  532. if test x$enable_debug = xyes; then
  533. CFLAGS=" -O0 "
  534. else
  535. CFLAGS=" -O3 "
  536. fi
  537. CFLAGS+=" -gdwarf-2 -g3 "
  538. AC_MSG_CHECKING(whether extra checks should be performed)
  539. AC_ARG_ENABLE(fast, [AS_HELP_STRING([--enable-fast],
  540. [do not enforce assertions])],
  541. enable_fast=$enableval, enable_fast=no)
  542. AC_MSG_RESULT($enable_fast)
  543. if test x$enable_fast = xyes; then
  544. AC_DEFINE(STARPU_NO_ASSERT, [1], [disable assertions])
  545. fi
  546. AC_MSG_CHECKING(whether debug messages should be displayed)
  547. AC_ARG_ENABLE(verbose, [AS_HELP_STRING([--enable-verbose],
  548. [display verbose debug messages])],
  549. enable_verbose=$enableval, enable_verbose=no)
  550. AC_MSG_RESULT($enable_verbose)
  551. if test x$enable_verbose = xyes; then
  552. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  553. fi
  554. AC_MSG_CHECKING(whether coverage testing should be enabled)
  555. AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],
  556. [enable coverage checking])],
  557. enable_coverage=$enableval, enable_coverage=no)
  558. AC_MSG_RESULT($enable_coverage)
  559. AC_SUBST(COVERAGE, $enable_coverage)
  560. AM_CONDITIONAL(STARPU_COVERAGE_ENABLED, [test "x$enable_coverage" = "xyes"])
  561. if test x$enable_coverage = xyes; then
  562. CPPFLAGS="${CPPFLAGS} --coverage"
  563. LDFLAGS="${LDFLAGS} --coverage"
  564. fi
  565. # shall we use FxT to generate trace of the execution ?
  566. AC_MSG_CHECKING(whether fxt traces should be generated)
  567. AC_ARG_WITH(fxt, [AS_HELP_STRING([--with-fxt[=<dir>]], [generate fxt traces])],
  568. [
  569. if test x$withval != xno; then
  570. use_fxt=yes
  571. if test x$withval = xyes; then
  572. AC_MSG_RESULT(yes)
  573. use_fxt_from_system=yes
  574. else
  575. # use specified path
  576. # TODO check if the dir is actually containing FxT
  577. use_fxt_from_system=no
  578. fxtdir=$withval
  579. AC_MSG_RESULT(yes using $fxtdir)
  580. AC_SUBST(FXTDIR, $fxtdir)
  581. fi
  582. else
  583. use_fxt=no
  584. AC_MSG_RESULT(no)
  585. fi
  586. ],
  587. [
  588. use_fxt=no
  589. AC_MSG_RESULT(no)
  590. ])
  591. AC_SUBST(STARPU_USE_FXT, $use_fxt)
  592. AM_CONDITIONAL(STARPU_USE_FXT, test x$use_fxt = xyes)
  593. if test x$use_fxt = xyes; then
  594. AC_DEFINE(STARPU_USE_FXT, [1], [enable FxT traces])
  595. AC_DEFINE(CONFIG_FUT, [1], [enable FUT traces])
  596. AC_SUBST(USE_FXTDIR_FROM_USER,$use_fxt_from_system)
  597. if test x$use_fxt_from_system = xno; then
  598. CPPFLAGS="${CPPFLAGS} -I$fxtdir/include/ "
  599. LDFLAGS="${LDFLAGS} -L$fxtdir/lib/ "
  600. fi
  601. # if we use monotonic clocks, FxT uses -lrt
  602. AC_CHECK_LIB(rt, clock_gettime,,AC_MSG_ERROR([cannot find clock_gettime]))
  603. AC_CHECK_LIB(fxt, fut_setup,,AC_MSG_ERROR([cannot find fxt lib]))
  604. AC_CHECK_HEADER([fxt/fxt.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  605. AC_CHECK_HEADER([fxt/fut.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  606. fi
  607. AC_MSG_CHECKING(whether performance debugging should be enabled)
  608. AC_ARG_ENABLE(perf-debug, [AS_HELP_STRING([--enable-perf-debug],
  609. [enable performance debugging])],
  610. enable_perf_debug=$enableval, enable_perf_debug=no)
  611. AC_MSG_RESULT($enable_perf_debug)
  612. AC_SUBST(STARPU_PERF_DEBUG, $enable_perf_debug)
  613. if test x$enable_perf_debuf = xyes; then
  614. AC_DEFINE(STARPU_PERF_DEBUG, [1], [enable performance debug])
  615. CPPFLAGS="${CPPFLAGS} -pg "
  616. LDFLAGS="${LDFLAGS} -pg "
  617. fi
  618. AC_MSG_CHECKING(whether performance model debugging should be enabled)
  619. AC_ARG_ENABLE(model-debug, [AS_HELP_STRING([--enable-model-debug],
  620. [enable performance model debugging])],
  621. enable_model_debug=$enableval, enable_model_debug=no)
  622. AC_MSG_RESULT($enable_model_debug)
  623. if test x$enable_model_debug = xyes; then
  624. AC_DEFINE(STARPU_MODEL_DEBUG, [1], [enable performance model debug])
  625. fi
  626. AC_MSG_CHECKING(whether statistics should be generated)
  627. AC_ARG_ENABLE(stats, [AS_HELP_STRING([--enable-stats],
  628. [enable statistics])],
  629. enable_stats=$enableval, enable_stats=no)
  630. AC_MSG_RESULT($enable_stats)
  631. AC_SUBST(STATS, $enable_stats)
  632. AC_SUBST(STARPU_DATA_STATS, $enable_stats)
  633. if test x$enable_stats = xyes; then
  634. AC_DEFINE(STARPU_DATA_STATS, [1], [enable statistics])
  635. fi
  636. AC_CHECK_HEADERS([glpk.h])
  637. AC_HAVE_LIBRARY([glpk])
  638. ###############################################################################
  639. # #
  640. # Miscellaneous options for StarPU #
  641. # #
  642. ###############################################################################
  643. AC_MSG_CHECKING(how many buffers can be manipulated per task)
  644. AC_ARG_ENABLE(maxbuffers, [AS_HELP_STRING([--enable-maxbuffers=<nbuffers>],
  645. [maximum number of buffers per task])],
  646. nmaxbuffers=$enableval, nmaxbuffers=8)
  647. AC_MSG_RESULT($nmaxbuffers)
  648. AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
  649. [how many buffers can be manipulated per task])
  650. # We have one memory node shared by all CPU workers, one node per GPU, and
  651. # currently the Cell driver is using the same memory node as the CPU.
  652. maxnodes=1
  653. if test x$enable_cuda = xyes ; then
  654. # we could have used nmaxcudadev + 1, but this would certainly give an
  655. # odd number.
  656. maxnodes=`expr $maxnodes + $nmaxcudadev`
  657. fi
  658. if test x$enable_opencl = xyes ; then
  659. # we could have used nmaxcudadev + 1, but this would certainly give an
  660. # odd number.
  661. maxnodes=`expr $maxnodes + $nmaxopencldev`
  662. fi
  663. # todo: set maxnodes to the next power of 2 greater than maxnodes
  664. AC_MSG_CHECKING(maximum number of memory nodes)
  665. AC_MSG_RESULT($maxnodes)
  666. AC_DEFINE_UNQUOTED(STARPU_MAXNODES, [$maxnodes],
  667. [maximum number of memory nodes])
  668. AC_MSG_CHECKING(whether allocation cache should be used)
  669. AC_ARG_ENABLE(allocation-cache, [AS_HELP_STRING([--enable-allocation-cache],
  670. [enable data allocation cache])],
  671. enable_allocation_cache=$enableval, enable_allocation_cache=no)
  672. AC_MSG_RESULT($enable_allocation_cache)
  673. if test x$enable_allocation_cache = xyes; then
  674. AC_DEFINE(STARPU_USE_ALLOCATION_CACHE, [1], [enable data allocation cache])
  675. fi
  676. AC_ARG_WITH(perf-model-dir, [AS_HELP_STRING([--with-perf-model-dir=<dir>], [specify where performance models shoulds be stored])],
  677. [
  678. if test x$withval = xno; then
  679. AC_MSG_ERROR(--without-perf-model-dir is not a valid option)
  680. fi
  681. perf_model_dir="$withval"
  682. have_explicit_perf_model_dir=yes
  683. AC_DEFINE_UNQUOTED(STARPU_PERF_MODEL_DIR, ["$perf_model_dir"], [performance models location])
  684. ], [
  685. # by default, we put the performance models in
  686. # $HOME/.starpu/sampling/
  687. have_explicit_perf_model_dir=no
  688. perf_model_dir="\$HOME/.starpu/sampling/"
  689. ]
  690. )
  691. AC_MSG_CHECKING(using explicit performance model location)
  692. AC_MSG_RESULT($have_explicit_perf_model_dir)
  693. AC_MSG_CHECKING(performance models location)
  694. AC_MSG_RESULT($perf_model_dir)
  695. # On many multicore CPUs, clock cycles are not synchronized
  696. AC_CHECK_LIB([rt], [clock_gettime])
  697. AC_CHECK_FUNCS([clock_gettime])
  698. # Compute the maximum number of workers (we round it to 16 for alignment
  699. # purposes).
  700. nmaxworkers=`expr 16 \* \( \( $nmaxcpus + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  701. AC_MSG_CHECKING(Maximum number of workers)
  702. AC_MSG_RESULT($nmaxworkers)
  703. AC_DEFINE_UNQUOTED(STARPU_NMAXWORKERS, [$nmaxworkers], [Maximum number of workers])
  704. ###############################################################################
  705. # #
  706. # MPI #
  707. # #
  708. ###############################################################################
  709. AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc[=<path to mpicc>]],
  710. [Path of the mpicc compiler])],
  711. [
  712. if test x$withval = xyes; then
  713. AC_MSG_ERROR(--with-mpicc must be given a pathname)
  714. else
  715. mpicc_path=$withval
  716. fi
  717. ],
  718. [
  719. # nothing was specified: default value is used
  720. AC_PATH_PROG(mpicc_path, mpicc, [no], [])
  721. ])
  722. # We test if the MPICC compiler exists
  723. if test ! -x $mpicc_path; then
  724. #MPICC does not exists or is not executable
  725. AC_MSG_RESULT(The mpicc compiler is not valid)
  726. use_mpi=no
  727. else
  728. use_mpi=yes
  729. fi
  730. AC_MSG_CHECKING(mpicc path)
  731. AC_MSG_RESULT($mpicc_path)
  732. AC_SUBST(MPICC, $mpicc_path)
  733. if test x$use_mpi = xyes; then
  734. cc_or_mpicc=$mpicc_path
  735. else
  736. cc_or_mpicc=$CC
  737. fi
  738. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  739. # If the user specifically asks for it, or if we are in a developer checkout, we enable mpi check
  740. AC_ARG_ENABLE(mpi-check, AC_HELP_STRING([--enable-mpi-check], [Enable execution of MPI testcases]))
  741. running_mpi_check=0
  742. if test -d "$srcdir/.svn" ; then
  743. running_mpi_check=yes
  744. fi
  745. if test x$enable_mpi_check = xyes ; then
  746. running_mpi_check=yes
  747. fi
  748. if test x$enable_mpi_check = xno ; then
  749. running_mpi_check=no
  750. fi
  751. # Check if mpiexec is available
  752. AC_ARG_WITH(mpiexec, [AS_HELP_STRING([--with-mpiexec[=<path to mpiexec>]],
  753. [Path of mpiexec])],
  754. [
  755. if test x$withval = xyes; then
  756. AC_MSG_ERROR(--with-mpiexec must be given a pathname)
  757. else
  758. mpiexec_path=$withval
  759. fi
  760. ],
  761. [
  762. # nothing was specified: look in the path
  763. AC_PATH_PROG(mpiexec_path, mpiexec, [no], [$(dirname $mpicc_path):$PATH])
  764. ])
  765. AC_MSG_CHECKING(whether mpiexec is available)
  766. AC_MSG_RESULT($mpiexec_path)
  767. # We test if MPIEXEC exists
  768. if test ! -x $mpiexec_path; then
  769. #MPIEXEC does not exists or is not executable
  770. AC_MSG_RESULT(The mpiexec script is not valid)
  771. running_mpi_check=no
  772. mpiexec_path=""
  773. fi
  774. AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
  775. if test x$use_mpi = xyes; then
  776. AC_MSG_CHECKING(whether MPI tests should be run)
  777. AC_MSG_RESULT($running_mpi_check)
  778. AC_SUBST(MPIEXEC,$mpiexec_path)
  779. fi
  780. AC_MSG_CHECKING(whether the StarPU MPI library should be generated)
  781. AC_MSG_RESULT($use_mpi)
  782. AC_SUBST(USE_MPI, $use_mpi)
  783. AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
  784. if test x$use_mpi = xyes; then
  785. AC_DEFINE(STARPU_USE_MPI,[],[whether the StarPU MPI library is available])
  786. fi
  787. ###############################################################################
  788. # #
  789. # GCC extensions #
  790. # #
  791. ###############################################################################
  792. AC_ARG_ENABLE([gcc-extensions],
  793. [AS_HELP_STRING([--enable-gcc-extensions],
  794. [build the GCC plug-in that provides C language extensions (experimental)])],
  795. [enable_gcc_plugin="$enableval"],
  796. [enable_gcc_plugin="no"])
  797. if test "x$enable_gcc_plugin" = "xyes"; then
  798. STARPU_GCC_PLUGIN_SUPPORT
  799. if test "x$ac_cv_have_gcc_plugins" != "xyes"; then
  800. AC_MSG_ERROR([This compiler lacks GCC plug-in support.])
  801. fi
  802. build_gcc_plugin="yes"
  803. else
  804. build_gcc_plugin="no"
  805. fi
  806. AM_CONDITIONAL([BUILD_GCC_PLUGIN], [test "x$build_gcc_plugin" = "xyes"])
  807. ###############################################################################
  808. # #
  809. # Examples #
  810. # #
  811. ###############################################################################
  812. AC_ARG_ENABLE(opengl-render, [AS_HELP_STRING([--enable-opengl-render],
  813. [enable OpenGL rendering of some examples])],
  814. enable_opengl_render=$enableval, enable_opengl_render=no)
  815. if test x$enable_opengl_render = xyes; then
  816. AC_CHECK_LIB(glut, glutInit,,AC_MSG_ERROR([cannot find glut]))
  817. AC_CHECK_LIB(GL, glXCreateContext,,AC_MSG_ERROR([cannot find GL]))
  818. AC_CHECK_LIB(GLU, gluLookAt,,AC_MSG_ERROR([cannot find GLU]))
  819. AC_DEFINE(STARPU_OPENGL_RENDER, [1], [enable OpenGL rendering of some examples])
  820. fi
  821. AC_MSG_CHECKING(whether OpenGL rendering is enabled)
  822. AC_SUBST(STARPU_OPENGL_RENDER, $enable_opengl_render)
  823. AC_MSG_RESULT($enable_opengl_render)
  824. AC_PATH_XTRA
  825. if test "x$x_includes" != "xNONE"; then
  826. AC_DEFINE(STARPU_HAVE_X11, [1], [enable X11])
  827. fi
  828. AM_CONDITIONAL([HAVE_X11], [test "x$x_includes" != "xNONE"])
  829. # In case there are BLAS kernels that are used by the example applications
  830. # we may specify which library to use. Note that this is not used for StarPU
  831. # itself.
  832. blas_lib=maybe
  833. AC_ARG_ENABLE(blas-lib,
  834. [ --enable-blas-lib[=blaslibname]:
  835. none [default]: no BLAS lib is used
  836. atlas: use ATLAS library
  837. goto: use GotoBLAS library],
  838. [
  839. if test "x$enableval" = "xatlas" ; then
  840. blas_lib=atlas
  841. elif test "x$enableval" = "xgoto" ; then
  842. blas_lib=goto
  843. elif test "x$enableval" = "xnone" ; then
  844. blas_lib=none
  845. elif test x$enableval = xno; then
  846. blas_lib=none
  847. else
  848. echo
  849. echo "Error!"
  850. echo "Unknown BLAS library"
  851. exit -1
  852. fi
  853. ])
  854. if test x$blas_lib = xmaybe -o x$blas_lib = xgoto; then
  855. AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS lib location])],
  856. [
  857. blas_lib=goto
  858. gotodir=$withval
  859. AC_SUBST(GOTODIR, $gotodir)
  860. CPPFLAGS="${CPPFLAGS} -I$gotodir/ "
  861. LDFLAGS="${LDFLAGS} -L$gotodir/ "
  862. ]
  863. )
  864. if test x$blas_lib = xgoto; then
  865. AC_CHECK_LIB(gfortran, main,,)
  866. # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
  867. AC_CHECK_LIB(goto2, sgemm_,, [havegoto2=no])
  868. if test x$havegoto2 = xno; then
  869. AC_CHECK_LIB(goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]))
  870. fi
  871. AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
  872. fi
  873. fi
  874. if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
  875. AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS lib location])],
  876. [
  877. AC_MSG_CHECKING(STARPU_ATLAS location)
  878. blas_lib=atlas
  879. atlasdir=$withval
  880. AC_MSG_RESULT($atlasdir)
  881. AC_SUBST(ATLASDIR, $atlasdir)
  882. CPPFLAGS="${CPPFLAGS} -I$atlasdir/include/ "
  883. LDFLAGS="${LDFLAGS} -L$atlasdir/lib/ "
  884. ]
  885. )
  886. if test x$blas_lib = xatlas; then
  887. # test whether STARPU_ATLAS is actually available
  888. AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
  889. AC_CHECK_LIB(atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
  890. AC_CHECK_LIB(cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
  891. AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
  892. fi
  893. fi
  894. if test x$blas_lib = xmaybe; then
  895. # Should we use MKL ?
  896. AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
  897. [
  898. CPPFLAGS="${CPPFLAGS} $withval"
  899. blas_lib=mkl
  900. ])
  901. AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
  902. [
  903. LDFLAGS="${LDFLAGS} $withval"
  904. blas_lib=mkl
  905. ])
  906. if test x$blas_lib=xmkl; then
  907. AC_DEFINE(STARPU_MKL, [1], [use MKL library])
  908. fi
  909. fi
  910. if test x$blas_lib = xmaybe; then
  911. #perhaps it is possible to use some BLAS lib from the system
  912. use_system_blas=no
  913. AC_SEARCH_LIBS([sgemm_],[blas],use_system_blas=yes,,)
  914. if test x$use_system_blas = xyes; then
  915. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
  916. blas_lib=system
  917. else
  918. blas_lib=none
  919. fi
  920. fi
  921. AM_CONDITIONAL(ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
  922. AM_CONDITIONAL(GOTO_BLAS_LIB, test x$blas_lib = xgoto)
  923. AM_CONDITIONAL(MKL_BLAS_LIB, test x$blas_lib = xmkl)
  924. AM_CONDITIONAL(SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
  925. AM_CONDITIONAL(NO_BLAS_LIB, test x$blas_lib = xnone)
  926. AC_MSG_CHECKING(which BLAS lib should be used)
  927. AC_MSG_RESULT($blas_lib)
  928. AC_SUBST(BLAS_LIB,$blas_lib)
  929. have_fftw=no
  930. have_fftwf=no
  931. have_fftwl=no
  932. PKG_CHECK_MODULES([FFTW], [fftw3], [
  933. AC_DEFINE([STARPU_HAVE_FFTW], [1], [Define to 1 if you have the libfftw3 library.])
  934. AC_SUBST([STARPU_HAVE_FFTW], [1])
  935. have_fftw=yes
  936. ], [:])
  937. AM_CONDITIONAL(STARPU_HAVE_FFTW, [test x$have_fftw = xyes])
  938. PKG_CHECK_MODULES([FFTWF], [fftw3f], [
  939. AC_DEFINE([STARPU_HAVE_FFTWF], [1], [Define to 1 if you have the libfftw3f library.])
  940. AC_SUBST([STARPU_HAVE_FFTWF], [1])
  941. have_fftwf=yes
  942. ], [:])
  943. AM_CONDITIONAL(STARPU_HAVE_FFTWF, [test x$have_fftwf = xyes])
  944. PKG_CHECK_MODULES([FFTWL], [fftw3l], [
  945. AC_DEFINE([STARPU_HAVE_FFTWL], [1], [Define to 1 if you have the libfftw3l library.])
  946. AC_SUBST([HAVE_FFTWFL], [1])
  947. have_fftwl=yes
  948. ], [:])
  949. AM_CONDITIONAL(STARPU_HAVE_FFTWL, [test x$have_fftwl = xyes])
  950. AC_ARG_WITH([hwloc], [AS_HELP_STRING([--without-hwloc], [Disable hwloc (enabled by default)])])
  951. SAVED_LDFLAGS="${LDFLAGS}"
  952. SAVED_CPPFLAGS="${CPPFLAGS}"
  953. AS_IF([test "x$with_hwloc" != "xno"], [
  954. PKG_CHECK_MODULES([HWLOC],[hwloc], [
  955. have_valid_hwloc=yes
  956. have_pkgconfig_hwloc=yes], [
  957. have_valid_hwloc=no
  958. have_pkgconfig_hwloc=no])
  959. AS_IF([test "$have_valid_hwloc" = "no"], [
  960. hwloc_dir="$withval"
  961. CPPFLAGS="${SAVED_CPPFLAGS} -I$hwloc_dir/include"
  962. AC_CHECK_HEADER([hwloc.h],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  963. LDFLAGS="${SAVED_LDFLAGS} -L$hwloc_dir/lib"
  964. AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  965. ])
  966. ])
  967. AS_IF([test "$have_valid_hwloc" = "yes"], [
  968. AC_DEFINE([STARPU_HAVE_HWLOC], [1], [Define to 1 if you have the hwloc library.])
  969. HWLOC_REQUIRES=hwloc
  970. AC_SUBST([STARPU_HAVE_HWLOC], [1])
  971. AS_IF([test "$have_pkgconfig_hwloc" = "no"], [
  972. HWLOC_CFLAGS="-I$hwloc_dir/include"
  973. HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"])
  974. ])
  975. LDFLAGS="${SAVED_LDFLAGS}"
  976. CPPFLAGS="${SAVED_CPPFLAGS}"
  977. AC_MSG_CHECKING(whether hwloc should be used)
  978. AC_MSG_RESULT($have_valid_hwloc)
  979. AC_SUBST(HWLOC_REQUIRES)
  980. # is the header file f77.h available ?
  981. have_f77_h=yes
  982. AC_CHECK_HEADER([f77.h],,[have_f77_h=no])
  983. AC_MSG_CHECKING(whether header file f77.h is available)
  984. AC_MSG_RESULT($have_f77_h)
  985. AC_SUBST(STARPU_HAVE_F77_H, $have_f77_h)
  986. AM_CONDITIONAL(STARPU_HAVE_F77_H, test x$have_f77_h = xyes)
  987. if test x$have_f77_h = xyes; then
  988. AC_DEFINE([STARPU_HAVE_F77_H], [1], [Define to 1 if you have the <f77.h> header file.])
  989. fi
  990. AC_CONFIG_COMMANDS([executable-scripts], [chmod +x ]tests/regression/regression.sh)
  991. AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
  992. AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h)
  993. AC_CONFIG_HEADERS([gcc-plugin/src/starpu-gcc-config.h])
  994. AC_OUTPUT([
  995. Makefile
  996. src/Makefile
  997. tools/Makefile
  998. gcc-plugin/Makefile
  999. gcc-plugin/src/Makefile
  1000. gcc-plugin/tests/Makefile
  1001. libstarpu.pc
  1002. examples/Makefile
  1003. examples/starpufft/Makefile
  1004. examples/stencil/Makefile
  1005. tests/Makefile
  1006. doc/Makefile
  1007. mpi/Makefile
  1008. ])