configure.ac 40 KB

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