Add support for static linking on OS X. It's only partial since

full static linking is not supported, but most of the non-standard
libraries will be linked in statically.
pull/37/merge
Tim Stack 13 years ago
parent 2bb28bc333
commit a24a4f5533

28
configure vendored

@ -2344,8 +2344,15 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
for defdir in /usr/local /opt/local; do
if test -d "$defdir/include"; then
CPPFLAGS="$CPPFLAGS -I$defdir/include"
fi
if test -d "$defdir/lib"; then
LDFLAGS="$LDFLAGS -L$defdir/lib"
fi
done
case x$srcdir in
x/*)
@ -3146,8 +3153,21 @@ fi
if test x"${enable_static}" != x"no"; then
case "$host_os" in
darwin*)
{ echo "$as_me:$LINENO: WARNING: \"static linking is not supported on $host_os\"" >&5
echo "$as_me: WARNING: \"static linking is not supported on $host_os\"" >&2;}
STATIC_LDFLAGS="$STATIC_LDFLAGS -Wl,-search_paths_first -Lstatic-libs"
# This is a hack to link against static libraries instead of shared
# on OS X so that we can build a mostly statically link exe that can
# be downloaded and used right away.
mkdir -p src/static-libs
for libflag in $LDFLAGS; do
case $libflag in
-Lstatic-libs)
;;
-L*)
ln -sf `echo $libflag/*.a | sed -e 's/-L//'` \
src/static-libs/.;
;;
esac
done
;;
*)
STATIC_LDFLAGS="$STATIC_LDFLAGS -static"

@ -7,8 +7,15 @@ AC_PREFIX_DEFAULT(/usr/)
AC_CANONICAL_HOST
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
for defdir in /usr/local /opt/local; do
if test -d "$defdir/include"; then
CPPFLAGS="$CPPFLAGS -I$defdir/include"
fi
if test -d "$defdir/lib"; then
LDFLAGS="$LDFLAGS -L$defdir/lib"
fi
done
dnl abssrcdir is the absolute path to the source base (regardless of where
dnl you are building it)
@ -33,7 +40,21 @@ AC_ARG_ENABLE([static],
if test x"${enable_static}" != x"no"; then
case "$host_os" in
darwin*)
AC_WARN("static linking is not supported on $host_os")
STATIC_LDFLAGS="$STATIC_LDFLAGS -Wl,-search_paths_first -Lstatic-libs"
# This is a hack to link against static libraries instead of shared
# on OS X so that we can build a mostly statically link exe that can
# be downloaded and used right away.
mkdir -p src/static-libs
for libflag in $LDFLAGS; do
case $libflag in
-Lstatic-libs)
;;
-L*)
ln -sf `echo $libflag/*.a | sed -e 's/-L//'` \
src/static-libs/.;
;;
esac
done
;;
*)
STATIC_LDFLAGS="$STATIC_LDFLAGS -static"

@ -21,7 +21,6 @@ LDADD = \
$(READLINE_LIBS) \
$(CURSES_LIB) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
-lpcrecpp
noinst_HEADERS = \
@ -86,9 +85,6 @@ lnav_LDADD = help.o $(LDADD)
bin2c_SOURCES = bin2c.c
DISTCLEANFILES = \
help.txt.term
uncrusty:
(cd $(srcdir) && uncrustify -c ../lnav.cfg --replace $(SOURCES) \
$(HEADERS))

@ -69,13 +69,11 @@ bin2c_OBJECTS = $(am_bin2c_OBJECTS)
bin2c_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
bin2c_DEPENDENCIES = libdiag.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_lnav_OBJECTS = lnav.$(OBJEXT)
lnav_OBJECTS = $(am_lnav_OBJECTS)
am__DEPENDENCIES_2 = libdiag.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
lnav_DEPENDENCIES = help.o $(am__DEPENDENCIES_2)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -221,7 +219,6 @@ LDADD = \
$(READLINE_LIBS) \
$(CURSES_LIB) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
-lpcrecpp
noinst_HEADERS = \
@ -284,9 +281,6 @@ libdiag_a_SOURCES = \
lnav_SOURCES = lnav.cc $(HELP_SRC)
lnav_LDADD = help.o $(LDADD)
bin2c_SOURCES = bin2c.c
DISTCLEANFILES = \
help.txt.term
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@ -531,7 +525,6 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"

@ -2835,6 +2835,12 @@ int main(int argc, char *argv[])
int lpc, c, retval = EXIT_SUCCESS;
auto_ptr<piper_proc> stdin_reader;
/* If we statically linked against an ncurses library that had a non-
* standard path to the terminfo database, we need to set this variable
* so that it will try the default path.
*/
setenv("TERMINFO_DIRS", "/usr/share/terminfo", 0);
ensure_dotlnav();
if (sqlite3_open(":memory:", lnav_data.ld_db.out()) != SQLITE_OK) {

Loading…
Cancel
Save