-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
130 lines (108 loc) · 3.15 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
dnl Define ourselves
AC_INIT(tcc4tcl, @@VERS@@)
dnl Default prefix should be "UNSPECIFIED" to use magic in the Makefile
ac_default_prefix="UNSPECIFIED"
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_GNU_SOURCE
AC_LANG(C)
dnl Determine system information
DC_CHK_OS_INFO
dnl Perform Tcl Extension required stuff
TCLEXT_INIT
dnl Determine if a shared or static build is requested
TCC4TCL_TARGET="${TCLEXT_BUILD}"
dnl Configure TCC build options
AC_SUBST(TCC_CONFIGURE_OPTS)
TCC_CONFIGURE_OPTS=""
if test "${TCC4TCL_TARGET}" = "shared"; then
dnl Determine how to make shared objects
DC_GET_SHOBJFLAGS
dnl Only export symbols we wish to expose
TARGET="tcc4tcl.${SHOBJEXT}"
else
TCC_EXTRA_CFLAGS="${TCC_EXTRA_CFLAGS} -DCONFIG_TCC_STATIC=1"
AC_CHECK_TOOL([RANLIB], [ranlib])
AC_CHECK_TOOL([AR], [ar])
TARGET="tcc4tcl-static.a"
fi
AC_SUBST(TARGET)
AC_SUBST(TCC4TCL_TARGET)
AC_SUBST(TCC_EXTRA_CFLAGS)
dnl -- If cross-compiling, specify a "--cross-prefix" and define the CPU
if test "${host}" != "${build}"; then
cross_prefix="`echo "${AR}" | sed 's@ .*$@@;s@^ar$@@;s@-ar$@@'`"
if test -z "${cross_prefix}"; then
cross_prefix="`echo "${CC}" | sed 's@ .*$@@;s@^[[^-]]*$@@;s@-[[^-]]*$@@'`"
fi
if test -z "${cross_prefix}"; then
cross_prefix="${host_alias}"
fi
TCC_CONFIGURE_OPTS="${TCC_CONFIGURE_OPTS} --cross-prefix=${cross_prefix}- --cpu=${host_cpu} --os=${host_os}"
fi
no_dlopen='0'
AC_ARG_WITH([dlopen], AS_HELP_STRING([--without-dlopen], [do not define dlopen/dlclose/dlerror]), [
if test "$withval" = "no"; then
no_dlopen='1'
else
no_dlopen='0'
fi
])
if test "$no_dlopen" = '1'; then
CPPFLAGS="${CPPFLAGS} -DCONFIG_TCC_STATIC_NODLOPEN=1"
fi
dnl Determine if the compiler supports -Wno-unused-result
AC_CACHE_CHECK([if compiler supports -Wno-unused-result], [tcc4tcl_cv_compiler_wno_unused_result], [
SAVE_CFLAGS="${CFLAGS}"
CFLAGS="${SAVE_CFLAGS} -Wno-unused-result"
AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
tcc4tcl_cv_compiler_wno_unused_result='yes'
], [
tcc4tcl_cv_compiler_wno_unused_result='no'
])
CFLAGS="${SAVE_CFLAGS}"
])
if test "$tcc4tcl_cv_compiler_wno_unused_result" = 'yes'; then
TCC_WNO_UNUSED_RESULT='-Wno-unused-result'
else
TCC_WNO_UNUSED_RESULT=''
fi
AC_SUBST(TCC_WNO_UNUSED_RESULT)
dnl Determine if the compiler supports -gz=none
AC_CACHE_CHECK([if compiler supports -gz=none], [tcc4tcl_cv_compiler_gz_none], [
SAVE_CFLAGS="${CFLAGS}"
CFLAGS="${SAVE_CFLAGS} -gz=none"
AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
tcc4tcl_cv_compiler_gz_none='yes'
], [
tcc4tcl_cv_compiler_gz_none='no'
])
CFLAGS="${SAVE_CFLAGS}"
])
if test "$tcc4tcl_cv_compiler_gz_none" = 'yes'; then
TCC_GZ_NONE='-gz=none'
else
TCC_GZ_NONE=''
fi
AC_SUBST(TCC_GZ_NONE)
dnl Determine HOST_PATH_SEPERATOR
case $host_os in
*mingw*)
HOST_PATH_SEPARATOR=';'
;;
*)
HOST_PATH_SEPARATOR=':'
;;
esac
AC_SUBST(HOST_PATH_SEPARATOR)
dnl Find a suitable awk
AC_CHECK_TOOLS(AWK, gawk awk, [false])
dnl This must be done last since it breaks the compilation
if test "${TCC4TCL_TARGET}" = "shared"; then
DC_SETUP_STABLE_API([${srcdir}/tcc4tcl.vers], [tcc4tcl.syms])
fi
dnl Produce output
AC_OUTPUT(Makefile pkgIndex.tcl tcc4tcl.syms tcc/Makefile)