Debian Codegraph @

libs/luajit/configure.ac

raw
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl Copyright 2016-2019 Karl Berry <[email protected]>
4 dnl Copyright 2014-2015 Peter Breitenlohner <[email protected]>
5 dnl
6 dnl This file is free software; the copyright holder
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
9 dnl
10 m4_include([version.ac])[] dnl define luajit_version
11 AC_INIT([luajit for TeX Live], luajit_version, [[email protected]])
12 AC_PREREQ([2.65])
13 AC_CONFIG_SRCDIR([LuaJIT-src/src/luajit_rolling.h])
14 AC_CONFIG_AUX_DIR([../../build-aux])
15 AC_CONFIG_MACRO_DIRS([../../m4 m4])
16
17 KPSE_BASIC([luajit])
18
19 KPSE_CANONICAL_HOST
20
21 AC_PROG_CC
22 AC_PROG_CC_C99
23 AM_PROG_AS
24 AC_PROG_RANLIB
25 AC_PROG_LN_S
26
27 AC_SUBST([LUAJITVERSION], [luajit_version])
28 KPSE_LT_VERSION([luajit])
29
30 LT_INIT([win32-dll])
31
32 KPSE_DLL_NAME([texluajit], [texluajit])
33
34 AC_CHECK_SIZEOF([void *])
35 ac_configure_args="$ac_configure_args HOST_PTR_SIZE='$ac_cv_sizeof_void_p'"
36
37 AC_SEARCH_LIBS([pow], [m])
38 AC_SEARCH_LIBS([dlopen], [dl])
39
40 KPSE_LUAJIT_DEFINES
41 KPSE_LARGEFILE([LUAJIT_DEFINES])
42
43 AS_CASE([$host_os],
44 [cygwin* | mingw* | msys*], [LJHOST='Windows'],
45 [darwin*], [LJHOST='Darwin'],
46 [solaris* | sunos*], [LJHOST='SunOS'],
47 [linux*], [LJHOST='Linux'],
48 [freebsd*], [LJHOST='FreeBSD'],
49 [LJHOST='Other'])
50 LJ_ARCH()
51 AS_CASE([$LJHOST],
52 [Windows], [LJVM_MODE=peobj
53 LUAJIT_CFLAGS="$LUAJIT_CFLAGS -malign-double"],
54 [Darwin | iOS], [LJVM_MODE=machasm],
55 [LJVM_MODE=elfasm])
56
57 dnl Original test, adapted.
58 dnl AS_IF([ echo 'extern void b(void);int a(void){b();return 0;}' | $CC -c -x c - -o tmpunwind.o && { grep -qa -e eh_frame -e __unwind_info tmpunwind.o || grep -qU -e eh_frame -e __unwind_info tmpunwind.o; }],
59 AS_IF([ echo 'extern void b(void);int a(void){b();return 0;}' | $CC -c -x c - -o tmpunwind.o && { sed -n /eh_frame/p tmpunwind.o >tmpunwind_test || sed -n /__unwind_info/p tmpunwind.o >>tmpunwind_test && test -s tmpunwind_test; }],
60 [LUAJIT_CFLAGS="$LUAJIT_CFLAGS -DLUAJIT_UNWIND_EXTERNAL"
61 rm tmpunwind.o tmpunwind_test],
62 [rm tmpunwind.o tmpunwind_test])
63 lj_save_CFLAGS=$CFLAGS
64 CFLAGS="$CFLAGS -fno-stack-protector"
65 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
66 [LUAJIT_CFLAGS="$LUAJIT_CFLAGS -fno-stack-protector"])
67 CFLAGS=$lj_save_CFLAGS
68 AM_CONDITIONAL([PEOBJ], [test "x$LJVM_MODE" = xpeobj])
69
70 AC_SUBST([LUAJIT_CFLAGS])
71 AC_SUBST([LJHOST])
72 AC_SUBST([LJVM_MODE])
73
74 dnl Extra switches
75 dnl We support openbsd x86_64 and i386,
76 dnl other platforms could require different switches.
77 dnl
78 AS_CASE([$host_os:$host_cpu],
79 [*darwin*:x86_64], [LIBLUAJIT_LDEXTRA='-image_base 7fff04c4a000'])
80 AS_CASE([$host_os:$host_cpu:$CC],
81 [*openbsd*:x86_64:clang* | *openbsd*:x86_64:cc], [LIBLUAJIT_LDEXTRA='-lc++abi -lpthread'],
82 [*openbsd*:i386:clang* | *openbsd*:i386:cc], [LIBLUAJIT_LDEXTRA='-lc++abi -lpthread'])
83 AC_SUBST([LIBLUAJIT_LDEXTRA])
84
85 AM_CONDITIONAL([build], [test "x$enable_build" != xno])
86
87 if test "x$enable_build" != xno || test -f config.force; then
88
89 AS_IF([test "x$lj_cpp" != xok],
90 [AC_MSG_ERROR([Sorry, can not preprocess <lj_arch.h>])])
91
92 echo timestamp >config.force
93 fi
94
95 # Check log2, on some systems is still not defined
96 LUAJIT_HAS_NOT_LOG2=
97 AC_CHECK_DECLS([log2], [], [LUAJIT_HAS_NOT_LOG2=[-DLUAJIT_NO_LOG2]], [[#include <math.h>]])
98 AC_SUBST([LUAJIT_HAS_NOT_LOG2])
99
100
101
102
103 AC_SUBST([LUAJIT_TREE], [LuaJIT-src])
104
105 dnl Not used but avoids putting a zillion useless -D's on the command line.
106 AC_CONFIG_HEADERS([config.h])
107
108 AC_CONFIG_FILES([Makefile include/Makefile texluajit.pc])
109
110 dnl Pass DASM_ARCH to the subdirectory native,
111 dnl which must be configured for the build system.
112 AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args DASM_ARCH=$DASM_ARCH"])
113 KPSE_NATIVE_SUBDIRS([native])
114
115 AC_OUTPUT