File: compiler_characteristics.m4

package info (click to toggle)
google-perftools 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 7,284 kB
  • sloc: cpp: 27,869; ansic: 9,534; sh: 4,799; perl: 4,116; makefile: 1,101; asm: 128
file content (24 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Check compiler characteristics (e.g. type sizes, PRIxx macros, ...)

# If types $1 and $2 are compatible, perform action $3
AC_DEFUN([AC_TYPES_COMPATIBLE],
  [AC_TRY_COMPILE([#include <stddef.h>], [$1 v1 = 0; $2 v2 = 0; return (&v1 - &v2)], $3)])

define(AC_PRIUS_COMMENT, [printf format code for printing a size_t and ssize_t])

AC_DEFUN([AC_COMPILER_CHARACTERISTICS],
  [AC_CACHE_CHECK(AC_PRIUS_COMMENT, ac_cv_formatting_prius_prefix,
    [AC_TYPES_COMPATIBLE(unsigned int, size_t, 
	                 ac_cv_formatting_prius_prefix=; ac_cv_prius_defined=1)
     AC_TYPES_COMPATIBLE(unsigned long, size_t,
	                 ac_cv_formatting_prius_prefix=l; ac_cv_prius_defined=1)
     AC_TYPES_COMPATIBLE(unsigned long long, size_t,
                         ac_cv_formatting_prius_prefix=ll; ac_cv_prius_defined=1
     )])
   if test -z "$ac_cv_prius_defined"; then 
      ac_cv_formatting_prius_prefix=z;
   fi
   AC_DEFINE_UNQUOTED(PRIuS, "${ac_cv_formatting_prius_prefix}u", AC_PRIUS_COMMENT)
   AC_DEFINE_UNQUOTED(PRIxS, "${ac_cv_formatting_prius_prefix}x", AC_PRIUS_COMMENT)
   AC_DEFINE_UNQUOTED(PRIdS, "${ac_cv_formatting_prius_prefix}d", AC_PRIUS_COMMENT)
])