1 dnl Copyright © 2022 Nick Bowler
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
9 dnl Search PATH for standard POSIX "join" utility. If found, the JOIN
10 dnl variable (which is substituted by AC_SUBST) is set to the result and
11 dnl the cache variable dx_cv_join_works is set to "yes". Otherwise,
12 dnl dx_cv_join_works is set to "no" and JOIN is set to an incomplete
13 dnl awk-based implementation which supports no options.
15 AC_DEFUN([DX_PROG_JOIN], [AC_PREREQ([2.62])dnl
16 AC_REQUIRE([AC_PROG_AWK])dnl
17 AC_CACHE_CHECK([for join], [ac_cv_path_JOIN],
19 AC_PATH_PROGS_FEATURE_CHECK([JOIN], [join],
20 [_DX_JOIN_DO_TEST([$ac_path_JOIN],
21 [DX_BASENAME([join_relcmd], ["$ac_path_JOIN"])
22 join_bypath=`{ command -v "$join_relcmd"; } 2>/dev/null` #''
23 ac_cv_path_JOIN=$ac_path_JOIN
24 test x"$join_bypath" = x"$ac_path_JOIN" && ac_cv_path_JOIN=$join_relcmd
26 dx_cv_join_works=yes])], [ac_cv_path_JOIN=no dx_cv_join_found=false])])
27 AS_IF([$dx_cv_join_found],
28 [JOIN=$ac_cv_path_JOIN
30 AC_CACHE_CHECK([whether $JOIN works], [dx_cv_join_works],
31 [_DX_JOIN_DO_TEST([$JOIN], [dx_cv_join_works=yes], [dx_cv_join_works=no])])])
32 rm -f conftest.a conftest.b conftest.c
33 AS_IF([test x"$dx_cv_join_works" != x"yes"],
35 [m4_pushdef([m4_include], [$][1])],
36 [m4_include(DX_BASEDIR[/scripts/join.awk])],
37 [m4_popdef([m4_include])])"])])
39 AC_DEFUN([_DX_JOIN_DO_TEST],
40 [AS_IF([test ! -f conftest.b],
41 [cat >conftest.a <<'EOF'
50 cat >conftest.b <<'EOF'
62 AS_IF([$1 conftest.a conftest.b >conftest.c 2>&AS_MESSAGE_LOG_FD],
63 [if diff - conftest.c >/dev/null 2>&1 <<'EOF'