mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 01:33:06 +00:00
ca810eec66
Let's pretend we live in the C23 future. Signed-off-by: Omar Sandoval <osandov@osandov.com>
22 lines
827 B
Plaintext
22 lines
827 B
Plaintext
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
# Check whether C23 auto is supported by the current compiler and compilation
|
|
# flags. If not, but the GNU __auto_type extension is supported, define auto to
|
|
# __auto_type. Otherwise, fail.
|
|
AC_DEFUN([MY_C_AUTO],
|
|
[AC_CACHE_CHECK([for auto], [my_cv_c_auto],
|
|
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[auto x = 1;]])],
|
|
[my_cv_c_auto=yes], [my_cv_c_auto=no])])
|
|
if test "x$my_cv_c_auto" != xyes; then
|
|
AC_CACHE_CHECK([for __auto_type], [my_cv_c___auto_type],
|
|
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[__auto_type x = 1;]])],
|
|
[my_cv_c___auto_type=yes], [my_cv_c___auto_type=no])])
|
|
if test "x$my_cv_c___auto_type" == xyes; then
|
|
AC_DEFINE([auto], [__auto_type])
|
|
else
|
|
AC_MSG_ERROR([no auto or __auto_type])
|
|
fi
|
|
fi
|
|
])
|