-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
172 lines (149 loc) · 5.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
m4_define([MAJOR_VERSION], 1)
m4_define([MINOR_VERSION], 2)
m4_define([MICRO_VERSION], 1)
AC_PREREQ(2.59)
AC_INIT([faux],
[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION],
[serj.kalichev at gmail dot com])
AC_CONFIG_AUX_DIR(aux_scripts)
AC_CONFIG_MACRO_DIR([m4])
# Values for SONAME. See -version-info for details.
AC_SUBST(SONAME_CURRENT, 1)
AC_SUBST(SONAME_REVISION, 0)
AC_SUBST(SONAME_AGE, 0)
# Check for system extensions (_POSIX_THREAD_SEMANTICS for Solaris)
AC_USE_SYSTEM_EXTENSIONS
# Checks for programs.
AC_PROG_CC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(subdir-objects)
AM_PROG_CC_C_O
# Dir for libc replacements
AC_CONFIG_LIBOBJ_DIR([libc])
# needed to handle 64-bit architecture
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)
#########################################
# See if linker supports version scripts
#########################################
# Check if LD supports linker scripts,
# and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
AC_ARG_ENABLE([ld-version-script],
AS_HELP_STRING([--enable-ld-version-script],
[enable linker version script (default is enabled when possible)]),
[have_ld_version_script=$enableval], [])
if test -z "$have_ld_version_script"; then
AC_MSG_CHECKING([if LD -Wl,--version-script works])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
cat > conftest.map <<EOF
VERS_1 {
global: sym;
};
VERS_2 {
global: sym;
} VERS_1;
EOF
AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
[have_ld_version_script=yes], [have_ld_version_script=no])
rm -f conftest.map
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($have_ld_version_script)
fi
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
################################
# Deal with debugging options
################################
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[Turn on debugging including asserts [default=no]])],
[],
[enable_debug=no])
AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
################################
# Compile in testc tests
################################
AC_ARG_ENABLE(testc,
[AS_HELP_STRING([--enable-testc],
[Enable testc tests compiling [default=no]])],
[],
[enable_testc=no])
AM_CONDITIONAL(TESTC,test x$enable_testc = xyes)
################################
# Internal getopt()
################################
AC_ARG_WITH(internal-getopt,
[AS_HELP_STRING([--with-internal-getopt],
[Use internal implementation of getopt [default=no]])],
[],
[with_internal_getopt=no])
if test x$with_internal_getopt != xno; then
AC_DEFINE([WITH_INTERNAL_GETOPT], [1], [Use internal getopt() implementation])
AC_LIBOBJ([getopt])
AC_MSG_WARN([Use internal implementation of getopt() and getopt_long()])
else
AC_CHECK_HEADERS(getopt.h, [found_getopt_h=yes],
AC_MSG_WARN([getopt.h not found: only short parameters can be used on command line]))
fi
AC_MSG_CHECKING([for getopt_long()])
if test x$with_internal_getopt = xyes -o x$found_getopt_h = xyes; then
AC_DEFINE([HAVE_GETOPT_LONG], [1], [getopt_long() function])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
################################
# Check for locale.h
################################
AC_CHECK_HEADERS(locale.h, [],
AC_MSG_WARN([locale.h not found: the locales is not supported]))
################################
# Check for CODESET within nl_langinfo
################################
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET); return !cs;],
[am_cv_langinfo_codeset=yes],
[am_cv_langinfo_codeset=no])
])
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi
])
AM_LANGINFO_CODESET
################################
# Check for pwd.h and grp.h
################################
AC_CHECK_HEADERS(pwd.h, [],
AC_MSG_WARN([pwd.h not found: the pwd operations is not supported]))
AC_CHECK_HEADERS(grp.h, [],
AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
################################
# Check for dlopen()
################################
AC_CHECK_HEADERS(dlfcn.h, [
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
],[
AC_MSG_ERROR([dlfcn.h not found: the dl operations is not supported])
])
################################
# Check for pthread
################################
AX_PTHREAD
################################
# Check for signalfd()
################################
AC_CHECK_FUNCS(signalfd, [],
AC_MSG_WARN([signalfd() not found: more complex mechanism will be used]))
AC_CONFIG_FILES([Makefile])
AC_OUTPUT