-
Notifications
You must be signed in to change notification settings - Fork 26
/
configure.ac
168 lines (148 loc) · 3.83 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
AC_INIT(open-isns, [0.99])
AC_CONFIG_SRCDIR([isnsd.c])
AC_CONFIG_AUX_DIR([aclocal])
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_CANONICAL_HOST
AC_C_BIGENDIAN
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PATH_PROG(SH, sh)
dnl C Compiler features
AC_C_INLINE
if test "$GCC" = "yes"; then
CFLAGS="-Wall -Werror $CFLAGS"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([errno.h fcntl.h malloc.h stdlib.h string.h strings.h sys/time.h unistd.h locale.h getopt.h])
# Check if socket() is in libsocket
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
AC_SUBST(GETOPTSRC)
AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define if you have the `getopt_long' function.]),
[GETOPTSRC="$GETOPTSRC \$(top_srcdir)/compat/my_getopt.c"
CPPFLAGS="-I\$(top_srcdir)/compat/ $CPPFLAGS"
AC_DEFINE(HAVE_GETOPT_H, 1, [Define if you have the <getopt.h> header file.])])
WITH_SECURITY=maybe
AC_ARG_WITH(security,
[ --with-security Enable iSNS authentication - requires OpenSSL],
[
if test "x$withval" = "xno" -o "x$withval" = "xyes"; then
WITH_SECURITY=$withval
else
WITH_SECURITY=yes
CPPFLAGS="$CPPFLAGS -I${withval}"
LDFLAGS="$LDFLAGS -L${withval}"
fi
]
)
if test "x$WITH_SECURITY" != "xno" ; then
# Check for openssl support - very primitive, we just
# check for the presence of crypto.h
AC_CHECK_HEADERS([openssl/crypto.h],
,
[have_libcrypto=no])
AC_CHECK_LIB(crypto, EVP_PKEY_new,
[SECLIBS="-lcrypto"],
[have_libcrypto=no])
if test "x$have_libcrypto" != "xno" ; then
AC_DEFINE(WITH_SECURITY, 1,
[Define if you want to support iSNS authentication])
else
if test "x$WITH_SECURITY" = "xyes" ; then
AC_MSG_ERROR([Security requested, but unable to find libcrypto])
fi
fi
fi
AC_SUBST(SECLIBS)
WITH_SLP=maybe
AC_ARG_WITH(slp,
[ --with-slp Enable SLP for server discovery - requires OpenSLP],
[
if test "x$withval" = "xno" -o "x$withval" = "xyes"; then
WITH_SLP=$withval
else
WITH_SLP=yes
CPPFLAGS="$CPPFLAGS -I${withval}"
LDFLAGS="$LDFLAGS -L${withval}"
fi
]
)
if test "x$WITH_SLP" != "xno" ; then
# Check for openslp support - very primitive
AC_CHECK_HEADERS([slp.h],,
[have_openslp=no])
AC_CHECK_LIB(slp, SLPOpen,
[SLPLIBS="-lslp"],
[have_openslp=no])
if test "x$have_openslp" != "xno" ; then
AC_DEFINE(WITH_SLP, 1,
[Define if you want to support SLP discovery])
else
if test "x$WITH_SLP" = "xyes" ; then
AC_MSG_ERROR([SLP requested, but unable to find openslp])
fi
fi
fi
AC_SUBST(SLPLIBS)
RUNDIR=/var/run
AC_ARG_WITH(rundir,
[ --with-rundir=/var/run The runtime directory for PID files etc.],
[
if test "x$withval" = "xno" -o "x$withval" = "xyes"; then
AC_MSG_ERROR([No rundir value specified.])
else
RUNDIR="${withval}"
fi
]
)
MEMDEBUG=
AC_ARG_ENABLE(memdebug,
[ --enable-memdebug Enable malloc debugging],
[
if test "x$enableval" = "xyes" ; then
CPPFLAGS="$CPPFLAGS -DMEMDEBUG"
fi
]
)
AC_SUBST(OPTIMIZE)
ENABLE_SHARED=0
AC_ARG_ENABLE(shared,
[ --enable-shared Build shared library],
[
if test "x$enableval" = "xyes" ; then
ENABLE_SHARED=1
fi
]
)
ENABLE_STATIC=1
AC_ARG_ENABLE(static,
[ --disable-static Build static library],
[
if test "x$enableval" = "xno" ; then
ENABLE_STATIC=0
fi
]
)
if test "x$ENABLE_SHARED" = "x1" ; then
# Taken and modified from libpng's configure.ac
AC_MSG_CHECKING([if libraries can be versioned])
GLD=`$CC -Wl,--help < /dev/null 2>/dev/null | grep version-script`
if test "$GLD"; then
HAVE_LD_VERSION_SCRIPT=1
AC_MSG_RESULT(yes)
else
HAVE_LD_VERSION_SCRIPT=0
AC_MSG_RESULT(no)
AC_MSG_WARN(*** You have not enabled versioned symbols.)
fi
AC_SUBST(HAVE_LD_VERSION_SCRIPT)
fi
AC_SUBST(ENABLE_SHARED)
AC_SUBST(ENABLE_STATIC)
AC_SUBST(RUNDIR)
AC_OUTPUT(Makefile include/libisns/paths.h)