| 1 | ## -*- mode: m4 -*- |
|---|
| 2 | dnl Copyright (c) 1998 N. D. Bellamy |
|---|
| 3 | dnl Copyright (c) 1999,2000 Dirk Mueller <dirk@licq.org> |
|---|
| 4 | |
|---|
| 5 | AC_DEFUN([AC_CHECK_SOCKS5], |
|---|
| 6 | [ |
|---|
| 7 | AC_MSG_CHECKING(whether to enable SOCKS5 support) |
|---|
| 8 | |
|---|
| 9 | WITH_SOCKS5="no" |
|---|
| 10 | SOCKS_LIBS="" |
|---|
| 11 | SOCKS_LIBDIR="" |
|---|
| 12 | SOCKS_INCDIR="" |
|---|
| 13 | |
|---|
| 14 | AC_ARG_ENABLE( |
|---|
| 15 | socks5, |
|---|
| 16 | [ --enable-socks5 enable SOCKS5 firewall support], |
|---|
| 17 | WITH_SOCKS5=yes) |
|---|
| 18 | |
|---|
| 19 | AC_ARG_WITH( |
|---|
| 20 | socks5-inc, |
|---|
| 21 | [ --with-socks5-inc=PATH include path for SOCKS5 headers], |
|---|
| 22 | socks_incdir="$withval", socks_incdir="no") |
|---|
| 23 | |
|---|
| 24 | AC_ARG_WITH( |
|---|
| 25 | socks5-lib, |
|---|
| 26 | [ --with-socks5-lib=PATH library path for SOCKS5 libraries], |
|---|
| 27 | socks_libdir="$withval", socks_libdir="no") |
|---|
| 28 | |
|---|
| 29 | if test "$WITH_SOCKS5" = "no"; then |
|---|
| 30 | AC_MSG_RESULT(no) |
|---|
| 31 | else |
|---|
| 32 | AC_MSG_RESULT(yes) |
|---|
| 33 | WITH_SOCKS5="no" |
|---|
| 34 | |
|---|
| 35 | dnl Init |
|---|
| 36 | if test "$socks_libdir" != "no"; then |
|---|
| 37 | BACKUP_LDFLAGS="$LDFLAGS" |
|---|
| 38 | LDFLAGS="$LDFLAGS -L$socks_libdir" |
|---|
| 39 | fi |
|---|
| 40 | if test "$socks_incdir" != "no"; then |
|---|
| 41 | BACKUP_CPPFLAGS="$CPPFLAGS" |
|---|
| 42 | CPPFLAGS="$CPPFLAGS -I$socks_incdir" |
|---|
| 43 | fi |
|---|
| 44 | |
|---|
| 45 | SOCKS_LIBS="" |
|---|
| 46 | SOCKS_INCDIR="" |
|---|
| 47 | |
|---|
| 48 | licq_socks_optlen=unknown |
|---|
| 49 | |
|---|
| 50 | AC_CHECK_LIB(socks5, SOCKSinit, SOCKS_LIBS="-lsocks5") |
|---|
| 51 | if test -z "$SOCKS_LIBS"; then |
|---|
| 52 | AC_CHECK_LIB(socks, SOCKSinit, SOCKS_LIBS="-lsocks") |
|---|
| 53 | fi |
|---|
| 54 | |
|---|
| 55 | if test -n "$SOCKS_LIBS"; then |
|---|
| 56 | if test "$socks_libdir" != "no"; then |
|---|
| 57 | SOCKS_LIBDIR="-L$socks_libdir" |
|---|
| 58 | fi |
|---|
| 59 | AC_CHECK_HEADER(socks.h, |
|---|
| 60 | [if test "$socks_incdir" == "no"; then |
|---|
| 61 | SOCKS_INCDIR="-Wno-implicit" |
|---|
| 62 | else |
|---|
| 63 | SOCKS_INCDIR="-I$socks_incdir -Wno-implicit" |
|---|
| 64 | fi |
|---|
| 65 | WITH_SOCKS5="yes" |
|---|
| 66 | |
|---|
| 67 | ]) |
|---|
| 68 | if test -n "$SOCKS_INCDIR"; then |
|---|
| 69 | AC_DEFINE(USE_SOCKS5, 1, [use socks5 support]) |
|---|
| 70 | |
|---|
| 71 | AC_MSG_CHECKING(SOCKS getsockopt's optlen type) |
|---|
| 72 | AC_TRY_COMPILE( |
|---|
| 73 | [ #include <stdlib.h> |
|---|
| 74 | #include <socks.h> |
|---|
| 75 | ], |
|---|
| 76 | [ getsockopt(0,0,0,(void *)0,(socklen_t) 0) ], |
|---|
| 77 | licq_socks_optlen=socklen_t, |
|---|
| 78 | [AC_TRY_COMPILE( |
|---|
| 79 | [ #include <stdlib.h> |
|---|
| 80 | #include <socks.h> |
|---|
| 81 | ], |
|---|
| 82 | [ getsockopt(0,0,0,(void *)0,(int) 0)], |
|---|
| 83 | licq_socks_optlen=int, |
|---|
| 84 | licq_socks_optlen=unknown) |
|---|
| 85 | ] |
|---|
| 86 | ) |
|---|
| 87 | AC_MSG_RESULT($licq_socks_optlen) |
|---|
| 88 | if test $licq_socks_optlen = "int"; then |
|---|
| 89 | AC_DEFINE(SOCKS5_OPTLEN, int, [getsockopt optlen parameter type]) |
|---|
| 90 | else |
|---|
| 91 | if test $licq_socks_optlen = "socklen_t"; then |
|---|
| 92 | AC_DEFINE(SOCKS5_OPTLEN,socklen_t, [getsockopt optlen parameter type]) |
|---|
| 93 | fi |
|---|
| 94 | fi |
|---|
| 95 | fi |
|---|
| 96 | |
|---|
| 97 | fi |
|---|
| 98 | |
|---|
| 99 | dnl restore flags |
|---|
| 100 | if test "$socks_libdir" != "no"; then |
|---|
| 101 | LDFLAGS="$BACKUP_LDFLAGS" |
|---|
| 102 | fi |
|---|
| 103 | if test "$socks_incdir" != "no"; then |
|---|
| 104 | CPPFLAGS="$BACKUP_CPPFLAGS" |
|---|
| 105 | fi |
|---|
| 106 | fi |
|---|
| 107 | |
|---|
| 108 | dnl Substitute these even if they're null, so as not to mess up makefiles |
|---|
| 109 | AC_SUBST(SOCKS_LIBS) |
|---|
| 110 | AC_SUBST(SOCKS_LIBDIR) |
|---|
| 111 | AC_SUBST(SOCKS_INCDIR) |
|---|
| 112 | ]) |
|---|
| 113 | |
|---|
| 114 | dnl Check if struct tm contains long int tm_gmtoff |
|---|
| 115 | AC_DEFUN([LICQ_CHECK_GMTOFF], |
|---|
| 116 | [AC_CACHE_CHECK(for tm_gmtoff, licq_tm_gmtoff, |
|---|
| 117 | [ AC_TRY_COMPILE([ |
|---|
| 118 | #include <time.h> |
|---|
| 119 | ], [ |
|---|
| 120 | long int foo; |
|---|
| 121 | struct tm bar; |
|---|
| 122 | foo = bar.tm_gmtoff; |
|---|
| 123 | ], [ |
|---|
| 124 | licq_tm_gmtoff=yes |
|---|
| 125 | ], [ |
|---|
| 126 | licq_tm_gmtoff=no |
|---|
| 127 | ]) |
|---|
| 128 | ]) |
|---|
| 129 | if test $licq_tm_gmtoff = yes; then |
|---|
| 130 | AC_DEFINE(USE_GMTOFF, 1, [Define if struct tm has gmtoff]) |
|---|
| 131 | fi |
|---|
| 132 | ]) |
|---|
| 133 | |
|---|
| 134 | dnl Check if long timezone is somewhere defined (i.e. AIX) |
|---|
| 135 | AC_DEFUN([LICQ_CHECK_TIMEZONE], |
|---|
| 136 | [AC_CACHE_CHECK(for extern long timezone, licq_extern_timezone, |
|---|
| 137 | [ AC_TRY_LINK([ |
|---|
| 138 | #include <time.h> |
|---|
| 139 | ], [ |
|---|
| 140 | long foo; |
|---|
| 141 | foo = timezone; |
|---|
| 142 | ], [ |
|---|
| 143 | licq_extern_timezone=yes |
|---|
| 144 | ], [ |
|---|
| 145 | licq_extern_timezone=no |
|---|
| 146 | ]) |
|---|
| 147 | ]) |
|---|
| 148 | if test $licq_extern_timezone = yes; then |
|---|
| 149 | AC_DEFINE(USE_TIMEZONE, 1, [Define if global variable timezone exists]) |
|---|
| 150 | fi |
|---|
| 151 | ]) |
|---|
| 152 | |
|---|
| 153 | AC_DEFUN([LICQ_OLD_CHECK_GPGME], |
|---|
| 154 | [ |
|---|
| 155 | AC_MSG_CHECKING(if GPGME support is desired) |
|---|
| 156 | |
|---|
| 157 | AC_ARG_ENABLE( |
|---|
| 158 | gpgme, |
|---|
| 159 | [ --disable-gpgme disable GPGME support], |
|---|
| 160 | WITH_GPGME="$enableval", WITH_GPGME="yes") |
|---|
| 161 | |
|---|
| 162 | if test "$WITH_GPGME" = "yes"; then |
|---|
| 163 | AC_MSG_RESULT(yes) |
|---|
| 164 | AC_CHECK_LIB(gpgme,gpgme_check_version, |
|---|
| 165 | [ |
|---|
| 166 | dnl Action if found... |
|---|
| 167 | LIBS="$LIBS -lgpgme" |
|---|
| 168 | AC_DEFINE_UNQUOTED(HAVE_LIBGPGME, 1, [Define if GPGME is available]) |
|---|
| 169 | ], |
|---|
| 170 | [ |
|---|
| 171 | dnl Action if not found... |
|---|
| 172 | WITH_GPGME="no" |
|---|
| 173 | ]) |
|---|
| 174 | else |
|---|
| 175 | AC_MSG_RESULT(no) |
|---|
| 176 | fi |
|---|
| 177 | ]) |
|---|
| 178 | |
|---|