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-src/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="$LUAJIT_CFLAGS -malign-double"],
52 [Darwin | iOS], [LJVM_MODE=machasm],
54 lj_save_CFLAGS=$CFLAGS
55 CFLAGS="$CFLAGS -fno-stack-protector"
56 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
57 [LUAJIT_CFLAGS="$LUAJIT_CFLAGS -fno-stack-protector"])
58 CFLAGS=$lj_save_CFLAGS
59 AM_CONDITIONAL([PEOBJ], [test "x$LJVM_MODE" = xpeobj])
61 AC_SUBST([LUAJIT_CFLAGS])
65 AS_CASE([$host_os:$host_cpu],
66 [*darwin*:x86_64], [LIBLUAJIT_LDEXTRA='-image_base 7fff04c4a000'])
67 AC_SUBST([LIBLUAJIT_LDEXTRA])
69 AM_CONDITIONAL([build], [test "x$enable_build" != xno])
71 if test "x$enable_build" != xno || test -f config.force; then
73 AS_IF([test "x$lj_cpp" != xok],
74 [AC_MSG_ERROR([Sorry, can not preprocess <lj_arch.h>])])
76 echo timestamp >config.force
79 AC_SUBST([LUAJIT_TREE], [LuaJIT-src])
81 dnl Not used but avoids putting a zillion useless -D's on the command line.
82 AC_CONFIG_HEADERS([config.h])
84 AC_CONFIG_FILES([Makefile include/Makefile texluajit.pc])
86 dnl Pass DASM_ARCH to the subdirectory native,
87 dnl which must be configured for the build system.
88 AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args DASM_ARCH=$DASM_ARCH"])
89 KPSE_NATIVE_SUBDIRS([native])