-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.in
124 lines (102 loc) · 3.58 KB
/
configure.in
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
AC_INIT(tinu, [0.1b], [https://tracker.bteam.hu/projects/tinu])
AM_INIT_AUTOMAKE(tinu, [0.1b], [https://tracker.bteam.hu/projects/tinu])
AC_CONFIG_SRCDIR([lib/tinu.h])
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LIBTOOL
LDFLAGS=-ldl
CFLAGS=
top_builddir=$ac_pwd
case "$srcdir" in
/*)
top_srcdir=$srcdir
;;
*)
oldsrcdir="$srcdir"
top_srcdir="`cd \"$srcdir\"; pwd`"
;;
esac
CFLAGS="-I$top_srcdir/lib -I$top_builddir/lib $CFLAGS"
CXXFLAGS="-I$top_srcdir/lib -I$top_builddir/lib $CXXFLAGS"
AM_CONFIG_HEADER([lib/tinu/config.h])
PKG_CHECK_MODULES(LIBGLIB, glib-2.0 >= 2.20)
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[enable debuging information @<:@default=no@:>@]))
AC_ARG_ENABLE(cxxwrapper,
AC_HELP_STRING([--disable-cxxwrapper],
[disable building the cxx wrapper @<:@default: enabled@:>@]))
AC_ARG_WITH(coredumper,
AC_HELP_STRING([--with-coredumper=yes/no/auto],
[enable coredumper support @<:@default=auto@:>@]),
with_coredumper="$withval", with_coredumper="auto")
AC_ARG_WITH(elfdebug,
AC_HELP_STRING([--with-elfdebug=yes/no/auto],
[enable elf and dwarf support @<:@default=auto@:>@]),
with_elfdebug="$withval", with_elfdebug="auto")
AC_ARG_WITH(stacksize,
AC_HELP_STRING([--with-stack-size=ARG],
[set test stack size in kbytes @<:@default=256kb@:>@]),
stack_size=$withval, stack_size=256)
AC_CHECK_LIB(dl, dlopen, [], AC_MSG_ERROR([dl library missing]))
AC_CHECK_LIB(elf, elf_begin, has_elf="yes", has_elf="no")
AC_CHECK_LIB(dwarf, dwarf_linesrc, has_dwarf="yes", has_dwarf="no")
if test x$has_elf = "xyes" -a x$has_dwarf = "xyes"; then
has_elflibs="yes"
else
has_elflibs="no"
fi
AC_MSG_CHECKING([elfdebug should be enabled])
if test x$with_elfdebug = xauto; then
with_elfdebug=$has_elflibs
elif test x$with_elfdebug = xyes; then
if test x$has_elflibs != xyes; then
AC_MSG_ERROR([dwarf and/or elf library missing])
fi
fi
AC_MSG_RESULT($with_elfdebug)
if test x$with_coredumper = xauto; then
with_coredumper=$with_elfdebug
elif test x$with_coredumper = xyes; then
if x$with_elfdebug != xyes; then
AC_MSG_ERROR([cannot use coredumper without elfdebug (enable elfdebug or disable coredumper)])
fi
fi
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
if test x$enable_debug = xyes; then
CFLAGS="$CFLAGS -g -O0"
LDFLAGS="$LDFLAGS -g -O0"
AC_DEFINE(EBUG, 1, [debug options turned on])
fi
AM_CONDITIONAL(ELFDEBUG, test x$with_elfdebug = xyes)
if test x$with_elfdebug = xyes; then
AC_DEFINE(ELFDEBUG_ENABLED, 1, [elf and dwarf support])
LDFLAGS="$LDFLAGS -lelf -ldwarf"
fi
AM_CONDITIONAL(COREDUMPER, test x$with_coredumper = xyes)
if test x$with_coredumper = xyes; then
AC_DEFINE(COREDUMPER_ENABLED, 1, [coredumper support])
fi
AM_CONDITIONAL(CXXWRAPPER, test x$enable_cxxwrapper != xno)
if test x$enable_cxxwrapper != xno; then
AC_DEFINE(CXXWRAPPER_ENABLED, 1, [cxx wrapper enabled])
fi
if test -d .git; then
AC_DEFINE_UNQUOTED(GIT_BRANCH, "`cat .git/HEAD | cut -f 3- -d/`", [git branch])
AC_DEFINE_UNQUOTED(GIT_COMMIT, "`git log -1 | head -1 | cut -f 2 -d' '`", [git revision])
fi
BUILD=`date +%c`
AC_MSG_NOTICE([build time is $BUILD])
AC_DEFINE_UNQUOTED(BUILDTIME, "$BUILD", [time of build])
AC_MSG_NOTICE([stack size is $stack_size kbytes])
AC_DEFINE_UNQUOTED(TEST_CTX_STACK_SIZE, $((stack_size * 1024)), [stack size when running isolated test cases])
AC_SUBST(LDFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_CONFIG_FILES([Makefile lib/Makefile example/Makefile coredumper/Makefile tools/Makefile])
AC_OUTPUT([tinu.pc])
if test x$enable_cxxwrapper != xno; then
AC_OUTPUT([tinucxx.pc])
fi