Files
magic/configure
T
Darryl L. MilesandClaude Opus 4.8 a4e6289035 build: make configure relocatable (out-of-tree)
Enable `mkdir build; cd build; ../configure` to run entirely in the build
directory, with generated config landing there instead of in the source
tree.  This is the autoconf-layer groundwork for a full VPATH build; the
make layer (defs.mak/rules.mak VPATH support, per-dir orchestration) is
still to come, so an out-of-tree `make` is not yet expected to work.

Changes:

* configure (wrapper): run the generated config.status in the *current*
  directory with --srcdir pointing back at the source tree (instead of
  `cd scripts`), so outputs land in the build dir.  Uses an absolute
  basedir so any build-dir location works, not just a subdir of srcdir.

* scripts/configure.in:
  - AC_CONFIG_AUX_DIR(.) -> AC_CONFIG_AUX_DIR(scripts).  Once srcdir
    resolves to the true top (scripts' parent, where rules.mak lives),
    autoconf searches for install-sh/config.sub/... relative to srcdir;
    "." pointed at the wrong place and out-of-tree configure died with
    "cannot find install-sh".
  - Name the .in templates explicitly
    (defs.mak:scripts/defs.mak.in, scripts/makedbh:scripts/makedbh.in)
    so config.status finds them from a separate build dir.  defs.mak is
    written to the build top; makedbh under build/scripts/ to match
    ${SCRIPTS}/makedbh.
  - Drop the trailing `cp defs.mak ..`; defs.mak is now generated in the
    build top directly, and from a build dir the copy would clobber the
    source tree's defs.mak.

* scripts/configure: regenerated with autoconf 2.69.

Verified: out-of-tree `../configure` completes rc=0, writes defs.mak /
scripts/makedbh / config.status into the build dir, records
srcdir=<source top>, and leaves the source tree's tracked files and
generated defs.mak/makedbh untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-26 14:54:11 -04:00

18 lines
756 B
Bash
Executable File

#!/bin/sh
#
# Use: ./configure [args]
#
# where [args] are arguments passed to the scripts/configure script
#
# This script is a workaround to GNU autoconf which can't deal with having
# all of its config scripts in a different directory than the configure
# script itself. It also sets up CFLAGS without the default optimizer
# flag (-O2).
# Run the generated config.status in the *current* directory (which may be a
# separate build directory), with --srcdir pointing back at the source tree, so
# that generated files (defs.mak, makedbh, ...) land in the build directory
# rather than in the source tree.
basedir=$(cd "$(dirname "$0")" && pwd)
( CFLAGS=${CFLAGS:-"-g"}; export CFLAGS; exec "${basedir}/scripts/configure" --srcdir="${basedir}" "$@" )