configure failure when whitespace in directory name

Darren Tucker dtucker at dtucker.net
Wed Oct 1 09:18:47 AEST 2025


On Tue, Sep 30, 2025 at 09:28:10PM +0000, Job Snijders wrote:
> On Tue, Sep 30, 2025 at 03:02:54PM +0100, Sevan Janiyan wrote:
> > On Darwin, if you extract the snapshot archive from the GUI, and there's
> > already a directory named openssh present, the system adds a number to the
> > directory name to avoid what's in place. e.g "openssh 2"
> > When it comes to configuring, the "checking compiler and flags for sanity"
> > fails with "clang: error: no such file or directory:
> > '2/openbsd-compat/include'"
> 
> I'm not sure that can be fixed. Seems autoconf doesn't work well with
> whitespaces

We can't fix it in configure, but we *can* punt the problem to make:

Sevan: please try this patch.  You will need to run "autoreconf" after
applying it to rebuild configure.

diff --git a/Makefile.in b/Makefile.in
index 769ec17f4..b5f73cd3f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -33,6 +33,7 @@ STRIP_OPT=@STRIP_OPT@
 TEST_SHELL=@TEST_SHELL@
 BUILDDIR=@abs_top_builddir@
 SK_STANDALONE=@SK_STANDALONE@
+COMPATINCLUDES=$(BUILDDIR)/@COMPATINCLUDES@
 
 PATHS= -DSSHDIR=\"$(sysconfdir)\" \
 	-D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
@@ -50,7 +51,7 @@ CC=@CC@
 LD=@LD@
 CFLAGS=@CFLAGS@
 CFLAGS_NOPIE=@CFLAGS_NOPIE@
-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+CPPFLAGS=-I. -I$(srcdir) -I$(COMPATINCLUDES) @CPPFLAGS@ $(PATHS) @DEFS@
 PICFLAG=@PICFLAG@
 LIBS=@LIBS@
 CHANNELLIBS=@CHANNELLIBS@
diff --git a/configure.ac b/configure.ac
index 819e83689..3eb6d4697 100644
--- a/configure.ac
+++ b/configure.ac
@@ -526,7 +526,7 @@ AC_CHECK_HEADERS([ \
 # platform.  Usually these are just empty, but in some cases they'll include
 # the equivalent file.  This avoids having to wrap those includes in
 # '#ifdef HAVE_FOO_H'.  If we create any such headers, add the path to includes.
-compatincludes=no
+COMPATINCLUDES=""
 AC_CHECK_HEADERS([ \
     endian.h \
     ifaddrs.h \
@@ -541,8 +541,8 @@ AC_CHECK_HEADERS([ \
     sys/un.h \
     time.h \
     util.h], [], [
-	compatincludes="`pwd`/openbsd-compat/include"
-	header="$compatincludes/$ac_header"
+	COMPATINCLUDES="openbsd-compat/include"
+	header="$COMPATINCLUDES/$ac_header"
 	dir=`dirname "$header"`
 	mkdir -p "$dir"
 	case "$ac_header" in
@@ -552,9 +552,7 @@ AC_CHECK_HEADERS([ \
 	*)      ;;
 	esac >"$header"
 ])
-if test "$compatincludes" != "no"; then
-    CPPFLAGS="$CPPFLAGS -I$compatincludes"
-fi
+AC_SUBST([COMPATINCLUDES])
 
 AC_CHECK_DECLS([le32toh, le64toh, htole64], [], [], [
 #ifdef HAVE_SYS_TYPES_H
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 1d549954f..5bce2b38b 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -120,3 +120,4 @@ clean:
 
 distclean: clean
 	rm -f Makefile *~
+	rm -rf include

-- 
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list