From 590d51030c1db82e4a6dc59dffa9634ac2293643 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Thu, 15 Oct 2009 09:18:30 -0700 Subject: [PATCH] some more build work --- Makefile.in | 1 + configure | 119 ++++++++++++++++++++++++++++++++++++++++++++++- configure.in | 14 +++++- src/Makefile.am | 4 +- src/Makefile.in | 31 ++++++------ src/config.h.in | 3 ++ src/lnav.cc | 12 ++++- test/Makefile.in | 1 + 8 files changed, 164 insertions(+), 21 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1e044323..a5d1c73d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -112,6 +112,7 @@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ diff --git a/configure b/configure index 9e2b5283..568d63cf 100755 --- a/configure +++ b/configure @@ -651,6 +651,9 @@ READLINE_LIBS PCRE_CFLAGS PCRE_LIBS CURSES_LIB +OBJ_FORMAT +HAVE_OBJ_FORMAT_FALSE +HAVE_OBJ_FORMAT_TRUE HAVE_OBJCOPY_FALSE HAVE_OBJCOPY_TRUE OBJCOPY @@ -5687,6 +5690,25 @@ else fi +case "$host_cpu" in +x86_64) + OBJ_FORMAT=elf64-x86-64 + ;; +*) + { $as_echo "$as_me:$LINENO: WARNING: \"embedded help not supported for $host_cpu\"" >&5 +$as_echo "$as_me: WARNING: \"embedded help not supported for $host_cpu\"" >&2;} + ;; +esac + if test x"$OBJ_FORMAT" != x"" -a x"$OBJCOPY" != x""; then + HAVE_OBJ_FORMAT_TRUE= + HAVE_OBJ_FORMAT_FALSE='#' +else + HAVE_OBJ_FORMAT_TRUE='#' + HAVE_OBJ_FORMAT_FALSE= +fi + + + { $as_echo "$as_me:$LINENO: checking for library containing openpty" >&5 $as_echo_n "checking for library containing openpty... " >&6; } if test "${ac_cv_search_openpty+set}" = set; then @@ -5774,9 +5796,97 @@ if test "$ac_res" != no; then fi +{ $as_echo "$as_me:$LINENO: checking for library containing gzseek" >&5 +$as_echo_n "checking for library containing gzseek... " >&6; } +if test "${ac_cv_search_gzseek+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gzseek (); +int +main () +{ +return gzseek (); + ; + return 0; +} +_ACEOF +for ac_lib in '' libz; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_search_gzseek=$ac_res +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_gzseek+set}" = set; then + break +fi +done +if test "${ac_cv_search_gzseek+set}" = set; then + : +else + ac_cv_search_gzseek=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_gzseek" >&5 +$as_echo "$ac_cv_search_gzseek" >&6; } +ac_res=$ac_cv_search_gzseek +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + -for ac_header in pty.h util.h + +for ac_header in pty.h util.h zlib.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -7056,6 +7166,13 @@ $as_echo "$as_me: error: conditional \"HAVE_OBJCOPY\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${HAVE_OBJ_FORMAT_TRUE}" && test -z "${HAVE_OBJ_FORMAT_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_OBJ_FORMAT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"HAVE_OBJ_FORMAT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${HAVE_LIBSQLITE3_TRUE}" && test -z "${HAVE_LIBSQLITE3_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_LIBSQLITE3\" was never defined. Usually this means the macro was only invoked conditionally." >&5 diff --git a/configure.in b/configure.in index e7147887..0a03b368 100644 --- a/configure.in +++ b/configure.in @@ -51,8 +51,20 @@ AC_CHECK_SIZEOF(size_t) AC_CHECK_PROG(OBJCOPY, objcopy, objcopy) AM_CONDITIONAL(HAVE_OBJCOPY, test x"$OBJCOPY" != x"") +case "$host_cpu" in +x86_64) + OBJ_FORMAT=elf64-x86-64 + ;; +*) + AC_WARN("embedded help not supported for $host_cpu") + ;; +esac +AM_CONDITIONAL(HAVE_OBJ_FORMAT, test x"$OBJ_FORMAT" != x"" -a x"$OBJCOPY" != x"") +AC_SUBST(OBJ_FORMAT) + AC_SEARCH_LIBS(openpty, util) -AC_CHECK_HEADERS(pty.h util.h) +AC_SEARCH_LIBS(gzseek, libz) +AC_CHECK_HEADERS(pty.h util.h zlib.h) MP_WITH_CURSES() AX_PATH_LIB_PCRE([], [AC_MSG_ERROR([pcre required to build])]) diff --git a/src/Makefile.am b/src/Makefile.am index 5a017a49..b9c41046 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,13 +3,13 @@ bin_PROGRAMS = lnav noinst_LIBRARIES = libdiag.a -if HAVE_OBJCOPY +if HAVE_OBJ_FORMAT help.txt.term: help.txt cat $< > $@ /bin/echo -en '\000' >> $@ help.o: help.txt.term - objcopy -I binary -O elf64-x86-64 -Bi386 \ + objcopy -I binary -O $(OBJ_FORMAT) -Bi386 \ --redefine-sym _binary_help_txt_term_start=help_text_start \ --redefine-sym _binary_help_txt_term_end=help_text_end \ --redefine-sym _binary_help_txt_term_size=help_text_size \ diff --git a/src/Makefile.in b/src/Makefile.in index 54c0973e..95c82bd2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -64,12 +64,12 @@ am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__lnav_SOURCES_DIST = lnav.cc help.cc -@HAVE_OBJCOPY_FALSE@am__objects_1 = help.$(OBJEXT) +@HAVE_OBJ_FORMAT_FALSE@am__objects_1 = help.$(OBJEXT) am_lnav_OBJECTS = lnav.$(OBJEXT) $(am__objects_1) lnav_OBJECTS = $(am_lnav_OBJECTS) lnav_LDADD = $(LDADD) am__DEPENDENCIES_1 = -@HAVE_OBJCOPY_TRUE@am__DEPENDENCIES_2 = help.o +@HAVE_OBJ_FORMAT_TRUE@am__DEPENDENCIES_2 = help.o lnav_DEPENDENCIES = libdiag.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ /usr/lib/libsqlite3.a @@ -126,6 +126,7 @@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -199,10 +200,10 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libdiag.a -@HAVE_OBJCOPY_FALSE@HELP_O = -@HAVE_OBJCOPY_TRUE@HELP_O = help.o -@HAVE_OBJCOPY_FALSE@HELP_SRC = help.cc -@HAVE_OBJCOPY_TRUE@HELP_SRC = +@HAVE_OBJ_FORMAT_FALSE@HELP_O = +@HAVE_OBJ_FORMAT_TRUE@HELP_O = help.o +@HAVE_OBJ_FORMAT_FALSE@HELP_SRC = help.cc +@HAVE_OBJ_FORMAT_TRUE@HELP_SRC = AM_LDFLAGS = \ $(SQLITE3_LDFLAGS) \ -pthread @@ -574,16 +575,16 @@ uninstall-am: uninstall-binPROGRAMS uninstall-am uninstall-binPROGRAMS -@HAVE_OBJCOPY_TRUE@help.txt.term: help.txt -@HAVE_OBJCOPY_TRUE@ cat $< > $@ -@HAVE_OBJCOPY_TRUE@ /bin/echo -en '\000' >> $@ +@HAVE_OBJ_FORMAT_TRUE@help.txt.term: help.txt +@HAVE_OBJ_FORMAT_TRUE@ cat $< > $@ +@HAVE_OBJ_FORMAT_TRUE@ /bin/echo -en '\000' >> $@ -@HAVE_OBJCOPY_TRUE@help.o: help.txt.term -@HAVE_OBJCOPY_TRUE@ objcopy -I binary -O elf64-x86-64 -Bi386 \ -@HAVE_OBJCOPY_TRUE@ --redefine-sym _binary_help_txt_term_start=help_text_start \ -@HAVE_OBJCOPY_TRUE@ --redefine-sym _binary_help_txt_term_end=help_text_end \ -@HAVE_OBJCOPY_TRUE@ --redefine-sym _binary_help_txt_term_size=help_text_size \ -@HAVE_OBJCOPY_TRUE@ $< $@ +@HAVE_OBJ_FORMAT_TRUE@help.o: help.txt.term +@HAVE_OBJ_FORMAT_TRUE@ objcopy -I binary -O $(OBJ_FORMAT) -Bi386 \ +@HAVE_OBJ_FORMAT_TRUE@ --redefine-sym _binary_help_txt_term_start=help_text_start \ +@HAVE_OBJ_FORMAT_TRUE@ --redefine-sym _binary_help_txt_term_end=help_text_end \ +@HAVE_OBJ_FORMAT_TRUE@ --redefine-sym _binary_help_txt_term_size=help_text_size \ +@HAVE_OBJ_FORMAT_TRUE@ $< $@ uncrusty: (cd $(srcdir) && uncrustify -c ../lnav.cfg --replace $(SOURCES) \ diff --git a/src/config.h.in b/src/config.h.in index c51c22a8..c8db795a 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -60,6 +60,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_ZLIB_H + /* Name of package */ #undef PACKAGE diff --git a/src/lnav.cc b/src/lnav.cc index 9f33e850..4cb38a4c 100644 --- a/src/lnav.cc +++ b/src/lnav.cc @@ -1683,6 +1683,7 @@ static void usage(void) "\n" "Options:\n" " -h Print this message, then exit.\n" + " -V Print version information.\n" " -s Load the most recent syslog messages file.\n" " -a Load all of the most recent log file types.\n" " -r Load older rotated log files as well.\n" @@ -1695,7 +1696,9 @@ static void usage(void) " $ lnav\n" "\n" " To interleave the JBoss and backend log files -\n" - " $ lnav -bf\n"; + " $ lnav -bf\n" + "\n" + "Version: " PACKAGE_STRING "\n"; fprintf(stderr, usage_msg, lnav_data.ld_program_name); } @@ -2395,7 +2398,7 @@ int main(int argc, char *argv[]) lnav_data.ld_looping = true; lnav_data.ld_mode = LNM_PAGING; lnav_data.ld_debug_log_name = "/dev/null"; // XXX change to /dev/null - while ((c = getopt(argc, argv, "harsd:")) != -1) { + while ((c = getopt(argc, argv, "harsd:V")) != -1) { switch (c) { case 'h': usage(); @@ -2418,6 +2421,11 @@ int main(int argc, char *argv[]) lnav_data.ld_flags |= LNF_SYSLOG; break; + case 'V': + printf("%s\n", PACKAGE_STRING); + exit(0); + break; + default: retval = EXIT_FAILURE; break; diff --git a/test/Makefile.in b/test/Makefile.in index 1b8b9986..6157f4ab 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -186,6 +186,7 @@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@