blob: e4d6ebb45b1d10a8c7d3fafdad382788dc1d0ab1 [file] [log] [blame]
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001From 40bbd419ad8d1bd9cbe8b17063c323f8a40ab327 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 6 Sep 2022 09:59:31 -0700
4Subject: [PATCH 1/2] configure: Pass _XOPEN_SOURCE when checking for strptime
5
6Include sys/time.h for gettimeofday since thats where its in glibc
7
8Upstream-Status: Submitted [https://github.com/stedolan/jq/pull/2480]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 configure.ac | 5 ++++-
12 1 file changed, 4 insertions(+), 1 deletion(-)
13
14diff --git a/configure.ac b/configure.ac
15index a2cd99e..95afe06 100644
16--- a/configure.ac
17+++ b/configure.ac
18@@ -139,7 +139,10 @@ AC_FUNC_ALLOCA
19
20 AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
21 AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
22+OLD_CFLAGS=$CFLAGS
23+CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
24 AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])
25+CFLAGS=$OLD_CFLAGS
26 AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])
27 AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0])
28 AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])
29@@ -147,7 +150,7 @@ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
30 AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
31 AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])
32 AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0])
33-AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0])
34+AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0])
35 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])],
36 [], [[#include <time.h>]])
37 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])],
38--
392.37.3
40