-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
234 lines (208 loc) · 7.14 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#
# Copyright (c) 2011-2013 CESNET
#
# LICENSE TERMS
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Company nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# ALTERNATIVELY, provided that this notice is retained in full, this
# product may be distributed under the terms of the GNU General Public
# License (GPL) version 2 or later, in which case the provisions
# of the GPL apply INSTEAD OF those given above.
#
# This software is provided ``as is'', and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall the company or contributors be liable for any
# direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute
# goods or services; loss of use, data, or profits; or business
# interruption) however caused and on any theory of liability, whether
# in contract, strict liability, or tort (including negligence or
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
#
# $Id$
#
# Process this file with autoconf to produce a configure script.
AC_INIT([netopeer-server-sl], m4_esyscmd([cut -f1 ./VERSION | tr -d '\n']))
m4_include([m4/ax_pthread.m4])
AC_CANONICAL_HOST
PACKAGE_VERSION=`cut -f1 ./VERSION | tr -d '\n'`
AC_SUBST(PACKAGE_VERSION)
LIBTOOL_VERSION_INFO=`echo ${PACKAGE_VERSION} | sed -e 's/\./:/g' `
AC_SUBST(LIBTOOL_VERSION_INFO)
RELEASE=1
AC_SUBST(RELEASE)
if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then
CPPFLAGS="$CPPFLAGS -DRCSID=\\\"\$(IDGIT)\\\""
else
CPPFLAGS="$CPPFLAGS -DRCSID=\\\"\$(IDNOGIT)\\\""
fi
SETBIT=0
SETUSER=""
SETGROUP=""
SERVERCFG_PATH="/var/lib/libnetconf/server/"
# Check for pkg-config.
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR(['pkgconfig' not found.])
fi
AC_ARG_ENABLE([notifications],
AC_HELP_STRING([--disable-notifications], [Disable support of NETCONF Notifications (RFC 5277)]),
[
if test "$enableval" = "no"; then
notif="no"
else
notif="yes"
fi
],
# notifications are supported by default
notif="yes"
)
if test "$notif" = "no"; then
CPPFLAGS="$CPPFLAGS -DDISABLE_NOTIFICATIONS"
fi
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug],[Compile with debug options]),
CFLAGS="$CFLAGS -g -O0 -DDEBUG",
CFLAGS="$CFLAGS -O3"
)
AC_ARG_WITH([servercfgpath],
AC_HELP_STRING([--with-servercfgpath=path],[Path to example server configuration files, the default value is /var/lib/libnetconf/server/]),
SERVERCFG_PATH="$withval"
)
AC_ARG_WITH([suid],
AC_HELP_STRING([--with-suid=user],[Build server as set-user-id application for specified user (current user by default).\nNote that libnetconf should be also built with this option.]),
if test "$withval" != "no"; then
SETBIT=$(($SETBIT | 1))
if test "$withval" != "yes"; then
SETUSER="$withval"
else
SETUSER="`id -un`"
fi
fi
)
AC_ARG_WITH([sgid],
AC_HELP_STRING([--with-sgid=group],[Build server as set-group-id application for specified group (current group by default).\nNote that libnetconf should be also built with this option.]),
if test "$withval" != "no"; then
SETBIT=$(($SETBIT | 2))
if test "$withval" != "yes"; then
SETGROUP="$withval"
else
SETGROUP="`id -gn`"
fi
fi
)
############################ Check for programs ################################
# Check for architecture, only x86 and x86_64 are supported
if test -z "$host_cpu";
then
AC_CHECK_PROG([UNAME], [uname], [yes], [no])
if test "$UNAME" = "no"; then
AC_MSG_ERROR(["uname not found!"])
fi
build_cpu=`uname -m`
host_cpu=$build_cpu
fi
AC_MSG_CHECKING([for host architecture])
case $host_cpu in
i?86 )
AC_MSG_RESULT($host_cpu is supported)
;;
x86_64 )
AC_MSG_RESULT($host_cpu is supported)
;;
* )
AC_MSG_WARN([unsupported architecture $host_cpu])
;;
esac
# Check for rpmbuild
AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, no)
# Check whether readlink supports the -f option
READLINK_FKNOWN=`$readlink -f xxx 1>/dev/null 2>&1 && echo yes`
if test "x${READLINK_FKNOWN}" != "xyes";
then
# Try finding greadlink (e.g., Mac OS X)
AC_CHECK_PROG(READLINK, greadlink, greadlink, readlink)
if test "x${READLINK}" = "xreadlink";
then
AC_MSG_WARN([Try installing greadlink.])
fi
else
AC_SUBST(READLINK, [readlink])
fi
# Check for standard programs
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
# Use libtool
AC_PROG_LIBTOOL
# Always use ./libtool unless overridden from command-line
if test -z "$libtool"; then
libtool='./libtool'
fi
AC_SUBST(libtool)
############################ Check for libraries ###############################
export PKG_CONFIG_PATH=/usr/local/${libdir##*/}/pkgconfig:$PKG_CONFIG_PATH
# libnetconf
AC_ARG_WITH([libnetconf],
AC_HELP_STRING([--with-libnetconf=PATH],[Set explicit installation prefix to the libnetconf library]),
[CFLAGS="-I$withval/include/ $CFLAGS"
LIBS="-L$withval/lib/ -Wl,-rpath,$withval/lib $LIBS"
],[
# get info from pkg-config about installed package
PKG_CHECK_MODULES(LIBNETCONF, libnetconf)
CFLAGS="$LIBNETCONF_CFLAGS $CFLAGS"
LIBS="$LIBNETCONF_LIBS $LIBS"]
)
if test "$notif" = "yes"; then
AC_CHECK_LIB([netconf], [ncntf_dispatch_receive],
[],
[CPPFLAGS="-DDISABLE_NOTIFICATIONS $CPPFLAGS"
AC_CHECK_LIB([netconf], [nc_init], [], AC_MSG_ERROR([libnetconf not found.]))]
)
else
AC_CHECK_LIB([netconf], [nc_init], [], AC_MSG_ERROR([libnetconf not found.]))
fi
if test "$notif" = "yes"; then
### pthread ###
AX_PTHREAD([
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"],
AC_MSG_ERROR([Missing POSIX threads support.])
)
fi
### libevent ###
AC_CHECK_LIB([event], [event_base_dispatch], [], AC_MSG_ERROR([Missing libevent]))
AC_CHECK_HEADERS(event2/event.h, [], AC_MSG_ERROR([Missing libevent headers.]))
###################### Check for configure parameters ##########################
######################### Checks for header files ##############################
AC_CHECK_HEADERS([stdlib.h syslog.h], [], AC_MSG_ERROR([Missing system headers.]))
######## Checks for typedefs, structures, and compiler characteristics #########
######################## Checks for library functions ##########################
AC_FUNC_MALLOC
############################### Set output #####################################
AC_SUBST(SERVERCFG_PATH)
AC_SUBST(SETBIT)
AC_SUBST(SETUSER)
AC_SUBST(SETGROUP)
AC_SUBST(RPMBUILD)
if test -z "$RPMBUILD"; then
AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.])
fi
AC_CONFIG_FILES(Makefile)
AC_CONFIG_SUBDIRS([toaster])
AC_OUTPUT