Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow static building with ./build.sh --enable-static #398

Merged
merged 1 commit into from
Jun 2, 2024
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
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