Skip to content

Commit

Permalink
Merge pull request #398 from fasterit/allow-static-building
Browse files Browse the repository at this point in the history
Allow static building with `./build.sh --enable-static`
  • Loading branch information
genivia-inc authored Jun 2, 2024
2 parents 4f51d50 + 7aed094 commit ee2d222
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand Down

0 comments on commit ee2d222

Please sign in to comment.