1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-17 09:57:02 +00:00

CMake: check for getopt_long_only() instead of just getopt()

so behaviour of CLI same
general: AIX compat, suppress some warnings
This commit is contained in:
gitlost
2024-01-17 21:55:11 +00:00
parent bead450f38
commit 1449866d18
9 changed files with 34 additions and 34 deletions

View File

@@ -25,19 +25,20 @@
#include <stdlib.h>
#include <string.h>
#ifndef _MSC_VER
#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(_AIX)
# include <getopt.h>
# if defined(__NetBSD__) && !defined(getopt_long_only) /* `getopt_long_only()` not available */
# define getopt_long_only getopt_long
# endif
# include <zint.h>
#else
# include "../getopt/getopt.h"
# include "zint.h"
# if _MSC_VER != 1200 /* VC6 */
# pragma warning(disable: 4996) /* function or variable may be unsafe */
# ifdef _MSC_VER
# include "zint.h"
# if _MSC_VER != 1200 /* VC6 */
# pragma warning(disable: 4996) /* function or variable may be unsafe */
# endif
# else
# include <zint.h>
# endif
#endif /* _MSC_VER */
#endif
/* Following copied from "backend/library.c" */
@@ -64,7 +65,7 @@ typedef char static_assert_int_at_least_32bits[sizeof(int) * CHAR_BIT < 32 ? -1
# include <malloc.h>
# define z_alloca(nmemb) _alloca(nmemb)
#else
# if defined(ZINT_IS_C89) || defined(ZINT_IS_C99) || defined(__NuttX__) /* C89 or C99 or NuttX RTOS */
# if defined(ZINT_IS_C89) || defined(ZINT_IS_C99) || defined(__NuttX__) || defined(_AIX)
# include <alloca.h>
# endif
# define z_alloca(nmemb) alloca(nmemb)

View File

@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -1245,9 +1245,6 @@ static void test_other_opts(const testCtx *const p_ctx) {
for (i = 0; i < data_size; i++) {
if (testContinue(p_ctx, i)) continue;
#ifdef __NetBSD__
if (strcmp(data[i].opt, " -bg=") == 0) continue; /* `getopt_long_only()` not available on NetBSD */
#endif
strcpy(cmd, "zint");