1dnl ############################################################################ 2dnl 3dnl Copyright (c) 2011-2021, EURid vzw. All rights reserved. 4dnl The YADIFA TM software product is provided under the BSD 3-clause license: 5dnl 6dnl Redistribution and use in source and binary forms, with or without 7dnl modification, are permitted provided that the following conditions 8dnl are met: 9dnl 10dnl * Redistributions of source code must retain the above copyright 11dnl notice, this list of conditions and the following disclaimer. 12dnl * Redistributions in binary form must reproduce the above copyright 13dnl notice, this list of conditions and the following disclaimer in 14dnl the documentation and/or other materials provided with the 15dnl distribution. 16dnl * Neither the name of EURid nor the names of its contributors may be 17dnl used to endorse or promote products derived from this software 18dnl without specific prior written permission. 19dnl 20dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23dnl ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28dnl CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30dnl POSSIBILITY OF SUCH DAMAGE. 31dnl 32dnl ############################################################################ 33 34dnl Assume it is true 35 36cpu_intel_compatible=1 37icc_enabled=0 38 39dnl #################################################### 40dnl 41dnl AC_HAS_ENABLE(low-case --enable-*, up-case HAS_*, text, config.h text,ifyes,ifno) 42dnl 43dnl This macro creates a parameter with 44dnl _ a shell-variable-name that will be used for --enable-VARIABLENAME 45dnl '_' of the variable name will be replaced by a '-' in the command 46dnl 47dnl _ SOMETHINGSOMETHING that will be transformed into a HAS_SOMETHINGSOMETHING define (both C & Makefile) 48dnl 49dnl _ A text to be put next to the --enable-this line in the --help 50dnl 51dnl _ An optional text to be put in the config.h output file. If not set or empty, the --help text is used 52dnl 53dnl _ A block to execute if the option is enabled (--enable-this) 54dnl 55dnl _ A block to execute if the option is disabled (--disable-this or not set) 56dnl 57dnl #################################################### 58 59AC_DEFUN([AC_HAS_ENABLE], [ 60# 61# AC_HAS_ENABLE $1 62# 63# CHECKING 64AC_MSG_CHECKING(if [$2] has been enabled) 65# ARG ENABLE 66AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-[translit($1,[_],[-])]], [Enable $3])) 67dnl # MSG RESULT 68dnl AC_MSG_RESULT($enable_[$1]) 69dnl echo "enabled: '$enable_[$1]'" 70# CASE 71case "y$enable_[$1]" in 72 yyes) 73# DEFINE Y 74 AC_DEFINE_UNQUOTED([HAS_$2], [1], ifelse($4,,[$3 enabled.],$4)) 75# CONDITIONAL Y 76 enable_[$1]="yes" 77 AC_MSG_RESULT([yes]) 78# IF YES 79 $5 80# ENDIF 81 ;; 82 yno|y|*) 83# DEFINE N 84 AC_DEFINE_UNQUOTED([HAS_$2], [0], ifelse($4,,[$3 disabled.],$4)) 85# CONDITIONAL N 86 enable_[$1]="no" 87 AC_MSG_RESULT([no]) 88# IF NO 89 $6 90# ENDIF 91 ;; 92esac 93# CONDITIONAL 94AM_CONDITIONAL([HAS_$2], [test y$enable_[$1] = yyes]) 95# SUBST 96AC_SUBST(HAS_$2) 97# AC_HAS_ENABLE $1 DONE 98]) 99 100dnl #################################################### 101dnl 102dnl AC_FORCE_ENABLE(var) 103dnl 104dnl Forces --enable-var 105dnl 106dnl #################################################### 107 108AC_DEFUN([AC_FORCE_ENABLE], [ 109# 110# AC_FORCE_ENABLE $1 111# 112enable_[$1]=yes 113AC_DEFINE_UNQUOTED([HAS_$2], [1], [$1 = $2 enabled]) 114AM_CONDITIONAL([HAS_$2], [test y$enable_[$1] = yyes]) 115AC_SUBST(HAS_$2) 116# AC_FORCE_ENABLE $1 DONE 117]) 118 119dnl #################################################### 120dnl 121dnl AC_HAS_DISABLE(low-case --disable-*, up-case HAS_*, text, config.h text,ifyes,ifno) 122dnl 123dnl This macro creates a parameter with 124dnl _ a shell-variable-name that will be used for --disable-VARIABLENAME 125dnl '_' of the variable name will be replaced by a '-' in the command 126dnl 127dnl _ SOMETHINGSOMETHING that will be transformed into a HAS_SOMETHINGSOMETHING define (both C & Makefile) 128dnl 129dnl _ A text to be put next to the --disable-this line in the --help 130dnl 131dnl _ An optional text to be put in the config.h output file. If not set or empty, the --help text is used 132dnl 133dnl _ A block to execute if the option is enabled (--enable-this or not set) 134dnl 135dnl _ A block to execute if the option is disabled (--disable-this) 136dnl 137dnl #################################################### 138 139AC_DEFUN([AC_HAS_DISABLE], [ 140# 141# AC_HAS_DISABLE $1 142# 143# CHECKING 144AC_MSG_CHECKING(if [$2] has been disabled) 145# ARG ENABLE 146AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-[translit($1,[_],[-])]],[Disable $3])) 147# MSG RESULT 148dnl echo "enabled: '$enable_[$1]'" 149# CASE 150case "y$enable_[$1]" in 151 yyes|y) 152# DEFINE Y 153 AC_DEFINE_UNQUOTED([HAS_$2], [1], ifelse($4,,[$3 enabled.],$4)) 154# CONDITIONAL Y 155 enable_[$1]=yes 156 AC_MSG_RESULT([no]) 157# IF YES 158 $5 159# ENDIF 160 ;; 161 yno|*) 162# DEFINE N 163 AC_DEFINE_UNQUOTED([HAS_$2], [0], ifelse($4,,[$3 disabled.],$4)) 164# CONDITIONAL N 165 enable_[$1]=no 166 AC_MSG_RESULT([yes]) 167# IF NO 168 $6 169# ENDIF 170 ;; 171esac 172# CONDITIONAL 173AM_CONDITIONAL([HAS_$2], [test y$enable_[$1] != yno]) 174# SUBST 175AC_SUBST(HAS_$2) 176# AC_HAS_DISABLE $1 DONE 177]) 178 179dnl #################################################### 180dnl 181dnl AC_HAS_WITH(low-case --with-*, up-case HAS_*, text, config.h text,ifyes,ifno) 182dnl 183dnl This macro creates a parameter with 184dnl _ a shell-variable-name that will be used for --with-VARIABLENAME 185dnl '_' of the variable name will be replaced by a '-' in the command 186dnl 187dnl _ SOMETHINGSOMETHING that will be transformed into a HAS_SOMETHINGSOMETHING define (both C & Makefile) 188dnl 189dnl _ A text to be put next to the --with-this line in the --help 190dnl 191dnl _ An optional text to be put in the config.h output file. If not set or empty, the --help text is used 192dnl 193dnl _ A block to execute if the option is withd (--with-this) 194dnl 195dnl _ A block to execute if the option is withoutd (--without-this or not set) 196dnl 197dnl #################################################### 198 199AC_DEFUN([AC_HAS_WITH], [ 200# 201# AC_HAS_WITH $1 202# 203# CHECKING 204AC_MSG_CHECKING(if [translit($1,[_A-Z],[ a-z])] has been given) 205# ARG WITH 206AC_ARG_WITH([$1], AS_HELP_STRING([--with-[translit($1,[_],[-])]], [With $3]), 207[ 208# DEFINE Y 209 AC_DEFINE_UNQUOTED([HAS_$2], [1], ifelse($4,,[With $3.],$4)) 210# CONDITIONAL Y 211 AC_DEFINE_UNQUOTED([HAS_WITH_$2], "$with_[$1]" // $withval, ifelse($4,,[build $3.],$4)) 212 with_[$1]="yes" 213 AC_MSG_RESULT([yes]) 214# IF YES 215 $5 216# ENDIF 217] 218, 219[ 220# DEFINE N 221 AC_DEFINE_UNQUOTED([HAS_$2], [0], ifelse($4,,[Without $3.],$4)) 222# CONDITIONAL N 223 with_[$1]="no" 224 AC_MSG_RESULT([no]) 225# IF NO 226 $6 227# ENDIF 228]) 229# CONDITIONAL 230AM_CONDITIONAL([HAS_$2], [test "y$with_[$1]" == "yyes"]) 231# SUBST 232AC_SUBST([HAS_$2]) 233# AC_HAS_WITH $1 DONE 234]) 235 236dnl #################################################### 237dnl 238dnl AC_HAS_WITHOUT(low-case --without-*, up-case HAS_*, text, config.h text,ifyes,ifno) 239dnl 240dnl This macro creates a parameter with 241dnl _ a shell-variable-name that will be used for --without-VARIABLENAME 242dnl '_' of the variable name will be replaced by a '-' in the command 243dnl 244dnl _ SOMETHINGSOMETHING that will be transformed into a HAS_SOMETHINGSOMETHING define (both C & Makefile) 245dnl 246dnl _ A text to be put next to the --without-this line in the --help 247dnl 248dnl _ An optional text to be put in the config.h output file. If not set or empty, the --help text is used 249dnl 250dnl _ A block to execute if the option is withd (--with-this or not set) 251dnl 252dnl _ A block to execute if the option is withoutd (--without-this) 253dnl 254dnl #################################################### 255 256AC_DEFUN([AC_HAS_WITHOUT], [ 257# 258# AC_HAS_WITHOUT $1 259# 260# CHECKING 261AC_MSG_CHECKING(if [$1] has to be build) 262# ARG WITH 263AC_ARG_WITH([$1], AS_HELP_STRING([--without-[translit($1,[_],[-])]],[Without $3])) 264 265# MSG RESULT 266case "y$with_[$1]" in 267 yyes|y) 268# DEFINE Y 269 AC_DEFINE_UNQUOTED([HAS_$2], [1], ifelse($4,,[With $3.],$4)) 270# CONDITIONAL Y 271 with_[$1]=yes 272 AC_MSG_RESULT([yes]) 273# IF YES 274 $5 275# ENDIF 276 ;; 277 278 yno|*) 279# DEFINE N 280 AC_DEFINE_UNQUOTED([HAS_$2], [0], ifelse($4,,[Without $3.],$4)) 281# CONDITIONAL N 282 with_[$1]=no 283 AC_MSG_RESULT([no]) 284# IF NO 285 $6 286# ENDIF 287 ;; 288esac 289 290dnl # CONDITIONAL 291AM_CONDITIONAL([HAS_$2], [test "y$with_[$1]" != "yno"]) 292# Used to check the test was correct (it is) 293#AM_CONDITIONAL([TEST_HAS_$2], [echo test "y$with_[$1]" != "yno" > /tmp/test_has_$2.txt]) 294# SUBST 295AC_SUBST([HAS_$2]) 296# AC_HAS_WITHOUT $1 DONE 297]) 298 299dnl handles Darwin libtoolize -> glibtoolize 300 301AC_DEFUN([AC_DARWIN_LIBTOOL], [ 302 303case "$(uname -s)" in 304 Darwin) 305 alias libtoolize="glibtoolize" 306 307 which libtool > /dev/null 2>&1 308 if [[ $? -ne 0 ]] 309 then 310 which glibtool > /dev/null 2>&1 311 if [[ $? -eq 0 ]] 312 then 313 alias libtool="glibtool" 314 fi 315 fi 316 317 echo 'brol' | sed 's/brol/truc/' > /dev/null 2>&1 318 if [[ $? -ne 0 ]] 319 then 320 alias sed="gsed" 321 fi 322 323 AC_MSG_RESULT([Darwin workaround]) 324 325 ;; 326 *) 327 AC_MSG_RESULT([nothing to do]) 328 ;; 329esac 330 331]) 332 333AC_DEFUN([YA_TRY_LINK], [ 334AC_LINK_IFELSE([AC_LANG_PROGRAM([$1],[$2],[$3],[$4])]) 335]) 336 337ac_os_workaround_done=0 338 339AC_DEFUN([AC_OS_WORKAROUND], [ 340 341if [[ $ac_os_workaround_done -eq 0 ]] 342then 343 344ac_os_workaround_done=1 345 346AC_MSG_CHECKING(what kind of OS this is) 347 348is_darwin_os=0 349is_bsd_family=0 350is_solaris_family=0 351is_linux_family=0 352 353case "$(uname -s)" in 354 Darwin) 355 is_darwin_os=1 356 is_bsd_family=1 357 osx_version_major=$(uname -r|sed 's/\..*//') 358 AC_MSG_RESULT([OSX $osx_version_major]) 359 CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542=1" 360 ;; 361 FreeBSD) 362 is_bsd_family=1 363 364 AC_MSG_RESULT([BSD]) 365 ;; 366 Linux) 367 is_linux_family=1 368 369 AC_MSG_RESULT([Linux]) 370 ;; 371 SunOS) 372 is_solaris_family=1 373 374 AC_MSG_RESULT([SunOS]) 375 ;; 376 *) 377 378 AC_MSG_RESULT([not specifically supported]) 379 ;; 380esac 381 382if [[ "$is_darwin_os" = "" ]] 383then 384 echo "OS detection failed to give relevant results" 385 exit 1; 386fi 387 388if [[ $is_darwin_os -ne 0 ]] 389then 390 AC_DEFINE_UNQUOTED(IS_DARWIN_OS, [1], [OSX]) 391 is_darwin_os_txt="yes" 392 if [[ $osx_version_major -ge 14 ]] 393 then 394 osx_version_major_ge14="yes" 395 else 396 osx_version_major_ge14="no" 397 fi 398else 399 AC_DEFINE_UNQUOTED(IS_DARWIN_OS, [0], [OSX]) 400 is_darwin_os_txt="no" 401 osx_version_major_ge14="no" 402fi 403 404AM_CONDITIONAL([IS_DARWIN_OS], [test "y$isdarwin_os_txt" == "yyes"]) 405AM_CONDITIONAL([IS_DARWIN_GE14], [test "y$osx_version_major_ge14" == "yyes"]) 406AC_SUBST(IS_DARWIN_OS) 407AC_SUBST(IS_DARWIN_GE14) 408 409if [[ $is_bsd_family -ne 0 ]] 410then 411 is_bsd_family_txt="yes" 412 AC_DEFINE_UNQUOTED(IS_BSD_FAMILY, [1], [BSD]) 413else 414 is_bsd_family_txt="no" 415 AC_DEFINE_UNQUOTED(IS_BSD_FAMILY, [0], [BSD]) 416fi 417AM_CONDITIONAL([IS_BSD_FAMILY], [test "y$is_bsd_family_txt" == "yyes"]) 418 419AC_SUBST(IS_BSD_FAMILY) 420 421if [[ $is_linux_family -ne 0 ]] 422then 423 is_linux_family_txt="yes" 424 AC_DEFINE_UNQUOTED(IS_LINUX_FAMILY, [1], [LINUX]) 425else 426 is_linux_family_txt="no" 427 AC_DEFINE_UNQUOTED(IS_LINUX_FAMILY, [0], [LINUX]) 428fi 429AM_CONDITIONAL([IS_LINUX_FAMILY], [test "y$is_linux_family_txt" == "yyes"]) 430 431AC_SUBST(IS_LINUX_FAMILY) 432 433if [[ $is_solaris_family -ne 0 ]] 434then 435 is_solaris_family_txt="yes" 436 AC_DEFINE_UNQUOTED(IS_SOLARIS_FAMILY, [1], [SOLARIS]) 437else 438 is_solaris_family_txt="no" 439 AC_DEFINE_UNQUOTED(IS_SOLARIS_FAMILY, [0], [SOLARIS]) 440fi 441AM_CONDITIONAL([IS_SOLARIS_FAMILY], [test "y$is_solaris_family_txt" == "yyes"]) 442 443AC_SUBST(IS_SOLARIS_FAMILY) 444 445fi 446 447]) 448 449dnl Compiler support 450 451dnl #################################################### 452dnl 453dnl COMPILER SUPPORT 454dnl 455dnl #################################################### 456 457AC_DEFUN([AC_COMPILER_SUPPORTS], [ 458# 459# AC_COMPILER_SUPPORTS $1 460# 461# CHECKING 462AC_MSG_CHECKING(if compiler supports [$1]) 463if [[ "$CC" = "" ]] 464then 465 AC_MSG_RESULT("[compiler not set yet, fix this]") 466 exit 1 467fi 468cat > test-gcc-$2.c <<_ACEOF 469#include "confdefs.h" 470#if HAVE_STDLIB_H 471#include<stdlib.h> 472#endif 473int main(int argc,char** argv) 474{ 475 (void)argc; 476 (void)argv; 477 puts("Hello World!"); 478 return 0; 479} 480_ACEOF 481$CC $1 test-gcc-$2.c -o test-gcc-$2 > /dev/null 2>&1 482if [[ $? -ne 0 ]] 483then 484 has_cc_[$2]="no" 485 AM_CONDITIONAL(HAS_CC_$2, [false]) 486 AC_DEFINE_UNQUOTED([HAS_CC_$2], [0], [Compiler supports feature]) 487 AC_MSG_RESULT([no]) 488else 489 has_cc_[$2]="yes" 490 AM_CONDITIONAL(HAS_CC_$2, [true]) 491 AC_DEFINE_UNQUOTED([HAS_CC_$2], [1], [Compiler supports feature]) 492 AC_MSG_RESULT([yes]) 493fi 494# CONDITIONAL 495AM_CONDITIONAL(HAS_CC_$2, [test "y$has_cc_[$2]" == "yyes"]) 496# SUBST 497AC_SUBST(HAS_CC_$2) 498rm -rf test-gcc-$2* 499]) 500 501dnl setgroups support 502 503AC_DEFUN([AC_SETGROUPS_CHECK], [ 504AC_MSG_CHECKING([for setgroups]) 505AC_CHECK_LIB(c,setgroups, 506 [ 507 AC_DEFINE_UNQUOTED([HAS_SETGROUPS], [1], [The system supports setgroups]) 508 AC_MSG_RESULT([yes]) 509 ], 510 [ 511 AC_MSG_RESULT([no]) 512 ] 513) 514]) 515 516dnl __sync builtins 517 518AC_DEFUN([AC_SYNC_BUILTINS], [ 519 520AC_MSG_CHECKING([if the compiler supports __sync builtins]) 521cat > sync_builtin_test.c <<_ACEOF 522typedef int atomic_flag; 523 524static int atomic_flag_test_and_set(atomic_flag* v) 525{ 526 atomic_flag old = __sync_fetch_and_or(v, (atomic_flag)1); 527 return old; 528} 529 530static void atomic_flag_clear(atomic_flag* v) 531{ 532 __sync_fetch_and_and(v, (atomic_flag)0); 533} 534 535int main() 536{ 537 atomic_flag f; 538 atomic_flag old = atomic_flag_test_and_set(&f); 539 atomic_flag_clear(&f); 540 return 0; 541} 542 543_ACEOF 544${CC} ${CFLAGS} sync_builtin_test.c -o sync_builtin_test > /dev/null 2>&1 545./sync_builtin_test > /dev/null 2>&1 546if [[ $? -eq 0 ]]; then 547 has_sync_builtins=1 548 AC_MSG_RESULT([yes]) 549else 550 has_sync_builtins=0 551 AC_MSG_RESULT([no]) 552fi 553rm -f sync_builtin_test sync_builtin_test.c 554# CONDITIONAL 555AM_CONDITIONAL([HAS_SYNC_BUILTINS], [test $has_sync_builtins -eq 1]) 556# SUBST 557AC_SUBST(HAS_SYNC_BUILTINS) 558AC_DEFINE_UNQUOTED([HAS_SYNC_BUILTINS], [$has_sync_builtins], [An alternative to be used if stdatomics is not available]) 559 560]) 561 562dnl #################################################### 563 564dnl Memory aligment issues (T1000) 565 566AC_DEFUN([AC_MEMALIGN_CHECK], [ 567 568AC_MSG_CHECKING([if memory accesses must be size-aligned]) 569cat > memalign_issues_test.c <<_ACEOF 570#include "confdefs.h" 571#if HAVE_STDLIB_H 572#include<stdlib.h> 573#endif 574 575int main(int argc, char** argv) 576{ 577 char* p = (char*)malloc(8); 578 p++; 579 int* intp= (int*)p; 580 *intp=1; 581 return 0; 582} 583_ACEOF 584${CC} ${CFLAGS} memalign_issues_test.c -o memalign_issues_test > /dev/null 2>&1 585./memalign_issues_test > /dev/null 2>&1 586if [[ $? -ne 0 ]]; then 587 has_memalign_issues=1 588 AC_MSG_RESULT([yes]) 589else 590 has_memalign_issues=0 591 AC_MSG_RESULT([no]) 592fi 593rm -f memalign_issues_test memalign_issues_test.c 594# CONDITIONAL 595AM_CONDITIONAL([HAS_MEMALIGN_ISSUES], [test $has_memalign_issues -eq 1]) 596# SUBST 597AC_SUBST(HAS_MEMALIGN_ISSUES) 598AC_DEFINE_UNQUOTED([HAS_MEMALIGN_ISSUES], [$has_memalign_issues], [Define this to enable slow but safe unaligned memory accesses]) 599 600]) 601 602dnl #################################################### 603 604dnl Architecture 605 606AC_DEFUN([AC_CPU_CHECK], [ 607 608AC_DEFINE_UNQUOTED([DEFAULT_ASSUMED_CPU_COUNT], [2], [number of hardware core if the auto-detect fails]) 609 610cpu_intel_compatible=1 611 612 613AC_MSG_CHECKING([for the CPU options]) 614cpu_unknown=1 615has_cpu_niagara=0 616has_cpu_amdintel=0 617 618CFLAGS3264= 619case "$(uname -i 2>/dev/null)" in 620 SUNW,SPARC-Enterprise-T1000) 621 AC_DEFINE_UNQUOTED([HAS_CPU_NIAGARA], [1], [T1000 has a Niagara cpu]) 622 has_cpu_niagara=1 623 AC_MSG_RESULT([UtrasparcT1]) 624 CFLAGS3264=-m64 625 cpu_unknown=0 626 cpu_intel_compatible=0 627 ;; 628 *) 629 ;; 630esac 631 632AC_REQUIRE([AC_CANONICAL_HOST]) 633AS_IF([test "x$host_cpu" = xx86_64],[ 634 AC_DEFINE_UNQUOTED([HAS_CPU_AMDINTEL], [1], [i386, Athlon, Opteron, Core2, i3, i5, i7, ...]) 635 AM_CONDITIONAL([HAS_CPU_AMDINTEL], [true]) 636 AC_MSG_RESULT([AMD/Intel ($host)]) 637 AS_IF([test "x$host" = "xx86_64-linux-gnux32"],,[CFLAGS3264=-m64]) 638 CPU_UNKNOWN=0 639 cpu_intel_compatible=1 640]) 641 642case "${cpu_unknown}" in 643 1) 644 AC_MSG_RESULT([generic]) 645 ;; 646 0) 647 ;; 648esac 649 650AM_CONDITIONAL([HAS_CPU_NIAGARA], [test $has_cpu_niagara -eq 1]) 651AM_CONDITIONAL([HAS_CPU_AMDINTEL], [test $has_cpu_amdintel -eq 1]) 652 653if [[ "$is_solaris_family" = "" ]] 654then 655 echo "OS must be detected first" 656 exit 1 657fi 658 659if [[ $is_solaris_family -eq 1 ]] 660then 661 echo "Solaris ..." 662 663 AC_MSG_CHECKING([if either force 32 or 64 bits is enabled]) 664 if [[ ! "$enable_force32bits" = "yes" ]] 665 then 666 if [[ ! "$enable_force64bits" = "yes" ]] 667 then 668 AC_MSG_RESULT([no, forcing 64 bits]) 669 enable_force64bits="yes" 670 else 671 AC_MSG_RESULT([yes]) 672 fi 673 else 674 AC_MSG_RESULT([yes]) 675 fi 676else 677 echo "Not Solaris ..." 678fi 679 680echo "Force ..." 681 682dnl Forced 32/64 bits architecture 683AC_MSG_CHECKING([if force 32 bits is enabled]) 684AC_ARG_ENABLE(force32bits, AS_HELP_STRING([--enable-force32bits], [Forces a 32 bits binary compilation]), [enable_force32bits=yes], [enable_force32bits=no]) 685AC_MSG_RESULT($enable_force32bits) 686case "$enable_force32bits" in 687 yes) 688 CFLAGS3264=-m32 689 ;; 690 *) 691 ;; 692esac 693 694AM_CONDITIONAL([FORCE32BITS], [test "y$enable_force32bits" == "yyes"]) 695 696AC_MSG_CHECKING([if force 64 bits is enabled]) 697AC_ARG_ENABLE(force64bits, AS_HELP_STRING([--enable-force64bits], [Forces a 64 bits binary compilation]), [enable_force64bits=yes], [enable_force64bits=no]) 698AC_MSG_RESULT($enable_force64bits) 699case "$enable_force64bits" in 700 yes) 701 CFLAGS3264=-m64 702 703 if [[ "$enable_force32" = "yes" ]] 704 then 705 echo "cannot do both --enable-force32bits and --enable-force64bits at the same time" 706 exit 1 707 fi 708 709 ;; 710 *) 711 ;; 712esac 713AM_CONDITIONAL([FORCE64BITS], [test "y$enable_force64bits" = "yyes"]) 714 715]) 716 717dnl #################################################### 718 719dnl Endianness 720 721AC_DEFUN([AC_ENDIANNESS], [ 722# 723# AC_ENDIANNESS 724# 725# CHECKING 726AC_MSG_CHECKING([endianness: ]) 727if [[ "$CC" = "" ]] 728then 729 AC_MSG_RESULT("[compiler not set yet, fix this]") 730 exit 1 731fi 732cat > test-gcc-endian.c <<_ACEOF 733#include "confdefs.h" 734#if HAVE_STDLIB_H 735#include<stdlib.h> 736#endif 737#if HAVE_STDIO_H 738#include <stdio.h> 739#endif 740#if defined __FreeBSD__ 741#if HAVE_SYS_ENDIAN_H 742#include <sys/endian.h> 743#endif 744#elif defined __APPLE__ 745#if HAVE_MACHINE_ENDIAN_H 746#include <machine/endian.h> 747#endif 748#elif defined __sun 749#if HAVE_SYS_BYTEORDER_H 750#include <sys/byteorder.h> 751#endif 752#else 753#if HAVE_ENDIAN_H 754#include <endian.h> 755#endif 756#if HAVE_BYTESWAP_H 757#include <byteswap.h> 758#endif 759#endif 760static int magic = 0x00525545; 761int main(int argc,char** argv) 762{ 763 (void)argc; 764 (void)argv; 765 int pp = -1; 766 int c = -1; 767 768#if defined _BIG_ENDIAN 769 pp = 2; 770#elif defined _LITTLE_ENDIAN 771 pp = 1; 772#endif 773 774#ifdef __BYTE_ORDER 775#if __BYTE_ORDER == __LITTLE_ENDIAN 776 pp = 1; 777#elif __BYTE_ORDER == __BIG_ENDIAN 778 pp = 2; 779#endif 780// printf("__BYTE_ORDER=%x\n", __BYTE_ORDER); 781#endif 782 783#ifdef _BYTE_ORDER 784#if _BYTE_ORDER == _LITTLE_ENDIAN 785 pp = 1; 786#elif _BYTE_ORDER == _BIG_ENDIAN 787 pp = 2; 788#endif 789 printf("_BYTE_ORDER=%x\n", _BYTE_ORDER); 790#endif 791 792#ifdef BYTE_ORDER 793#if BYTE_ORDER == LITTLE_ENDIAN 794 pp = 1; 795#elif BYTE_ORDER == BIG_ENDIAN 796 pp = 2; 797#endif 798// printf("BYTE_ORDER=%x\n", BYTE_ORDER); 799#endif 800# 801#ifdef WORDS_BIGENDIAN 802 803// printf("WORDS_BIGENDIAN=%x\n", WORDS_BIGENDIAN); 804 805 if(pp == 1) // could be -1 or 2 806 { 807 pp = -2; 808 } 809 else 810 { 811 pp = 2; 812 } 813#endif 814 815 char *p = (char*)&magic; 816 if(*p == '\0') 817 { 818 c = 2; 819 } 820 else if(*p == 'E') 821 { 822 c = 1; 823 } 824 825 if((pp < 0) || (c < 0)) 826 { 827 printf("*** WARNING *** preprocessor says %i, real test says %i *** WARNING ***\n", pp, c); 828 } 829 830 if(c == pp) 831 { 832 return c; 833 } 834 else 835 { 836 return -1; 837 } 838} 839_ACEOF 840$CC $1 test-gcc-endian.c -o test-gcc-endian > /dev/null 2>&1 841if [[ $? -ne 0 ]] 842then 843 AC_MSG_RESULT("[failed to compile test]") 844 exit 1 845fi 846./test-gcc-endian 847if [[ $? -eq 1 ]] 848then 849 cpu_endian="little" 850 AC_MSG_RESULT([little]) 851else 852 cpu_endian="big" 853 AC_MSG_RESULT([big]) 854fi 855# CONDITIONAL 856AM_CONDITIONAL(HAS_LITTLE_ENDIAN, [test "$cpu_endian" == "little"]) 857AM_CONDITIONAL(HAS_BIG_ENDIAN, [test "$cpu_endian" == "big"]) 858# SUBST 859AC_SUBST(HAS_LITTLE_ENDIAN) 860AC_SUBST(HAS_BIG_ENDIAN) 861rm -f test-gcc-endian.c* test-gcc-endian 862]) 863 864dnl #################################################### 865 866dnl Compiler 867 868AC_DEFUN([AC_COMPILER_CHECK], [ 869 870AC_OS_WORKAROUND 871 872AC_CPU_CHECK 873 874cat /etc/redhat-version > /dev/null 2>&1 875if [[ $? -eq 0 ]] 876then 877 is_redhat_family=1 878else 879 is_redhat_family=0 880fi 881 882EURID_CFLAGS= 883 884VERSION_OPT=--version 885$CC --version > /dev/null 2>&1 886if [[ $? -ne 0 ]] 887then 888 $CC -V > /dev/null 2>&1 889 if [[ $? -ne 0 ]] 890 then 891 CCVER='0.0' 892 CCNAME='unknown' 893 VERSION_OPT='' 894 else 895 VERSION_OPT='-V' 896 fi 897fi 898 899if [[ ! "$VERSION_OPT" = "" ]] 900then 901 902dnl $CC --version 2>&1 903dnl $CC $VERSION_OPT 2>&1|head -1 904dnl $CC $VERSION_OPT 2>&1|head -1|sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/' 905dnl $CC $VERSION_OPT 2>&1|head -1|sed -e 's/.*clang.*/clang/' -e 's/.*gcc.*/gcc/' -e 's/.*icc.*/icc/' -e 's/.*Sun C.*/Sun C/'|tr A-Z a-z 906 907CCVER=$($CC $VERSION_OPT 2>&1|head -1|sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/') 908dnl echo $CC $VERSION_OPT "2>&1" |head -1|sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/' 909if [[ "$CCVER" = "" ]] 910then 911 CCVER='0.0' 912fi 913 914CCNAME=$($CC $VERSION_OPT 2>&1|head -1|sed -e 's/.*clang.*/clang/' -e 's/.*gcc.*/gcc/' -e 's/.*icc.*/icc/' -e 's/.*Sun C.*/Sun C/'|tr A-Z a-z) 915dnl echo $CC $VERSION_OPT "2>&1"|head -1|sed -e 's/.*clang.*/clang/' -e 's/.*gcc.*/gcc/' -e 's/.*icc.*/icc/' -e 's/.*Sun C.*/Sun C/'|tr A-Z a-z 916if [[ "$CCNAME" = "" ]] 917then 918 CCNAME='unknown' 919fi 920 921else 922 923CCVER='0.0' 924CCNAME='unknown' 925 926fi # version opt 927 928CCMAJOR=$(echo $CCVER | sed 's/\./ /g' | awk '{ print @S|@1}') 929CCMINOR=$(echo $CCVER | sed 's/\./ /g' | awk '{ print @S|@2}') 930 931dnl echo "$CC $VERSION_OPT : CCNAME='$CCNAME' CCVER='$CCVER' CCMAJOR='$CCMAJOR' CCMINOR='$CCMINOR'" 932 933if [[ "$CCMAJOR" = "" ]] 934then 935 CCMAJOR=0 936fi 937 938if [[ "$CCMINOR" = "" ]] 939then 940 CCMINOR=0 941fi 942 943uses_icc=0 944uses_gcc=0 945uses_clang=0 946uses_sunc=0 947uses_unknown=0 948 949if [[ "$CCNAME" = "gcc" ]] 950then 951 CCOPTIMISATIONFLAGS=-O3 952 953 if [[ $CCMAJOR -lt 4 ]] 954 then 955 CCOPTIMISATIONFLAGS=-O0 956 957 echo "WARNING: GCC < 4.0 has optimisations issues with YADIFA." 958 sleep 1 959 960 elif [[ $CCMAJOR -eq 4 ]] 961 then 962 if [[ $CCMINOR -lt 6 ]] 963 then 964 CCOPTIMISATIONFLAGS=-O0 965 966 echo "WARNING: GCC before 4.6 have optimisation issues with YADIFA." 967 sleep 1 968 969 elif [[ $CCMINOR -eq 6 ]] 970 then 971 CCOPTIMISATIONFLAGS=-O2 972 else 973 # hopefully after 4.6 the issue is fixed ... 974 CCOPTIMISATIONFLAGS=-O3 975 fi 976 fi 977 978 uses_gcc=1 979 980elif [[ "$CCNAME" = "icc" ]] 981then 982 echo "ICC" 983 984 CCOPTIMISATIONFLAGS=-O3 985 986 uses_icc=1 987 988 AR=xiar 989 990elif [[ "$CCNAME" = "clang" ]] 991then 992 echo "CLANG" 993 994 CCOPTIMISATIONFLAGS=-O3 995 996 uses_clang=1 997 998elif [[ "$CCNAME" = "Sun C" ]] 999then 1000 echo "Sun C" 1001 1002 CCOPTIMISATIONFLAGS=-xO5 1003 1004 uses_sunc=1 1005else 1006 echo "unsupported compiler" 1007 1008 CCNAME=$CC 1009 1010 CCOPTIMISATIONFLAGS=-O2 1011 1012 uses_unknown=1 1013fi 1014 1015AM_CONDITIONAL([USES_ICC], [test $uses_icc -eq 1]) 1016AM_CONDITIONAL([USES_GCC], [test $uses_gcc -eq 1]) 1017AM_CONDITIONAL([USES_CLANG], [test $uses_clang -eq 1]) 1018AM_CONDITIONAL([USES_SUNC], [test $uses_sunc -eq 1]) 1019AM_CONDITIONAL([USES_UNKNOWN], [test $uses_unknown -eq 1]) 1020 1021# 1022# We've been told RedHat does not like -O3 at all, so ... 1023# 1024 1025if [[ $is_redhat_family -ne 0 ]] 1026then 1027 if [[ "$CCOPTIMISATIONFLAGS " eq "-O3" ]] 1028 then 1029 CCOPTIMISATIONFLAGS=-O2 1030 fi 1031fi 1032 1033echo "detected compiler is $CCNAME $CCMAJOR $CCMINOR" 1034 1035AC_SUBST(CCOPTIMISATIONFLAGS, $CCOPTIMISATIONFLAGS) 1036 1037if [[ $cpu_intel_compatible -eq 0 ]] 1038then 1039 if [[ $icc_enabled -ne 0 ]] 1040 then 1041 echo "ERROR: cannot enable ICC with CPU other than x86 or amd64" 1042 exit 1 1043 fi 1044fi 1045 1046AC_COMPILER_SUPPORTS([-mtune=native],TUNE_NATIVE) 1047AC_COMPILER_SUPPORTS([-fno-ident],NO_IDENT) 1048AC_COMPILER_SUPPORTS([-ansi],ANSI) 1049AC_COMPILER_SUPPORTS([-ansi-alias],ANSI_ALIAS) 1050AC_COMPILER_SUPPORTS([-pedantic],PEDANTIC) 1051AC_COMPILER_SUPPORTS([-std=gnu11],STD_GNU11) 1052AC_COMPILER_SUPPORTS([-std=c11],STD_C11) 1053AC_COMPILER_SUPPORTS([-std=gnu99],STD_GNU99) 1054AC_COMPILER_SUPPORTS([-std=c99],STD_C99) 1055AC_COMPILER_SUPPORTS([-xc99],XC99) 1056AC_COMPILER_SUPPORTS([-m32],M32) 1057AC_COMPILER_SUPPORTS([-m64],M64) 1058AC_COMPILER_SUPPORTS([-Wall],WALL) 1059AC_COMPILER_SUPPORTS([-g],G) 1060AC_COMPILER_SUPPORTS([-g3],G3) 1061AC_COMPILER_SUPPORTS([-gdwarf-2],DWARF2) 1062AC_COMPILER_SUPPORTS([-gdwarf-3],DWARF3) 1063AC_COMPILER_SUPPORTS([-gdwarf-4],DWARF4) 1064AC_COMPILER_SUPPORTS([-fstack-protector --param=ssp-buffer-size=4],STACK_PROTECTOR) 1065AC_COMPILER_SUPPORTS([-fexceptions],EXCEPTIONS) 1066AC_COMPILER_SUPPORTS([-Werror=missing-field-initializers],MISSING_FIELD_INITIALIZERS) 1067AC_COMPILER_SUPPORTS([-fsanitize=address],SANITIZE_ADDRESS) 1068AC_COMPILER_SUPPORTS([-fno-omit-frame-pointer],NO_OMIT_FRAME_POINTER) 1069AC_COMPILER_SUPPORTS([-faddress-sanitizer],ADDRESS_SANITIZER_CHECK) 1070AC_COMPILER_SUPPORTS([-fcatch_undefined_behavior],CATCH_UNDEFINED_BEHAVIOR) 1071AC_COMPILER_SUPPORTS([-rdynamic],RDYNAMIC) 1072 1073AC_CHECK_HEADERS([arpa/inet.h]) 1074AC_CHECK_HEADERS([asm/unistd.h]) 1075AC_CHECK_HEADERS([assert.h]) 1076AC_CHECK_HEADERS([bfd.h]) 1077AC_CHECK_HEADERS([byteswap.h]) 1078AC_CHECK_HEADERS([cpuid.h]) 1079AC_CHECK_HEADERS([ctype.h]) 1080AC_CHECK_HEADERS([dirent.h]) 1081AC_CHECK_HEADERS([dlfcn.h]) 1082AC_CHECK_HEADERS([endian.h]) 1083AC_CHECK_HEADERS([errno.h]) 1084AC_CHECK_HEADERS([execinfo.h]) 1085AC_CHECK_HEADERS([fcntl.h]) 1086AC_CHECK_HEADERS([getopt.h]) 1087AC_CHECK_HEADERS([grp.h]) 1088AC_CHECK_HEADERS([limits.h]) 1089AC_CHECK_HEADERS([linux/limits.h]) 1090AC_CHECK_HEADERS([mach/clock.h]) 1091AC_CHECK_HEADERS([machine/endian.h]) 1092AC_CHECK_HEADERS([mach/mach.h]) 1093AC_CHECK_HEADERS([malloc.h]) 1094AC_CHECK_HEADERS([netdb.h]) 1095AC_CHECK_HEADERS([net/ethernet.h]) 1096AC_CHECK_HEADERS([netinet/in.h]) 1097AC_CHECK_HEADERS([netinet6/in6.h]) 1098AC_CHECK_HEADERS([netinet/tcp.h]) 1099AC_CHECK_HEADERS([pcap/pcap.h]) 1100AC_CHECK_HEADERS([poll.h]) 1101AC_CHECK_HEADERS([pthread.h]) 1102AC_CHECK_HEADERS([pwd.h]) 1103AC_CHECK_HEADERS([sched.h]) 1104AC_CHECK_HEADERS([signal.h]) 1105AC_CHECK_HEADERS([stdarg.h]) 1106AC_CHECK_HEADERS([stdatomic.h]) 1107AC_CHECK_HEADERS([stdbool.h]) 1108AC_CHECK_HEADERS([stddef.h]) 1109AC_CHECK_HEADERS([stdint.h]) 1110AC_CHECK_HEADERS([stdio.h]) 1111AC_CHECK_HEADERS([stdlib.h]) 1112AC_CHECK_HEADERS([string.h]) 1113AC_CHECK_HEADERS([strings.h]) 1114AC_CHECK_HEADERS([sys/byteorder.h]) 1115AC_CHECK_HEADERS([sys/cpuset.h]) 1116AC_CHECK_HEADERS([sys/endian.h]) 1117AC_CHECK_HEADERS([sys/file.h]) 1118AC_CHECK_HEADERS([sys/ipc.h]) 1119AC_CHECK_HEADERS([syslog.h]) 1120AC_CHECK_HEADERS([sys/mman.h]) 1121AC_CHECK_HEADERS([sys/msg.h]) 1122AC_CHECK_HEADERS([sys/param.h]) 1123AC_CHECK_HEADERS([sys/prctl.h]) 1124AC_CHECK_HEADERS([sys/resource.h]) 1125AC_CHECK_HEADERS([sys/socket.h]) 1126AC_CHECK_HEADERS([sys/stat.h]) 1127AC_CHECK_HEADERS([sys/syslimits.h]) 1128AC_CHECK_HEADERS([sys/time.h]) 1129AC_CHECK_HEADERS([sys/types.h]) 1130AC_CHECK_HEADERS([sys/un.h]) 1131AC_CHECK_HEADERS([sys/wait.h]) 1132AC_CHECK_HEADERS([tcl.h]) 1133AC_CHECK_HEADERS([time.h]) 1134AC_CHECK_HEADERS([ucontext.h]) 1135AC_CHECK_HEADERS([unistd.h]) 1136AC_CHECK_HEADERS([stdnoreturn.h]) 1137 1138AC_MEMALIGN_CHECK 1139AC_SYNC_BUILTINS 1140AC_SETGROUPS_CHECK 1141AC_ENDIANNESS 1142]) 1143 1144dnl #################################################### 1145 1146dnl timegm support 1147 1148AC_DEFUN([AC_TIMEGM_CHECK], [ 1149 1150AC_MSG_CHECKING([for timegm]) 1151 1152YA_TRY_LINK([#include<time.h>],[struct tm t; timegm(&t);],[AC_DEFINE_UNQUOTED([HAS_TIMEGM], [1], [The system supports timegm]) echo yes],[echo no]) 1153 1154]) 1155 1156dnl #################################################### 1157 1158dnl mremap support 1159 1160AC_DEFUN([AC_MREMAP_CHECK], [ 1161 1162AC_MSG_CHECKING([for mremap]) 1163 1164YA_TRY_LINK([#define _GNU_SOURCE 1165 #include<sys/mman.h>],[mremap(0,0,0,0);],[AC_DEFINE_UNQUOTED([HAS_MREMAP], [1], [The system supports mremap]) echo yes],[echo no]) 1166 1167]) 1168 1169dnl #################################################### 1170 1171dnl pthread spinlock support 1172 1173AC_DEFUN([AC_PTHREAD_SPINLOCK_CHECK], [ 1174 1175AC_MSG_CHECKING([for pthread_spin_init]) 1176AC_SEARCH_LIBS(pthread_spin_init,pthread,[AC_DEFINE_UNQUOTED([HAS_PTHREAD_SPINLOCK], [1], [The system supports spinlocks]) echo yes],[echo no]) 1177]) 1178 1179dnl #################################################### 1180 1181dnl pthread_setname_np support 1182 1183AC_DEFUN([AC_PTHREAD_SETNAME_NP_CHECK], [ 1184 1185AC_MSG_CHECKING([for pthread_setname_np]) 1186AC_SEARCH_LIBS(pthread_setname_np, pthread,[AC_DEFINE_UNQUOTED([HAS_PTHREAD_SETNAME_NP], [1], [The system supports thread names]) echo yes],[echo no]) 1187]) 1188 1189dnl #################################################### 1190 1191dnl pthread_setaffinity_np support 1192 1193AC_DEFUN([AC_PTHREAD_SETAFFINITY_NP_CHECK], [ 1194 1195AC_MSG_CHECKING([for pthread_setaffinity_np]) 1196AC_SEARCH_LIBS(pthread_setaffinity_np,pthread,[AC_DEFINE_UNQUOTED([HAS_PTHREAD_SETAFFINITY_NP], [1], [The system supports thread affinity]) echo yes],[echo no]) 1197]) 1198 1199dnl #################################################### 1200 1201dnl gettid support 1202 1203AC_DEFUN([AC_GETTID_CHECK], [ 1204 1205 AC_MSG_CHECKING([for gettid]) 1206AC_SEARCH_LIBS(gettid,,[AC_DEFINE_UNQUOTED([HAVE_GETTID], [1], [The system supports gettid]) echo yes],[echo no]) 1207]) 1208 1209dnl #################################################### 1210 1211dnl gethostbyname inet_pton inet_ntop ... (Solaris requires a lib) 1212 1213AC_DEFUN([AC_GETHOSTBYNAME_CHECK], [ 1214 1215AC_MSG_CHECKING([for gethostbyname inet_pton inet_ntop]) 1216AC_MSG_CHECKING([if gethostbyname requires some lib]) 1217YA_TRY_LINK([#include<netdb.h>],[struct hostent *host = gethostbyname("www.yadifa.eu.");], 1218 [ 1219 AC_MSG_RESULT([no]) 1220 ], 1221 [ 1222 AC_MSG_CHECKING([if gethostbyname requires nsl]) 1223 OLD_LDFLAGS="$LDFLAGS" 1224 LDFLAGS="-lnsl $LDFLAGS" 1225 YA_TRY_LINK([#include<netdb.h>],[struct hostent *host = gethostbyname("www.yadifa.eu.");], 1226 [ 1227 AC_MSG_RESULT([yes]) 1228 ], 1229 [ 1230 LDFLAGS="$OLDLDFLAGS" 1231 AC_MSG_RESULT([no, and I could not find it ...]) 1232 exit 1; 1233 ]) 1234 ]) 1235]) 1236 1237dnl #################################################### 1238 1239dnl LTO 1240 1241AC_DEFUN([AC_CHECK_LTO], [ 1242 1243AC_MSG_CHECKING(if LTO has been enabled) 1244AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable LTO support, requires gold linker]), [enable_lto=yes], [enable_lto=no]) 1245AC_MSG_RESULT($enable_lto) 1246case "$enable_lto" in 1247 yes) 1248 1249 type -p gold 1250 1251 if [[ $? -ne 0 ]] 1252 then 1253 AC_MSG_RESULT([WARNING: 'gold' not found]) 1254 sleep 1 1255 fi 1256 1257 if [[ ! "$LD" = "" ]] 1258 then 1259 $LD -v |grep -i gold > /dev/null 2>&1 1260 1261 if [[ $? -ne 0 ]] 1262 then 1263 AC_MSG_RESULT([WARNING: LTO enabled but LD ($LD) is not gold]) 1264 sleep 1 1265 fi 1266 else 1267 AC_MSG_RESULT([LD not defined]) 1268 fi 1269 1270 ;; 1271 no|*) 1272 ;; 1273esac 1274 1275AM_CONDITIONAL(HAS_LTO_SUPPORT, [test "x$enable_lto" == "yyes"]) 1276 1277]) 1278 1279dnl #################################################### 1280 1281AC_DEFUN([AC_SOCKADDR_SA_LEN_CHECK], 1282[ 1283dnl Check for sa_len field 1284AC_MSG_CHECKING([if sockaddr has a sa_len field]) 1285cat > sockaddr_sa_len.c <<_ACEOF 1286#include "confdefs.h" 1287#if HAVE_STDLIB_H 1288#include<stdlib.h> 1289#endif 1290#if HAVE_SYS_TYPES_H 1291#include<sys/types.h> 1292#endif 1293#if HAVE_SYS_SOCKET_H 1294#include<sys/socket.h> 1295#endif 1296#if HAVE_NETINET_IN_H 1297#include<netinet/in.h> 1298#endif 1299#if HAVE_NETINET6_IN6_H 1300#include<netinet6/in6.h> 1301#endif 1302int main(int argc, char** argv) 1303{ 1304 struct sockaddr sa; 1305 sa.sa_len = 4; 1306} 1307_ACEOF 1308has_sockaddr_sa_len=0 1309${CC} ${CFLAGS} sockaddr_sa_len.c > /dev/null 2>&1 1310if [[ $? -eq 0 ]]; then 1311 has_sockaddr_sa_len=1; 1312 AC_MSG_RESULT([yes]) 1313else 1314 AC_MSG_RESULT([no]) 1315fi 1316rm -f sockaddr_sa_len.c sockaddr_sa_len 1317AM_CONDITIONAL([HAS_SOCKADDR_SA_LEN], [test $has_sockaddr_sa_len = yes]) 1318AC_DEFINE_UNQUOTED([HAS_SOCKADDR_SA_LEN], [$has_sockaddr_sa_len], [The sockaddr struct has an sa_len field]) 1319]) 1320 1321dnl #################################################### 1322 1323AC_DEFUN([AC_SOCKADDR_IN_SIN_LEN_CHECK], 1324[ 1325dnl Check for sin_len field 1326AC_MSG_CHECKING([if sockaddr_in has a sin_len field]) 1327cat > sockaddr_in_sin_len.c <<_ACEOF 1328#include "confdefs.h" 1329#if HAVE_STDLIB_H 1330#include<stdlib.h> 1331#endif 1332#if HAVE_SYS_TYPES_H 1333#include<sys/types.h> 1334#endif 1335#if HAVE_SYS_SOCKET_H 1336#include<sys/socket.h> 1337#endif 1338#if HAVE_NETINET_IN_H 1339#include<netinet/in.h> 1340#endif 1341#if HAVE_NETINET6_IN6_H 1342#include<netinet6/in6.h> 1343#endif 1344int main(int argc, char** argv) 1345{ 1346 struct sockaddr_in sa; 1347 sa.sin_len = sizeof(struct sockaddr_in); 1348} 1349_ACEOF 1350has_sockaddr_in_sin_len=0 1351${CC} ${CFLAGS} sockaddr_in_sin_len.c > /dev/null 2>&1 1352if [[ $? -eq 0 ]]; then 1353 has_sockaddr_in_sin_len=1; 1354 AC_MSG_RESULT([yes]) 1355else 1356 AC_MSG_RESULT([no]) 1357fi 1358rm -f sockaddr_in_sin_len.c sockaddr_in_sin_len 1359AM_CONDITIONAL([HAS_SOCKADDR_IN_SIN_LEN], [test $has_sockaddr_in_sin_len = yes]) 1360AC_DEFINE_UNQUOTED([HAS_SOCKADDR_IN_SIN_LEN], [$has_sockaddr_in_sin_len], [The sockaddr_in struct has an sin_len field]) 1361]) 1362 1363dnl #################################################### 1364 1365AC_DEFUN([AC_SOCKADDR_IN6_SIN6_LEN_CHECK], 1366[ 1367dnl Check for sin6_len field 1368AC_MSG_CHECKING([if sockaddr_in6 has a sin6_len field]) 1369cat > sockaddr_in6_sin6_len.c <<_ACEOF 1370#include "confdefs.h" 1371#if HAVE_STDLIB_H 1372#include<stdlib.h> 1373#endif 1374#if HAVE_SYS_TYPES_H 1375#include<sys/types.h> 1376#endif 1377#if HAVE_SYS_SOCKET_H 1378#include<sys/socket.h> 1379#endif 1380#if HAVE_NETINET_IN_H 1381#include<netinet/in.h> 1382#endif 1383#if HAVE_NETINET6_IN6_H 1384#include<netinet6/in6.h> 1385#endif 1386int main(int argc, char** argv) 1387{ 1388 struct sockaddr_in6 sa; 1389 sa.sin6_len = sizeof(struct sockaddr_in6); 1390} 1391_ACEOF 1392has_sockaddr_in6_sin6_len=0 1393${CC} ${CFLAGS} sockaddr_in6_sin6_len.c > /dev/null 2>&1 1394if [[ $? -eq 0 ]]; then 1395 has_sockaddr_in6_sin6_len=1; 1396 AC_MSG_RESULT([yes]) 1397else 1398 AC_MSG_RESULT([no]) 1399fi 1400rm -f sockaddr_in6_sin6_len.c sockaddr_in6_sin6_len 1401AM_CONDITIONAL([HAS_SOCKADDR_IN6_SIN6_LEN], [test $has_sockaddr_in6_sin6_len = yes]) 1402AC_DEFINE_UNQUOTED([HAS_SOCKADDR_IN6_SIN6_LEN], [$has_sockaddr_in6_sin6_len], [The sockaddr_in6 struct has an sin6_len field]) 1403]) 1404 1405dnl #################################################### 1406 1407AC_DEFUN([AC_EURID_SUMMARY], [ 1408 1409cat <<EOF 1410 CC : $CC 1411 CPP : $CPP 1412 LD : $LD 1413 AR : $AR 1414 1415 CFLAGS : $CFLAGS 1416 CPPFLAGS : $CPPFLAGS 1417 LDFLAGS : $LDFLAGS 1418 1419 MEMALIGN ISSUES : $has_memalign_issues 1420 32/64 : $CFLAGS3264 1421 LTO : $enable_lto 1422 LOG : $logdir 1423EOF 1424]) 1425 1426dnl #################################################### 1427 1428AC_DEFUN([AC_MAKE_BUILDINFO], [ 1429make buildinfo.h 1430]) 1431 1432