Skip to content

Commit 0b1795c

Browse files
committed
Record top_srcdir so that in-place gosh can find it
1 parent f8231c4 commit 0b1795c

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

Makefile.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ GAUCHE_ACLOCAL_DIR = $(GAUCHE_DATA_DIR)/$(GAUCHE_VERSION)/
2929
BUILD_GOSH = @BUILD_GOSH@
3030
BUILD_GOSH_VERSION = @BUILD_GOSH_VERSION@
3131
BUILD_GOSH_FLAGS = -v:$(BUILD_GOSH_VERSION)
32+
REALPATH = @REALPATH@
3233
DESTDIR =
3334

3435
GOSH = gosh
@@ -42,7 +43,7 @@ AUTOCONF_GENERATED = $(CONFIG_GENERATED) configure
4243

4344
TESTRECORD = ./test.record
4445

45-
all: pre-package.stamp
46+
all: pre-package.stamp top_srcdir
4647
if [ $(srcdir) != "." ]; then $(srcdir)/wirebuildlibs "$(srcdir)" "$(LN_S)"; fi
4748
for d in $(SUBDIRS); do (cd $$d; $(MAKE) all) || exit 1; done
4849
cd src; $(MAKE) -s static
@@ -76,6 +77,10 @@ pre-package: $(PRE_PACKAGE_GENERATED)
7677
pre-package.stamp:
7778
"$(BUILD_GOSH)" "$(srcdir)/tools/check-build-version" ${BUILD_GOSH_VERSION} && touch pre-package.stamp
7879

80+
# Saving top_srcdir help in-place execution finds source directory
81+
top_srcdir:
82+
rm -f top_srcdir && echo `$(REALPATH) "${top_srcdir}"` > top_srcdir
83+
7984
INSTALL.en.adoc: INSTALL.adoc
8085
sed -e '/^ifdef::JA/,/^endif::JA/d ; /^ifdef::EN/d ; /^endif::EN/d ; /^\/\/@start header/,/^\/\/@end header/d' $< > $@
8186

@@ -121,7 +126,8 @@ install-examples:
121126
# NB: we don't run maintainer-clean in $(LIBATOMICDIR) to avoid
122127
# dealing with automake.
123128
clean:
124-
rm -rf test.log test.record core Gauche.framework rpmfiles-*.txt *~
129+
rm -rf test.log test.record core Gauche.framework rpmfiles-*.txt *~ \
130+
top_srcdir
125131
-for d in $(SRIDBUS); do (cd $$d; $(MAKE) clean); done
126132
-if test -f $(LIBATOMICDIR)/Makefile; then (cd $(LIBATOMICDIR); $(MAKE) clean); fi
127133

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,17 @@ else
387387
build_doc=Yes
388388
fi
389389

390+
# A program used to canonicalize top_srcdir file
391+
# The file is placed in top_builddir and referenced when gosh is
392+
# run in-place.
393+
AC_CHECK_PROGS(CYGPATH, cygpath)
394+
if test -z "$CYGPATH"; then
395+
REALPATH=realpath
396+
else
397+
REALPATH="cygpath -w -a"
398+
fi
399+
AC_SUBST(REALPATH)
400+
390401
dnl for cross build
391402
AC_CHECK_PROGS(BUILD_CC, ${build}-gcc ${build_alias}-gcc gcc cc)
392403

0 commit comments

Comments
 (0)