1AC_DEFUN([FLA_CHECK_ENABLE_STATIC_BUILD],
2[
3	dnl Tell the user we're checking whether to enable the option.
4	AC_MSG_CHECKING([whether user requested building a static library])
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([static-build],
10	              AC_HELP_STRING([--enable-static-build],[Enable static library generation. (Enabled 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_static_build=no
17
18		elif test "$enableval" = "yes" ; then
19
20			dnl User provided --enable-<option>=yes or --enable-<option>.
21			fla_enable_static_build=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_STATIC_BUILD!]])
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_static_build=yes
34	]
35	)
36
37	dnl Now act according to whether the option was requested.
38	if   test "$fla_enable_static_build" = "yes" ; then
39
40		dnl Output the result.
41		AC_MSG_RESULT([yes])
42
43	elif test "$fla_enable_static_build" = "no" ; then
44
45		dnl Output the result.
46		AC_MSG_RESULT([no])
47
48	else
49
50		dnl Only "yes" and "no" are accepted, so this block is empty.
51		AC_MSG_ERROR([[Reached unreachable branch in FLA_CHECK_ENABLE_STATIC_BUILD!]])
52
53	fi
54
55	dnl Substitute the output variable.
56	AC_SUBST(fla_enable_static_build)
57
58])
59