+
+# Install with the gcc headers files, not the fixed include files, which we
+# are typically not allowed to distribute. The general idea is to:
+# - Get to "install" with a bare set of internal headers, not the
+# fixed system ones,
+# - Prevent rebuilds of what normally depends on the headers, which is
+# useless for installation purposes and would rely on improper headers.
+# - Restore as much of the original state as possible.
+
+.PHONY: install-no-fixedincludes
+
+install-no-fixedincludes:
+ # Stash the current set of headers away, save stamps we're going to
+ # alter explicitly, and arrange for fixincludes not to run next time
+ # we trigger a headers rebuild.
+ -rm -rf tmp-include
+ -mv include tmp-include 2>/dev/null
+ -mv include-fixed tmp-include-fixed 2>/dev/null
+ -mv stmp-int-hdrs tmp-stmp-int-hdrs 2>/dev/null
+ -mv stmp-fixinc tmp-stmp-fixinc 2>/dev/null
+ -mkdir include
+ -cp -p $(srcdir)/gsyslimits.h include/syslimits.h
+ -touch stmp-fixinc
+
+ # Rebuild our internal headers, restore the original stamps so that
+ # "install" doesn't trigger pointless rebuilds because of that update,
+ # then do install
+ $(MAKE) $(FLAGS_TO_PASS) stmp-int-hdrs
+ -mv tmp-stmp-int-hdrs stmp-int-hdrs 2>/dev/null
+ -mv tmp-stmp-fixinc stmp-fixinc 2>/dev/null
+ $(MAKE) $(FLAGS_TO_PASS) install
+
+ # Restore the original set of maybe-fixed headers
+ -rm -rf include; mv tmp-include include 2>/dev/null
+ -rm -rf include-fixed; mv tmp-include-fixed include-fixed 2>/dev/null
+