Skip to content

Commit

Permalink
configure.ac: do not run conftest in case of cross compilation
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Chen Qi <[email protected]>
  • Loading branch information
ChenQi1989 committed Mar 8, 2024
1 parent 43693c4 commit 42f7bbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 42f7bbc

Please sign in to comment.