1AC_DEFUN([FLA_CHECK_WITH_AR], 2[ 3 dnl Tell the user we're checking whether to enable the option. 4 AC_MSG_CHECKING([whether user requested a specific library archiver]) 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_WITH([ar], 10 AC_HELP_STRING([--with-ar=ar],[ Search for and use a library archiver named <ar>. If <ar> is not found, then use the first library archiver found from the default search list for the detected build architecture. Note: the library archiver search list usually consists only of "ar".]), 11 [ 12 dnl If any form of the option is given, handle each case. 13 if test "$withval" = "no" ; then 14 15 dnl User provided --with-<option>=no or --without-<option>. 16 fla_with_specific_ar=without 17 fla_requested_ar='' 18 19 elif test "$withval" = "yes" ; then 20 21 dnl User provided --with-<option>=yes or --with-<option>. 22 fla_with_specific_ar=no 23 fla_requested_ar='' 24 else 25 26 dnl User provided argument value: --with-<option>=value. 27 fla_with_specific_ar=yes 28 fla_requested_ar=$withval 29 fi 30 ], 31 [ 32 dnl User did not specify whether to enable or disable the option. 33 dnl Default behavior is to disable the option. 34 fla_with_specific_ar=no 35 fla_requested_ar='' 36 ] 37 ) 38 39 dnl Now act according to whether a specific value was given. 40 if test "$fla_with_specific_ar" = "yes" ; then 41 42 dnl Output the result. 43 AC_MSG_RESULT([yes ($fla_requested_ar)]) 44 45 elif test "$fla_with_specific_ar" = "without" ; then 46 47 dnl Output the result. 48 AC_MSG_RESULT([no]) 49 50 dnl The user requested --with-ar=no or --without-ar. Scold him. 51 AC_MSG_ERROR([[Detected --without-ar. Cannot continue with library archiver disabled!]]) 52 53 else 54 dnl Output the result. 55 AC_MSG_RESULT([no]) 56 fi 57 58 dnl Check for AR environment variable, which would override everything else. 59 if test "$AR" != "" ; then 60 AC_MSG_NOTICE([[AR environment variable is set to $AR, which will override --with-ar option and default search list for library archiver.]]) 61 fi 62 63]) 64