blob: 8be52042bcc4e7eac2e6c194bf9876ed62507cd4 [file] [log] [blame]
https://github.com/stedolan/jq/pull/2480
From 40bbd419ad8d1bd9cbe8b17063c323f8a40ab327 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 6 Sep 2022 09:59:31 -0700
Subject: [PATCH 1/2] configure: Pass _XOPEN_SOURCE when checking for strptime
Include sys/time.h for gettimeofday since thats where its in glibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,10 @@ AC_FUNC_ALLOCA
AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
+OLD_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])
+CFLAGS=$OLD_CFLAGS
AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])
AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0])
AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])
@@ -147,7 +150,7 @@ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0])
-AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0])
+AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0])
AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])],
[], [[#include <time.h>]])
AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])],
From cda1734bed3b048c01452c798877d05b8c2f4c15 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 6 Sep 2022 10:00:59 -0700
Subject: [PATCH 2/2] builtin: Replace _BSD_SOURCE with _DEFAULT_SOURCE
newer glibc has remove _BSD_SOURCE and wants it to be replaced with _DEFAULT_SOURCE
Fixes
/usr/include/features.h:194:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings]
warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -1,4 +1,4 @@
-#define _BSD_SOURCE
+#define _DEFAULT_SOURCE
#define _GNU_SOURCE
#ifndef __sun__
# define _XOPEN_SOURCE