1AC_DEFUN([FLA_CHECK_ENABLE_MEMORY_LEAK_COUNTER], 2[ 3 dnl Tell the user we're checking whether to enable the option. 4 AC_MSG_CHECKING([whether user requested enabling FLA_malloc()/FLA_free() memory leak counter]) 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([memory-leak-counter], 10 AC_HELP_STRING([--enable-memory-leak-counter],[Enable code that keeps track of the balance between calls to FLA_malloc() and FLA_free(). If enabled, the counter value is output to standard error upon calling FLA_Finalize(). Note that this option determines the default status, which may be changed at runtime. (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_memory_leak_counter=no 17 18 elif test "$enableval" = "yes" ; then 19 20 dnl User provided --enable-<option>=yes or --enable-<option>. 21 fla_enable_memory_leak_counter=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_MEMORY_LEAK_COUNTER!]]) 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_memory_leak_counter=no 34 ] 35 ) 36 37 dnl Now act according to whether the option was requested. 38 if test "$fla_enable_memory_leak_counter" = "yes" ; then 39 40 dnl Output the result. 41 AC_MSG_RESULT([yes]) 42 43 dnl Define the macro. 44 AC_DEFINE(FLA_ENABLE_MEMORY_LEAK_COUNTER,1, 45 [Determines whether to enable the FLA_malloc()/FLA_free() memory counter by default.]) 46 47 elif test "$fla_enable_memory_leak_counter" = "no" ; then 48 49 dnl Output the result. 50 AC_MSG_RESULT([no]) 51 52 else 53 dnl Only "yes" and "no" are accepted, so this block is empty. 54 AC_MSG_ERROR([[Reached unreachable branch in FLA_CHECK_ENABLE_MEMORY_LEAK_COUNTER!]]) 55 fi 56 57 dnl Substitute the output variable. 58 AC_SUBST(fla_enable_memory_leak_counter) 59 60]) 61