diff options
author | Steve Bennett <steveb@workware.net.au> | 2019-10-07 11:46:05 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2019-11-15 09:04:13 +1000 |
commit | 88256c9ddad271427153d0cbc3db397345d372e0 (patch) | |
tree | f3f85631f5bbe875930434c3561689e9e65f3f67 | |
parent | e8176eb6f964805a5128dddea137d4c996c33df3 (diff) | |
download | jimtcl-88256c9ddad271427153d0cbc3db397345d372e0.zip jimtcl-88256c9ddad271427153d0cbc3db397345d372e0.tar.gz jimtcl-88256c9ddad271427153d0cbc3db397345d372e0.tar.bz2 |
build: Check for inline support
To ensure that linenoise.c can build, even for strict c89
Add cc-check-inline in autosetup/jim-misc.auto
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | auto.def | 3 | ||||
-rw-r--r-- | autosetup/jim-misc.auto | 33 |
2 files changed, 36 insertions, 0 deletions
@@ -297,6 +297,9 @@ if {[opt-bool-or-full lineedit]} { define USE_LINENOISE define-append PARSE_UNIDATA_FLAGS -width lappend extra_objs linenoise.o + if {[cc-check-inline] && [is-defined inline]} { + define-append CCOPTS -Dinline=[get-define inline] + } } } if {[opt-bool references]} { diff --git a/autosetup/jim-misc.auto b/autosetup/jim-misc.auto new file mode 100644 index 0000000..cf13592 --- /dev/null +++ b/autosetup/jim-misc.auto @@ -0,0 +1,33 @@ +# @cc-check-inline +# +# The equivalent of the 'AC_C_INLINE' macro. +# +# defines 'HAVE_INLINE' if inline is available, +# and defines 'inline' to be __inline__ or __inline if necessary +# or to "" if not available. +# +# Returns 1 if 'inline' is available or 0 otherwise +# +proc cc-check-inline {} { + msg-checking "Checking for inline support..." + set ok 0 + foreach i {inline __inline__ __inline} { + if {[cctest -declare "#ifndef __cplusplus\nstatic $i void testfunc__(void);\n#endif"]} { + incr ok + break + } + } + if {$ok} { + if {$i eq "inline"} { + msg-result yes + } else { + msg-result $i + define inline $i + } + } else { + define inline "" + msg-result no + } + define-feature inline $ok + return $ok +} |