1 dnl ## AC_COMPILER_OPTION based on: GNU Pth - The GNU Portable Threads
2 dnl ## Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com>
4 dnl ## This file is part of GNU Pth, a non-preemptive thread scheduling
5 dnl ## library which can be found at http://www.gnu.org/software/pth/.
7 dnl ## This library is free software; you can redistribute it and/or
8 dnl ## modify it under the terms of the GNU Lesser General Public
9 dnl ## License as published by the Free Software Foundation; either
10 dnl ## version 2.1 of the License, or (at your option) any later version.
12 dnl ## This library is distributed in the hope that it will be useful,
13 dnl ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 dnl ## Lesser General Public License for more details.
17 dnl ## You should have received a copy of the GNU Lesser General Public
18 dnl ## License along with this library; if not, write to the Free Software
19 dnl ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 dnl ## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
22 dnl ## Check whether compiler option works
25 dnl ## AC_COMPILER_OPTION(<name>, <display>, <option>,
26 dnl ## <action-success>, <action-failure>)
29 AC_DEFUN([AC_COMPILER_OPTION],[dnl
30 AC_MSG_CHECKING([for compiler option $2])
31 AC_CACHE_VAL(ac_cv_compiler_option_$1,[
32 cat >conftest.$ac_ext <<EOF
33 int main() { return 0; }
35 ${CXX} -c $CFLAGS $CPPFLAGS $3 conftest.$ac_ext 1>conftest.out 2>conftest.err
36 if test $? -ne 0 -o -s conftest.err; then
37 ac_cv_compiler_option_$1=no
39 ac_cv_compiler_option_$1=yes
41 rm -f conftest.$ac_ext conftest.out conftest.err
43 if test ".$ac_cv_compiler_option_$1" = .yes; then
44 ifelse([$4], , :, [$4])
46 ifelse([$5], , :, [$5])
48 AC_MSG_RESULT([$ac_cv_compiler_option_$1])