+autom4te.cache
+config.h
+config.h.in
+config.log
+config.make
+config.status
+configure
manual.html-chunked
manual.pdf
manual.toc
To install tig simply run:
+ $ sh autoconf.sh
+ $ ./configure
$ make install
To install documentation run:
$ make install-doc
-Edit the Makefile if you need to configure specific compiler or linker flags.
-On FreeBSD for example the c library does not support the iconv interface and
-to compile tig you need to append `-L/usr/local/lib -liconv` to `LDLIBS` and
-`-I/usr/local/include` to the `CFLAGS` variable.
+If you had to install your own copy of libiconv, you'll probably want to pass
+the "--with-libiconv" option to the "configure" script to tell it where to look.
The following tools and packages are needed:
-prefix = $(HOME)
-bindir = $(prefix)/bin
-mandir = $(prefix)/man
-docdir = $(prefix)/share/doc
+## Makefile for tig
+
+# Include setting from the configure script
+-include config.make
+
+prefix ?= $(HOME)
+bindir ?= $(prefix)/bin
+mandir ?= $(prefix)/man
+datarootdir ?= $(prefix)/share
+docdir ?= $(datarootdir)/doc
# DESTDIR=
# Get version either via git or from VERSION file. Allow either
RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)
LDLIBS = -lcurses
-CFLAGS = -Wall -O2
+CFLAGS ?= -Wall -O2
DFLAGS = -g -DDEBUG -Werror
PROGS = tig
MANDOC = tig.1 tigrc.5
override CFLAGS += '-DVERSION="$(VERSION)"'
+AUTOHEADER ?= autoheader
+AUTOCONF ?= autoconf
+
all: $(PROGS)
all-debug: $(PROGS)
all-debug: CFLAGS += $(DFLAGS)
rpm: dist
rpmbuild -ta $(TARNAME).tar.gz
+configure: configure.ac
+ $(AUTOHEADER)
+ $(AUTOCONF)
+
# Maintainer stuff
release-doc:
git checkout release && \
part of the commit detail information you display on the lower pane
(log/diff view).
- - Use autoconf to check for iconv in libc and how it is declared (the
- 2nd argument is 'const' on FreeBSD / Mac OS X). Maybe also check for
- the AsciiDoc and XmlTo document tools.
+ - Use autoconf to check for the AsciiDoc and XmlTo document tools.
- The autoconf check could also be used to determine whether it is a
newer git so that git-config will be used instead of git-repo-config.
--- /dev/null
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+LDLIBS = @LIBS@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+mandir = @mandir@
+docdir = @docdir@
+datarootdir = @datarootdir@
--- /dev/null
+AC_INIT([tig], [0],
+ [Jonas Fonseca <fonseca@diku.dk>],
+ [tig])
+AC_LANG([C])
+AC_CONFIG_HEADER(config.h)
+AC_CONFIG_SRCDIR(tig.c)
+
+AC_ARG_WITH(libiconv,
+ AC_HELP_STRING([--with-libiconv=DIRECTORY],[base directory for libiconv]))
+if test "$with_libiconv" != ""
+then
+ CFLAGS="$CFLAGS -I$with_libiconv/include"
+ LDFLAGS="$LDFLAGS -L$with_libiconv/lib"
+fi
+
+dnl
+dnl See if we need to link with -liconv to get the iconv() function.
+dnl
+AC_SEARCH_LIBS([wclear], [ncurses curses])
+AC_SEARCH_LIBS([iconv], [iconv])
+
+if test "$ac_cv_search_iconv" = "no"
+then
+ AC_MSG_FAILURE([iconv() not found. Please install libiconv.],[1])
+fi
+
+dnl
+dnl See if iconv() requires a const char ** for the input buffer.
+dnl
+if test "$GCC" = "yes"
+then
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_MSG_CHECKING([whether iconv needs const char **])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <iconv.h>]],
+ [[char **buf;
+ size_t *size;
+ iconv_t cd;
+ iconv(cd, buf, size, buf, size);]])],
+ [AC_DEFINE([ICONV_INBUF_TYPE],[char *],
+ [Type of iconv() input buffer])
+ AC_MSG_RESULT([no])],
+ [AC_DEFINE([ICONV_INBUF_TYPE],[const char *],
+ [Type of iconv() input buffer])
+ AC_MSG_RESULT([yes])])
+ CFLAGS="$OLD_CFLAGS"
+fi
+
+AC_PROG_CC
+
+AC_CONFIG_FILES([config.make])
+AC_OUTPUT
* GNU General Public License for more details.
*/
-#ifndef VERSION
-#define VERSION "unknown-version"
+#ifndef TIG_VERSION
+#define TIG_VERSION "unknown-version"
#endif
#ifndef DEBUG
#include <curses.h>
+#include "config.h"
+
#if __GNUC__ >= 3
#define __NORETURN __attribute__((__noreturn__))
#else
*/
static const char usage[] =
-"tig " VERSION " (" __DATE__ ")\n"
+"tig " TIG_VERSION " (" __DATE__ ")\n"
"\n"
"Usage: tig [options]\n"
" or: tig [options] [--] [git log options]\n"
}
if (check_option(opt, 'v', "version", OPT_NONE)) {
- printf("tig version %s\n", VERSION);
+ printf("tig version %s\n", TIG_VERSION);
return FALSE;
}
line[linelen - 1] = 0;
if (opt_iconv != ICONV_NONE) {
- char *inbuf = line;
+ ICONV_INBUF_TYPE inbuf = line;
size_t inlen = linelen;
char *outbuf = out_buffer;
break;
case REQ_SHOW_VERSION:
- report("tig-%s (built %s)", VERSION, __DATE__);
+ report("tig-%s (built %s)", TIG_VERSION, __DATE__);
return TRUE;
case REQ_SCREEN_RESIZE: