summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 7ac3f177d042ebb55999f147c48cffb0557b1448 (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#  Copyright (C) 2008, 2009 Jiri Olsa <olsajiri@gmail.com>
#
#  This file is part of the latrace.
#
#  The latrace is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  The latrace is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with the latrace (file COPYING).  If not, see 
#  <http://www.gnu.org/licenses/>.


AC_PREREQ(2.61)
AC_INIT(latrace, 0.5.12, olsajiri@gmail.com)
AC_CONFIG_SRCDIR([src/latrace.c])

AC_PROG_CC
AC_PROG_LEX
AS_IF([test "x$LEX" = "x:"],
      [AC_MSG_ERROR([lex/flex is needed.])])
AC_PROG_YACC
AS_IF([test "x$YACC" = "x:"],
      [AC_MSG_ERROR([yacc/bison is needed.])])
AC_PROG_LN_S
AC_PATH_PROG([ASCIIDOC], [asciidoc], [:])
AC_PATH_PROG([XMLTO], [xmlto], [:])

AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([libintl.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([stddef.h])
AC_C_CONST
AC_TYPE_PID_T
AC_FUNC_FORK
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset setenv])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([mkfifo])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strtol])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([limits.h])
AC_FUNC_MALLOC
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_SELECT_ARGTYPES
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT32_T
AC_TYPE_SIZE_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT8_T
AC_SYS_LARGEFILE

date=`date "+%B %G"`
unamem=`uname -m | sed -e 's/i.86/i686/' -e 's/^armv.*/arm/'`

AC_SUBST(CONFIG_DATE, "$date")
AC_SUBST(CONFIG_SYSDEP_DIR, "$unamem")
AC_SUBST(CONFIG_VERSION, "AC_PACKAGE_VERSION")

AC_DEFINE(CONFIG_LT_CONFIG, "/tmp/lt-config", [Temporary directory prefix.])
AC_DEFINE(CONFIG_VERSION, "AC_PACKAGE_VERSION", [Version of latrace.])

# for following architectures we have argument display support
if test "$unamem" = "x86_64" -o\
	"$unamem" = "i686" -o\
	"$unamem" = "arm"; then
	AC_DEFINE(CONFIG_ARCH_HAVE_ARGS)
	AC_SUBST(CONFIG_ARCH_HAVE_ARGS, "y")
else
	AC_MSG_WARN([Arguments display support disabled])
fi

# for following architectures we have automated tests support
if test "$unamem" = "x86_64" -o\
	"$unamem" = "i686" -o\
	"$unamem" = "arm" ; then
	AC_SUBST(CONFIG_ARCH_HAVE_TEST, "y")
else
	AC_MSG_WARN([No automated test support])
fi

# for following architectures we have error simulation support
if test "$unamem" = "x86_64" -o\
	"$unamem" = "i686"; then
	AC_DEFINE(CONFIG_ARCH_HAVE_ERROR_SIM)
	AC_SUBST(CONFIG_ARCH_HAVE_ERROR_SIM, "y")
else
	AC_MSG_WARN([Error simulation support disabled])
fi

# check for libunwind, haven't found any generic function,
# so need to set one based on architecture
unwind_func="krava"
if test "$unamem" = "x86_64"; then
	unwind_func="_Ux86_64_init_local"
fi
if test "$unamem" = "i686"; then
	unwind_func="_Ux86_init_local"
fi

AC_SEARCH_LIBS([$unwind_func], [unwind-generic],
	[
		AC_DEFINE(CONFIG_LIBUNWIND, 1, "Unwind library found.")
		AC_SUBST(CONFIG_LIBUNWIND, "y")
	],
	[AC_MSG_WARN([libunwind not found, no backtrace support (install libunwind-dev)])])

AC_SEARCH_LIBS([elf_begin], [elf],
	[
		AC_DEFINE(CONFIG_LIBELF, 1, "Elf library found.")
		AC_SUBST(CONFIG_LIBELF, "y")
	],
	[AC_MSG_WARN([libelf not found, no symbol support (install libelf-dev)])])

AC_SEARCH_LIBS([cplus_demangle], [iberty_pic iberty],
	[
		AC_DEFINE(CONFIG_LIBERTY, 1, "Liberty library found.")
		AC_SUBST(CONFIG_LIBERTY, "y")
	],
	[AC_MSG_WARN([libiberty not found, no demangle support (install binutils-dev)])])

AC_CONFIG_HEADER([src/autoconf.h])
AC_CONFIG_FILES([src/autoconf.make])
AC_CONFIG_FILES([doc/asciidoc.conf])
AC_CONFIG_FILES([etc/latrace.d/latrace.conf])

AC_OUTPUT