-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
130 lines (115 loc) · 4.7 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([cashwebtools], [0])
AC_CONFIG_SRCDIR([src/cashget.c])
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AC_ARG_ENABLE([emscripten],
AS_HELP_STRING([--enable-emscripten], [Build for web with emscripten]),
[], [enable_emscripten=no])
AC_ARG_WITH([mongodb],
[AS_HELP_STRING([--with-mongodb], [specify whether or not to build cashgettools with direct MongoDB support, default=yes] @@)],
[],
[with_mongodb=yes])
AC_ARG_WITH([cashserver],
[AS_HELP_STRING([--with-cashserver], [specify whether or not to build cashserver binary, default=yes] @@)],
[],
[with_cashserver=yes])
AC_ARG_WITH([cashsend],
[AS_HELP_STRING([--with-cashsend], [specify whether or not to build cashsendtools library + cashsend binary, default=yes] @@)],
[],
[with_cashsend=yes])
# Checks for programs.
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_LTDL_DLLIB
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
# Allows datadir to be specified
dnl Defined in the file ac_define_dir.m4 (needs to be listed in acinclude.m4)
AC_DEFINE_DIR([DATADIR], [datadir], [Directory for data files.])
# jansson nested package
AC_CONFIG_SUBDIRS([src/jansson])
AS_IF([test "x$enable_emscripten" != xyes && test "x$EMSCRIPTEN" != xyes], [
AS_IF([test "x$with_mongodb" != xno],
[
CFLAGS="$(pkg-config --cflags libmongoc-1.0) ${CFLAGS}"
LDFLAGS="$(pkg-config --libs libmongoc-1.0) ${LDFLAGS}"
AC_SEARCH_LIBS([mongoc_init], [mongoc-1.0], [], [
AC_MSG_ERROR([unable to find mongoc; please install this library with your package manager and try again, or if MongoDB support not needed, try again with flag --without-mongodb])
])
AC_SEARCH_LIBS([bson_destroy], [bson-1.0], [], [
AC_MSG_ERROR([unable to find bson; please install this library with your package manager (should come included with mongoc) and try again, or if MongoDB support not needed, try again with flag --without-mongodb])
])
AC_CHECK_HEADER([mongoc.h], [], [
AC_MSG_ERROR([unable to find header mongoc.h, please verify mongoc library installation and try again])
])
AM_CONDITIONAL(WITH_MONGODB, true)
], [
AM_CONDITIONAL(WITH_MONGODB, false)
])
AC_SEARCH_LIBS([curl_easy_init], [curl], [], [
AC_MSG_ERROR([unable to find curl; please install this library with your package manager, and try again])
])
AC_CHECK_HEADER([curl/curl.h], [], [
AC_MSG_ERROR([unable to find header curl/curl.h, please verify curl library installation and try again])
])
AS_IF([test "x$with_cashserver" != xno],
[
AC_SEARCH_LIBS([MHD_start_daemon], [microhttpd], [], [
AC_MSG_ERROR([unable to find libmicrohttpd, which is necessary for cashserver; please install this library with your package manager and try again, or if cashserver is not needed, try again with flag --without-cashserver])
])
AC_CHECK_HEADER([microhttpd.h], [], [
AC_MSG_ERROR([unable to find header microhttpd.h; please verify libmicrohttpd library installation and try again])
])
AM_CONDITIONAL(WITH_CASHSERVER, true)
], [
AM_CONDITIONAL(WITH_CASHSERVER, false)
])
AS_IF([test "x$with_cashsend" != xno],
[
AC_SEARCH_LIBS([uuid_generate_random], [uuid], [], [
AC_MSG_ERROR([unable to find uuid, which is necessary for cashsend; please install library with your package manager and try again, or if cashsend is not needed, try again with flag --without-cashsend])
])
AC_CHECK_HEADER([uuid/uuid.h], [], [
AC_MSG_ERROR([unable to find header jansson.h; please verify jansson library installation and try again])
])
AM_CONDITIONAL(WITH_CASHSEND, true)
], [
AM_CONDITIONAL(WITH_CASHSEND, false)
])
AM_CONDITIONAL(WITH_EMSCRIPTEN, false)
], [
AC_CHECK_HEADER([emscripten/fetch.h], [], [
AC_MSG_ERROR([unable to find header emscripten/fetch.h, please verify emscripten library installation and try again])
])
AC_CHECK_HEADER([emscripten.h], [], [
AC_MSG_ERROR([unable to find header emscripten/fetch.h, please verify emscripten library installation and try again])
])
AM_CONDITIONAL(WITH_MONGODB, false)
AM_CONDITIONAL(WITH_CASHSERVER, false)
AM_CONDITIONAL(WITH_CASHSEND, false)
AM_CONDITIONAL(WITH_EMSCRIPTEN, true)
])
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h stdlib.h stdint.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([bzero inet_ntoa memset strdup strrchr strstr strtoul])
AC_OUTPUT(Makefile src/Makefile data/Makefile)