Skip to content

Commit

Permalink
configure.ac: unify search dirs for pcap and add lib32
Browse files Browse the repository at this point in the history
* add lib32 because when building lib32-tcpreplay it's
  impossible to set --with-libpcap so that it would find
  both include files as well as the library in lib32 directory

* maybe it would be beneficial to split --with-libpcap
  into --with-libpcap-includedir --with-libpcap-libdir as this
  already searches in the --with-libpcap value with and
  without any "lib" prefix, but include files always expect
  "include" dir there

* most of this code was added in:
  202b8e8#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810R570

* then search for
  ${host_cpu} lib/${host_cpu} (without -${host_os} suffix)
  and ${build_arch}-${host_os} lib/${build_arch}-${host_os}
  was added, but only for search of dynamic library in:
  c3d5236

* ${build_arch}-${host_os} lib/${build_arch}-${host_os}
  was later replaced with:
  lib/${MULTIARCH} ${MULTIARCH}
  and it was added to static library search as well

  but for dynamic library it was searching in reversed order:
  ${MULTIARCH} lib/${MULTIARCH}
  ed9e3a8

  I don't think this reversed order was intentional, just unify all 4 cases
  to use the same directories in the same order

Signed-off-by: Martin Jansa <[email protected]>
  • Loading branch information
shr-project committed Sep 3, 2023
1 parent 43693c4 commit 5f8c783
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ AC_ARG_WITH(libpcap,
LPCAPINCDIR=${testdir}
if test $dynamic_link = yes; then
for ext in .dylib .so .tbd ; do
for dir in . lib lib64 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
for dir in . lib lib64 lib32 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
sharefile=$(ls ${testdir}/$dir/libpcap${ext}* 2> /dev/null | sort | head -n1)
if test -n "${sharefile}"; then
LPCAP_LD_LIBRARY_PATH="$(dirname ${sharefile})"
Expand All @@ -690,7 +690,7 @@ AC_ARG_WITH(libpcap,
dnl If dynamic library not found, try static
dnl
for ext in ${libext} .a .A.tbd ; do
for dir in . lib lib64 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
for dir in . lib lib64 lib32 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
staticfile=$(ls ${testdir}/$dir/libpcap${ext} 2> /dev/null | sort | head -n1)
if test -n "${staticfile}"; then
LPCAPLIB="${staticfile}"
Expand Down Expand Up @@ -771,7 +771,7 @@ AC_ARG_WITH(libpcap,
LPCAPINCDIR="${testdir}/include"
if test $dynamic_link = yes; then
for ext in .dylib .so .tbd; do
for dir in . lib lib64 ${host_cpu} lib/${host_cpu} ${host_cpu}-${host_os} lib/${host_cpu}-${host_os} ${MULTIARCH} lib/${MULTIARCH}; do
for dir in . lib lib64 lib32 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
sharefile=$(ls "${testdir}/$dir/libpcap${ext}" 2> /dev/null | sort | head -n1)
if test -n "${sharefile}"; then
LPCAPLIB="-L$(dirname ${sharefile}) -lpcap"
Expand All @@ -790,7 +790,7 @@ AC_ARG_WITH(libpcap,
dnl If dynamic library not found, try static
dnl
for ext in ${libext} .a .A.tbd ; do
for dir in . lib lib64 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
for dir in . lib lib64 lib32 lib/${host_cpu}-${host_os} ${host_cpu}-${host_os} lib/${MULTIARCH} ${MULTIARCH}; do
staticfile=$(ls "${testdir}/$dir/libpcap${ext}" 2> /dev/null | sort | head -n1)
if test -n "${staticfile}"; then
LPCAPLIB="${staticfile}"
Expand Down

0 comments on commit 5f8c783

Please sign in to comment.