diff --git a/README.md b/README.md index 55e8b71..fac13fc 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ $ ./configure $ make -j ``` +Since no sensible functionality independent of cairo is implemented as of now, +cairo is a hard dependency. On NixOS the included `shell.nix` script can be +used to bring the dependencies and a couple of development tools intos cope. + HTML documentation can be generated with `make html` if Doxygen is installed. diff --git a/configure.ac b/configure.ac index 3b93605..7910fcd 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,10 @@ AX_CHECK_COMPILE_FLAG([-std=c11], [ CFLAGS+=" -std=c11" ], [ AC_MSG_ERROR([C compiler doesn't support C11 mode])] ) +# Other tools +AC_PROG_RANLIB +AM_PROG_AR + # Checks for header files. AC_CHECK_HEADERS([assert.h math.h stdint.h stdlib.h stdbool.h stdio.h]) @@ -32,13 +36,10 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([memmove memset mkdir pow strchr strdup strstr strtol]) -# User defined options: debug, lto +# User defined options: debug AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],[compile with debug options])], [debug=${enableval}], [debug=no]) -AC_ARG_ENABLE([lto], - [AS_HELP_STRING([--disable-lto], [disable link time optimization])], - [lto=${enableval}], [lto=yes]) # Libraries PKG_CHECK_MODULES([CAIRO], [cairo]) @@ -52,19 +53,9 @@ if test x$debug = xyes; then CFLAGS+=" -ftrapv" CPPFLAGS+="-DDEBUG" YFLAGS+=" --debug -v" - lto=no else CFLAGS+=" -O3" CPPFLAGS+=" -DNDEBUG" - CFLAGS+=" -fomit-frame-pointer" - AX_CHECK_COMPILE_FLAG([-finline-limit=1000000 ], - [ CFLAGS+=" -finline-limit=1000000" ]) -fi - -if test x$lto = xyes; then - AX_CHECK_COMPILE_FLAG([-flto], - [ CFLAGS+=" -flto" ], - [ AC_MSG_WARN([C compiler doesn't support link time optimization])] ) fi AC_CONFIG_FILES([Makefile src/Makefile]) diff --git a/shell.nix b/shell.nix index 5b2684e..eb667e2 100644 --- a/shell.nix +++ b/shell.nix @@ -15,6 +15,6 @@ pkgs.stdenv.mkDerivation { name = "hvif-light"; hardeningDisable = [ "all" ]; - buildInputs = with pkgs; [ autoconf automake gcc clang-tools gdb valgrind-light pkg-config cairo doxygen ]; + buildInputs = with pkgs; [ autoconf automake gcc clang-tools gdb valgrind-light pkg-config cairo doxygen libtool ]; } diff --git a/src/Makefile.am b/src/Makefile.am index 22e34a3..4ddd30f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ NULL = bin_PROGRAMS = hvif +lib_LIBRARIES = libhviflight.a # hvif configuration hvif_CFLAGS = \ @@ -13,16 +14,36 @@ hvif_CPPFLAGS = \ $(NULL) hvif_LDADD = \ $(AM_LDADD) \ - -lm \ $(CAIRO_LIBS) \ + -lm \ + libhviflight.a \ + $(NULL) + +# libhviflight.a configuration +libhviflight_a_CFLAGS = \ + $(AM_CFLAGS) \ + $(CAIRO_CFLAGS) \ + $(NULL) +libhviflight_a_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_builddir)/src \ + $(NULL) +libhviflight_a_LIBADD = \ + $(AM_LIBAD) \ + $(NULL) + +libhviflight_a_SOURCES = \ + $(BUILT_SOURCES) \ + src/hvif-light.c \ + src/hvif-light.h \ + src/hvif-cairo.c \ + src/hvif-cairo.h \ $(NULL) hvif_SOURCES = \ $(BUILT_SOURCES) \ src/main.c \ - src/hvif-light.c \ src/hvif-light.h \ - src/hvif-cairo.c \ src/hvif-cairo.h \ $(NULL)