root/tags/jabberd-2.1.4/configure.in

Revision 139, 28.6 KB (checked in by smoku, 20 months ago)

Integrated libs.patch by Simon Wilkinson. Closes #16

Line 
1dnl jabberd2 configure script
2dnl $Id: configure.in,v 1.95 2005/08/21 10:06:06 zion Exp $
3
4dnl
5dnl autoconf setup
6dnl
7
8AC_PREREQ(2.57)
9
10dnl startup
11AC_INIT(jabberd, 2.1)
12AM_INIT_AUTOMAKE
13
14dnl copyright
15AC_COPYRIGHT([Copyright (c) 2002-2004 Robert Norris
16This configure script may be copied, distributed and modified under the
17terms of the jabberd license; see COPYING for more details.])
18
19dnl identify the source tree
20AC_CONFIG_SRCDIR(sx/sx.h)
21
22dnl output config header
23AM_CONFIG_HEADER(config.h)
24
25
26dnl
27dnl build environment setup
28dnl
29
30dnl developer flags
31AC_ARG_ENABLE(developer, AC_HELP_STRING([--enable-developer], [Compile with warnings and debugging symbols]),
32              CFLAGS="-Wall -g $CFLAGS")
33
34dnl basic tools
35AC_PROG_CC
36AC_PROG_MAKE_SET
37
38dnl need libtool for internal linking
39AC_DISABLE_STATIC
40AC_LIBTOOL_DLOPEN
41AC_PROG_LIBTOOL
42
43dnl use libtool to compile checks
44ac_link="${SHELL} ${srcdir}/libtool --mode=link $ac_link"
45
46
47dnl
48dnl extra paths
49dnl
50
51AC_ARG_WITH(extra_include_path, AC_HELP_STRING([--with-extra-include-path],
52                                           [use additional include paths]),
53            extra_include_path=$withval)
54split_includes="`echo $extra_include_path | sed -e 's/:/ /g'`"
55for incpath in $split_includes ; do
56    CPPFLAGS="-I$incpath $CPPFLAGS"
57done
58
59AC_ARG_WITH(extra_library_path, AC_HELP_STRING([--with-extra-library-path],
60                                               [use additional library paths]),
61            extra_library_path=$withval)
62split_libs="`echo $extra_library_path | sed -e 's/:/ /g'`"
63for libpath in $split_libs ; do
64    LDFLAGS="-L$libpath $LDFLAGS"
65done
66
67dnl
68dnl header checks
69dnl
70AC_HEADER_DIRENT
71AC_HEADER_STDC
72AC_HEADER_SYS_WAIT
73AC_HEADER_TIME
74
75# Two-step header checking.  First check for headers which don't
76# require any other headers.
77AC_CHECK_HEADERS( \
78    arpa/inet.h \
79    arpa/nameser.h \
80    fcntl.h \
81    netinet/in.h \
82    signal.h \
83    sys/filio.h \
84    sys/ioctl.h \
85    sys/types.h \
86    sys/socket.h \
87    sys/stat.h \
88    sys/time.h \
89    sys/timeb.h \
90    sys/utsname.h \
91    syslog.h \
92    unistd.h \
93    windows.h \
94    winsock2.h)
95
96# Now check for those headers that do, including all the required
97# headers.
98AC_CHECK_HEADERS(resolv.h windns.h,,,
99[#ifdef HAVE_SYS_TYPES_H
100# include <sys/types.h>
101#endif
102#ifdef HAVE_WINSOCK2_H
103# include <winsock2.h>
104#endif
105#ifdef HAVE_NETINET_IN_H
106# include <netinet/in.h>
107#endif])
108
109
110dnl
111dnl quirky functions
112dnl
113
114AC_CHECK_FUNC(connect, ,[AC_CHECK_LIB(socket, connect)])
115AC_CHECK_LIB(ws2_32, _head_libws2_32_a)
116AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(resolv, gethostbyname)])
117AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(nsl, gethostbyname)])
118
119if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
120  AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
121fi
122
123if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
124  AC_MSG_CHECKING([if we can include libnsl + libsocket])
125  LIBS="-lnsl -lsocket $LIBS"
126  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
127  if test "$my_ac_link_result" = "no" ; then
128    AC_MSG_RESULT([failure])
129    AC_MSG_ERROR([unable to use gethostbyname()])
130  else
131    AC_MSG_RESULT([success])
132  fi
133fi
134
135dnl res_query has been seen in libc, libbind and libresolv
136if test "x-$ac_cv_header_resolv_h" = "x-yes" ; then
137    AC_CHECK_FUNCS(res_query)
138    if test "x-$ac_cv_func_res_query" = "x-yes" ; then
139        have_res_query=yes
140    else
141        AC_CHECK_LIB(resolv, res_query)
142        if test "x-$ac_cv_lib_resolv_res_query" = "x-yes" ; then
143            have_res_query=yes
144        else
145            AC_CHECK_LIB(bind, res_query)
146            if test "x-$ac_cv_lib_bind_res_query" = "x-yes" ; then
147                have_res_query=yes
148            else
149                dnl some glibcs have res_query as a macro, so work around it
150                AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
151                save_libs="$LIBS"
152                LIBS="-lresolv $LIBS"
153                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]],
154                                                [[res_query(0,0,0,0,0)]])],
155                               [AC_MSG_RESULT(yes)
156                                have_res_query=yes],
157                               [AC_MSG_RESULT(no)
158                                LIBS="$save_libs"])
159            fi
160        fi
161    fi
162fi
163
164dnl windows calls it DnsQuery
165if test "x-$ac_cv_header_windns_h" = "x-yes" ; then
166    AC_MSG_CHECKING([for DnsQuery in -ldnsapi])
167    save_libs="$LIBS"
168    LIBS="-ldnsapi $LIBS"
169    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>
170                                      #include <windns.h>]],
171                                    [[DnsQuery(0,0,0,0,0,0)]])],
172                   [AC_MSG_RESULT(yes)
173                    have_dnsquery=yes],
174                   [AC_MSG_RESULT(no)
175                    LIBS="$save_libs"])
176fi
177
178if test "x-$have_res_query" = "x-yes" ; then
179    AC_DEFINE(HAVE_RES_QUERY,1,[Define to 1 if you have the 'res_query' function.])
180elif test "x-$have_dnsquery" = "x-yes" ; then
181    AC_DEFINE(HAVE_DNSQUERY,1,[Define to 1 if you have the 'DnsQuery' function.])
182else
183    AC_MSG_ERROR([no DNS resolver interface (res_query or DnsQuery) found])
184fi
185
186dnl inet_ntop/inet_pton have been seen in -lnsl, and sometimes not at all
187AC_CHECK_FUNC(inet_ntop, ,[AC_CHECK_LIB(nsl, inet_ntop)])
188unset ac_cv_func_inet_ntop
189AC_CHECK_FUNCS(inet_ntop inet_pton)
190
191dnl some glibcs have broken sockaddr_storage members
192if test "x-$ac_cv_type_struct_sockaddr_storage" = "x-yes" ; then
193    AC_MSG_CHECKING(for broken __ss_family member in struct sockaddr_storage)
194    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES,
195                                       [[do {
196                                             struct sockaddr_storage s;
197                                             s.__ss_family = 0;
198                                         } while(0)]])],
199                      [AC_MSG_RESULT(yes)
200                       AC_DEFINE(ss_family, __ss_family,
201                                 [Define to '__ss_family' if 'struct sockaddr_storage' defines '__ss_family' instead of 'ss_family'.])],
202                      AC_MSG_RESULT(no))
203
204    AC_MSG_CHECKING(for broken __ss_len member in struct sockaddr_storage)
205    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES,
206                                       [[do {
207                                             struct sockaddr_storage s;
208                                             s.__ss_len = 0;
209                                         } while(0)]])],
210                      [AC_MSG_RESULT(yes)
211                       AC_DEFINE(ss_len, __ss_len,
212                                 [Define to '__ss_len' if 'struct sockaddr_storage' defines '__ss_len' instead of 'ss_len'.])],
213                      AC_MSG_RESULT(no))
214fi
215
216
217dnl syslog
218if test "x-$ac_cv_header_syslog_h" = "x-yes" ; then
219    AC_CHECK_FUNCS(syslog vsyslog)
220fi
221
222if test "x-$ac_cv_header_windows_h" = "x-yes" ; then
223    AC_MSG_CHECKING(for ReportEvent)
224    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
225                                    [[ReportEvent(0,0,0,0,0,0,0,0,0)]])],
226                   [AC_MSG_RESULT(yes)
227                    AC_DEFINE(HAVE_REPORTEVENT,1,[Define to 1 if you have the 'ReportEvent' function.])],
228                   AC_MSG_RESULT(no))
229fi
230
231
232dnl snprintf/vsnprintf don't exist everywhere. additionally, we require
233dnl them to gracefully accept NULLs, which is non-standard
234AC_CHECK_FUNCS(snprintf vsnprintf)
235if test "x-$ac_cv_func_snprintf" = "x-yes" ; then
236    AC_MSG_CHECKING([if snprintf can handle NULL arguments])
237    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
238                                    #include <signal.h>
239                                    segv() { exit(1); }
240                                    main() { char b[10]; signal(SIGSEGV,segv); snprintf(b,10,"%s",NULL); exit(0); }]])],
241                  AC_MSG_RESULT(yes),
242                  [AC_MSG_RESULT(no)
243                   AC_DEFINE(HAVE_BROKEN_SNPRINTF,1,[Define to 1 if 'snprintf' cannot handle NULL arguments.])])
244fi
245if test "x-$ac_cv_func_vsnprintf" = "x-yes" ; then
246    AC_MSG_CHECKING([if vsnprintf can handle NULL arguments])
247    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
248                                    #include <signal.h>
249                                    #include <stdarg.h>
250                                    segv() { exit(1); }
251                                    expand(char *f,...) { va_list ap; char b[10]; va_start(ap,f); vsnprintf(b,10,f,ap); va_end(ap); }
252                                    main() { char b[10]; signal(SIGSEGV,segv); expand("%s", NULL); exit(0); }]])],
253                  AC_MSG_RESULT(yes),
254                  [AC_MSG_RESULT(no)
255                   AC_DEFINE(HAVE_BROKEN_VSNPRINTF,1,[Define to 1 if 'vsnprintf' cannot handle NULL arguments.])])
256fi
257
258
259dnl
260dnl external packages
261dnl
262
263dnl find libidn >= 0.3.0
264AC_ARG_ENABLE(idn, AC_HELP_STRING([--enable-idn], [enable IDN support (yes)]), want_idn=$enableval, want_idn=yes)
265if test "x-$want_idn" = "x-yes" ; then
266    AC_CHECK_HEADERS(stringprep.h)
267    if test "x-$ac_cv_header_stringprep_h" = "x-yes" ; then
268        AC_CHECK_LIB(idn, stringprep_check_version)
269    fi
270    if test "x-$ac_cv_lib_idn_stringprep_check_version" = "x-yes" ; then
271        AC_MSG_CHECKING(for Libidn version >= 0.3.0)
272        AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stringprep.h>]],
273                                       [[return !(stringprep_check_version("0.3.0"))]])],
274                      [AC_MSG_RESULT(yes)
275                        have_idn=yes],
276                      AC_MSG_RESULT(no))
277    fi
278    if test "x-$have_idn" = "x-" ; then
279        AC_MSG_ERROR([Libidn >= 0.3.0 not found])
280    fi
281
282    AC_DEFINE(HAVE_IDN,1,[Define to 1 if Libidn is available.])
283fi
284
285dnl
286dnl Cyrus-SASL
287dnl
288AC_CHECK_LIB(sasl2, sasl_client_init, [],
289        [AC_MSG_ERROR([Cyrus-SASL library not found])])
290AC_CHECK_HEADERS("sasl/sasl.h", ,
291        [AC_MSG_ERROR([Cyrus-SASL development headers not found])])
292
293
294dnl find openssl >= 0.9.6b
295AC_ARG_ENABLE(ssl, AC_HELP_STRING([--enable-ssl], [enable SSL/TLS support (yes)]), want_ssl=$enableval, want_ssl=yes)
296if test "x-$want_ssl" = "x-yes" ; then
297    AC_CHECK_HEADERS(openssl/crypto.h)
298    if test "x-$ac_cv_header_openssl_crypto_h" = "x-yes" ; then
299        AC_CHECK_LIB(crypto, CRYPTO_lock)
300    fi
301    if test "x-$ac_cv_lib_crypto_CRYPTO_lock" = "x-yes" ; then
302        AC_CHECK_HEADERS(openssl/ssl.h)
303    fi
304    if test "x-$ac_cv_header_openssl_ssl_h" = "x-yes" ; then
305        AC_CHECK_LIB(ssl, SSL_connect)
306    fi
307    if test "x-$ac_cv_lib_ssl_SSL_connect" = "x-yes" ; then
308        AC_MSG_CHECKING(for OpenSSL version >= 0.9.6b)
309        AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
310                                       [[return !(SSLeay() >= 0x000906020L)]])],
311                      [AC_MSG_RESULT(yes)
312                       have_openssl=yes],
313                      AC_MSG_RESULT(no))
314    fi
315    if test "x-$have_openssl" = "x-" ; then
316        AC_MSG_ERROR([OpenSSL >= 0.9.6b not found])
317    fi
318
319    AC_DEFINE(HAVE_SSL,1,[Define to 1 if OpenSSL is available.])
320fi
321
322dnl find expat
323AC_ARG_ENABLE(expat, AC_HELP_STRING([--enable-expat], [enable expat (yes)]), want_expat=$enableval, want_expat=yes)
324if test "x-$want_expat" = "x-yes" ; then
325    AC_CHECK_HEADERS(expat.h)
326    LIBS="-lexpat $LIBS"
327fi
328
329
330dnl
331dnl optional libs
332dnl
333
334dnl mysql
335AC_ARG_ENABLE(mysql, AC_HELP_STRING([--enable-mysql], [enable MySQL auth/reg/storage support (yes)]),
336              want_mysql=$enableval, want_mysql=yes)
337if test "x-$want_mysql" = "x-yes" ; then
338    AC_CHECK_HEADERS(mysql.h)
339    if test "x-$ac_cv_header_mysql_h" != "x-yes" ; then
340        for incpath in /usr/include/mysql /usr/local/include/mysql; do
341            if test "x-$ac_cv_header_mysql_h" != "x-yes" ; then
342                AC_MSG_CHECKING([for mysql.h in $incpath])
343                save_cppflags="$CPPFLAGS"
344                CPPFLAGS="-I$incpath $CPPFLAGS"
345                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mysql.h>]])],
346                                  [AC_MSG_RESULT(yes)
347                                   AC_DEFINE(HAVE_MYSQL_H,,[Define if you have mysql.h])
348                                   ac_cv_header_mysql_h=yes],
349                                  AC_MSG_RESULT(no))
350                if test "x-$ac_cv_header_mysql_h" != "x-yes" ; then
351                    CPPFLAGS="$save_cppflags"
352                fi
353            fi
354        done
355    fi
356    if test "x-$ac_cv_header_mysql_h" = "x-yes" ; then
357        AC_CHECK_LIB(mysqlclient, mysql_init)
358    fi
359    if test "x-$ac_cv_lib_mysqlclient_mysql_init" != "x-yes" ; then
360        AC_MSG_ERROR([MySQL client libraries not found])
361    else
362        AC_DEFINE(STORAGE_MYSQL,1,[Define to 1 if you want to use MySQL for auth/reg/storage.])
363    fi
364fi
365
366
367dnl postgresql
368AC_ARG_ENABLE(pgsql, AC_HELP_STRING([--enable-pgsql], [enable PostgreSQL auth/reg/storage support (no)]),
369              want_pgsql=$enableval, want_pgsql=no)
370if test "x-$want_pgsql" = "x-yes" ; then
371    AC_CHECK_HEADERS(libpq-fe.h)
372    if test "x-$ac_cv_header_libpq_fe_h" != "x-yes" ; then
373        for incpath in /usr/include/postgresql /usr/local/include/postgresql; do
374            if test "x-$ac_cv_header_libpq_fe_h" != "x-yes" ; then
375                AC_MSG_CHECKING([for libpq-fe.h in $incpath])
376                save_cppflags="$CPPFLAGS"
377                CPPFLAGS="-I$incpath $CPPFLAGS"
378                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libpq-fe.h>]])],
379                                  [AC_MSG_RESULT(yes)
380                                   AC_DEFINE(HAVE_LIBPQ_FE_H,,[Define if you have libpq_fe.h])
381                                   ac_cv_header_libpq_fe_h=yes],
382                                  AC_MSG_RESULT(no))
383                if test "x-$ac_cv_header_libpq_fe_h" != "x-yes" ; then
384                    CPPFLAGS="$save_cppflags"
385                fi
386            fi
387        done
388    fi
389    if test "x-$ac_cv_header_libpq_fe_h" = "x-yes" ; then
390        AC_CHECK_LIB(pq, PQsetdbLogin)
391    fi
392    if test "x-$ac_cv_lib_pq_PQsetdbLogin" != "x-yes" ; then
393        AC_MSG_ERROR([PostgreSQL client libraries not found])
394    else
395        AC_DEFINE(STORAGE_PGSQL,1,[Define to 1 if you want to use PostgreSQL for auth/reg/storage.])
396    fi
397fi
398
399
400dnl SQLite 3
401AC_ARG_ENABLE(sqlite, AC_HELP_STRING([--enable-sqlite], [enable SQLite 3 storage support (no)]),
402              want_sqlite=$enableval, want_sqlite=no)
403if test "x-$want_sqlite" = "x-yes" ; then
404    AC_CHECK_HEADERS(sqlite3.h)
405    if test "x-$ac_cv_header_sqlite3_h" = "x-yes" ; then
406        AC_CHECK_LIB(sqlite3, sqlite3_open)
407    fi
408    if test "x-$ac_cv_lib_sqlite3_sqlite3_open" != "x-yes" ; then
409        AC_MSG_ERROR([SQLite 3 library not found])
410    else
411        AC_DEFINE(STORAGE_SQLITE,1,[Define to 1 if you want to use SQLite 3 for storage.])
412    fi
413fi
414
415
416dnl berkeley db
417AC_ARG_ENABLE(db, AC_HELP_STRING([--enable-db], [enable Berkeley DB auth/reg/storage support (no)]),
418              want_db=$enableval, want_db=no)
419if test "x-$want_db" = "x-yes" ; then
420    AC_CHECK_HEADERS(db.h)
421    if test "x-$ac_cv_header_db_h" = "x-yes" ; then
422        for lib in db-4.3 db-4.2 db-4.1 db-4 db4 db41 db ; do
423            if test "x-$have_db_version" != "x-yes" ; then
424                AC_MSG_CHECKING([for db_create in -l$lib])
425                save_libs="$LIBS"
426                LIBS="-l$lib $LIBS"
427                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],
428                                                [[db_create(0,0,0)]])],
429                               [AC_MSG_RESULT(yes)
430                                AC_MSG_CHECKING(for Berkeley DB version >= 4.1.25)
431                                AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],
432                                                               [[do {
433                                                                     int major, minor, patch;
434                                                                     db_version(&major, &minor, &patch);
435                                                                     if(major < 4 ||
436                                                                         (major == 4 && minor < 1) ||
437                                                                         (major == 4 && minor == 1 && patch < 24))
438                                                                         return 1;
439                                                                 } while(0)]])],
440                                              [AC_MSG_RESULT(yes)
441                                               have_db_version=yes],
442                                              AC_MSG_RESULT(no))],
443                                AC_MSG_RESULT(no))
444                if test "x-$have_db_version" = "x-" ; then
445                    LIBS="$save_libs"
446                fi
447            fi
448        done
449    fi
450    if test "x-$have_db_version" != "x-yes" ; then
451        AC_MSG_ERROR([Berkeley DB >= 4.1.24 not found])
452    else
453        AC_DEFINE(STORAGE_DB,1,[Define to 1 if you want to use Berkeley DB for auth/reg/storage.])
454    fi
455fi
456
457
458dnl openldap
459AC_ARG_ENABLE(ldap, AC_HELP_STRING([--enable-ldap], [enable OpenLDAP auth/reg support (no)]),
460              want_ldap=$enableval, want_ldap=no)
461if test "x-$want_ldap" = "x-yes" ; then
462    AC_CHECK_HEADERS(lber.h ldap.h)
463    if test "x-$ac_cv_header_ldap_h" = "x-yes" -a "x-$ac_cv_header_lber_h" = "x-yes" ; then
464        AC_CHECK_LIB(lber, ber_alloc)
465        AC_CHECK_LIB(ldap, ldap_init)
466    fi
467    if test "x-$ac_cv_lib_lber_ber_alloc" = "x-yes" -a "x-$ac_cv_lib_ldap_ldap_init" = "x-yes" ; then
468        AC_MSG_CHECKING(for OpenLDAP version >= 2.1.0)
469        AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lber.h>
470                                         #include <ldap.h>]],
471                                       [[do {
472                                             LDAPAPIInfo info;
473                                             info.ldapai_info_version = LDAP_API_INFO_VERSION;
474                                             ldap_get_option(0, LDAP_OPT_API_INFO, &info);
475                                             if(info.ldapai_vendor_version != LDAP_VENDOR_VERSION || LDAP_VENDOR_VERSION < 2004)
476                                                 return 1;
477                                         } while(0)]])],
478                                       [AC_MSG_RESULT(yes)
479                                        have_ldap_version=yes],
480                                       AC_MSG_RESULT(no))
481    fi
482    if test "x-$want_ldap" = "x-yes" -a "x-$have_ldap_version" = "x-" ; then
483        AC_MSG_ERROR([OpenLDAP client libraries >= 2.1.0 not found])
484    else
485        AC_DEFINE(STORAGE_LDAP,1,[Define to 1 if you want to use OpenLDAP for auth/reg.])
486    fi
487fi
488
489
490dnl pam
491AC_ARG_ENABLE(pam, AC_HELP_STRING([--enable-pam], [enable PAM auth/reg support (no)]),
492              want_pam=$enableval, want_pam=no)
493if test "x-$want_pam" = "x-yes" ; then
494    AC_CHECK_HEADERS(security/pam_appl.h)
495    if test "x-$ac_cv_header_security_pam_appl_h" = "x-yes" ; then
496        AC_CHECK_LIB(pam, pam_start)
497    fi
498    if test "x-$ac_cv_lib_pam_pam_start" != "x-yes" ; then
499        AC_MSG_ERROR([PAM application libraries not found])
500    else
501        AC_DEFINE(STORAGE_PAM,1,[Define to 1 if you want to use PAM for auth/reg.])
502    fi
503fi
504
505
506dnl pipe (not really an external package, but does need some checks)
507AC_ARG_ENABLE(pipe, AC_HELP_STRING([--enable-pipe], [enable pipe auth/reg support (no)]),
508              want_pipe=$enableval, want_pipe=no)
509if test "x-$want_pipe" = "x-yes" ; then
510    AC_CHECK_HEADERS(sys/wait.h)
511    AC_FUNC_FORK
512    AC_CHECK_FUNCS(pipe wait)
513    if test "x-$ac_cv_header_sys_wait_h" != "x-yes" -o \
514            "x-$ac_cv_func_fork" != "x-yes" -o \
515            "x-$ac_cv_func_pipe" != "x-yes" -o \
516            "x-$ac_cv_func_wait" != "x-yes" ; then
517        AC_MSG_ERROR([Pipe auth/reg requirements (sys/wait.h, fork(), pipe(), wait()) not found])
518    else
519        AC_DEFINE(STORAGE_PIPE,1,[Define to 1 if you want to use pipes for auth/reg.])
520    fi
521fi
522
523
524dnl anon
525AC_ARG_ENABLE(anon, AC_HELP_STRING([--enable-anon], [enable anonymous auth/reg support (no)]),
526              want_anon=$enableval, want_anon=no)
527if test "x-$want_anon" = "x-yes" ; then
528    AC_DEFINE(STORAGE_ANON,1,[Define to 1 if you want anonymous auth.])
529fi
530
531
532dnl filesystem storage
533AC_ARG_ENABLE(fs, AC_HELP_STRING([--enable-fs], [enable filesystem storage support (no)]),
534              want_fs=$enableval, want_fs=no)
535if test "x-$want_fs" = "x-yes" ; then
536    AC_DEFINE(STORAGE_FS,1,[Define to 1 if you want to use the filesystem for storage.])
537fi
538
539dnl Oracle
540AC_ARG_WITH(oracle-home,
541        [ --with-oracle-home=DIR   the Oracle home directory, for includes and libs. ],
542        [ ac_oracle_home="$withval" ])
543
544AC_ARG_ENABLE(oracle, AC_HELP_STRING([--enable-oracle], [enable Oracle auth/reg/storage support (no)]),
545              want_oracle=$enableval, want_oracle=no)
546if test "x-$want_oracle" = "x-yes" ; then
547    AC_CHECK_HEADERS(oci.h)
548    if test "x-$ac_cv_header_oci_h" != "x-yes" ; then
549       if test -n $ac_oracle_home ; then
550          AC_MSG_CHECKING([for oci.h in $ac_oracle_home])
551                save_cppflags="$CPPFLAGS"
552                CPPFLAGS="-I$ac_oracle_home/rdbms/demo -I$ac_oracle_home/rdbms/public $CPPFLAGS"
553                save_libs="$LIBS"
554                LIBS="-L$ac_oracle_home/lib $LIBS"
555                save_ldflags="$LDFLAGS"
556                LDFLAGS="-Wl,-rpath,$ac_oracle_home/lib $LDFLAGS"
557                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <oci.h>]])],
558                                  [AC_MSG_RESULT(yes)
559                                   AC_DEFINE(HAVE_OCI_H,,[Define if you have oci.h])
560                                   ac_cv_header_oci_h=yes],
561                                  AC_MSG_RESULT(no))
562                if test "x-$ac_cv_header_oci_h" != "x-yes" ; then
563                    CPPFLAGS="$save_cppflags"
564                    LIBS="$save_libs"
565                     LDFLAGS="$save_ldflags"
566                fi
567       fi
568    fi
569    if test "x-$ac_cv_header_oci_h" = "x-yes" ; then
570        AC_CHECK_LIB(clntsh, OCIInitialize)
571    fi
572    if test "x-$ac_cv_lib_clntsh_OCIInitialize" != "x-yes" ; then
573        AC_MSG_ERROR([Oracle client libraries not found])
574    else
575        AC_DEFINE(STORAGE_ORACLE,1,[Define to 1 if you want to use Oracle for auth/reg/storage.])
576    fi
577fi
578
579
580
581dnl
582dnl generic system types
583dnl
584AC_CREATE_STDINT_H(ac-stdint.h)
585
586
587
588
589dnl
590dnl typedefs, structs, compiler quirks
591dnl
592AC_TYPE_MODE_T
593AC_TYPE_OFF_T
594AC_TYPE_PID_T
595AC_TYPE_SIZE_T
596AC_STRUCT_TM
597AC_STRUCT_TIMEZONE
598
599
600dnl
601dnl ipv6 stuff
602dnl
603AC_DEFUN([_IP6_INCLUDES],[[
604#include "ac-stdint.h"
605#ifdef HAVE_SYS_TYPES_H
606# include <sys/types.h>
607#endif
608#ifdef HAVE_SYS_SOCKET_H
609# include <sys/socket.h>
610#endif
611#ifdef HAVE_NETINET_IN_H
612# include <netinet/in.h>
613#endif
614#ifdef HAVE_ARPA_INET_H
615# include <arpa/inet.h>
616#endif
617]])
618
619dnl these types are missing in places
620AC_CHECK_TYPES([in_port_t, sa_family_t, struct sockaddr_storage, struct sockaddr_in6, struct in6_addr],,, _IP6_INCLUDES)
621
622
623dnl
624dnl mio backend checks
625dnl
626AC_ARG_ENABLE(mio, AC_HELP_STRING([--enable-mio=BACKEND], [use BACKEND to drive MIO]),
627              mio_check=$enableval, mio_check='epoll poll select')
628
629mio_backend=''
630for backend in $mio_check ; do
631    case x-$backend in
632
633        x-epoll)
634            AC_CHECK_HEADERS(sys/epoll.h)
635            if test "x-$ac_cv_header_sys_epoll_h" = "x-yes" ; then
636                AC_CHECK_FUNCS(epoll_create,[
637                    mio_backend='epoll'
638                    AC_DEFINE(MIO_EPOLL,1,[Define to 1 if you want to use 'epoll' for non-blocking I/O.])])
639            fi
640            ;;
641
642        x-poll)
643            AC_CHECK_HEADERS(poll.h)
644            if test "x-$ac_cv_header_poll_h" = "x-yes" ; then
645                AC_CHECK_FUNCS(poll,[
646                    mio_backend='poll'
647                    AC_DEFINE(MIO_POLL,1,[Define to 1 if you want to use 'poll' for non-blocking I/O.])])
648            fi
649            ;;
650
651        x-select)
652            AC_CHECK_HEADERS(sys/select.h)
653            if test "x-$ac_cv_header_sys_select_h" = "x-yes" ; then
654                AC_CHECK_FUNCS(select, have_select=yes)
655            fi
656
657            if test "x-$have_select" != "x-yes" -a "x-$ac_cv_header_winsock2_h" = "x-yes" ; then
658                AC_MSG_CHECKING([for select in ws2_32])
659                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
660                                                [[select(0,0,0,0,0)]])],
661                               [AC_MSG_RESULT(yes)
662                                have_select=yes],
663                               AC_MSG_RESULT(no))
664            fi
665
666            if test "x-$have_select" = "x-yes" ; then
667                mio_backend='select'
668                AC_DEFINE(MIO_SELECT,1,[Define to 1 if you want to use 'select' for non-blocking I/O.])
669            fi
670            ;;
671    esac
672done
673
674if test "x-$mio_backend" = "x-" ; then
675    AC_MSG_ERROR([no MIO backend available out of: $backend])
676fi
677
678
679dnl functions we need
680AC_FUNC_MALLOC
681AC_FUNC_MEMCMP
682AC_FUNC_MKTIME
683AC_FUNC_REALLOC
684AC_FUNC_STAT
685AC_FUNC_VPRINTF
686AC_CHECK_FUNCS( \
687    close \
688    dup2 \
689    fcntl \
690    inet_aton \
691    ioctl \
692    isascii \
693    _findfirst \
694    getopt \
695    gettimeofday \
696    getpid \
697    _getpid \
698    memchr \
699    memmove \
700    memset \
701    mkdir \
702    _mkdir \
703    modf \
704    sleep \
705    Sleep \
706    strcasecmp \
707    stricmp \
708    strchr \
709    strdup \
710    strerror \
711    strncasecmp \
712    strnicmp \
713    strstr \
714    tzset \
715    uname \
716    getpagesize )
717
718dnl windows has different names for a few basic things
719if test "x-$ac_cv_func_getpid" != "x-yes" -a "x-$ac_cv_func__getpid" = "x-yes" ; then
720    AC_DEFINE(getpid,_getpid,[Define to a function than can provide getpid(2) functionality.])
721fi
722
723if test "x-$ac_cv_func_sleep" != "x-yes" -a "x-$ac_cv_func_Sleep" = "x-yes" ; then
724    AC_DEFINE(sleep,Sleep,[Define to a function than can provide sleep(2) functionality.])
725fi
726
727if test "x-$ac_cv_func_strcasecmp" != "x-yes" -a "x-$ac_cv_func_stricmp" = "x-yes" ; then
728    AC_DEFINE(strcasecmp,stricmp,[Define to a function than can provide strcasecmp(3) functionality.])
729fi
730
731if test "x-$ac_cv_func_strncasecmp" != "x-yes" -a "x-$ac_cv_func_strnicmp" = "x-yes" ; then
732    AC_DEFINE(strncasecmp,strnicmp,[Define to a function than can provide strncasecmp(3) functionality.])
733fi
734
735dnl winsock substitutions
736if test "x-$ac_cv_func_close" != "x-yes" ; then
737    AC_MSG_CHECKING(for closesocket)
738    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
739                                    [[closesocket(0)]])],
740                   [AC_MSG_RESULT(yes)
741                    AC_DEFINE(close,closesocket,[Define to a function than can provide close(2) functionality.])],
742                    AC_DEFINE(HAVE_CLOSE,1,[Define to 1 if you have the 'close' function.])
743                   AC_MSG_RESULT(no))
744fi
745
746if test "x-$ac_cv_func_ioctl" != "x-yes" ; then
747    AC_MSG_CHECKING(for ioctlsocket)
748    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
749                                    [[ioctlsocket(0,0,0)]])],
750                   [AC_MSG_RESULT(yes)
751                    AC_DEFINE(ioctl,ioctlsocket,[Define to a function than can provide ioctl(2) functionality.])],
752                    AC_DEFINE(HAVE_IOCTL,1,[Define to 1 if you have the 'ioctl' function.])
753                   AC_MSG_RESULT(no))
754fi
755
756
757dnl
758dnl debugging
759dnl
760AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debug messages]),
761              want_debug=$enableval, want_debug=no)
762if test "x-$want_debug" = "x-yes" ; then
763    AC_DEFINE(DEBUG,1,[Define to 1 if you want to get debug output with -D.])
764    AC_DEFINE(SX_DEBUG,1,[Define to 1 if you want to get SX debug output with -D.])
765fi
766
767AC_ARG_ENABLE(nad_debug, AC_HELP_STRING([--enable-nad-debug], [enable NAD pointer tracking]),
768              want_nad_debug=$enableval, want_nad_debug=no)
769if test "x-$want_nad_debug" = "x-yes" ; then
770    AC_DEFINE(NAD_DEBUG,1,[Define to 1 if you want to enable NAD pointer tracking.])
771fi
772
773AC_ARG_ENABLE(pool_debug, AC_HELP_STRING([--enable-pool-debug], [enable memory pool statistics]),
774              want_pool_debug=$enableval, want_pool_debug=no)
775if test "x-$want_pool_debug" = "x-yes" ; then
776    AC_DEFINE(POOL_DEBUG,1,[Define to 1 if you want to enable memory pool statistics.])
777fi
778
779AC_ARG_ENABLE(mio_debug, AC_HELP_STRING([--enable-mio-debug], [enable managed IO debug output]),
780              want_mio_debug=$enableval, want_mio_debug=no)
781if test "x-$want_mio_debug" = "x-yes" ; then
782    AC_DEFINE(MIO_DEBUG,1,[Define to 1 if you want to enable managed IO debug output.])
783fi
784
785
786dnl
787dnl finishing up
788dnl
789
790dnl put our config in its own subdir
791sysconfdir="$sysconfdir/jabberd"
792
793dnl done!
794AC_OUTPUT(Makefile \
795          etc/Makefile \
796          etc/templates/Makefile \
797          tools/Makefile \
798          man/Makefile \
799          mio/Makefile \
800          subst/Makefile \
801          sx/Makefile \
802          util/Makefile \
803          c2s/Makefile \
804          resolver/Makefile \
805          router/Makefile \
806          s2s/Makefile \
807          sm/Makefile \
808          Doxyfile)
Note: See TracBrowser for help on using the browser.