From: Enrico Scholz Date: Tue, 30 Dec 2003 17:08:36 +0000 (+0000) Subject: added check for C99 compatibility X-Git-Tag: VERSION_0_10~1002 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d78bd46dbaf49190f383ecae1e7a2b1e22973c9;p=util-vserver.git added check for C99 compatibility git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@521 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/m4/ensc_dietlibc.m4 b/util-vserver/m4/ensc_dietlibc.m4 index fecf30e..ef9984c 100644 --- a/util-vserver/m4/ensc_dietlibc.m4 +++ b/util-vserver/m4/ensc_dietlibc.m4 @@ -15,6 +15,42 @@ dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +AC_DEFUN([_ENSC_DIETLIBC_C99], +[ + AH_TEMPLATE([ENSC_DIETLIBC_C99], [Define to 1 if dietlibc supports C99]) + + AC_CACHE_CHECK([whether dietlibc supports C99], [ensc_cv_c_dietlibc_c99], + [ + old_CFLAGS=$CFLAGS + old_CC=$CC + + CFLAGS="-std=c99" + CC="${DIET:-diet} $CC" + + AC_LANG_PUSH(C) + AC_COMPILE_IFELSE([/* */],[ + AC_COMPILE_IFELSE([ + #include + #include + #if defined(inline) + # error 'inline' badly defined + #endif + volatile uint64_t a; + ], + [ensc_cv_c_dietlibc_c99=yes], + [ensc_cv_c_dietlibc_c99=no])], + [ensc_cv_c_dietlibc_c99='skipped (compiler does not support C99)']) + AC_LANG_POP + + CC=$old_CC + CFLAGS=$old_CFLAGS + ]) + + if test x"$ensc_cv_c_dietlibc_c99" = xyes; then + AC_DEFINE(ENSC_DIETLIBC_C99,1) + fi +]) + dnl Usage: ENSC_ENABLE_DIETLIBC() dnl ... automake-conditional which will be set when dnl dietlibc shall be enabled @@ -33,14 +69,17 @@ AC_DEFUN([ENSC_ENABLE_DIETLIBC], [: ${DIET:=diet} which "$DIET" >/dev/null 2>/dev/null && use_dietlibc=detected || use_dietlibc=detected_no]) + ensc_have_dietlibc=no case x"$use_dietlibc" in xdetected) AM_CONDITIONAL($1, true) AC_MSG_RESULT([yes (autodetected)]) + ensc_have_dietlibc=1 ;; xforced) AM_CONDITIONAL($1, true) AC_MSG_RESULT([yes (forced)]) + ensc_have_dietlibc=1 ;; xdetected_no) AM_CONDITIONAL($1, false) @@ -54,4 +93,8 @@ AC_DEFUN([ENSC_ENABLE_DIETLIBC], AC_MSG_ERROR([internal error, use_dietlibc was "$use_dietlibc"]) ;; esac + + if test x"$ensc_have_dietlibc" != xno; then + _ENSC_DIETLIBC_C99 + fi ])