1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2014, 2015 Peter Breitenlohner <tex-live@tug.org>
5 dnl This file is free software; the copyright holder
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 m4_include([version.ac])[] dnl define luajit_version
10 AC_INIT([luajit for TeX Live], luajit_version, [tex-k@tug.org])
12 AC_CONFIG_SRCDIR([LuaJIT-]luajit_version[/src/luajit.h])
13 AC_CONFIG_AUX_DIR([../../build-aux])
14 AC_CONFIG_MACRO_DIRS([../../m4 m4])
26 AC_SUBST([LUAJITVERSION], [luajit_version])
27 KPSE_LT_VERSION([luajit])
31 KPSE_DLL_NAME([texluajit], [texluajit])
33 AC_CHECK_SIZEOF([void *])
34 ac_configure_args="$ac_configure_args HOST_PTR_SIZE='$ac_cv_sizeof_void_p'"
36 AC_SEARCH_LIBS([sqrt], [m])
37 AC_SEARCH_LIBS([dlopen], [dl])
40 KPSE_LARGEFILE([LUAJIT_DEFINES])
43 [cygwin* | mingw* | msys*], [LJHOST='Windows'],
44 [darwin*], [LJHOST='Darwin'],
45 [solaris* | sunos*], [LJHOST='SunOS'],
46 [linux*], [LJHOST='Linux'],
50 [Windows], [LJVM_MODE=peobj
51 LUAJIT_CFLAGS=-malign-double],
52 [Darwin | iOS], [LJVM_MODE=machasm],
54 AM_CONDITIONAL([PEOBJ], [test "x$LJVM_MODE" = xpeobj])
56 AC_SUBST([LUAJIT_CFLAGS])
60 AS_CASE([$host_os:$host_cpu],
61 [*darwin*:x86_64], [LIBLUAJIT_LDEXTRA='-image_base 7fff04c4a000'])
62 AC_SUBST([LIBLUAJIT_LDEXTRA])
64 AM_CONDITIONAL([build], [test "x$enable_build" != xno])
66 if test "x$enable_build" != xno || test -f config.force; then
68 AS_IF([test "x$lj_cpp" != xok],
69 [AC_MSG_ERROR([Sorry, can not preprocess <lj_arch.h>])])
71 echo timestamp >config.force
74 AC_SUBST([LUAJIT_TREE], [LuaJIT-]luajit_version)
76 dnl Not used but avoids putting a zillion useless -D's on the command line.
77 AC_CONFIG_HEADERS([config.h])
79 AC_CONFIG_FILES([Makefile include/Makefile texluajit.pc])
81 dnl Pass DASM_ARCH to the subdirectory native,
82 dnl which must be configured for the build system.
83 AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args DASM_ARCH=$DASM_ARCH"])
84 KPSE_NATIVE_SUBDIRS([native])