Skip to content

Commit

Permalink
cmake conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
pguyot authored Jan 2, 2025
1 parent 9299f6f commit 60c1511
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/libAtomVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,33 @@ if (HAVE_PRAGMA_STDC_FENV_ACCESS)
target_compile_definitions(libAtomVM PUBLIC HAVE_PRAGMA_STDC_FENV_ACCESS)
endif()

# workaround for gcc-arm-none-eabi package issue
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067692
check_c_source_compiles("
#include <inttypes.h>
#include <stdio.h>
int main() {
printf("%" PRIu64, (uint64_t) 42);
return 0;
}
" PRIU64_WORKS)

if (NOT PRIU64_WORKS)
check_c_source_compiles("
#include <sys/_stdint.h>
#include <inttypes.h>
#include <stdio.h>
int main() {
printf("%" PRIu64, (uint64_t) 42);
return 0;
}
" PRIU64_REQUIRES_WORKAROUND)

if(PRIU64_REQUIRES_WORKAROUND)
target_compile_definitions(libAtomVM PUBLIC REQUIRES_SYS_STDINT_FOR_PRIU64)
endif()
endif()

if(${CMAKE_C_FLAGS} MATCHES -DAVM_NO_SMP)
message("SMP is disabled by CFLAGS environment")
set(AVM_DISABLE_SMP ON)
Expand Down
2 changes: 2 additions & 0 deletions src/libAtomVM/term.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#ifndef _TERM_H_
#define _TERM_H_

#if REQUIRES_SYS_STDINT_FOR_PRIU64
#include <sys/_stdint.h>
#include <inttypes.h>
#endif

#include <stdbool.h>
#include <stdint.h>
Expand Down

0 comments on commit 60c1511

Please sign in to comment.