AC_PREREQ([2.69]) AC_INIT([fastwc], [0.1.0], [], [fastwc]) AC_CONFIG_SRCDIR([src/main.c]) # Build flavor: --enable-glibc links dynamically against the system libc # (respecting CC, whatever it is). The default is a fully static musl # binary, preferring musl-gcc even when CC is set in the environment, # since removing ld.so from startup is exactly what the tiny-file # benchmark races hinge on. AC_ARG_ENABLE([glibc], [AS_HELP_STRING([--enable-glibc], [link dynamically against the system libc (respects CC) instead of the default static musl])], [enable_glibc=$enableval], [enable_glibc=no]) STATIC_LDFLAGS= if test "x$enable_glibc" = xno; then # Static musl is the default toolchain. Fall back to the system # compiler (dynamic link) only when no musl compiler is installed. AC_PATH_PROGS([MUSL_CC], [musl-gcc x86_64-linux-musl-gcc]) if test -n "$MUSL_CC"; then CC="$MUSL_CC" STATIC_LDFLAGS="-static" fi fi AC_PROG_CC AC_CHECK_TOOL([STRIP], [strip], [:]) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([foreign subdir-objects]) AS_IF([test "x$enable_glibc" = xyes], [AC_MSG_NOTICE([fastwc: glibc build requested, using $CC])], [AS_IF([test -n "$MUSL_CC"], [AC_MSG_NOTICE([fastwc: building against static musl ($MUSL_CC)])], [AC_MSG_WARN([fastwc: musl-gcc not found; falling back to $CC (dynamic link). Install a musl toolchain or configure --enable-glibc.])])]) AC_SUBST([STATIC_LDFLAGS]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT