1dnl Try to detect the type of the third arg to getsockname() et al 2AC_DEFUN([LSH_TYPE_SOCKLEN_T], 3[AH_TEMPLATE([socklen_t], [Length type used by getsockopt]) 4AC_CACHE_CHECK([for socklen_t in sys/socket.h], ac_cv_type_socklen_t, 5[AC_EGREP_HEADER(socklen_t, sys/socket.h, 6 [ac_cv_type_socklen_t=yes], [ac_cv_type_socklen_t=no])]) 7if test $ac_cv_type_socklen_t = no; then 8 AC_MSG_CHECKING(for AIX) 9 AC_EGREP_CPP(yes, [ 10#ifdef _AIX 11 yes 12#endif 13],[ 14AC_MSG_RESULT(yes) 15AC_DEFINE(socklen_t, size_t) 16],[ 17AC_MSG_RESULT(no) 18AC_DEFINE(socklen_t, int) 19]) 20fi 21]) 22 23dnl Choose cc flags for compiling position independent code 24dnl FIXME: Doesn't do the right thing when crosscompiling. 25AC_DEFUN([LSH_CCPIC], 26[AC_REQUIRE([AC_CANONICAL_HOST])dnl 27AC_MSG_CHECKING(CCPIC) 28AC_CACHE_VAL(lsh_cv_sys_ccpic,[ 29 if test -z "$CCPIC" ; then 30 if test "$GCC" = yes ; then 31 case "$host_os" in 32 bsdi4.*) CCPIC="-fPIC" ;; 33 bsdi*) CCPIC="" ;; 34 darwin*) CCPIC="-fPIC" ;; 35 # Could also use -fpic, depending on the number of symbol references 36 solaris*) CCPIC="-fPIC" ;; 37 cygwin*) CCPIC="" ;; 38 mingw32*) CCPIC="" ;; 39 *) CCPIC="-fpic" ;; 40 esac 41 else 42 case "$host_os" in 43 darwin*) CCPIC="-fPIC" ;; 44 irix*) CCPIC="-share" ;; 45 hpux*) CCPIC="+z"; ;; 46 *freebsd*) CCPIC="-fpic" ;; 47 sco*|sysv4.*) CCPIC="-KPIC -dy -Bdynamic" ;; 48 solaris*) CCPIC="-KPIC -Bdynamic" ;; 49 winnt*) CCPIC="-shared" ;; 50 *) CCPIC="" ;; 51 esac 52 fi 53 fi 54 OLD_CFLAGS="$CFLAGS" 55 CFLAGS="$CFLAGS $CCPIC" 56 AC_TRY_COMPILE([], [exit(0);], 57 lsh_cv_sys_ccpic="$CCPIC", lsh_cv_sys_ccpic='') 58 CFLAGS="$OLD_CFLAGS" 59]) 60CCPIC="$lsh_cv_sys_ccpic" 61AC_MSG_RESULT($CCPIC)]) 62 63dnl LSH_PATH_ADD(path-id, directory) 64AC_DEFUN([LSH_PATH_ADD], 65[AC_MSG_CHECKING($2) 66ac_exists=no 67if test -d "$2/." ; then 68 ac_real_dir=`cd $2 && pwd` 69 if test -n "$ac_real_dir" ; then 70 ac_exists=yes 71 for old in $1_REAL_DIRS ; do 72 ac_found=no 73 if test x$ac_real_dir = x$old ; then 74 ac_found=yes; 75 break; 76 fi 77 done 78 if test $ac_found = yes ; then 79 AC_MSG_RESULT(already added) 80 else 81 AC_MSG_RESULT(added) 82 # LDFLAGS="$LDFLAGS -L $2" 83 $1_REAL_DIRS="$ac_real_dir [$]$1_REAL_DIRS" 84 $1_DIRS="$2 [$]$1_DIRS" 85 fi 86 fi 87fi 88if test $ac_exists = no ; then 89 AC_MSG_RESULT(not found) 90fi 91]) 92 93dnl LSH_RPATH_ADD(dir) 94AC_DEFUN([LSH_RPATH_ADD], [LSH_PATH_ADD(RPATH_CANDIDATE, $1)]) 95 96dnl LSH_RPATH_INIT(candidates) 97AC_DEFUN([LSH_RPATH_INIT], 98[AC_REQUIRE([AC_CANONICAL_HOST])dnl 99AC_MSG_CHECKING([for -R flag]) 100RPATHFLAG='' 101case "$host_os" in 102 osf1*) RPATHFLAG="-rpath " ;; 103 irix6.*|irix5.*) RPATHFLAG="-rpath " ;; 104 solaris*) 105 if test "$TCC" = "yes"; then 106 # tcc doesn't know about -R 107 RPATHFLAG="-Wl,-R," 108 else 109 RPATHFLAG=-R 110 fi 111 ;; 112 linux*|freebsd*) RPATHFLAG="-Wl,-rpath," ;; 113 *) RPATHFLAG="" ;; 114esac 115 116if test x$RPATHFLAG = x ; then 117 AC_MSG_RESULT(none) 118else 119 AC_MSG_RESULT([using $RPATHFLAG]) 120fi 121 122RPATH_CANDIDATE_REAL_DIRS='' 123RPATH_CANDIDATE_DIRS='' 124 125AC_MSG_RESULT([Searching for libraries]) 126 127for d in $1 ; do 128 LSH_RPATH_ADD($d) 129done 130]) 131 132dnl Try to execute a main program, and if it fails, try adding some 133dnl -R flag. 134dnl LSH_RPATH_FIX 135AC_DEFUN([LSH_RPATH_FIX], 136[if test $cross_compiling = no -a "x$RPATHFLAG" != x ; then 137 ac_success=no 138 AC_TRY_RUN([int main(int argc, char **argv) { return 0; }], 139 ac_success=yes, ac_success=no, :) 140 141 if test $ac_success = no ; then 142 AC_MSG_CHECKING([Running simple test program failed. Trying -R flags]) 143dnl echo RPATH_CANDIDATE_DIRS = $RPATH_CANDIDATE_DIRS 144 ac_remaining_dirs='' 145 ac_rpath_save_LDFLAGS="$LDFLAGS" 146 for d in $RPATH_CANDIDATE_DIRS ; do 147 if test $ac_success = yes ; then 148 ac_remaining_dirs="$ac_remaining_dirs $d" 149 else 150 LDFLAGS="$RPATHFLAG$d $LDFLAGS" 151dnl echo LDFLAGS = $LDFLAGS 152 AC_TRY_RUN([int main(int argc, char **argv) { return 0; }], 153 [ac_success=yes 154 ac_rpath_save_LDFLAGS="$LDFLAGS" 155 AC_MSG_RESULT([adding $RPATHFLAG$d]) 156 ], 157 [ac_remaining_dirs="$ac_remaining_dirs $d"], :) 158 LDFLAGS="$ac_rpath_save_LDFLAGS" 159 fi 160 done 161 RPATH_CANDIDATE_DIRS=$ac_remaining_dirs 162 fi 163 if test $ac_success = no ; then 164 AC_MSG_RESULT(failed) 165 fi 166fi 167]) 168 169dnl Like AC_CHECK_LIB, but uses $KRB_LIBS rather than $LIBS. 170dnl LSH_CHECK_KRB_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [, 171dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) 172 173AC_DEFUN([LSH_CHECK_KRB_LIB], 174[AC_CHECK_LIB([$1], [$2], 175 ifelse([$3], , 176 [[ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ 177 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` 178 AC_DEFINE_UNQUOTED($ac_tr_lib) 179 KRB_LIBS="-l$1 $KRB_LIBS" 180 ]], [$3]), 181 ifelse([$4], , , [$4 182])dnl 183, [$5 $KRB_LIBS]) 184]) 185 186dnl LSH_LIB_ARGP(ACTION-IF-OK, ACTION-IF-BAD) 187AC_DEFUN([LSH_LIB_ARGP], 188[ ac_argp_save_LIBS="$LIBS" 189 ac_argp_save_LDFLAGS="$LDFLAGS" 190 ac_argp_ok=no 191 # First check if we can link with argp. 192 AC_SEARCH_LIBS(argp_parse, argp, 193 [ LSH_RPATH_FIX 194 AC_CACHE_CHECK([for working argp], 195 lsh_cv_lib_argp_works, 196 [ AC_TRY_RUN( 197[#include <argp.h> 198#include <stdlib.h> 199 200static const struct argp_option 201options[] = 202{ 203 { NULL, 0, NULL, 0, NULL, 0 } 204}; 205 206struct child_state 207{ 208 int n; 209}; 210 211static error_t 212child_parser(int key, char *arg, struct argp_state *state) 213{ 214 struct child_state *input = (struct child_state *) state->input; 215 216 switch(key) 217 { 218 default: 219 return ARGP_ERR_UNKNOWN; 220 case ARGP_KEY_END: 221 if (!input->n) 222 input->n = 1; 223 break; 224 } 225 return 0; 226} 227 228const struct argp child_argp = 229{ 230 options, 231 child_parser, 232 NULL, NULL, NULL, NULL, NULL 233}; 234 235struct main_state 236{ 237 struct child_state child; 238 int m; 239}; 240 241static error_t 242main_parser(int key, char *arg, struct argp_state *state) 243{ 244 struct main_state *input = (struct main_state *) state->input; 245 246 switch(key) 247 { 248 default: 249 return ARGP_ERR_UNKNOWN; 250 case ARGP_KEY_INIT: 251 state->child_inputs[0] = &input->child; 252 break; 253 case ARGP_KEY_END: 254 if (!input->m) 255 input->m = input->child.n; 256 257 break; 258 } 259 return 0; 260} 261 262static const struct argp_child 263main_children[] = 264{ 265 { &child_argp, 0, "", 0 }, 266 { NULL, 0, NULL, 0} 267}; 268 269static const struct argp 270main_argp = 271{ options, main_parser, 272 NULL, 273 NULL, 274 main_children, 275 NULL, NULL 276}; 277 278int main(int argc, char **argv) 279{ 280 struct main_state input = { { 0 }, 0 }; 281 char *v[2] = { "foo", NULL }; 282 283 argp_parse(&main_argp, 1, v, 0, NULL, &input); 284 285 if ( (input.m == 1) && (input.child.n == 1) ) 286 return 0; 287 else 288 return 1; 289} 290], lsh_cv_lib_argp_works=yes, 291 lsh_cv_lib_argp_works=no, 292 lsh_cv_lib_argp_works=no)]) 293 294 if test x$lsh_cv_lib_argp_works = xyes ; then 295 ac_argp_ok=yes 296 else 297 # Reset link flags 298 LIBS="$ac_argp_save_LIBS" 299 LDFLAGS="$ac_argp_save_LDFLAGS" 300 fi]) 301 302 if test x$ac_argp_ok = xyes ; then 303 ifelse([$1],, true, [$1]) 304 else 305 ifelse([$2],, true, [$2]) 306 fi 307]) 308 309dnl LSH_GCC_ATTRIBUTES 310dnl Check for gcc's __attribute__ construction 311 312AC_DEFUN([LSH_GCC_ATTRIBUTES], 313[AC_CACHE_CHECK(for __attribute__, 314 lsh_cv_c_attribute, 315[ AC_TRY_COMPILE([ 316#include <stdlib.h> 317 318static void foo(void) __attribute__ ((noreturn)); 319 320static void __attribute__ ((noreturn)) 321foo(void) 322{ 323 exit(1); 324} 325],[], 326lsh_cv_c_attribute=yes, 327lsh_cv_c_attribute=no)]) 328 329AH_TEMPLATE([HAVE_GCC_ATTRIBUTE], [Define if the compiler understands __attribute__]) 330if test "x$lsh_cv_c_attribute" = "xyes"; then 331 AC_DEFINE(HAVE_GCC_ATTRIBUTE) 332fi 333 334AH_BOTTOM( 335[#if __GNUC__ && HAVE_GCC_ATTRIBUTE 336# define NORETURN __attribute__ ((__noreturn__)) 337# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a))) 338# define UNUSED __attribute__ ((__unused__)) 339#else 340# define NORETURN 341# define PRINTF_STYLE(f, a) 342# define UNUSED 343#endif 344])]) 345 346# Check for alloca, and include the standard blurb in config.h 347AC_DEFUN([LSH_FUNC_ALLOCA], 348[AC_FUNC_ALLOCA 349AC_CHECK_HEADERS([malloc.h]) 350AH_BOTTOM( 351[/* AIX requires this to be the first thing in the file. */ 352#ifndef __GNUC__ 353# if HAVE_ALLOCA_H 354# include <alloca.h> 355# else 356# ifdef _AIX 357 #pragma alloca 358# else 359# ifndef alloca /* predefined by HP cc +Olibcalls */ 360char *alloca (); 361# endif 362# endif 363/* Needed for alloca on windows */ 364# if HAVE_MALLOC_H 365# include <malloc.h> 366# endif 367# endif 368#else /* defined __GNUC__ */ 369# if HAVE_ALLOCA_H 370# include <alloca.h> 371# else 372/* Needed for alloca on windows, also with gcc */ 373# if HAVE_MALLOC_H 374# include <malloc.h> 375# endif 376# endif 377#endif 378])]) 379 380AC_DEFUN([LSH_FUNC_STRERROR], 381[AC_CHECK_FUNCS(strerror) 382AH_BOTTOM( 383[#if HAVE_STRERROR 384#define STRERROR strerror 385#else 386#define STRERROR(x) (sys_errlist[x]) 387#endif 388])]) 389 390AC_DEFUN([LSH_FUNC_STRSIGNAL], 391[AC_CHECK_FUNCS(strsignal) 392AC_CHECK_DECLS([sys_siglist, _sys_siglist]) 393AH_BOTTOM( 394[#if HAVE_STRSIGNAL 395# define STRSIGNAL strsignal 396#else /* !HAVE_STRSIGNAL */ 397# if HAVE_DECL_SYS_SIGLIST 398# define STRSIGNAL(x) (sys_siglist[x]) 399# else 400# if HAVE_DECL__SYS_SIGLIST 401# define STRSIGNAL(x) (_sys_siglist[x]) 402# else 403# define STRSIGNAL(x) "Unknown signal" 404# if __GNUC__ 405# warning Using dummy STRSIGNAL 406# endif 407# endif 408# endif 409#endif /* !HAVE_STRSIGNAL */ 410])]) 411 412dnl LSH_MAKE_CONDITIONAL(symbol, test) 413AC_DEFUN([LSH_MAKE_CONDITIONAL], 414[if $2 ; then 415 IF_$1='' 416 UNLESS_$1='# ' 417else 418 IF_$1='# ' 419 UNLESS_$1='' 420fi 421AC_SUBST(IF_$1) 422AC_SUBST(UNLESS_$1)]) 423 424dnl LSH_DEPENDENCY_TRACKING 425 426dnl Defines compiler flags DEP_FLAGS to generate dependency 427dnl information, and DEP_PROCESS that is any shell commands needed for 428dnl massaging the dependency information further. Dependencies are 429dnl generated as a side effect of compilation. Dependency files 430dnl themselves are not treated as targets. 431 432AC_DEFUN([LSH_DEPENDENCY_TRACKING], 433[AC_ARG_ENABLE(dependency_tracking, 434 AC_HELP_STRING([--disable-dependency-tracking], 435 [Disable dependency tracking. Dependency tracking doesn't work with BSD make]),, 436 [enable_dependency_tracking=yes]) 437 438DEP_FLAGS='' 439DEP_PROCESS='true' 440if test x$enable_dependency_tracking = xyes ; then 441 if test x$GCC = xyes ; then 442 gcc_version=`gcc --version | head -1` 443 case "$gcc_version" in 444 2.*|*[[!0-9.]]2.*) 445 enable_dependency_tracking=no 446 AC_MSG_WARN([Dependency tracking disabled, gcc-3.x is needed]) 447 ;; 448 *) 449 DEP_FLAGS='-MT $[]@ -MD -MP -MF $[]@.d' 450 DEP_PROCESS='true' 451 ;; 452 esac 453 else 454 enable_dependency_tracking=no 455 AC_MSG_WARN([Dependency tracking disabled]) 456 fi 457fi 458 459if test x$enable_dependency_tracking = xyes ; then 460 DEP_INCLUDE='include ' 461else 462 DEP_INCLUDE='# ' 463fi 464 465AC_SUBST([DEP_INCLUDE]) 466AC_SUBST([DEP_FLAGS]) 467AC_SUBST([DEP_PROCESS])]) 468 469dnl GMP_TRY_ASSEMBLE(asm-code,[action-success][,action-fail]) 470dnl ---------------------------------------------------------- 471dnl Attempt to assemble the given code. 472dnl Do "action-success" if this succeeds, "action-fail" if not. 473dnl 474dnl conftest.o and conftest.out are available for inspection in 475dnl "action-success". If either action does a "break" out of a loop then 476dnl an explicit "rm -f conftest*" will be necessary. 477dnl 478dnl This is not unlike AC_TRY_COMPILE, but there's no default includes or 479dnl anything in "asm-code", everything wanted must be given explicitly. 480 481AC_DEFUN([GMP_TRY_ASSEMBLE], 482[cat >conftest.s <<EOF 483[$1] 484EOF 485gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" 486if AC_TRY_EVAL(gmp_assemble); then 487 cat conftest.out >&AC_FD_CC 488 ifelse([$2],,:,[$2]) 489else 490 cat conftest.out >&AC_FD_CC 491 echo "configure: failed program was:" >&AC_FD_CC 492 cat conftest.s >&AC_FD_CC 493 ifelse([$3],,:,[$3]) 494fi 495rm -f conftest* 496]) 497 498dnl GMP_PROG_CC_FOR_BUILD 499dnl --------------------- 500dnl Establish CC_FOR_BUILD, a C compiler for the build system. 501dnl 502dnl If CC_FOR_BUILD is set then it's expected to work, likewise the old 503dnl style HOST_CC, otherwise some likely candidates are tried, the same as 504dnl configfsf.guess. 505 506AC_DEFUN([GMP_PROG_CC_FOR_BUILD], 507[AC_REQUIRE([AC_PROG_CC]) 508if test -n "$CC_FOR_BUILD"; then 509 GMP_PROG_CC_FOR_BUILD_WORKS($CC_FOR_BUILD,, 510 [AC_MSG_ERROR([Specified CC_FOR_BUILD doesn't seem to work])]) 511elif test -n "$HOST_CC"; then 512 GMP_PROG_CC_FOR_BUILD_WORKS($HOST_CC, 513 [CC_FOR_BUILD=$HOST_CC], 514 [AC_MSG_ERROR([Specified HOST_CC doesn't seem to work])]) 515else 516 if test $cross_compiling = no ; then 517 CC_FOR_BUILD="$CC" 518 else 519 for i in gcc cc c89 c99; do 520 GMP_PROG_CC_FOR_BUILD_WORKS($i, 521 [CC_FOR_BUILD=$i 522 break]) 523 done 524 if test -z "$CC_FOR_BUILD"; then 525 AC_MSG_ERROR([Cannot find a build system compiler]) 526 fi 527 fi 528 if test "$CC_FOR_BUILD" = gcc ; then 529 CC_FOR_BUILD="$CC_FOR_BUILD -O -g" 530 fi 531fi 532 533AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) 534AC_SUBST(CC_FOR_BUILD) 535]) 536 537 538dnl GMP_PROG_CC_FOR_BUILD_WORKS(cc/cflags[,[action-if-good][,action-if-bad]]) 539dnl ------------------------------------------------------------------------- 540dnl See if the given cc/cflags works on the build system. 541dnl 542dnl It seems easiest to just use the default compiler output, rather than 543dnl figuring out the .exe or whatever at this stage. 544 545AC_DEFUN([GMP_PROG_CC_FOR_BUILD_WORKS], 546[AC_MSG_CHECKING([build system compiler $1]) 547# remove anything that might look like compiler output to our "||" expression 548rm -f conftest* a.out b.out a.exe a_out.exe 549cat >conftest.c <<EOF 550int 551main () 552{ 553 exit(0); 554} 555EOF 556gmp_compile="$1 conftest.c" 557cc_for_build_works=no 558if AC_TRY_EVAL(gmp_compile); then 559 if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&AC_FD_CC 2>&1; then 560 cc_for_build_works=yes 561 fi 562fi 563rm -f conftest* a.out b.out a.exe a_out.exe 564AC_MSG_RESULT($cc_for_build_works) 565if test "$cc_for_build_works" = yes; then 566 ifelse([$2],,:,[$2]) 567else 568 ifelse([$3],,:,[$3]) 569fi 570]) 571 572dnl GMP_PROG_EXEEXT_FOR_BUILD 573dnl ------------------------- 574dnl Determine EXEEXT_FOR_BUILD, the build system executable suffix. 575dnl 576dnl The idea is to find what "-o conftest$foo" will make it possible to run 577dnl the program with ./conftest. On Unix-like systems this is of course 578dnl nothing, for DOS it's ".exe", or for a strange RISC OS foreign file 579dnl system cross compile it can be ",ff8" apparently. Not sure if the 580dnl latter actually applies to a build-system executable, maybe it doesn't, 581dnl but it won't hurt to try. 582 583AC_DEFUN([GMP_PROG_EXEEXT_FOR_BUILD], 584[AC_REQUIRE([GMP_PROG_CC_FOR_BUILD]) 585AC_CACHE_CHECK([for build system executable suffix], 586 gmp_cv_prog_exeext_for_build, 587[if test $cross_compiling = no ; then 588 gmp_cv_prog_exeext_for_build="$EXEEXT" 589else 590 cat >conftest.c <<EOF 591int 592main () 593{ 594 exit (0); 595} 596EOF 597 for i in .exe ,ff8 ""; do 598 gmp_compile="$CC_FOR_BUILD conftest.c -o conftest$i" 599 if AC_TRY_EVAL(gmp_compile); then 600 if (./conftest) 2>&AC_FD_CC; then 601 gmp_cv_prog_exeext_for_build=$i 602 break 603 fi 604 fi 605 done 606 rm -f conftest* 607 if test "${gmp_cv_prog_exeext_for_build+set}" != set; then 608 AC_MSG_ERROR([Cannot determine executable suffix]) 609 fi 610fi 611]) 612AC_SUBST(EXEEXT_FOR_BUILD,$gmp_cv_prog_exeext_for_build) 613]) 614 615dnl NETTLE_CHECK_ARM_NEON 616dnl --------------------- 617dnl Check if ARM Neon instructions should be used. 618dnl Obeys enable_arm_neon, which should be set earlier. 619AC_DEFUN([NETTLE_CHECK_ARM_NEON], 620[if test "$enable_arm_neon" = auto ; then 621 if test "$cross_compiling" = yes ; then 622 dnl Check if compiler/assembler accepts it, 623 dnl without an explicit .fpu neon directive. 624 AC_CACHE_CHECK([if assembler accepts Neon instructions], 625 nettle_cv_asm_arm_neon, 626 [GMP_TRY_ASSEMBLE([ 627.text 628foo: 629 vmlal.u32 q1, d0, d1 630], 631 [nettle_cv_asm_arm_neon=yes], 632 [nettle_cv_asm_arm_neon=no])]) 633 enable_arm_neon="$nettle_cv_asm_arm_neon" 634 else 635 AC_MSG_CHECKING([if /proc/cpuinfo claims neon support]) 636 if grep '^Features.*:.* neon' /proc/cpuinfo >/dev/null ; then 637 enable_arm_neon=yes 638 else 639 enable_arm_neon=no 640 fi 641 AC_MSG_RESULT($enable_arm_neon) 642 fi 643fi 644]) 645 646dnl NETTLE_CHECK_IFUNC 647dnl ------------------ 648dnl Check if __attribute__ ((ifunc(...))) works 649AC_DEFUN([NETTLE_CHECK_IFUNC], 650[AC_REQUIRE([AC_PROG_CC]) 651AC_CACHE_CHECK([for ifunc support], 652 nettle_cv_link_ifunc, 653 [AC_LINK_IFELSE([AC_LANG_PROGRAM([ 654static int 655foo_imp(int x) 656{ 657 return 1; 658} 659 660typedef void void_func (void); 661 662static void_func * 663foo_resolv(void) 664{ 665 return (void_func *) foo_imp; 666} 667 668int foo (int x) __attribute__ ((ifunc("foo_resolv"))); 669],[ 670 return foo(0); 671 672])], 673[nettle_cv_link_ifunc=yes], 674[nettle_cv_link_ifunc=no])]) 675AH_TEMPLATE([HAVE_LINK_IFUNC], [Define if compiler and linker supports __attribute__ ifunc]) 676if test "x$nettle_cv_link_ifunc" = xyes ; then 677 AC_DEFINE(HAVE_LINK_IFUNC) 678fi 679]) 680 681# ld-version-script.m4 serial 3 682dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. 683dnl This file is free software; the Free Software Foundation 684dnl gives unlimited permission to copy and/or distribute it, 685dnl with or without modifications, as long as this notice is preserved. 686 687dnl From Simon Josefsson 688 689# FIXME: The test below returns a false positive for mingw 690# cross-compiles, 'local:' statements does not reduce number of 691# exported symbols in a DLL. Use --disable-ld-version-script to work 692# around the problem. 693 694# gl_LD_VERSION_SCRIPT 695# -------------------- 696# Check if LD supports linker scripts, and define automake conditional 697# HAVE_LD_VERSION_SCRIPT if so. 698AC_DEFUN([LD_VERSION_SCRIPT], 699[ 700 AC_ARG_ENABLE([ld-version-script], 701 AS_HELP_STRING([--enable-ld-version-script], 702 [enable linker version script (default is enabled when possible)]), 703 [have_ld_version_script=$enableval], []) 704 if test -z "$have_ld_version_script"; then 705 AC_MSG_CHECKING([if LD -Wl,--version-script works]) 706 save_LDFLAGS="$LDFLAGS" 707 LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" 708 cat > conftest.map <<EOF 709foo 710EOF 711 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 712 [accepts_syntax_errors=yes], [accepts_syntax_errors=no]) 713 if test "$accepts_syntax_errors" = no; then 714 cat > conftest.map <<EOF 715VERS_1 { 716 global: sym; 717}; 718 719VERS_2 { 720 global: sym; 721} VERS_1; 722EOF 723 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 724 [have_ld_version_script=yes], [have_ld_version_script=no]) 725 else 726 have_ld_version_script=no 727 fi 728 rm -f conftest.map 729 LDFLAGS="$save_LDFLAGS" 730 AC_MSG_RESULT($have_ld_version_script) 731 fi 732 if test "$have_ld_version_script" = "yes";then 733 EXTRA_LINKER_FLAGS="-Wl,--version-script=libnettle.map" 734 AC_SUBST(EXTRA_LINKER_FLAGS) 735 EXTRA_HOGWEED_LINKER_FLAGS="-Wl,--version-script=libhogweed.map" 736 AC_SUBST(EXTRA_HOGWEED_LINKER_FLAGS) 737 fi 738]) 739