-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
179 lines (135 loc) · 5.42 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
173
174
175
176
177
178
179
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(bartlby-agent,1.6.0, [email protected])
AC_PREFIX_DEFAULT(/usr/local/bartlby-agent)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
AM_SILENT_RULES([yes])
dnl check for plugin dir
AC_ARG_WITH(plugin-dir,AC_HELP_STRING([--with-plugin-dir], [Where are the plugins located]), PLUGIN_DIR="${withval}", PLUGIN_DIR="${prefix}/plugins/")
AC_SUBST(PLUGIN_DIR)
dnl check for allowed IPS
AC_ARG_WITH(allowed-ips,AC_HELP_STRING([--with-allowed-ips], [from wich ip addresses connections are allowed? seperated with commas]), ALLOWEDIPS="${withval}", ALLOWEDIPS="127.0.0.1")
AC_SUBST(ALLOWEDIPS)
dnl check for allowed IPS
AC_ARG_WITH(load-limit,AC_HELP_STRING([--with-load-limit], [load limit to skip checks]), LOADLIMIT="${withval}", LOADLIMIT="50")
AC_SUBST(LOADLIMIT)
dnl check for allowed IPS
AC_ARG_WITH(sync-url,AC_HELP_STRING([--with-sync-url], [Url to the bartlby-ui installation]), BARTLBY_SYNC="${withval}", BARTLBY_SYNC="http://localhost/bartlby-ui/")
AC_SUBST(BARTLBY_SYNC)
dnl check for allowed IPS
AC_ARG_WITH(sync-user,AC_HELP_STRING([--with-sync-user], [username for the sync]), BARTLBY_SYNC_USER="${withval}", BARTLBY_SYNC_USER="sync")
AC_SUBST(BARTLBY_SYNC_USER)
dnl check for allowed IPS
AC_ARG_WITH(sync-pw,AC_HELP_STRING([--with-sync-password], [password for the sync]), BARTLBY_SYNC_PW="${withval}", BARTLBY_SYNC_PW="sync")
AC_SUBST(BARTLBY_SYNC_PW)
AC_ARG_WITH(sync-clientname,AC_HELP_STRING([--with-sync-clientname], [clientname for the sync]), BARTLBY_SYNC_CLIENTNAME="${withval}", BARTLBY_SYNC_CLIENTNAME="bartlbydemo")
AC_SUBST(BARTLBY_SYNC_CLIENTNAME)
AC_ARG_WITH(sync-arch,AC_HELP_STRING([--with-sync-arch], [arch for the sync]), BARTLBY_SYNC_ARCH="${withval}", BARTLBY_SYNC_ARCH="i386")
AC_SUBST(BARTLBY_SYNC_ARCH)
AC_CHECK_LIB(socket, socket)
dnl Check for ssl library.
AC_ARG_ENABLE(ssl,
[ --enable-ssl=PREFIX Enable SSL in varios parts of CORE)],
[
case "$enable_ssl" in
n|no)
;;
y|ye|yes)
enable_ssl=yes
;;
*)
SSL_DIR="$withval"
LIBS="$LIBS -L$SSL_DIR/lib"
enable_ssl=yes
;;
esac
])
AC_MSG_CHECKING(for OpenSSL support)
if test "$enable_ssl" == "yes" ; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(ssl, SSL_library_init,ssl_lib_found=yes,ssl_lib_found=no)
AC_CHECK_HEADER(openssl/ssl.h,ssl_lib_found=yes,ssl_lib_found=no)
if test "$ssl_lib_found" == "yes"; then
OPENSSL_ADDON="-DHAVE_SSL"
OPENSSL_FLAG="-lssl -lcrypto"
OPENSSL_LIBDIR="-L$SSL_DIR/include"
OPENSSL_INCDIR=""
AC_SUBST(OPENSSL_LIBDIR)
AC_SUBST(OPENSSL_INCDIR)
AC_SUBST(OPENSSL_ADDON)
AC_SUBST(OPENSSL_FLAG)
openssl dhparam -C 512 | awk '/^-----/ {exit} {print}' > bartlby_v2_dh.c
fi;
else
#AC_MSG_ERROR([Unable to locate -lssl -lcrypto. OpenSSL support is currently required.])
AC_MSG_RESULT(no)
fi
dnl Check for jsonc library.
AC_MSG_CHECKING(for json-c support)
AC_MSG_RESULT(yes)
AC_CHECK_LIB(json, json_tokener_parse,json_lib_found=yes,json_lib_found=no)
AC_CHECK_HEADER(json-c/json.h,json_lib_found=yes,json_lib_found=no)
if test "$json_lib_found" == "yes"; then
JSON_ADDON="-DJSON_ADDON -I/usr/include/json-c/"
JSON_FLAG="-ljson-c "
JSON_LIBDIR="-L$JSON_DIR/include"
JSON_INCDIR=""
AC_SUBST(JSON_LIBDIR)
AC_SUBST(JSON_INCDIR)
AC_SUBST(JSON_ADDON)
AC_SUBST(JSON_FLAG)
else
AC_MSG_ERROR([Unable to locate -ljson JSON support is required please install the libjson0-dev package])
fi;
dnl Check if libjson is too old
AC_CHECK_LIB(json, json_object_object_get_ex,aaa=1,AC_DEFINE([NEEDS_JSON_GET_EX], [], [set if lilbjson is too old and a few wrappers will be built]))
AC_CHECK_LIB(json, json_object_new_int64,aaa=1,AC_DEFINE([NEEDS_JSON_INT64], [], [set if lilbjson is too old and a few wrappers will be built]))
dnl User stuff
AC_ARG_WITH(user, AC_HELP_STRING([--with-user], [Bartlby User]), BARTLBY_USER="${withval}",BARTLBY_USER="bartlby")
AC_SUBST(BARTLBY_USER)
INSTALL_OPTIONS="-o $BARTLBY_USER";
AC_SUBST(BARTLBY_USER)
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PATH_PROG(INSTALL_PATH, install)
if test "x${INSTALL_PATH}" = "x" ; then
AC_MSG_ERROR(["install" is not found please fix it])
fi
AC_SUBST(INSTALL_PATH)
AC_SUBST(INSTALL_OPTIONS)
# Checks for libraries.
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h malloc.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm gethostbyname gettimeofday inet_ntoa memmove memset setenv socket strdup strstr])
AC_CONFIG_FILES([Makefile bartlby.cfg postinstall-pak preinstall-pak agent_sync.cfg])
AC_OUTPUT
echo "######################################"
echo "# bartlby Agent #"
echo "######################################"
echo "Base path: $prefix";
echo "Plugin dir: $PLUGIN_DIR";
echo "Sync Host: $BARTLBY_SYNC";
echo "install: $INSTALL_PATH a $install_path";