]> git.ipfire.org Git - thirdparty/gcc.git/blame - libcody/config.m4
Use OEP_DECL_NAME when comparing VLA bounds [PR101585].
[thirdparty/gcc.git] / libcody / config.m4
CommitLineData
36230329
NS
1# Nathan's Common Config -*- mode:autoconf -*-
2# Copyright (C) 2020 Nathan Sidwell, nathan@acm.org
3# License: Apache v2.0
4
6d972f51
NS
5# Note: VAR+=... is not dashing, despite its looks
6
36230329
NS
7AC_DEFUN([NMS_MAINTAINER_MODE],
8[AC_ARG_ENABLE([maintainer-mode],
9AS_HELP_STRING([--enable-maintainer-mode],
10[enable maintainer mode. Add rules to rebuild configurey bits]),,
11[enable_maintainer_mode=no])
12AS_CASE([$enable_maintainer_mode],
13 [yes], [maintainer_mode=yes],
14 [no], [maintainer=no],
15 [AC_MSG_ERROR([unknown maintainer mode $enable_maintainer_mode])])
16AC_MSG_CHECKING([maintainer-mode])
17AC_MSG_RESULT([$maintainer_mode])
18test "$maintainer_mode" = yes && MAINTAINER=yes
19AC_SUBST(MAINTAINER)])
20
21AC_DEFUN([NMS_CXX_COMPILER],
22[AC_ARG_WITH([compiler],
23AS_HELP_STRING([--with-compiler=NAME],[which compiler to use]),
24AC_MSG_CHECKING([C++ compiler])
25if test "$withval" = "yes" ; then
26 AC_MSG_ERROR([NAME not specified])
27elif test "$withval" = "no" ; then
28 AC_MSG_ERROR([Gonna need a C++ compiler!])
29else
30 CXX="${withval}"
31 AC_MSG_RESULT([$CXX])
32fi)])
33
34AC_DEFUN([NMS_CXX_11],
35[AC_MSG_CHECKING([whether $CXX is for C++11])
36AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
37[#if __cplusplus != 201103
38#error "C++11 is required"
39#endif
40]])],
41[AC_MSG_RESULT([yes])],
42[CXX_ORIG="$CXX"
6d972f51 43CXX="$CXX -std=c++11"
36230329
NS
44AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
45[#if __cplusplus != 201103
46#error "C++11 is required"
47#endif
48]])],
49AC_MSG_RESULT([adding -std=c++11]),
50[CXX="$CXX_ORIG"
51AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
52[#if __cplusplus > 201103
53#error "C++11 is required"
54#endif
55]])],
56AC_MSG_RESULT([> C++11]),
57AC_MSG_RESULT([no])
58AC_MSG_ERROR([C++11 is required])]))
59unset CXX_ORIG])])
60
36230329
NS
61AC_DEFUN([NMS_ENABLE_EXCEPTIONS],
62[AC_ARG_ENABLE([exceptions],
63AS_HELP_STRING([--enable-exceptions],
64[enable exceptions & rtti]),,
65[enable_exceptions="no"])
66AS_CASE([$enable_exceptions],
67 [yes], [nms_exceptions=yes],
68 [no], [nms_exceptions=no],
69 [AC_MSG_ERROR([unknown exceptions $enable_exceptions])])
70AC_MSG_CHECKING([exceptions])
71AC_MSG_RESULT([$nms_exceptions])
72if test "$nms_exceptions" != no ; then
73 EXCEPTIONS=yes
74fi
75AC_SUBST(EXCEPTIONS)])
76
77AC_DEFUN([NMS_LINK_OPT],
78[AC_MSG_CHECKING([adding $1 to linker])
79ORIG_LDFLAGS="$LDFLAGS"
a582a319 80LDFLAGS="$LDFLAGS $1"
36230329
NS
81AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
82[AC_MSG_RESULT([ok])],
83[LDFLAGS="$ORIG_LDFLAGS"
84AC_MSG_RESULT([no])])
85unset ORIG_LDFLAGS])
86
36230329
NS
87AC_DEFUN([NMS_ENABLE_CHECKING],
88[AC_ARG_ENABLE([checking],
89AS_HELP_STRING([--enable-checking],
90[enable run-time checking]),,
91[enable_checking="yes"])
92AS_CASE([$enable_checking],
93 [yes|all|yes,*], [nms_checking=yes],
94 [no|none|release], [nms_checking=],
95 [AC_MSG_ERROR([unknown check "$enable_checking"])])
96AC_MSG_CHECKING([checking])
97AC_MSG_RESULT([${nms_checking:-no}])
98if test "$nms_checking" = yes ; then
99 AC_DEFINE_UNQUOTED([NMS_CHECKING], [0${nms_checking:+1}], [Enable checking])
100fi])