diff --git a/README.md b/README.md index bd806763..710e5c24 100644 --- a/README.md +++ b/README.md @@ -422,6 +422,9 @@ from `/usr/local/lib`, causing a library load error when running `ugrep`. To correct this, add `export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"` to your `~/.bashrc` file. Or run `sudo ldconfig /usr/local/lib`. +**Note:** you can build static executables by supplying `--enable-static` +as an argument to `./build.sh`. + ### Other platforms: step 3 build Build `ugrep` on Unix-like systems with colors enabled by default: diff --git a/configure.ac b/configure.ac index be41b410..3bdcc32f 100644 --- a/configure.ac +++ b/configure.ac @@ -389,6 +389,24 @@ fi AC_SUBST(ZSH_COMPLETION_DIR) AM_CONDITIONAL([ENABLE_ZSH_COMPLETION],[test "x$with_zsh_completion_dir" != "xno"]) +################################################################################ +# Static or dynamic (default) linking +################################################################################ + +AC_ARG_ENABLE(static, + [AS_HELP_STRING([--enable-static], + [build static ugrep binaries])], + [enable_static=yes], + [enable_static=no]) +AC_MSG_CHECKING(for --enable-static) +if test "x$enable_static" == "xyes"; then + CFLAGS="$CFLAGS -static" + LDFLAGS="$LDFLAGS -static" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + ################################################################################ # Installation preferences ################################################################################