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.
15 dnl The awk replacement currently has the following limitations:
17 dnl - Only the -v and -a options are supported.
19 dnl - Due to limitations of some awk implementations, a filename of "-"
20 dnl to mean standard input should be avoided for the second file name.
21 dnl Nevertheless, using "-" for the first filename should be portable.
23 AC_DEFUN([DX_PROG_JOIN], [AC_PREREQ([2.62])dnl
24 AC_REQUIRE([AC_PROG_AWK])dnl
25 AC_CACHE_CHECK([for join], [ac_cv_path_JOIN],
27 AC_PATH_PROGS_FEATURE_CHECK([JOIN], [join],
28 [_DX_JOIN_DO_TEST([$ac_path_JOIN],
29 [DX_BASENAME([join_relcmd], ["$ac_path_JOIN"])
30 join_bypath=`{ command -v "$join_relcmd"; } 2>/dev/null` #''
31 ac_cv_path_JOIN=$ac_path_JOIN
32 test x"$join_bypath" = x"$ac_path_JOIN" && ac_cv_path_JOIN=$join_relcmd
34 dx_cv_join_works=yes])], [ac_cv_path_JOIN=no dx_cv_join_found=false])])
35 AS_IF([$dx_cv_join_found],
36 [JOIN=$ac_cv_path_JOIN
38 AC_CACHE_CHECK([whether $JOIN works], [dx_cv_join_works],
39 [_DX_JOIN_DO_TEST([$JOIN], [dx_cv_join_works=yes], [dx_cv_join_works=no])])])
40 rm -f conftest.a conftest.b conftest.c
41 AS_IF([test x"$dx_cv_join_works" != x"yes"],
43 [m4_pushdef([m4_include], [$][1])],
44 [m4_include(DX_BASEDIR[/scripts/join.awk])],
45 [m4_popdef([m4_include])]) --"])])
47 AC_DEFUN([_DX_JOIN_DO_TEST],
48 [AS_IF([test ! -f conftest.b],
49 [cat >conftest.a <<'EOF'
58 cat >conftest.b <<'EOF'
70 AS_IF([$1 conftest.a conftest.b >conftest.c 2>&AS_MESSAGE_LOG_FD],
71 [if diff - conftest.c >/dev/null 2>&1 <<'EOF'