bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

configmake: Add support for $build_os != $host_os


From: Bruno Haible
Subject: configmake: Add support for $build_os != $host_os
Date: Sat, 18 Feb 2023 17:14:12 +0100

The 'configmake' module, so far, assumes that file names in the build
environment (a.k.a. $build_os) and file names in the target runtime
environment (a.k.a. $host_os) are the same. But some people use
environment where this is not the case:
  - When people do cross-compilation, or
  - When using Cygwin as the build environment for mingw or MSVC
    (such as documented in the INSTALL.windows file of some packages),
  - When people use a Debian distro as build environment and
    mingw + WINE as the host environment,
  - When using a cross-compiler to <cpu>-unknown-linux-gnu and QEMU
    for <cpu> in user-mode.

(Note: I don't call the latter three cases "cross compilation",
because the built binaries can be executed directly on the machine.)

These patches add support for the second case (Cygwin as the build
environment for mingw or MSVC). Previously the generated configmake.h
looked like this:

/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
#if HAVE_WINSOCK2_H
# include <winsock2.h> /* avoid mingw pollution on DATADIR */
#endif
#define PREFIX "/usr/local/msvc64"
#define EXEC_PREFIX "/usr/local/msvc64"
#define BINDIR "/usr/local/msvc64/bin"
#define SBINDIR "/usr/local/msvc64/sbin"
#define LIBEXECDIR "/usr/local/msvc64/libexec"
#define DATAROOTDIR "/usr/local/msvc64/share"
#define DATADIR "/usr/local/msvc64/share"
#define SYSCONFDIR "/usr/local/msvc64/etc"
#define SHAREDSTATEDIR "/usr/local/msvc64/com"
#define LOCALSTATEDIR "/usr/local/msvc64/var"
#define RUNSTATEDIR "/usr/local/msvc64/var/run"
#define INCLUDEDIR "/usr/local/msvc64/include"
#define OLDINCLUDEDIR "/usr/include"
#define DOCDIR "/usr/local/msvc64/share/doc/dummy"
#define INFODIR "/usr/local/msvc64/share/info"
#define HTMLDIR "/usr/local/msvc64/share/doc/dummy"
#define DVIDIR "/usr/local/msvc64/share/doc/dummy"
#define PDFDIR "/usr/local/msvc64/share/doc/dummy"
#define PSDIR "/usr/local/msvc64/share/doc/dummy"
#define LIBDIR "/usr/local/msvc64/lib"
#define LISPDIR "/usr/local/msvc64/share/emacs/site-lisp"
#define LOCALEDIR "/usr/local/msvc64/share/locale"
#define MANDIR "/usr/local/msvc64/share/man"
#define PKGDATADIR "/usr/local/msvc64/share/dummy"
#define PKGINCLUDEDIR "/usr/local/msvc64/include/dummy"
#define PKGLIBDIR "/usr/local/msvc64/lib/dummy"
#define PKGLIBEXECDIR "/usr/local/msvc64/libexec/dummy"

This is pointless, because the compiled programs want file names in native
Windows syntax. With the patches above, said generated configmake.h becomes

/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
#if HAVE_WINSOCK2_H
# include <winsock2.h> /* avoid mingw pollution on DATADIR */
#endif
#define PREFIX "C:\\cygwin64\\usr\\local\\msvc64"
#define EXEC_PREFIX "C:\\cygwin64\\usr\\local\\msvc64"
#define BINDIR "C:\\cygwin64\\usr\\local\\msvc64\\bin"
#define SBINDIR "C:\\cygwin64\\usr\\local\\msvc64\\sbin"
#define LIBEXECDIR "C:\\cygwin64\\usr\\local\\msvc64\\libexec"
#define DATAROOTDIR "C:\\cygwin64\\usr\\local\\msvc64\\share"
#define DATADIR "C:\\cygwin64\\usr\\local\\msvc64\\share"
#define SYSCONFDIR "C:\\cygwin64\\usr\\local\\msvc64\\etc"
#define SHAREDSTATEDIR "C:\\cygwin64\\usr\\local\\msvc64\\com"
#define LOCALSTATEDIR "C:\\cygwin64\\usr\\local\\msvc64\\var"
#define RUNSTATEDIR "C:\\cygwin64\\usr\\local\\msvc64\\var\\run"
#define INCLUDEDIR "C:\\cygwin64\\usr\\local\\msvc64\\include"
#define OLDINCLUDEDIR "C:\\cygwin64\\usr\\include"
#define DOCDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\doc\\dummy"
#define INFODIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\info"
#define HTMLDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\doc\\dummy"
#define DVIDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\doc\\dummy"
#define PDFDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\doc\\dummy"
#define PSDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\doc\\dummy"
#define LIBDIR "C:\\cygwin64\\usr\\local\\msvc64\\lib"
#define LISPDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\emacs\\site-lisp"
#define LOCALEDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\locale"
#define MANDIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\man"
#define PKGDATADIR "C:\\cygwin64\\usr\\local\\msvc64\\share\\dummy"
#define PKGINCLUDEDIR "C:\\cygwin64\\usr\\local\\msvc64\\include\\dummy"
#define PKGLIBDIR "C:\\cygwin64\\usr\\local\\msvc64\\lib\\dummy"
#define PKGLIBEXECDIR "C:\\cygwin64\\usr\\local\\msvc64\\libexec\\dummy"

With this configmake.h, a program can actually, at runtime, access files
that were installed by "make install".


2023-02-18  Bruno Haible  <bruno@clisp.org>

        configmake: Add support for $build_os != $host_os.
        * m4/build-to-host.m4: New file.
        * m4/configmake.m4 (gl_CONFIGMAKE_PREP): Provide a configure-time
        definition for pkgdatadir, pkgincludedir, pkglibdir.
        (gl_CONFIGMAKE): New macro.
        * modules/configmake (Files): Add m4/build-to-host.m4.
        (configure.ac): Invoke gl_CONFIGMAKE instead of gl_CONFIGMAKE_PREP.
        (Makefile.am): For creating configmake.h, use the various *prefix_c_make
        and *dir_c_make variables.

2023-02-18  Bruno Haible  <bruno@clisp.org>

        configmake: Prepare for using directory names with backslashes.
        * modules/configmake (Makefile.am): Use printf instead of echo.

Attachment: 0001-configmake-Prepare-for-using-directory-names-with-ba.patch
Description: Text Data

Attachment: 0002-configmake-Add-support-for-build_os-host_os.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]