-
Notifications
You must be signed in to change notification settings - Fork 0
/
aclocal.m4
123 lines (111 loc) · 3.45 KB
/
aclocal.m4
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
#
# Include the TEA standard macro set
#
builtin(include,tclconfig/tcl.m4)
#
# Add here whatever m4 macros you want to define for your package
#
AC_DEFUN([COOKFS_SET_PLATFORM], [
AC_MSG_CHECKING([for platform])
AC_CANONICAL_BUILD
if test -n "$build_alias"; then
cookfs_platform="$build_alias"
elif test -n "$build"; then
cookfs_platform="$build"
else
AC_MSG_ERROR([could not detect current platform])
fi
AC_MSG_RESULT([$cookfs_platform])
AC_DEFINE_UNQUOTED(COOKFS_PLATFORM, ["$cookfs_platform"])
])
AC_DEFUN([COOKFS_PROG_TCLSH], [
AC_MSG_CHECKING([for correct tclsh])
if ! test -f "${TCLSH_PROG}" && ! command -v "${TCLSH_PROG}" >/dev/null 2>&1; then
if test "${TEA_PLATFORM}" = "windows"; then
base_name="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}"
name_list="${base_name}${EXEEXT} \
${base_name}s${EXEEXT} \
${base_name}t${EXEEXT} \
${base_name}st${EXEEXT} \
${base_name}g${EXEEXT} \
${base_name}gs${EXEEXT} \
${base_name}gt${EXEEXT} \
${base_name}gst${EXEEXT}"
for i in $name_list; do
if test -f "${TCL_BIN_DIR}/../bin/$i"; then
TCLSH_PROG="`cd "${TCL_BIN_DIR}/../bin"; pwd`/$i"
break
fi
done
fi
if test -f "${TCLSH_PROG}"; then
AC_MSG_RESULT([${TCLSH_PROG}])
AC_SUBST(TCLSH_PROG)
else
AC_MSG_RESULT([fail])
AC_MSG_ERROR([ERROR: could not find tclsh binary])
fi
else
AC_MSG_RESULT([ok])
fi
])
AC_DEFUN([COOKFS_SET_LDFLAGS], [
_LDFLAGS="$LDFLAGS"
_CFLAGS="$CFLAGS"
LDFLAGS="-Wl,-Map=conftest.map"
CFLAGS=
AC_MSG_CHECKING([whether LD supports -Wl,-Map=])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],[
AC_MSG_RESULT([yes])
LDFLAGS="$_LDFLAGS -Wl,-Map=\[$]@.map"
],[
AC_MSG_RESULT([no])
LDFLAGS="$_LDFLAGS"
])
CFLAGS="$_CFLAGS"
_LDFLAGS="$LDFLAGS"
_CFLAGS="$CFLAGS"
LDFLAGS="-Wl,--gc-sections"
CFLAGS=
AC_MSG_CHECKING([whether LD supports -Wl,--gc-sections])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],[
AC_MSG_RESULT([yes])
LDFLAGS="$_LDFLAGS -Wl,--gc-sections -Wl,--as-needed"
],[
AC_MSG_RESULT([no])
LDFLAGS="$_LDFLAGS"
])
CFLAGS="$_CFLAGS"
if test "${CFLAGS_DEFAULT}" != "${CFLAGS_DEBUG}"; then
# Test this only on MacOS as GNU ld interprets -dead_strip
# as '-de'+'ad_strip'
if test "$SHLIB_SUFFIX" = ".dylib"; then
_LDFLAGS="$LDFLAGS"
_CFLAGS="$CFLAGS"
LDFLAGS="-Wl,-dead_strip"
CFLAGS=
AC_MSG_CHECKING([whether LD supports -Wl,-dead_strip])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],[
AC_MSG_RESULT([yes])
LDFLAGS="$_LDFLAGS -Wl,-dead_strip"
],[
AC_MSG_RESULT([no])
LDFLAGS="$_LDFLAGS"
])
CFLAGS="$_CFLAGS"
fi
_LDFLAGS="$LDFLAGS"
_CFLAGS="$CFLAGS"
LDFLAGS="-s"
CFLAGS=
AC_MSG_CHECKING([whether LD supports -s])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],[
AC_MSG_RESULT([yes])
LDFLAGS="$_LDFLAGS -s"
],[
AC_MSG_RESULT([no])
LDFLAGS="$_LDFLAGS"
])
CFLAGS="$_CFLAGS"
fi
])