Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Config/testthat/edition: 3
Config/usethis/last-upkeep: 2025-07-01
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
SystemRequirements: GNU make, zlib
Collate:
'RcppExports.R'
Expand Down
2 changes: 1 addition & 1 deletion man/runStaticServer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 13 additions & 25 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,23 @@ libuv/m4/lt~obsolete.m4: libuv/m4/lt_obsolete.m4

# Run ./configure to create the Makefile.
#
# On systems that do _not_ have automake installed, we need to make sure that
# configure does not try to run automake, because it will fail. To do that, we
# we need to touch various autotools-related files so it doesn't try to run
# autotools programs again. We also need to make sure configure is executable,
# because on some platforms, calling unzip() in R does not preserve the
# executable bit.
# The bundled libuv ships pre-generated autotools output files (configure,
# Makefile.in, aclocal.m4), so we do NOT need to run autogen.sh or automake.
#
# If the system does have automake, then we'll run autogen.sh before configure,
# as per the official build instructions for libuv. autogen.sh will in turn run
# aclocal, autoconf, and automake.
# To prevent make from trying to regenerate these files, libuv's configure.ac
# uses AM_MAINTAINER_MODE, which wraps all regeneration rules behind a
# conditional that is disabled by default (see #280, #319, #429).
#
# It's VERY IMPORTANT that mtime(aclocal.m4) <= mtime(configure), and also
# mtime(aclocal.m4) <= mtime(Makefile.in). On some platforms, passing multiple
# files to a single touch command gives them all the same time, but on others
# (Solaris and possibly some Fedoras) the timestamps are slightly increasing
# from one to the next, i.e. the order matters. To remove this fragility, we
# use "-r aclocal.m4" to ensure that all three files are guaranteed to have
# precisely the same timestamp value.
# As belt-and-suspenders, we also touch autotools files so that
# mtime(inputs) <= mtime(outputs), preventing regeneration rules from firing
# even if AM_MAINTAINER_MODE were somehow bypassed.
#
# We also need to make sure configure is executable, because on some platforms,
# calling unzip() in R does not preserve the executable bit.
libuv/Makefile: libuv/m4/lt~obsolete.m4
cd libuv; \
if ! command -v automake >/dev/null 2>&1 ; then \
echo "automake not found. Touching files so configure will not try to run automake."; \
touch aclocal.m4; \
touch -r aclocal.m4 configure Makefile.in; \
else \
echo "automake found. Running autoupdate and autogen.sh."; \
autoupdate; \
sh autogen.sh; \
fi; \
touch aclocal.m4 configure.ac Makefile.am m4/*.m4; \
touch -r aclocal.m4 configure Makefile.in; \
chmod +x configure; \
CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS) $(C_VISIBILITY) -DNDEBUG" CPPFLAGS="$(CPPFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" LDFLAGS="$(LDFLAGS)" ./configure $(CONFIGURE_FLAGS)

Expand Down
12 changes: 8 additions & 4 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,19 @@ CC_CHECK_CFLAGS_APPEND([-Wno-declaration-after-statement])
```


#### Run `autoupdate` and `autogen.sh`
#### Run `autogen.sh`

After modifying Makefile.am, run `autoupdate` and then `./autogen.sh`. This requires automake and libtool, and generates the `configure` script, along with a number of other related files. These generated files are checked into the repository so that other systems to not need automake and libtool to build libuv.
After modifying Makefile.am or configure.ac, run `./autogen.sh`. This requires automake and libtool, and generates the `configure` script, along with a number of other related files. These generated files are checked into the repository so that other systems do not need automake and libtool to build libuv.

The file `libuv/m4/lt~obsolete.m4` (generated by autogen.sh) is renamed to `lt_obsolete.m4` because the filename with the `~` causes problems with `R CMD check`. In the Makevars file, it gets copied to `lt~obsolete.m4` so that it's present during the build process.

In Makevars, before running `./configure`, it updates the timestamps output files `aclocal.m4`, `Makefile.in`, and `configure`, to make sure they are newer than the input files. Note that order matters: `aclocal.m4` must not be newer than the other files. On some platforms (like Solaris), the order in which the files are specified can matter. In our case, we touched `aclocal.m4`, and copied its date to the other files.
#### `AM_MAINTAINER_MODE`

If this is not done, then the `configure` script may generate a Makefile which tries to find `aclocal-1.15` and other autotools-related programs ([#124](https://github.com/rstudio/httpuv/issues/124)). See this [SO question](https://stackoverflow.com/questions/33278928/how-to-overcome-aclocal-1-15-is-missing-on-your-system-warning-when-compilin) for more information.
The `configure.ac` includes `AM_MAINTAINER_MODE`, which wraps all autotools regeneration rules in the generated `Makefile.in` behind a `@MAINTAINER_MODE_TRUE@` conditional. Since `--enable-maintainer-mode` is not passed to `./configure` at build time, these rules are disabled and `make` never attempts to re-run automake, autoconf, or aclocal — regardless of file timestamps or what autotools versions are installed on the build machine.

This is the standard approach used by projects that ship pre-generated autotools output (e.g. curl, libffi, libexpat). See [#280](https://github.com/rstudio/httpuv/issues/280), [#319](https://github.com/rstudio/httpuv/pull/319), and [#429](https://github.com/rstudio/httpuv/issues/429) for history.

As an additional safeguard, `Makevars.in` also touches autotools input and output files to ensure `mtime(inputs) <= mtime(outputs)`, preventing regeneration even if `AM_MAINTAINER_MODE` were somehow bypassed.

The following generated files are checked into the repository:

Expand Down
7 changes: 4 additions & 3 deletions src/libuv/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
Expand Down Expand Up @@ -1498,7 +1499,7 @@ all: all-am
.SUFFIXES: .c .lo .o .obj
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
Expand All @@ -1524,9 +1525,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck

$(top_srcdir)/configure: $(am__configure_deps)
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
libuv.pc: $(top_builddir)/config.status $(srcdir)/libuv.pc.in
Expand Down
40 changes: 38 additions & 2 deletions src/libuv/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
[m4_warning([this file was generated for autoconf 2.72.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
Expand Down Expand Up @@ -715,6 +715,42 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])

# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering

# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
# Default is to disable them, unless 'enable' is passed literally.
# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
[enable], [m4_define([am_maintainer_other], [disable])],
[disable], [m4_define([am_maintainer_other], [enable])],
[m4_define([am_maintainer_other], [enable])
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
am_maintainer_other[ make rules and dependencies not useful
(and sometimes confusing) to the casual installer])],
[USE_MAINTAINER_MODE=$enableval],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST([MAINT])dnl
]
)

# Check to see how 'make' treats includes. -*- Autoconf -*-

# Copyright (C) 2001-2021 Free Software Foundation, Inc.
Expand Down
35 changes: 35 additions & 0 deletions src/libuv/configure
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,9 @@ build_os
build_vendor
build_cpu
build
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
Expand Down Expand Up @@ -816,6 +819,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_silent_rules
enable_maintainer_mode
enable_shared
enable_static
enable_dependency_tracking
Expand Down Expand Up @@ -1466,6 +1470,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-dependency-tracking
Expand Down Expand Up @@ -3262,6 +3269,30 @@ END
fi


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
# Check whether --enable-maintainer-mode was given.
if test ${enable_maintainer_mode+y}
then :
enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
else $as_nop
USE_MAINTAINER_MODE=no
fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
printf "%s\n" "$USE_MAINTAINER_MODE" >&6; }
if test $USE_MAINTAINER_MODE = yes; then
MAINTAINER_MODE_TRUE=
MAINTAINER_MODE_FALSE='#'
else
MAINTAINER_MODE_TRUE='#'
MAINTAINER_MODE_FALSE=
fi

MAINT=$MAINTAINER_MODE_TRUE




# Make sure we can run config.sub.
$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||
Expand Down Expand Up @@ -15206,6 +15237,10 @@ else
am__EXEEXT_FALSE=
fi

if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down
1 change: 1 addition & 0 deletions src/libuv/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/as_case.m4])
m4_include([m4/libuv-check-flags.m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AC_ENABLE_SHARED
AC_ENABLE_STATIC
Expand Down
Loading