1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
AC_INIT(src/main.c) |
3 |
AM_CONFIG_HEADER(src/config.h) |
4 |
AM_INIT_AUTOMAKE(thales, 1.0) |
5 |
AC_PREFIX_DEFAULT([\${HOME}/thales]) |
6 |
dnl Checks for programs. |
7 |
AC_PROG_AWK |
8 |
AC_PROG_CC |
9 |
AC_PROG_INSTALL |
10 |
AC_PROG_LN_S |
11 |
|
12 |
dnl Checks for libraries. |
13 |
AC_CHECK_LIB(socket, connect, gethostbyname) |
14 |
AC_CHECK_LIB(z, compress) |
15 |
AC_CHECK_LIB(m, floor) |
16 |
|
17 |
dnl Checks for header files. |
18 |
AC_HEADER_STDC |
19 |
AC_CHECK_HEADERS(limits.h sys/time.h unistd.h) |
20 |
|
21 |
dnl Checks for typedefs, structures, and compiler characteristics. |
22 |
AC_C_CONST |
23 |
AC_TYPE_SIZE_T |
24 |
AC_HEADER_TIME |
25 |
AC_STRUCT_TM |
26 |
|
27 |
dnl Checks for library functions. |
28 |
AC_FUNC_STRFTIME |
29 |
AC_FUNC_VPRINTF |
30 |
AC_CHECK_FUNCS(gettimeofday select socket strcspn strdup strerror strspn strtol) |
31 |
|
32 |
AC_ARG_WITH(ircd, |
33 |
[ --with-ircd=ircdtype type of the ircd used with thales (bahamut, hybrid, ircdru, unreal, ultimate28 or ultimate30)]) |
34 |
AC_ARG_WITH(tableprefix, |
35 |
[ --tableprefix=string prefix to add to all SQL tables names. database creation scripts need to be modified accordingly.)]) |
36 |
AC_ARG_WITH(hashlist, |
37 |
[ --with-hashlist=YES/NO Use an internal hashlist to store some data ? (that makes Thales run faster)]) |
38 |
AC_ARG_WITH(mysql, |
39 |
[ --with-mysql=PFX Prefix where MySQL is installed (usually /usr/local)]) |
40 |
AC_ARG_WITH(mysql-includes, |
41 |
[ --with-mysql-includes=PFX Prefix where MySQL includes are found (usually |
42 |
/usr/local/include/mysql)]) |
43 |
AC_ARG_WITH(mysql-libraries, |
44 |
[ --with-mysql-libraries=PFX Prefix where MySQL libraries are found (usually |
45 |
/usr/local/lib/mysql)]) |
46 |
AC_ARG_ENABLE(noreportusage, |
47 |
[ --enable-noreportusage Forget about the Usage Survey],[REPORT=0],[REPORT=1]) |
48 |
|
49 |
dnl Check usr/local first, in case sys admin has installed a later version |
50 |
dnl than was included with the OS (in which case the older will be in /usr) |
51 |
|
52 |
if test "x$with_mysql_includes" != "x"; then |
53 |
AC_CHECK_HEADER($with_mysql_includes/mysql.h, |
54 |
[CFLAGS="$CFLAGS -I$with_mysql_includes"], |
55 |
AC_MSG_ERROR(Need MySQL includes!)) |
56 |
fi |
57 |
|
58 |
if test "x$with_mysql_libraries" != "x"; then |
59 |
AC_CHECK_LIB_LOC($with_mysql_libraries,mysqlclient,mysql_real_connect,, |
60 |
AC_MSG_ERROR(Need MySQL client library!)) |
61 |
fi |
62 |
|
63 |
if test "x$with_mysql" != "x"; then |
64 |
if test "x$with_mysql_libraries" = "x"; then |
65 |
AC_CHECK_LIB_LOC($with_mysql/lib/mysql,mysqlclient,mysql_real_connect,, |
66 |
AC_MSG_ERROR(Need MySQL client library!)) |
67 |
fi |
68 |
if test "x$with_mysql_includes" = "x"; then |
69 |
AC_CHECK_HEADER($with_mysql/include/mysql/mysql.h, |
70 |
[CFLAGS="$CFLAGS -I$with_mysql/include/mysql"], |
71 |
AC_MSG_ERROR(Need MySQL includes!)) |
72 |
fi |
73 |
else |
74 |
if test "x$with_mysql_libraries" = "x"; then |
75 |
AC_CHECK_LIB_LOC(/opt/lib/mysql,mysqlclient,mysql_real_connect,, |
76 |
AC_CHECK_LIB_LOC(/usr/local/lib/mysql,mysqlclient,mysql_real_connect,, |
77 |
AC_CHECK_LIB_LOC(/usr/lib/mysql,mysqlclient,mysql_real_connect,, |
78 |
AC_CHECK_LIB_LOC(/usr/local/lib,mysqlclient,mysql_real_connect,, |
79 |
AC_CHECK_LIB_LOC(/opt/lib,mysqlclient,mysql_real_connect,, |
80 |
AC_CHECK_LIB_LOC(/usr/lib,mysqlclient,mysql_real_connect,, |
81 |
AC_MSG_ERROR(Need MySQL client library!))))))) |
82 |
fi |
83 |
if test "x$with_mysql_includes" = "x"; then |
84 |
AC_CHECK_HEADER(/opt/include/mysql/mysql.h, CFLAGS="$CFLAGS -I/opt/include/mysql", |
85 |
AC_CHECK_HEADER(/usr/local/include/mysql/mysql.h, CFLAGS="$CFLAGS -I/usr/local/include/mysql", |
86 |
AC_CHECK_HEADER(/usr/include/mysql/mysql.h, CFLAGS="$CFLAGS -I/usr/include/mysql", |
87 |
AC_MSG_ERROR(Need MySQL includes!)))) |
88 |
fi |
89 |
fi |
90 |
CFLAGS="$CFLAGS -Wall" |
91 |
|
92 |
AC_ARG_ENABLE(static, |
93 |
[ --enable-static links statically], |
94 |
[LDFLAGS="$LDFLAGS -static"]) |
95 |
|
96 |
dnl Table prefix |
97 |
|
98 |
ok=0 |
99 |
if test "x$with_tableprefix" != "x"; then |
100 |
AC_DEFINE_UNQUOTED(TBL_PREFIX, "$with_tableprefix", 'table prefix to use') |
101 |
fi |
102 |
|
103 |
|
104 |
dnl Hashlist ? |
105 |
|
106 |
ok=0 |
107 |
if test "x$with_hashlist" != "x"; then |
108 |
case $with_hashlist in |
109 |
[[Nn][Oo]]) |
110 |
echo "Hashlist support disabled : Thales will run slower." |
111 |
ok=1 |
112 |
;; |
113 |
esac |
114 |
fi |
115 |
if test $ok -eq 0; then |
116 |
AC_DEFINE_UNQUOTED(HASHLISTSUPPORT, 1, 'use internal hashlist') |
117 |
fi |
118 |
|
119 |
dnl IRCD type |
120 |
|
121 |
ok=0 |
122 |
reportusage=1 |
123 |
if test "x$with_ircd" != "x"; then |
124 |
case $with_ircd in |
125 |
[[Bb][Aa][Hh][Aa][Mm][Uu][Tt]]) |
126 |
AC_DEFINE_UNQUOTED(IRCD_BAHAMUT, 1, 'ircd type') |
127 |
echo "Using Bahamut IRCD" |
128 |
ok=1 |
129 |
;; |
130 |
[[Hh][Yy][Bb][Rr][Ii][Dd]]) |
131 |
AC_DEFINE_UNQUOTED(IRCD_HYBRID, 1, 'ircd type') |
132 |
echo "Using Hybrid IRCD" |
133 |
ok=1 |
134 |
;; |
135 |
[[Ii][Rr][Cc][Dd][Rr][Uu]]) |
136 |
AC_DEFINE_UNQUOTED(IRCD_IRCDRU, 1, 'ircd type') |
137 |
echo "Using IRCD-RU IRCD" |
138 |
ok=1 |
139 |
;; |
140 |
[[Uu][Nn][Rr][Ee][Aa][Ll]]) |
141 |
AC_DEFINE_UNQUOTED(IRCD_UNREAL, 1, 'ircd type') |
142 |
echo "Using Unreal IRCD" |
143 |
reportusage=0 |
144 |
ok=1 |
145 |
;; |
146 |
[[Uu][Ll][Tt][Ii][Mm][Aa][Tt][Ee]28]) |
147 |
AC_DEFINE_UNQUOTED(IRCD_ULTI28, 1, 'ircd type') |
148 |
echo "Using Ultimate IRCD 2.8" |
149 |
ok=1 |
150 |
;; |
151 |
[[Uu][Ll][Tt][Ii][Mm][Aa][Tt][Ee]30]) |
152 |
AC_DEFINE_UNQUOTED(IRCD_ULTIMATE, 1, 'ircd type') |
153 |
echo "Using Ultimate IRCD 3.0" |
154 |
ok=1 |
155 |
;; |
156 |
*) |
157 |
echo "IRCD type unrecognized" |
158 |
;; |
159 |
esac |
160 |
fi |
161 |
if test $ok -eq 0; then |
162 |
echo |
163 |
echo "---------------------------------------------------------------" |
164 |
echo |
165 |
echo "Which of the following is closest to the type of server used on" |
166 |
echo "your IRC network ?" |
167 |
echo " 1) UnrealIRCd 3.1.1 or later" |
168 |
echo "Support for these servers is still available but might not be" |
169 |
echo "complete. See the NeedMaintainers file for more info." |
170 |
echo " 2) Bahamut 1.4.27 or later" |
171 |
echo " 3) Hybrid 7 or later" |
172 |
echo " 4) ircd-RU! 1.4.0 or later" |
173 |
echo " 5) UltimateIRCD 2.8 or later (2.8 branch)" |
174 |
echo " 6) UltimateIRCD 3.0.0 or later" |
175 |
while `test $ok -eq 0` ; do |
176 |
echo -n '> ' |
177 |
read KBDINPUT |
178 |
case $KBDINPUT in |
179 |
1) |
180 |
AC_DEFINE_UNQUOTED(IRCD_UNREAL, 1, 'ircd type') |
181 |
reportusage=0 |
182 |
ok=1 |
183 |
;; |
184 |
2) |
185 |
AC_DEFINE_UNQUOTED(IRCD_BAHAMUT, 1, 'ircd type') |
186 |
ok=1 |
187 |
;; |
188 |
3) |
189 |
AC_DEFINE_UNQUOTED(IRCD_HYBRID, 1, 'ircd type') |
190 |
ok=1 |
191 |
;; |
192 |
4) |
193 |
AC_DEFINE_UNQUOTED(IRCD_IRCDRU, 1, 'ircd type') |
194 |
ok=1 |
195 |
;; |
196 |
5) |
197 |
AC_DEFINE_UNQUOTED(IRCD_ULTI28, 1, 'ircd type') |
198 |
ok=1 |
199 |
;; |
200 |
6) |
201 |
AC_DEFINE_UNQUOTED(IRCD_ULTIMATE, 1, 'ircd type') |
202 |
ok=1 |
203 |
;; |
204 |
*) |
205 |
echo "Please enter a valid option number." |
206 |
;; |
207 |
esac |
208 |
done |
209 |
fi |
210 |
|
211 |
AC_ARG_ENABLE(no-modes, |
212 |
[ --enable-no-modes Disables modes in the database (modes are enabled by default)], |
213 |
[AC_DEFINE_UNQUOTED(NOMODES, 1, 'dont store modes in the database ?')]) |
214 |
|
215 |
AC_OUTPUT(src/Makefile data/Makefile Makefile) |
216 |
|
217 |
if test $REPORT -eq 1 -a $reportusage -eq 1; then |
218 |
./ReportUsage.sh |
219 |
fi |
220 |
echo |
221 |
echo "Thales will be installed in ${prefix}. To change this, run :" |
222 |
echo " ./configure --prefix=DIRECTORY" |
223 |
echo "To compile Thales, run make (or gmake on non-GNU systems)" |
224 |
echo "To install Thales, run make install (or gmake install on non-GNU systems)" |
225 |
echo |
226 |
echo "Don't forget to read the README and INSTALL files for more detailed instructions" |
227 |
echo |