148b28c239951797fdfbf2e264c852dd8ead1998
[blerg.git] / configure.in
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.65])
5 AC_INIT(config.h)
6 AM_INIT_AUTOMAKE([blerg], [1.6.1])
7 AC_PROG_RANLIB
8 AC_CONFIG_SRCDIR([common/app.c])
9 AC_CONFIG_HEADERS([config.h])
10
11 # Checks for programs.
12 AC_PROG_CC
13 AM_PROG_CC_C_O
14 PKG_PROG_PKG_CONFIG
15
16 # Checks for libraries.
17 AC_CHECK_LIB([pthread], [main])
18 AX_CHECK_YAJL
19 AX_CHECK_CGIUTIL
20 PKG_CHECK_MODULES([MICROHTTPD], [libmicrohttpd])
21 AC_SUBST([MICROHTTPD_CFLAGS])
22 AC_SUBST([MICROHTTPD_LIBS])
23
24
25 # Checks for header files.
26 AC_CHECK_HEADERS([fcntl.h memory.h stdint.h stdlib.h string.h sys/file.h unistd.h])
27
28 # Checks for typedefs, structures, and compiler characteristics.
29 AC_TYPE_SIZE_T
30 AC_TYPE_SSIZE_T
31 AC_TYPE_UINT16_T
32 AC_TYPE_UINT32_T
33 AC_TYPE_UINT64_T
34
35 # Checks for library functions.
36 AC_FUNC_MALLOC
37 AC_FUNC_MMAP
38 AC_FUNC_REALLOC
39 AC_CHECK_FUNCS([ftruncate memset mkdir munmap select strchr strtoull])
40
41 # Needed variables for programs to function...
42 AC_ARG_WITH([blerg-data-path],
43 AC_HELP_STRING([--with-blerg-data-path=@<:@DIR@:>@],
44 [Where database files will be stored default=data]
45 ),  
46 [
47 if test "$withval" != "no"; then
48         AC_DEFINE_UNQUOTED([DATA_PATH], ["$withval"], [Where data is located])
49 else
50         AC_MSG_ERROR(blerg-data-path MUST be defined)
51 fi
52 ],
53 [AC_DEFINE([DATA_PATH], ["data"], [Where data is located])]
54 )
55
56 AC_ARG_WITH([blerg-hash-tags-path],
57 AC_HELP_STRING([--with-blerg-hash-tags-path=@<:@DIR@:>@],
58 [Where hash tags files will be stored default=hash_tags]
59 ),  
60 [
61 if test "$withval" != "no"; then
62         AC_DEFINE_UNQUOTED([HASH_TAGS_PATH], ["$withval"], [Where tags will be saved])
63 else
64         AC_MSG_ERROR(blerg-hash-tags-path MUST be defined)
65 fi
66 ],
67 [AC_DEFINE([HASH_TAGS_PATH], ["hash_tags"], [Where tags will be saved])]
68 )
69
70
71 AC_ARG_WITH([blerg-ref-tags-path],
72 AC_HELP_STRING([--with-blerg-ref-tags-path=@<:@DIR@:>@],
73 [Where ref tags files will be stored default=ref_tags]
74 ),  
75 [
76 if test "$withval" != "no"; then
77         AC_DEFINE_UNQUOTED([REF_TAGS_PATH], ["$withval"], [Where refs will be saved])
78 else
79         AC_MSG_ERROR(blerg-ref-tags-path MUST be defined)
80 fi
81 ],
82 [AC_DEFINE([REF_TAGS_PATH], ["ref_tags"], [Where reffering tags will be save])]
83 )
84
85 AC_ARG_WITH([blerg-baseurl],
86 AC_HELP_STRING([--with-blerg-baseurl=@<:@URL@:>@],
87 [Baseurl is used for generating urls from cgi default=http://blerg.dominionofawesome.com/]
88 ),  
89 [
90 if test "$withval" != "no"; then
91         AC_DEFINE_UNQUOTED([BASEURL], ["$withval"], [Base url for cgi])
92 else
93         AC_MSG_ERROR(blerg-baseurl MUST be defined)
94 fi
95 ],
96 [AC_DEFINE([BASEURL], ["http://blerg.dominionofawesome.com/"], [Base URL for this blerg instance])]
97 )
98
99 AC_ARG_WITH([blerg-http-port],
100 AC_HELP_STRING([--with-blerg-http-port=@<:@INT@:>@],
101 [Listening port number default=8080]
102 ),  
103 [
104 if test "$withval" != "no"; then
105         AC_DEFINE_UNQUOTED([HTTP_BLERG_PORT], [$withval], [Port number for blerg.http])
106 else
107         AC_MSG_ERROR(blerg-http-port MUST be defined)
108 fi
109 ],
110 [AC_DEFINE([HTTP_BLERG_PORT], [8080], [Blerg listening port])]
111 )
112
113 AC_ARG_WITH([blerg-records-per-segment],
114 AC_HELP_STRING([--with-blerg-records-per-segment=@<:@INT@:>@],
115 [Records per segment default=65536]
116 ),  
117 [
118 if test "$withval" != "no"; then
119         AC_DEFINE_UNQUOTED([RECORDS_PER_SEGMENT], [$withval], [Database setting])
120 else
121         AC_MSG_ERROR(blerg-records-per-segment MUST be defined)
122 fi
123 ],
124 [AC_DEFINE([RECORDS_PER_SEGMENT], [65536], [Database settings])]
125 )
126
127 AC_ARG_WITH([blerg-max-record-size],
128 AC_HELP_STRING([--with-blerg-max-record-size=@<:@INT@:>@],
129 [Max record size default=65535]
130 ),  
131 [
132 if test "$withval" != "no"; then
133         AC_DEFINE_UNQUOTED([MAX_RECORD_SIZE], [$withval], [Database setting])
134 else
135         AC_MSG_ERROR(blerg-max-record-size MUST be defined)
136 fi
137 ],
138 [AC_DEFINE([MAX_RECORD_SIZE], [65535], [No greater than 65535])]
139 )
140
141 AC_ARG_WITH([blerg-max-tag-length],
142 AC_HELP_STRING([--with-blerg-max-tag-length=@<:@INT@:>@],
143 [Max size of tag default=64]
144 ),  
145 [
146 if test "$withval" != "no"; then
147         AC_DEFINE_UNQUOTED([MAX_TAG_LENGTH], [$withval], [Length of tags])
148 else
149         AC_MSG_ERROR(blerg-max-tag-length MUST be defined)
150 fi
151 ],
152 [AC_DEFINE([MAX_TAG_LENGTH], [64],[Length of tags])]
153 )
154
155 AC_ARG_WITH([blerg-max-tags-per-record],
156 AC_HELP_STRING([--with-blerg-max-tags-per-record=@<:@INT@:>@],
157 [Number of tags per record default=1024]
158 ),  
159 [
160 if test "$withval" != "no"; then
161         AC_DEFINE_UNQUOTED([MAX_TAGS_PER_RECORD], [$withval], [Tags per record])
162 else
163         AC_MSG_ERROR(blerg-max-tags-per-record MUST be defined)
164 fi
165 ],
166 [AC_DEFINE([MAX_TAGS_PER_RECORD], [1024],[Tags per record])]
167 )
168
169 AC_ARG_WITH([cgi-bin-dir],
170 AC_HELP_STRING([--with-cgi-bin-dir=@<:@DIR@:>@],
171 [Path where to install cgi programs default=/srv/www/cgi-bin]
172 ),  
173 [
174 if test "$withval" != "no"; then
175         CGIBINDIR="$withval"
176 else
177         AC_MSG_ERROR(cgi-bin-dir MUST be set)
178 fi
179 ],
180 [CGIBINDIR="/srv/www/cgi-bin/"]
181 )
182
183 AC_SUBST(CGIBINDIR)
184
185 AC_CONFIG_FILES([Makefile])
186 AC_OUTPUT