When cross-compiling a toolchan targeting cygwin, building cygwin1.dll
requires libstdc++v3 to be built.
However, building libstdc++v3 requires the cygwin headers to be
installed.
Work around this circular dependency by adding a --with-only-headers
configure option to only install the headers without trying to build any
libraries.

winsup/ChangeLog
Makefile.in: add special install target for with-only-headers
configure.ac: add with-only-headers option
configure: regenerate
winsup/cygserver/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-only-headers
configure: regenerate
winsup/cygwin/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-only-headers
configure: regenerate

Signed-off-by: Peter Foley <pefol...@pefoley.com>
---
 winsup/Makefile.in            |  5 +++++
 winsup/configure              | 13 +++++++++++++
 winsup/configure.ac           |  6 +++++-
 winsup/cygserver/configure    |  3 ++-
 winsup/cygserver/configure.ac | 12 +++++++-----
 winsup/cygwin/configure       |  3 ++-
 winsup/cygwin/configure.ac    | 14 ++++++++------
 7 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/winsup/Makefile.in b/winsup/Makefile.in
index 1fdf93a..76da977 100644
--- a/winsup/Makefile.in
+++ b/winsup/Makefile.in
@@ -69,7 +69,12 @@ install-license: CYGWIN_LICENSE COPYING
          ${INSTALL} $$i $(DESTDIR)$(prefix)/share/doc/Cygwin ; \
        done
 
+ifeq (@with_only_headers@,yes)
+install: Makefile
+       @${MAKE} -C cygwin install-headers
+else
 install: Makefile $(INSTALL_LICENSE) $(INSTALL_SUBDIRS)
+endif
 
 clean: $(CLEAN_SUBDIRS)
 
diff --git a/winsup/configure b/winsup/configure
index 988ce54..2cf3775 100755
--- a/winsup/configure
+++ b/winsup/configure
@@ -596,6 +596,7 @@ cygwin_headers
 newlib_headers
 windows_headers
 windows_libdir
+with_only_headers
 CPP
 ac_ct_CXX
 CXXFLAGS
@@ -666,6 +667,7 @@ ac_subst_files=''
 ac_user_opts='
 enable_option_checking
 with_mingw_progs
+with_only_headers
 with_windows_headers
 with_windows_libs
 '
@@ -1297,6 +1299,8 @@ Optional Packages:
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --without-mingw-progs   do not build programs using the mingw toolchain
                           (useful for cross-compiling)
+  --with-only-headers     only install headers for bootstraping a
+                          cross-compiler
   --with-windows-headers=DIR
                           specify where the windows includes are located
   --with-windows-libs=DIR specify where the windows libraries are located
@@ -3370,6 +3374,13 @@ else
 fi
 
 
+# Check whether --with-only-headers was given.
+if test "${with_only_headers+set}" = set; then :
+  withval=$with_only_headers;
+fi
+
+
+
 
 
 # Check whether --with-windows-headers was given.
@@ -3379,6 +3390,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3397,6 +3409,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/configure.ac b/winsup/configure.ac
index afa0d42..cc41d3f 100644
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -26,9 +26,13 @@ AC_PROG_CXX
 AC_PROG_CPP
 AC_LANG(C)
 AC_ARG_WITH([mingw-progs],[AS_HELP_STRING([--without-mingw-progs],[do not 
build programs using the mingw toolchain (useful for 
cross-compiling)])],[],[with_mingw_progs=yes])
+AC_ARG_WITH([only-headers],[AS_HELP_STRING([--with-only-headers],[only install 
headers for bootstraping a cross-compiler])])
+AC_SUBST(with_only_headers)
 
 AC_WINDOWS_HEADERS
-AC_WINDOWS_LIBS
+if test "x$with_only_headers" != "xyes"; then
+    AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
diff --git a/winsup/cygserver/configure b/winsup/cygserver/configure
index a4feae1..dd8f4de 100755
--- a/winsup/cygserver/configure
+++ b/winsup/cygserver/configure
@@ -2106,7 +2106,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3382,6 +3381,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3400,6 +3400,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/cygserver/configure.ac b/winsup/cygserver/configure.ac
index 4e2cb45..d04c39f 100644
--- a/winsup/cygserver/configure.ac
+++ b/winsup/cygserver/configure.ac
@@ -9,9 +9,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin Cygserver], 0,
-       cyg...@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin 
Cygserver],[0],[cyg...@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(cygserver.cc)
 AC_CONFIG_AUX_DIR(..)
 
@@ -19,7 +18,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -27,7 +26,9 @@ AC_PROG_CPP
 AC_LANG(C)
 
 AC_WINDOWS_HEADERS
+if test "x$with_only_headers" != "xyes"; then
 AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
@@ -66,4 +67,5 @@ esac
 ])
 
 AC_CONFIGURE_ARGS
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure
index 522fae6..4d6b449 100755
--- a/winsup/cygwin/configure
+++ b/winsup/cygwin/configure
@@ -2117,7 +2117,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3393,6 +3392,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3411,6 +3411,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/cygwin/configure.ac b/winsup/cygwin/configure.ac
index fc7697b..29b1e0c 100644
--- a/winsup/cygwin/configure.ac
+++ b/winsup/cygwin/configure.ac
@@ -10,9 +10,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin DLL], 0,
-       cyg...@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin DLL],[0],[cyg...@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(Makefile.in)
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_AUX_DIR(..)
@@ -21,7 +20,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -29,7 +28,9 @@ AC_PROG_CPP
 AC_LANG(C)
 
 AC_WINDOWS_HEADERS
+if test "x$with_only_headers" != "xyes"; then
 AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
@@ -100,7 +101,7 @@ case "$target_cpu" in
                DIN_FILE="x86_64.din"
                TLSOFFSETS_H="tlsoffsets64.h"
                ;;
-   *)          AC_MSG_ERROR(Invalid target processor \"$target_cpu\") ;;
+   *)          AC_MSG_ERROR([Invalid target processor "$target_cpu"]) ;;
 esac
 
 AC_CONFIGURE_ARGS
@@ -110,4 +111,5 @@ AC_SUBST(DLL_ENTRY)
 AC_SUBST(DEF_DLL_ENTRY)
 AC_SUBST(DIN_FILE)
 AC_SUBST(TLSOFFSETS_H)
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.7.4

Reply via email to