unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
unreal.m4 (13656B)
1 #serial 1 2 3 dnl Macro: unreal_CHECK_TYPE_SIZES 4 dnl originally called unet_CHECK_TYPE_SIZES 5 dnl 6 dnl Check the size of several types and define a valid int16_t and int32_t. 7 dnl 8 AC_DEFUN([unreal_CHECK_TYPE_SIZES], 9 [dnl Check type sizes 10 AC_CHECK_SIZEOF(short) 11 AC_CHECK_SIZEOF(int) 12 AC_CHECK_SIZEOF(long) 13 if test "$ac_cv_sizeof_int" = 2 ; then 14 AC_CHECK_TYPE(int16_t, int) 15 AC_CHECK_TYPE(u_int16_t, unsigned int) 16 elif test "$ac_cv_sizeof_short" = 2 ; then 17 AC_CHECK_TYPE(int16_t, short) 18 AC_CHECK_TYPE(u_int16_t, unsigned short) 19 else 20 AC_MSG_ERROR([Cannot find a type with size of 16 bits]) 21 fi 22 if test "$ac_cv_sizeof_int" = 4 ; then 23 AC_CHECK_TYPE(int32_t, int) 24 AC_CHECK_TYPE(u_int32_t, unsigned int) 25 elif test "$ac_cv_sizeof_short" = 4 ; then 26 AC_CHECK_TYPE(int32_t, short) 27 AC_CHECK_TYPE(u_int32_t, unsigned short) 28 elif test "$ac_cv_sizeof_long" = 4 ; then 29 AC_CHECK_TYPE(int32_t, long) 30 AC_CHECK_TYPE(u_int32_t, unsigned long) 31 else 32 AC_MSG_ERROR([Cannot find a type with size of 32 bits]) 33 fi 34 AC_CHECK_SIZEOF(rlim_t) 35 if test "$ac_cv_sizeof_rlim_t" = 8 ; then 36 AC_DEFINE([LONG_LONG_RLIM_T], [], [Define if rlim_t is long long]) 37 fi 38 ]) 39 40 AC_DEFUN([CHECK_LIBCURL], 41 [ 42 AC_ARG_ENABLE(libcurl, 43 [AC_HELP_STRING([--enable-libcurl=DIR],[enable libcurl (remote include) support])], 44 [enable_curl=$enableval], 45 [enable_curl=no]) 46 47 AS_IF([test "x$enable_curl" != "xno"], 48 [ 49 dnl sane, default directory for Operating System-managed libcURL 50 dnl (when --enable-libcurl is passed without any arguments). On 51 dnl systems with stuff in /usr/local, /usr/local/bin should already 52 dnl be in PATH. On sane systems, this will invoke the curl-config 53 dnl installed by the package manager. 54 CURLCONFIG="curl-config" 55 AS_IF([test "x$enable_curl" != "xyes"], 56 [CURLCONFIG="$enable_curl/bin/curl-config"]) 57 58 AC_MSG_CHECKING([$CURLCONFIG]) 59 AS_IF([$CURLCONFIG --version 2>/dev/null >/dev/null], 60 [AC_MSG_RESULT([yes])], 61 [AC_MSG_RESULT([no]) 62 AC_MSG_FAILURE([Could not find curl-config, try editing --enable-libcurl])]) 63 64 CURLCFLAG="`$CURLCONFIG --cflags`" 65 CURLLIBS="`$CURLCONFIG --libs`" 66 67 dnl This test must be this way because of #3981 68 AS_IF([$CURLCONFIG --libs | grep -q -e ares], 69 [CURLUSESCARES="1"], 70 [CURLUSESCARES="0"]) 71 72 dnl sanity warnings 73 AS_IF([test -z "${CURLLIBS}"], 74 [AC_MSG_WARN([CURLLIBS is empty, that probably means that I could not find $enable_curl/bin/curl-config])]) 75 76 dnl Ok this is ugly, basically we need to strip the version of c-ares that curl uses 77 dnl because we want to use our own version (which is hopefully fully binary 78 dnl compatible with the curl one as well). 79 dnl Therefore we need to strip the cares libs in a weird way... 80 dnl If anyone can come up with something better and still portable (no awk!?) 81 dnl then let us know. -- Syzop 82 dnl 83 dnl It is dangerous to mix and match cURL with potentially ABI-incompatible versions of 84 dnl c-ares, just use --with-system-cares. 85 dnl Thus, make sure to use --with-system-cares when using system-cURL. If the user 86 dnl wants bundled c-ares + system libcURL, then we should filter out c-ares 87 dnl flags. _Only_ in that case should we mess with the flags. -- ohnobinki 88 89 AS_IF([test "x$has_system_cares" = "xno" && test "x$BUILDDIR/extras/curl" != "x$enable_curl" && test "$CURLUSESCARES" != "0" ], 90 [ 91 AC_MSG_ERROR([[ 92 93 You have decided to build unrealIRCd with libcURL (remote includes) support. 94 However, you have system-installed c-ares support has either been disabled 95 (--without-system-cares) or is unavailable. 96 Because UnrealIRCd will use a bundled copy of c-ares which may be incompatible 97 with the system-installed libcURL, this is a bad idea which may result in error 98 messages looking like: 99 100 error downloading ... Could not resolve host: example.net (Successful completion) 101 102 Or UnrealIRCd might even crash. 103 104 Please build UnrealIRCd with --with-system-cares when enabling --enable-libcurl 105 ]]) 106 ]) 107 108 dnl Make sure that linking against cURL works rather than letting the user 109 dnl find out after compiling most of his program. ~ohnobinki 110 IRCDLIBS="$IRCDLIBS $CURLLIBS" 111 CFLAGS="$CFLAGS $CURLCFLAG" 112 AC_DEFINE([USE_LIBCURL], [], [Define if you have libcurl installed to get remote includes and MOTD support]) 113 114 AC_MSG_CHECKING([curl_easy_init() in $CURLLIBS]) 115 LIBS_SAVEDA="$LIBS" 116 CFLAGS_SAVEDA="$CFLAGS" 117 118 LIBS="$IRCDLIBS $IRCDLIBS_CURL_CARES" 119 CFLAGS="$CFLAGS $CFLAGS_CURL_CARES" 120 AC_LINK_IFELSE( 121 [ 122 AC_LANG_PROGRAM( 123 [[#include <curl/curl.h>]], 124 [[CURL *curl = curl_easy_init();]]) 125 ], 126 [AC_MSG_RESULT([yes])], 127 [AC_MSG_RESULT([no]) 128 AC_MSG_FAILURE([You asked for libcURL (remote includes) support, but it can't be found at $enable_curl]) 129 ]) 130 LIBS="$LIBS_SAVEDA" 131 CFLAGS="$CFLAGS_SAVEDA" 132 133 dnl Finally, choose the cURL implementation of url.c 134 URL="url_curl.o" 135 ],[ 136 dnl Choose UnrealIRCds internal implementation of url.c 137 URL="url_unreal.o" 138 ]) dnl AS_IF(enable_curl) 139 AC_SUBST(URL) 140 ]) 141 142 dnl the following 2 macros are based on CHECK_SSL by Mark Ethan Trostler <trostler@juniper.net> 143 144 AC_DEFUN([CHECK_SSL], 145 [ 146 AC_ARG_ENABLE(ssl, 147 [AC_HELP_STRING([--enable-ssl=],[enable ssl will check /usr/local/opt/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr])], 148 [], 149 [enable_ssl=no]) 150 AS_IF([test $enable_ssl != "no"], 151 [ 152 AC_MSG_CHECKING([for OpenSSL]) 153 for dir in $enable_ssl /usr/local/opt/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr; do 154 ssldir="$dir" 155 if test -f "$dir/include/openssl/ssl.h"; then 156 AC_MSG_RESULT([found in $ssldir/include/openssl]) 157 found_ssl="yes"; 158 if test ! "$ssldir" = "/usr" ; then 159 CFLAGS="$CFLAGS -I$ssldir/include"; 160 fi 161 break 162 fi 163 if test -f "$dir/include/ssl.h"; then 164 AC_MSG_RESULT([found in $ssldir/include]) 165 found_ssl="yes"; 166 if test ! "$ssldir" = "/usr" ; then 167 CFLAGS="$CFLAGS -I$ssldir/include"; 168 fi 169 break 170 fi 171 done 172 if test x_$found_ssl != x_yes; then 173 AC_MSG_RESULT(not found) 174 echo "" 175 echo "Apparently you do not have both the openssl binary and openssl development libraries installed." 176 echo "The following packages are required:" 177 echo "1) The library package is often called 'openssl-dev', 'openssl-devel' or 'libssl-dev'" 178 echo "2) The binary package is usually called 'openssl'." 179 echo "NOTE: you or your system administrator needs to install the library AND the binary package." 180 echo "After doing so, simply re-run ./Config" 181 exit 1 182 else 183 CRYPTOLIB="-lssl -lcrypto"; 184 if test ! "$ssldir" = "/usr" ; then 185 if test -d "$ssldir/lib64" ; then 186 LDFLAGS="$LDFLAGS -L$ssldir/lib64"; 187 else 188 LDFLAGS="$LDFLAGS -L$ssldir/lib"; 189 fi 190 dnl check if binary path exists 191 if test -f "$ssldir/bin/openssl"; then 192 OPENSSLPATH="$ssldir/bin/openssl"; 193 fi 194 fi 195 dnl linking require -ldl? 196 AC_MSG_CHECKING([OpenSSL linking with -ldl]) 197 SAVE_LIBS="$LIBS" 198 LIBS="$LIBS $CRYPTOLIB -ldl" 199 AC_TRY_LINK([#include <openssl/err.h>], [ERR_clear_error();], 200 [ 201 AC_MSG_RESULT(yes) 202 CRYPTOLIB="$CRYPTOLIB -ldl" 203 ], 204 [ 205 AC_MSG_RESULT(no) 206 207 dnl linking require both -ldl and -lpthread? 208 AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread]) 209 LIBS="$SAVE_LIBS $CRYPTOLIB -ldl -lpthread" 210 AC_TRY_LINK([#include <openssl/err.h>], [ERR_clear_error();], 211 [ 212 AC_MSG_RESULT(yes) 213 CRYPTOLIB="$CRYPTOLIB -ldl -lpthread" 214 ], 215 [ 216 AC_MSG_RESULT(no) 217 ]) 218 ]) 219 LIBS="$SAVE_LIBS" 220 fi 221 ]) 222 ]) 223 224 AC_DEFUN([CHECK_SSL_CTX_SET1_CURVES_LIST], 225 [ 226 AC_MSG_CHECKING([for SSL_CTX_set1_curves_list in SSL library]) 227 AC_LANG_PUSH(C) 228 SAVE_LIBS="$LIBS" 229 LIBS="$LIBS $CRYPTOLIB" 230 AC_TRY_LINK([#include <openssl/ssl.h>], 231 [SSL_CTX *ctx = NULL; SSL_CTX_set1_curves_list(ctx, "test");], 232 has_function=1, 233 has_function=0) 234 LIBS="$SAVE_LIBS" 235 AC_LANG_POP(C) 236 if test $has_function = 1; then 237 AC_MSG_RESULT([yes]) 238 AC_DEFINE([HAS_SSL_CTX_SET1_CURVES_LIST], [], [Define if ssl library has SSL_CTX_set1_curves_list]) 239 else 240 AC_MSG_RESULT([no]) 241 fi 242 ]) 243 244 AC_DEFUN([CHECK_SSL_CTX_SET_MIN_PROTO_VERSION], 245 [ 246 AC_MSG_CHECKING([for SSL_CTX_set_min_proto_version in SSL library]) 247 AC_LANG_PUSH(C) 248 SAVE_LIBS="$LIBS" 249 LIBS="$LIBS $CRYPTOLIB" 250 AC_TRY_LINK([#include <openssl/ssl.h>], 251 [SSL_CTX *ctx = NULL; SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION);], 252 has_function=1, 253 has_function=0) 254 LIBS="$SAVE_LIBS" 255 AC_LANG_POP(C) 256 if test $has_function = 1; then 257 AC_MSG_RESULT([yes]) 258 AC_DEFINE([HAS_SSL_CTX_SET_MIN_PROTO_VERSION], [], [Define if ssl library has SSL_CTX_set_min_proto_version]) 259 else 260 AC_MSG_RESULT([no]) 261 fi 262 ]) 263 264 AC_DEFUN([CHECK_SSL_CTX_SET_SECURITY_LEVEL], 265 [ 266 AC_MSG_CHECKING([for SSL_CTX_set_security_level in SSL library]) 267 AC_LANG_PUSH(C) 268 SAVE_LIBS="$LIBS" 269 LIBS="$LIBS $CRYPTOLIB" 270 AC_TRY_LINK([#include <openssl/ssl.h>], 271 [SSL_CTX *ctx = NULL; SSL_CTX_set_security_level(ctx, 1);], 272 has_function=1, 273 has_function=0) 274 LIBS="$SAVE_LIBS" 275 AC_LANG_POP(C) 276 if test $has_function = 1; then 277 AC_MSG_RESULT([yes]) 278 AC_DEFINE([HAS_SSL_CTX_SET_SECURITY_LEVEL], [], [Define if ssl library has SSL_CTX_set_security_level]) 279 else 280 AC_MSG_RESULT([no]) 281 fi 282 ]) 283 284 AC_DEFUN([CHECK_ASN1_TIME_diff], 285 [ 286 AC_MSG_CHECKING([for ASN1_TIME_diff in SSL library]) 287 AC_LANG_PUSH(C) 288 SAVE_LIBS="$LIBS" 289 LIBS="$LIBS $CRYPTOLIB" 290 AC_TRY_LINK([#include <openssl/ssl.h>], 291 [int one, two; ASN1_TIME_diff(&one, &two, NULL, NULL);], 292 has_function=1, 293 has_function=0) 294 LIBS="$SAVE_LIBS" 295 AC_LANG_POP(C) 296 if test $has_function = 1; then 297 AC_MSG_RESULT([yes]) 298 AC_DEFINE([HAS_ASN1_TIME_diff], [], [Define if ssl library has ASN1_TIME_diff]) 299 else 300 AC_MSG_RESULT([no]) 301 fi 302 ]) 303 304 AC_DEFUN([CHECK_X509_get0_notAfter], 305 [ 306 AC_MSG_CHECKING([for X509_get0_notAfter in SSL library]) 307 AC_LANG_PUSH(C) 308 SAVE_LIBS="$LIBS" 309 LIBS="$LIBS $CRYPTOLIB" 310 AC_TRY_LINK([#include <openssl/ssl.h>], 311 [X509_get0_notAfter(NULL);], 312 has_function=1, 313 has_function=0) 314 LIBS="$SAVE_LIBS" 315 AC_LANG_POP(C) 316 if test $has_function = 1; then 317 AC_MSG_RESULT([yes]) 318 AC_DEFINE([HAS_X509_get0_notAfter], [], [Define if ssl library has X509_get0_notAfter]) 319 else 320 AC_MSG_RESULT([no]) 321 fi 322 ]) 323 324 AC_DEFUN([CHECK_X509_check_host], 325 [ 326 AC_MSG_CHECKING([for X509_check_host in SSL library]) 327 AC_LANG_PUSH(C) 328 SAVE_LIBS="$LIBS" 329 LIBS="$LIBS $CRYPTOLIB" 330 AC_TRY_LINK([#include <openssl/x509v3.h>], 331 [X509_check_host(NULL, NULL, 0, 0, NULL);], 332 has_function=1, 333 has_function=0) 334 LIBS="$SAVE_LIBS" 335 AC_LANG_POP(C) 336 if test $has_function = 1; then 337 AC_MSG_RESULT([yes]) 338 AC_DEFINE([HAS_X509_check_host], [], [Define if ssl library has X509_check_host]) 339 else 340 AC_MSG_RESULT([no]) 341 fi 342 ]) 343 344 dnl For geoip-api-c 345 AC_DEFUN([CHECK_GEOIP_CLASSIC], 346 [ 347 AC_ARG_ENABLE(geoip_classic, 348 [AC_HELP_STRING([--enable-geoip-classic=no/yes],[enable GeoIP Classic support])], 349 [enable_geoip_classic=$enableval], 350 [enable_geoip_classic=no]) 351 352 AS_IF([test "x$enable_geoip_classic" = "xyes"], 353 [ 354 dnl First see if the system provides it 355 has_system_geoip_classic="no" 356 PKG_CHECK_MODULES([GEOIP_CLASSIC], [geoip >= 1.6.0], 357 [has_system_geoip_classic=yes 358 AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libGeoIP.*])], 359 [has_system_geoip_classic=no]) 360 361 dnl Otherwise fallback to our own.. 362 AS_IF([test "$has_system_geoip_classic" = "no"],[ 363 dnl REMEMBER TO CHANGE WITH A NEW GEOIP LIBRARY RELEASE! 364 geoip_classic_version="1.6.12" 365 AC_MSG_RESULT(extracting GeoIP Classic library) 366 cur_dir=`pwd` 367 cd extras 368 dnl remove old directory to force a recompile... 369 dnl and remove its installation prefix just to clean things up. 370 rm -rf GeoIP-$geoip_classic_version geoip-classic 371 if test "x$ac_cv_path_GUNZIP" = "x" ; then 372 tar xfz geoip-classic.tar.gz 373 else 374 cp geoip-classic.tar.gz geoip-classic.tar.gz.bak 375 gunzip -f geoip-classic.tar.gz 376 cp geoip-classic.tar.gz.bak geoip-classic.tar.gz 377 tar xf geoip-classic.tar 378 fi 379 AC_MSG_RESULT(configuring GeoIP Classic library) 380 cd GeoIP-$geoip_classic_version 381 save_cflags="$CFLAGS" 382 CFLAGS="$orig_cflags" 383 export CFLAGS 384 ./configure --prefix=$cur_dir/extras/geoip-classic --libdir=$PRIVATELIBDIR --enable-shared --disable-static || exit 1 385 CFLAGS="$save_cflags" 386 AC_MSG_RESULT(compiling GeoIP Classic library) 387 $ac_cv_prog_MAKER || exit 1 388 AC_MSG_RESULT(installing GeoIP Classic library) 389 rm -f "$PRIVATELIBDIR/"libGeoIP.so* 390 $ac_cv_prog_MAKER install || exit 1 391 dnl Try pkg-config first... 392 AS_IF([test -n "$ac_cv_path_PKGCONFIG"], 393 [GEOIP_CLASSIC_LIBS="`$ac_cv_path_PKGCONFIG --libs geoip.pc`" 394 GEOIP_CLASSIC_CFLAGS="`$ac_cv_path_PKGCONFIG --cflags geoip.pc`"]) 395 dnl In case the system does not have pkg-config, fallback to hardcoded settings... 396 AS_IF([test -z "$GEOIP_CLASSIC_LIBS"], 397 [GEOIP_CLASSIC_LIBS="-L$PRIVATELIBDIR -lGeoIP" 398 GEOIP_CLASSIC_CFLAGS="-I$cur_dir/extras/geoip-classic/include"]) 399 cd $cur_dir 400 ]) 401 402 AC_SUBST(GEOIP_CLASSIC_LIBS) 403 AC_SUBST(GEOIP_CLASSIC_CFLAGS) 404 405 GEOIP_CLASSIC_OBJECTS="geoip_classic.so" 406 AC_SUBST(GEOIP_CLASSIC_OBJECTS) 407 ]) dnl AS_IF(enable_geoip_classic) 408 ]) 409 410 AC_DEFUN([CHECK_LIBMAXMINDDB], 411 [ 412 AC_ARG_ENABLE(libmaxminddb, 413 [AC_HELP_STRING([--enable-libmaxminddb=no/yes],[enable GeoIP libmaxminddb support])], 414 [enable_libmaxminddb=$enableval], 415 [enable_libmaxminddb=no]) 416 417 AS_IF([test "x$enable_libmaxminddb" = "xyes"], 418 [ 419 dnl see if the system provides it 420 has_system_libmaxminddb="no" 421 PKG_CHECK_MODULES([LIBMAXMINDDB], [libmaxminddb >= 1.4.3], 422 [has_system_libmaxminddb=yes]) 423 AS_IF([test "x$has_system_libmaxminddb" = "xyes"], 424 [ 425 426 AC_SUBST(LIBMAXMINDDB_LIBS) 427 AC_SUBST(LIBMAXMINDDB_CFLAGS) 428 429 GEOIP_MAXMIND_OBJECTS="geoip_maxmind.so" 430 AC_SUBST(GEOIP_MAXMIND_OBJECTS) 431 ]) 432 ]) 433 ]) 434