beta-0.89.2
[luatex.git] / source / libs / luajit / configure.ac
blob68efbddbb349ce703d16c92f6692a15d91441f34
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl   Copyright (C) 2014, 2015 Peter Breitenlohner <tex-live@tug.org>
4 dnl
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.
8 dnl
9 m4_include([version.ac])[] dnl define luajit_version
10 AC_INIT([luajit for TeX Live], luajit_version, [tex-k@tug.org])
11 AC_PREREQ([2.65])
12 AC_CONFIG_SRCDIR([LuaJIT-src/src/luajit.h])
13 AC_CONFIG_AUX_DIR([../../build-aux])
14 AC_CONFIG_MACRO_DIRS([../../m4 m4])
16 KPSE_BASIC([luajit])
18 KPSE_CANONICAL_HOST
20 AC_PROG_CC
21 AC_PROG_CC_C99
22 AM_PROG_AS
23 AC_PROG_RANLIB
24 AC_PROG_LN_S
26 AC_SUBST([LUAJITVERSION], [luajit_version])
27 KPSE_LT_VERSION([luajit])
29 LT_INIT([win32-dll])
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])
39 KPSE_LUAJIT_DEFINES
40 KPSE_LARGEFILE([LUAJIT_DEFINES])
42 AS_CASE([$host_os],
43         [cygwin* | mingw* | msys*], [LJHOST='Windows'],
44         [darwin*], [LJHOST='Darwin'],
45         [solaris* | sunos*], [LJHOST='SunOS'],
46         [linux*], [LJHOST='Linux'],
47                   [LJHOST='Other'])
48 LJ_ARCH()
49 AS_CASE([$LJHOST],
50         [Windows], [LJVM_MODE=peobj
51                     LUAJIT_CFLAGS="$LUAJIT_CFLAGS -malign-double"],
52         [Darwin | iOS], [LJVM_MODE=machasm],
53                         [LJVM_MODE=elfasm])
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])
62 AC_SUBST([LJHOST])
63 AC_SUBST([LJVM_MODE])
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])
91 AC_OUTPUT