diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:13:40 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:13:40 +0100 |
| commit | b0afb8fe0ff1d87165af9df61501197a06240dda (patch) | |
| tree | 274ac6a96c53ef4c19ab4974ce24a06a233128c5 /gl/m4/byteswap.m4 | |
| parent | 68fc05381ee5fa0aee1413118fbb3d81ca888b09 (diff) | |
| download | monitoring-plugins-b0afb8fe0ff1d87165af9df61501197a06240dda.tar.gz | |
Sync with Gnulib stable-202507 code (a8ac9f9ce5)
Diffstat (limited to 'gl/m4/byteswap.m4')
| -rw-r--r-- | gl/m4/byteswap.m4 | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4 index 0c76fe93..b53cb4d0 100644 --- a/gl/m4/byteswap.m4 +++ b/gl/m4/byteswap.m4 | |||
| @@ -1,18 +1,42 @@ | |||
| 1 | # byteswap.m4 | 1 | # byteswap.m4 |
| 2 | # serial 5 | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 8 | ||
| 8 | dnl Written by Oskar Liljeblad. | 9 | dnl Written by Oskar Liljeblad. |
| 9 | 10 | ||
| 10 | AC_DEFUN([gl_BYTESWAP], | 11 | AC_DEFUN([gl_BYTESWAP], |
| 11 | [ | 12 | [ |
| 12 | dnl Prerequisites of lib/byteswap.in.h. | 13 | dnl Prerequisites of lib/byteswap.in.h. |
| 13 | AC_CHECK_HEADERS([byteswap.h], [ | 14 | AC_CHECK_HEADERS_ONCE([byteswap.h]) |
| 15 | if test $ac_cv_header_byteswap_h = yes; then | ||
| 16 | AC_CACHE_CHECK([for working bswap_16, bswap_32, bswap_64], | ||
| 17 | [gl_cv_header_working_byteswap_h], | ||
| 18 | [gl_cv_header_working_byteswap_h=no | ||
| 19 | dnl Check that floating point arguments work. | ||
| 20 | dnl This also checks C libraries with implementations like | ||
| 21 | dnl '#define bswap_16(x) (((x) >> 8 & 0xff) | (((x) & 0xff) << 8))' | ||
| 22 | dnl that mistakenly evaluate their arguments multiple times. | ||
| 23 | AC_COMPILE_IFELSE( | ||
| 24 | [AC_LANG_PROGRAM( | ||
| 25 | [[#include <byteswap.h> | ||
| 26 | ]], | ||
| 27 | [[int value_16 = bswap_16 (0.0); | ||
| 28 | int value_32 = bswap_32 (0.0); | ||
| 29 | int value_64 = bswap_64 (0.0); | ||
| 30 | return !(value_16 + value_32 + value_64); | ||
| 31 | ]]) | ||
| 32 | ], | ||
| 33 | [gl_cv_header_working_byteswap_h=yes], | ||
| 34 | [gl_cv_header_working_byteswap_h=no]) | ||
| 35 | ]) | ||
| 36 | fi | ||
| 37 | if test "$gl_cv_header_working_byteswap_h" = yes; then | ||
| 14 | GL_GENERATE_BYTESWAP_H=false | 38 | GL_GENERATE_BYTESWAP_H=false |
| 15 | ], [ | 39 | else |
| 16 | GL_GENERATE_BYTESWAP_H=true | 40 | GL_GENERATE_BYTESWAP_H=true |
| 17 | ]) | 41 | fi |
| 18 | ]) | 42 | ]) |
