aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-support/tcpreplay/tcpreplay/0001-configure.ac-do-not-run-conftest-in-case-of-cross-co.patch
blob: 08cb3b88fa0b745b28791d2aa2f8afdfcf654d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 42f7bbc1ce4913fe2c0bc76293c5445d31690f5d Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 7 Mar 2024 21:02:07 -0800
Subject: [PATCH] configure.ac: do not run conftest in case of cross
 compilation

It'll give us nothing but error like below:

  ./conftest: cannot execute binary file: Exec format error
  ...
  ./configure: line 23950: test: -eq: unary operator expected

The version check only has effect on Apple systems. We'd better
avoid error like above when cross compilation.

Also, in case of cross compilation, instead of having the above
Exec format error and resulting in unaligned_cv_fail to yes, set
it directly to yes.

Upstream-Status: Submitted [https://github.com/appneta/tcpreplay/pull/849]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 387219de..15201601 100644
--- a/configure.ac
+++ b/configure.ac
@@ -928,7 +928,7 @@ cat >conftest.c <<EOF
 EOF
 ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LPCAPLIB \
     conftest.c $LIBS >/dev/null 2>&1
-if test -x conftest ; then
+if test -x conftest -a "$cross_compiling" != "yes"; then
     full_libpcap_version=$(LD_LIBRARY_PATH="$LPCAP_LD_LIBRARY_PATH" ./conftest)
     libpcap_version=$(echo "$full_libpcap_version" | ${CUT} -d' ' -f3)
     pcap_version_ok=yes
@@ -1709,7 +1709,7 @@ case "$host_os" in
 EOF
         ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
             conftest.c $LIBS >/dev/null 2>&1
-        if test ! -x conftest ; then
+        if test ! -x conftest -o "$cross_compiling" = "yes" ; then
             dnl failed to compile for some reason
             unaligned_cv_fail=yes
         else
-- 
2.42.0