Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort bigendian builds #1921

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# cmake -B build
# cmake --build build

# Some useful tool versions to know about:
# cmake 3.14.0 2019-03-14 Current minimum requirement
# cmake 3.20.0 2021-03-23 Adds CMAKE_C_BYTE_ORDER

cmake_minimum_required(VERSION 3.14)
project(avrdude VERSION 8.0 LANGUAGES C)

Expand Down Expand Up @@ -51,6 +55,21 @@ include(GNUInstallDirs)
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION})


# =====================================================================
# Abort the build for non-little endian targets
#
# Our minimum cmake requirement is 3.14, so we cannot use
# CMAKE_C_BYTE_ORDER (cmake >= 3.20) to detect the byte order.
# =====================================================================

include (TestBigEndian)
test_big_endian(AVRDUDE_TARGET_IS_BIG_ENDIAN)
if(AVRDUDE_TARGET_IS_BIG_ENDIAN)
message(FATAL_ERROR "avrdude only supports building for little endian targets at this time")
endif()


# =====================================
# Get Git commit info
# =====================================
Expand Down
17 changes: 17 additions & 0 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dnl
dnl 2019-03-14 cmake 3.13
dnl
dnl 2006-10-23 autoconf 2.60 used to be avrdude's requirement
dnl 2012-04-24 autoconf 2.62 AC_C_BIGENDIAN
dnl 2012-04-24 autoconf 2.69
dnl 2021-01-28 autoconf 2.71
dnl
Expand Down Expand Up @@ -169,6 +170,22 @@ fi
dnl Makefile.am:77: compiling `config_gram.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'
AM_PROG_CC_C_O


ad_target_is_little_endian=false
AC_C_BIGENDIAN([dnl
], [dnl
dnl Target is Little Endian, which avrdude actually supports.
ad_target_is_little_endian=:
], [dnl
], [dnl
])

AS_IF([$ad_target_is_little_endian], [dnl
], [dnl
AC_MSG_ERROR([avrdude only supports building for little endian targets at this time])
])


# Checks for libraries.
# For MinGW.
AC_CHECK_LIB([ws2_32], [WSAStartup])
Expand Down
Loading