macro(check_include_file_add_to_default HEADER VARIABLE LIST)
  check_include_file(${HEADER} ${VARIABLE})
  if(${VARIABLE})
    list(APPEND ${LIST} ${HEADER})
  endif(${VARIABLE})
endmacro(check_include_file_add_to_default)

macro(get_autoconf_default_include_files LIST)
  unset(${LIST})
  check_include_file_add_to_default("stdio.h" HAVE_STDIO_H ${LIST})
  check_include_file_add_to_default("sys/types.h" HAVE_SYS_TYPES_H ${LIST})
  check_include_file_add_to_default("sys/stat.h" HAVE_SYS_STAT_H ${LIST})
  check_include_file_add_to_default("stdlib.h" HAVE_STDLIB_H ${LIST})
  check_include_file_add_to_default("stddef.h" HAVE_STDDEF_H ${LIST})
  check_include_file_add_to_default("string.h" HAVE_STRING_H ${LIST})
  check_include_file_add_to_default("strings.h" HAVE_STRINGS_H ${LIST})
  check_include_file_add_to_default("inttypes.h" HAVE_INTTYPES_H ${LIST})
  check_include_file_add_to_default("stdint.h" HAVE_STDINT_H ${LIST})
  check_include_file_add_to_default("unistd.h" HAVE_UNISTD_H ${LIST})
endmacro(get_autoconf_default_include_files)
