diff -uNr ugrep-3.9.2/m4/ax_check_bzlib.m4 ugrep-3.9.2.mod/m4/ax_check_bzlib.m4
--- ugrep-3.9.2/m4/ax_check_bzlib.m4	2022-08-21 19:20:26.000000000 +0300
+++ ugrep-3.9.2.mod/m4/ax_check_bzlib.m4	2022-10-29 15:07:19.868515345 +0300
@@ -64,7 +64,7 @@
 # Handle user hints
 #
 [AC_MSG_CHECKING(if bzlib is wanted)
-bzlib_places="/usr/local /usr /opt/homebrew /opt/local /sw"
+bzlib_places="@TERMUX_PREFIX@"
 AC_ARG_WITH([bzlib],
 [  --with-bzlib=DIR        root directory path of bzlib installation @<:@defaults to
                           /usr/local or /usr if not found in /usr/local@:>@
diff -uNr ugrep-3.9.2/m4/ax_check_lz4lib.m4 ugrep-3.9.2.mod/m4/ax_check_lz4lib.m4
--- ugrep-3.9.2/m4/ax_check_lz4lib.m4	2022-08-21 19:20:26.000000000 +0300
+++ ugrep-3.9.2.mod/m4/ax_check_lz4lib.m4	2022-10-29 15:07:28.868596412 +0300
@@ -64,7 +64,7 @@
 # Handle user hints
 #
 [AC_MSG_CHECKING(if lz4 is wanted)
-lz4_places="/usr/local /usr /opt/homebrew /opt/local /sw"
+lz4_places="@TERMUX_PREFIX@"
 AC_ARG_WITH([lz4],
 [  --with-lz4=DIR          root directory path of lz4 installation @<:@defaults to
                           /usr/local or /usr if not found in /usr/local@:>@
diff -uNr ugrep-3.9.2/m4/ax_check_lzmalib.m4 ugrep-3.9.2.mod/m4/ax_check_lzmalib.m4
--- ugrep-3.9.2/m4/ax_check_lzmalib.m4	2022-08-21 19:20:26.000000000 +0300
+++ ugrep-3.9.2.mod/m4/ax_check_lzmalib.m4	2022-10-29 15:07:37.300672362 +0300
@@ -64,7 +64,7 @@
 # Handle user hints
 #
 [AC_MSG_CHECKING(if lzma is wanted)
-lzma_places="/usr/local /usr /opt/homebrew /opt/local /sw"
+lzma_places="@TERMUX_PREFIX@"
 AC_ARG_WITH([lzma],
 [  --with-lzma=DIR         root directory path of lzma installation @<:@defaults to
                           /usr/local or /usr if not found in /usr/local@:>@
diff -uNr ugrep-3.9.2/m4/ax_check_pcre2.m4 ugrep-3.9.2.mod/m4/ax_check_pcre2.m4
--- ugrep-3.9.2/m4/ax_check_pcre2.m4	2022-08-21 19:20:26.000000000 +0300
+++ ugrep-3.9.2.mod/m4/ax_check_pcre2.m4	2022-10-29 15:07:44.504737252 +0300
@@ -72,7 +72,7 @@
 # Handle user hints
 #
 [AC_MSG_CHECKING(if PCRE2 is wanted)
-pcre2_places="/usr/local /usr /opt/homebrew /opt/local /sw"
+pcre2_places="@TERMUX_PREFIX@"
 AC_ARG_WITH([pcre2],
 [  --with-pcre2=DIR        root directory path of PCRE2 installation @<:@defaults to
                           /usr/local or /usr if not found in /usr/local@:>@
diff -uNr ugrep-3.9.2/m4/ax_check_zlib.m4 ugrep-3.9.2.mod/m4/ax_check_zlib.m4
--- ugrep-3.9.2/m4/ax_check_zlib.m4	2022-08-21 19:20:26.000000000 +0300
+++ ugrep-3.9.2.mod/m4/ax_check_zlib.m4	2022-10-29 15:07:51.844803367 +0300
@@ -70,7 +70,7 @@
 # Handle user hints
 #
 [AC_MSG_CHECKING(if zlib is wanted)
-zlib_places="/usr/local /usr /opt/homebrew /opt/local /sw"
+zlib_places="@TERMUX_PREFIX@"
 AC_ARG_WITH([zlib],
 [  --with-zlib=DIR         root directory path of zlib installation @<:@defaults to
                           /usr/local or /usr if not found in /usr/local@:>@
diff -uNr ugrep-3.9.2/m4/ax_check_zstdlib.m4 ugrep-3.9.2.mod/m4/ax_check_zstdlib.m4
--- ugrep-3.9.2/m4/ax_check_zstdlib.m4	2022-08-21 19:20:26.000000000 +0300
+++ ugrep-3.9.2.mod/m4/ax_check_zstdlib.m4	2022-10-29 15:07:59.376871210 +0300
@@ -64,7 +64,7 @@
 # Handle user hints
 #
 [AC_MSG_CHECKING(if zstd is wanted)
-zstd_places="/usr/local /usr /opt/homebrew /opt/local /sw"
+zstd_places="@TERMUX_PREFIX@"
 AC_ARG_WITH([zstd],
 [  --with-zstd=DIR         root directory path of zstd installation @<:@defaults to
                           /usr/local or /usr if not found in /usr/local@:>@
