Fix for the problem that
[AROS.git] / features.in
blob0c47289687185a4666460bc7a1153856ded92556
1 dnl Copyright © 1997-2016, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for target compiler feature detection
5 dnl Lang: english 
7 # Note: After file changes, generate features anew and commit _both_ files.
8 -------------------------
10 AC_INIT(mmakefile)
11 AC_PREREQ(2.61)
12 AC_CONFIG_AUX_DIR(scripts/autoconf)
14 # Don't know where else to put this...
15 AC_MSG_CHECKING([building AROS in])
16 AROS_BUILDDIR=`${PWDCMD-pwd}`
17 AROS_BUILDDIR_UNIX=${PWD}
18 AC_MSG_RESULT($AROS_BUILDDIR)
20 AC_MSG_CHECKING([AROS source in])
21 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
22 SRCDIR=${srcpwd}
23 AC_MSG_RESULT($SRCDIR)
25 # The first step is to find the binaries.
26 # Check for our compiler.
27 # Due to a bug in autoconf check for c++ compiler first.
28 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
29 AC_PROG_CXX
30 AC_PROG_CC
31 AC_PROG_CC_STDC
32 AC_PROG_CPP
34 AC_MSG_CHECKING([target config location])
35 AC_ARG_WITH(config-dir,AC_HELP_STRING([--with-config-dir=VERSION],[Location of generated target config files]),targetcfg_dir="$withval",targetcfg_dir="")
36 if test "$targetcfg_dir" = ""; then
37     AC_MSG_ERROR([missing config directory!])
38 else
39     aros_targetcfg_dir="$targetcfg_dir"
41 AC_MSG_RESULT($aros_targetcfg_dir)
43 #-----------------------------------------------------------------------------
45 # Check if the target compiler supports some options used for delinting:
46 #  -Wunused-but-set-variable
47 #  -Warray-bounds
48 #  -Wenum-compare
49 #  -Wstrict-overflow
50 #  -Wformat-security
52 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
53 CFLAGS=-Wunused-but-set-variable
54 AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
55 AC_MSG_RESULT($aros_unused_but_set_variable)
56 if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
57     aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
60 AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
61 CFLAGS=-Warray-bounds
62 AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
63 AC_MSG_RESULT($aros_array_bounds)
64 if test "x-$aros_array_bounds" = "x-yes" ; then
65     aros_cflags_array_bounds=-Wno-array-bounds
68 AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
69 CFLAGS=-Wenum-compare
70 AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
71 AC_MSG_RESULT($aros_enum_compare)
72 if test "x-$aros_enum_compare" = "x-yes" ; then
73     aros_cflags_enum_compare=-Wno-enum-compare
76 AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
77 CFLAGS=-Wstrict-overflow
78 AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
79 AC_MSG_RESULT($aros_strict_overflow)
80 if test "x-$aros_strict_overflow" = "x-yes" ; then
81     aros_cflags_strict_overflow=-Wno-strict-overflow
84 AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
85 CFLAGS=-Wformat-security
86 AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
87 AC_MSG_RESULT($aros_format_security)
88 if test "x-$aros_format_security" = "x-yes" ; then
89     aros_cflags_format_security=-Wno-format-security
92 AC_MSG_CHECKING([whether ${CC} accepts -Wmisleading-indentation])
93 CFLAGS=-Wmisleading-indentation
94 AC_TRY_COMPILE(,, aros_misleading_indentation="yes", aros_misleading_indentation="no")
95 AC_MSG_RESULT($aros_misleading_indentation)
96 if test "x-$aros_misleading_indentation" = "x-yes" ; then
97     aros_cflags_misleading_indentation=-Wno-misleading-indentation
100 AC_MSG_CHECKING([whether ${CC} accepts -Wnonnull-compare])
101 CFLAGS=-Wnonnull-compare
102 AC_TRY_COMPILE(,, aros_nonnull_compare="yes", aros_nonnull_compare="no")
103 AC_MSG_RESULT($aros_nonnull_compare)
104 if test "x-$aros_nonnull_compare" = "x-yes" ; then
105     aros_cflags_nonnull_compare=-Wno-nonnull-compare
108 AC_SUBST(aros_cflags_unused_but_set_variable)
109 AC_SUBST(aros_cflags_array_bounds)
110 AC_SUBST(aros_cflags_enum_compare)
111 AC_SUBST(aros_cflags_strict_overflow)
112 AC_SUBST(aros_cflags_format_security)
113 AC_SUBST(aros_cflags_misleading_indentation)
114 AC_SUBST(aros_cflags_nonnull_compare)
116 AC_CONFIG_FILES(
117     ${aros_targetcfg_dir}/compiler.cfg:config/compiler.cfg.in
120 AC_OUTPUT