enable optional inline dependency build

This commit is contained in:
Danny Robson 2016-04-05 11:16:23 +10:00
parent 08155c41f3
commit 4a990fe2a9
8 changed files with 60 additions and 24 deletions

View File

@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = dist-bzip2 dist-xz subdir-objects AUTOMAKE_OPTIONS = dist-bzip2 dist-xz subdir-objects
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
AM_CXXFLAGS = $(UTIL_CRUFT_CFLAGS) AM_CXXFLAGS = $(UTIL_CFLAGS)
DEFAULT_INCLUDES = -I${top_srcdir} -I${top_builddir} -I${top_builddir}/vk DEFAULT_INCLUDES = -I${top_srcdir} -I${top_builddir} -I${top_builddir}/vk
lib_LIBRARIES = libcruft-vk.a lib_LIBRARIES = libcruft-vk.a

View File

@ -21,6 +21,8 @@ NC_OPTIMISATION
NC_WARNINGS NC_WARNINGS
NC_DEBUGGING NC_DEBUGGING
NC_SUBPACKAGE_ENABLE
LT_INIT LT_INIT
AM_INIT_AUTOMAKE([1.14 foreign dist-xz dist-bzip2 subdir-objects]) AM_INIT_AUTOMAKE([1.14 foreign dist-xz dist-bzip2 subdir-objects])
@ -44,15 +46,20 @@ AS_IF([test "x$XSLTPROC" == "xfalse"], [
############################################################################### ###############################################################################
## Required packages ## Required packages
PKG_CHECK_MODULES([UTIL_CRUFT], [libcruft-util]) PKG_CHECK_MODULES([UTIL], [libcruft-util])
AC_SUBST([UTIL_CRUFT_CFLAGS]) AC_SUBST([UTIL_CFLAGS])
AC_SUBST([UTIL_CRUFT_LIBS]) AC_SUBST([UTIL_LIBS])
############################################################################### ###############################################################################
## Output ## Output
AX_APPEND_FLAG([-include config.h]) AX_APPEND_FLAG([-include config.h])
AC_CONFIG_FILES([Doxyfile libcruft-vk.pc Makefile]) NC_SUBPACKAGE_PC([libcruft-vk.pc])
AC_CONFIG_FILES([
Doxyfile
Makefile
])
AC_OUTPUT AC_OUTPUT

7
libcruft-vk-inline.pc.in Normal file
View File

@ -0,0 +1,7 @@
Name: libcruft-vk
Description: A Vulkan wrapper for C++
URL: http://nerdcruft.net/
Version: @VERSION@
Requires: libcruft-util
Libs: @abs_top_builddir@/libcruft-vk.a
Cflags: -isystem @abs_top_builddir@/fake

View File

@ -9,4 +9,4 @@ URL: http://nerdcruft.net/
Version: @VERSION@ Version: @VERSION@
Requires: libcruft-util Requires: libcruft-util
Libs: -L${libdir} -lcruft-vk Libs: -L${libdir} -lcruft-vk
Cflags: -I${includedir}/cruft Cflags: -I${includedir}

View File

@ -6,9 +6,7 @@ AC_DEFUN([NC_DEBUGGING],[
AX_REQUIRE_DEFINED([NC_APPEND_ONE_COMPILE_FLAG]) AX_REQUIRE_DEFINED([NC_APPEND_ONE_COMPILE_FLAG])
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
AC_ARG_ENABLE([sanitizer], [ AC_ARG_ENABLE([sanitizer], [AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])])
AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])
])
AS_IF([test "x$enable_sanitizer" = "xyes"], [ AS_IF([test "x$enable_sanitizer" = "xyes"], [
m4_foreach([NAME], [ m4_foreach([NAME], [
@ -51,9 +49,7 @@ AC_DEFUN([NC_DEBUGGING],[
]) ])
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
AC_ARG_ENABLE([debugging], [ AC_ARG_ENABLE([debugging], [AS_HELP_STRING([--enable-debugging], [enables developer debugging support])])
AS_HELP_STRING([--enable-debugging], [enables developer debugging support])
])
AS_IF([test "x${enable_debugging}" = "xyes"], [ AS_IF([test "x${enable_debugging}" = "xyes"], [
AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled]) AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled])

View File

@ -1,7 +1,6 @@
AC_DEFUN([NC_OPTIMISATION],[ AC_DEFUN([NC_OPTIMISATION],[
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AC_CANONICAL_HOST])
AX_REQUIRE_DEFINED([AX_COMPILER_VENDOR]) AX_REQUIRE_DEFINED([AX_COMPILER_VENDOR])
AX_COMPILER_VENDOR AX_COMPILER_VENDOR
@ -9,15 +8,9 @@ AC_DEFUN([NC_OPTIMISATION],[
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
## Enable LTO ## Enable LTO
AC_ARG_ENABLE([lto], [ AC_ARG_ENABLE([lto], [AS_HELP_STRING([--enable-lto], [enable link-time optimisation])])
AS_HELP_STRING([--enable-lto], [enable link-time optimisation])
])
AS_IF([test "x$enable_lto" == "xyes"], [ AS_IF([test "x$enable_lto" == "xyes"], [
AS_IF([test x"${host_os}" == x"mingw32"], [
AC_ERROR([mingw32 link-time optimisation is currently broken])
])
AS_IF([test "x$ax_cv_cxx_compiler_vendor" == "xgnu"], [ AS_IF([test "x$ax_cv_cxx_compiler_vendor" == "xgnu"], [
AC_CHECK_TOOLS([RANLIB], [gcc-ranlib ranlib]) AC_CHECK_TOOLS([RANLIB], [gcc-ranlib ranlib])
AC_CHECK_TOOLS([AR], [gcc-ar ar]) AC_CHECK_TOOLS([AR], [gcc-ar ar])
@ -35,9 +28,7 @@ AC_DEFUN([NC_OPTIMISATION],[
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
## Enable frame pointer ## Enable frame pointer
AC_ARG_ENABLE([frame-pointer], [ AC_ARG_ENABLE([frame-pointer], [AS_HELP_STRING([--enable-frame-pointer], [retain the frame pointer even if optimising])])
AS_HELP_STRING([--enable-frame-pointer], [retain the frame pointer even if optimising])
])
AS_IF([test "x$enable_frame_pointer" = "xyes"], [ AS_IF([test "x$enable_frame_pointer" = "xyes"], [
AX_APPEND_COMPILE_FLAGS([-fno-omit-frame-pointer], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-fno-omit-frame-pointer], [], [-Werror])

View File

@ -6,6 +6,8 @@ AC_DEFUN([NC_PLATFORM],[
AS_CASE([$host_os], AS_CASE([$host_os],
[mingw32], [ [mingw32], [
AC_DEFINE([WIN32_LEAN_AND_MEAN], [], [reduce win32 header complexity])
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h]) AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT]) AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT])
AC_SUBST([NET_LIBS], [-lws2_32]) AC_SUBST([NET_LIBS], [-lws2_32])

33
m4/nc_subpackage.m4 Normal file
View File

@ -0,0 +1,33 @@
AC_DEFUN([NC_SUBPACKAGE_PC], [
base=`basename $1 .pc`
AC_CONFIG_FILES([$1:$base$nc_cv_config_pc_postfix.pc.in])
])
AC_DEFUN([NC_SUBPACKAGE_ENABLE],[
AC_ARG_ENABLE([inline], [AS_HELP_STRING([--enable-inline], [enable building for use as an inline dependency])])
AS_IF([test "x$enable_inline" == "xyes"], [
AC_PROG_LN_S
AC_CACHE_VAL([nc_cv_config_pc_postfix], [nc_cv_config_pc_postfix='-inline'])
AC_CONFIG_COMMANDS([fake/cruft], [
dnl make a fake include directory which looks like the typical
dnl installation prefix. we should probably use AC_CONFIG_LINKS
dnl but i'm not proficient enough at m4 to process the globs
dnl correctly.
AS_ECHO(["fake/cruft/$cruft_base"])
AS_MKDIR_P(["fake/cruft"])
$LN_S -nf "$ac_abs_top_srcdir" "fake/cruft/$cruft_base"
AS_IF([test ! -L "fake/cruft/$cruft_base"], [
AC_MSG_ERROR([could not create inline include directory])
])
], [
cruft_base=`echo "${PACKAGE_NAME}" | sed 's/-.*//'`
])
])
])