1AC_DEFUN([FLA_CHECK_ENABLE_GPU],
2[
3	dnl Tell the user we're checking whether to enable the option.
4	AC_MSG_CHECKING([whether user requested GPU extensions])
5
6	dnl Determine whether the user gave the --enable-<option> or
7	dnl --disable-<option>. If so, then run the first snippet of code;
8	dnl otherwise, run the second code block.
9	AC_ARG_ENABLE([gpu],
10	              AC_HELP_STRING([--enable-gpu],[Enable code that takes advantage of GPUs when performing certain computations. If enabled, SuperMatrix must also be enabled. Note that this option is experimental. (Disabled by default.)]),
11	[
12		dnl If any form of the option is given, handle each case.
13		if test "$enableval" = "no" ; then
14
15			dnl User provided --enable-<option>=no or --disable-<option>.
16			fla_enable_gpu=no
17
18		elif test "$enableval" = "yes" ; then
19
20			dnl User provided --enable-<option>=yes or --enable-<option>.
21			fla_enable_gpu=yes
22		else
23
24			dnl We don't need an else branch because the configure script
25			dnl should detect whether the user provided an unexpected argument
26			dnl with the option.
27			AC_MSG_ERROR([[Reached unreachable branch in FLA_CHECK_ENABLE_GPU!]])
28		fi
29	],
30	[
31		dnl User did not specify whether to enable or disable the option.
32		dnl Default behavior is to disable the option.
33		fla_enable_gpu=no
34	]
35	)
36
37	dnl Now act according to whether the option was requested.
38	if   test "$fla_enable_gpu" = "yes" ; then
39
40		dnl Output the result.
41		AC_MSG_RESULT([yes])
42
43		dnl Define the macro.
44		AC_DEFINE(FLA_ENABLE_GPU,1,
45		          [Determines whether GPU-specific blocks of code should be compiled.])
46
47	elif test "$fla_enable_gpu" = "no" ; then
48
49		dnl Output the result.
50		AC_MSG_RESULT([no])
51
52	else
53
54		dnl Only "yes" and "no" are accepted, so this block is empty.
55		AC_MSG_ERROR([[Reached unreachable branch in FLA_CHECK_ENABLE_GPU!]])
56
57	fi
58
59	dnl Substitute the output variable.
60	AC_SUBST(fla_enable_gpu)
61
62])
63
64