summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-03 00:15:34 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-07 23:13:38 -0700
commit14ea26b8dc0c601e445331e09a4cc9ca082a1345 (patch)
treee775fe394dee7b875d7d132a6561d24e39c2cee3
parent09ab37f816d2fe9482574c825132d9b516b8e0bf (diff)
Check for openssl as mkcookie fallback on all platforms, not just OpenBSD
Configure will notify the builder which cookie maker it chooses, so that packagers can add a dependency on the program needed. (Matthieu says the -hex flag to the openssl command was originally OpenBSD-specific but has since been added in upstream OpenSSL.) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
-rw-r--r--configure.ac27
1 files changed, 18 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index c7fb0ab..0900bf1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,17 +153,26 @@ esac
AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
-case $host_os in
- *openbsd*)
- MCOOKIE='/usr/sbin/openssl rand -hex 16'
- ;;
- *solaris*)
- MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
- ;;
-esac
-
+# If mcookie not found, try openssl, else per-system fallbacks
+if test "x$MCOOKIE" = x ; then
+ AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
+ [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
+ if test "x$OPENSSL" != x ; then
+ MCOOKIE="$OPENSSL rand -hex 16"
+ else
+ case $host_os in
+ *openbsd*)
+ MCOOKIE='/usr/sbin/openssl rand -hex 16'
+ ;;
+ *solaris*)
+ MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
+ ;;
+ esac
+ fi
+fi
if test "x$MCOOKIE" != x ; then
STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
+ AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
fi
AC_SUBST(STARTX_COOKIE_FLAGS)