-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfigure.ac
121 lines (97 loc) · 3.24 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
## liblog-malloc2
####
AC_INIT([log-malloc2], [0.4.1], [_samuel_._behan_(at)_dob_._sk], [log-malloc2],
[http://devel.dob.sk/log-malloc2])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 -Wall no-define])
# Generate two configuration headers; one for building the library itself with
# an autogenerated template, and a second one that will be installed alongside
# the library.
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
LT_INIT([disable-static])
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h sys/time.h unistd.h stdbool.h libunwind.h])
AC_CHECK_FUNCS([ pread backtrace backtrace_symbols_fd ])
AC_CHECK_LIB(dl, dlsym, , [
AC_MSG_ERROR([
Can't find the dl library (libdl.so) !])])
AC_CHECK_LIB(pthread, pthread_mutex_trylock, , [
AC_MSG_ERROR([
Can't find the pthread library (libpthread.so) !])])
no_libunwind=no
AC_ARG_WITH([libunwind],
AS_HELP_STRING([--without-libunwind], [do not use libunwind for backtrace]),
[no_libunwind=yes], [no_libunwind=no]
)
libunwind_detail=no
AC_ARG_WITH([libunwind-detail],
AS_HELP_STRING([--with-libunwind-detail], [more details in libunwind backtrace]),
[libunwind_detail=yes], [libunwind_detail=no]
)
libunwind=no
if test "x$no_libunwind" != "xyes"; then
AC_CHECK_HEADER([libunwind.h], [libunwind=yes], [libunwind=no])
if test "x$libunwind_detail" = "xyes"; then
AC_DEFINE(HAVE_UNWIND_DETAIL, 1, [Generate detailed libunwind backtrace])
fi
fi
no_optimize=no
AC_ARG_ENABLE([optimize],
AS_HELP_STRING([--disable-optimize], [do not optimize library]),
[no_optimize=yes], [no_optimize=no]
)
no_call_count=no
AC_ARG_ENABLE([call-count],
AS_HELP_STRING([--disable-call-count], [do not count function calls]),
[no_call_count=yes], [no_call_count=no]
)
if test "x$no_call_count" = "xyes"; then
AC_DEFINE(DISABLE_CALL_COUNTS, 1, [Disable functions call counting])
fi
no_usable_size=no
AC_ARG_ENABLE([usable-size],
AS_HELP_STRING([--disable-usable-size], [do not check usable size]),
[no_usable_size=no], [no_usable_size=yes]
)
if test "x$no_usable_size" = "xyes"; then
AC_CHECK_FUNCS([ malloc_usable_size ])
fi
# FLAGS
CFLAGS="-DWITH_PTHREADS -D_GNU_SOURCE -Xcompiler -nostartfiles"
LDFLAGS="-ldl -lpthread"
if test "x$no_optimize" != "xyes"
then
CFLAGS="$CFLAGS -O2"
else
CFLAGS="$CFLAGS -g"
fi
if test "x$libunwind" != "xno"
then
LDFLAGS="$LDFLAGS -lunwind-generic -lunwind"
AC_DEFINE(HAVE_UNWIND, 1, [Use libunwind for backtrace])
fi
# Define these substitions here to keep all version information in one place.
# For information on how to properly maintain the library version information,
# refer to the libtool manual, section "Updating library version information":
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST([LOG_MALLOC2_SO_VERSION], [1:0:0])
AC_SUBST([LOG_MALLOC2_API_VERSION], [0.4])
# Override the template file name of the generated .pc file, so that there
# is no need to rename the template file when the API version changes.
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([log-malloc2.pc])
AC_CONFIG_FILES([scripts/log-malloc.pm])
AC_OUTPUT
# config results
echo
echo "HAVE_UNWIND $libunwind"
echo "HAVE_UNWIND_DETAIL $libunwind_detail"
echo