1# macros to configure gnupg 2# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2006, 2007, 3# 2008 Free Software Foundation, Inc. 4# 5# This file is part of GnuPG. 6# 7# GnuPG is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 3 of the License, or 10# (at your option) any later version. 11# 12# GnuPG is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program; if not, see <http://www.gnu.org/licenses/>. 19 20 21dnl GNUPG_MSG_PRINT(STRING) 22dnl print a message 23dnl 24define(GNUPG_MSG_PRINT, 25 [ echo $ac_n "$1"" $ac_c" 1>&AC_FD_MSG 26 ]) 27 28 29dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME) 30dnl Check whether a typedef exists and create a #define $2 if it exists 31dnl 32AC_DEFUN([GNUPG_CHECK_TYPEDEF], 33 [ AC_MSG_CHECKING(for $1 typedef) 34 AC_CACHE_VAL(gnupg_cv_typedef_$1, 35 [AC_TRY_COMPILE([#define _GNU_SOURCE 1 36 #include <stdlib.h> 37 #include <sys/types.h>], [ 38 #undef $1 39 int a = sizeof($1); 40 ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )]) 41 AC_MSG_RESULT($gnupg_cv_typedef_$1) 42 if test "$gnupg_cv_typedef_$1" = yes; then 43 AC_DEFINE($2,1,[Defined if a `]$1[' is typedef'd]) 44 fi 45 ]) 46 47 48# GNUPG_TIME_T_UNSIGNED 49# Check whether time_t is unsigned 50# 51AC_DEFUN([GNUPG_TIME_T_UNSIGNED], 52 [ AC_CACHE_CHECK(whether time_t is unsigned, gnupg_cv_time_t_unsigned, 53 [AC_REQUIRE([AC_HEADER_TIME])dnl 54 AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY( 55 [AC_INCLUDES_DEFAULT([]) 56#if TIME_WITH_SYS_TIME 57# include <sys/time.h> 58# include <time.h> 59#else 60# if HAVE_SYS_TIME_H 61# include <sys/time.h> 62# else 63# include <time.h> 64# endif 65#endif 66], 67 [((time_t)-1) < 0])], 68 gnupg_cv_time_t_unsigned=no, gnupg_cv_time_t_unsigned=yes)]) 69 if test $gnupg_cv_time_t_unsigned = yes; then 70 AC_DEFINE(HAVE_UNSIGNED_TIME_T,1,[Defined if time_t is an unsigned type]) 71 fi 72])# GNUPG_TIME_T_UNSIGNED 73 74 75dnl GNUPG_CHECK_GNUMAKE 76dnl 77AC_DEFUN([GNUPG_CHECK_GNUMAKE], 78 [ 79 if ${MAKE-make} --version 2>/dev/null | grep '^GNU ' >/dev/null 2>&1; then 80 : 81 else 82 AC_MSG_WARN([[ 83*** 84*** It seems that you are not using GNU make. Some make tools have serious 85*** flaws and you may not be able to build this software at all. Before you 86*** complain, please try GNU make: GNU make is easy to build and available 87*** at all GNU archives. It is always available from ftp.gnu.org:/gnu/make. 88***]]) 89 fi 90 ]) 91 92 93dnl GNUPG_CHECK_FAQPROG 94dnl 95AC_DEFUN([GNUPG_CHECK_FAQPROG], 96 [ AC_MSG_CHECKING(for faqprog.pl) 97 if faqprog.pl -V 2>/dev/null | grep '^faqprog.pl ' >/dev/null 2>&1; then 98 working_faqprog=yes 99 FAQPROG="faqprog.pl" 100 else 101 working_faqprog=no 102 FAQPROG=": " 103 fi 104 AC_MSG_RESULT($working_faqprog) 105 AC_SUBST(FAQPROG) 106 AM_CONDITIONAL(WORKING_FAQPROG, test "$working_faqprog" = "yes" ) 107 108dnl if test $working_faqprog = no; then 109dnl AC_MSG_WARN([[ 110dnl *** 111dnl *** It seems that the faqprog.pl program is not installed; 112dnl *** however it is only needed if you want to change the FAQ. 113dnl *** (faqprog.pl should be available at: 114dnl *** ftp://ftp.gnupg.org/gcrypt/contrib/faqprog.pl ) 115dnl *** No need to worry about this warning. 116dnl ***]]) 117dnl fi 118 ]) 119 120dnl GNUPG_CHECK_ENDIAN 121dnl define either LITTLE_ENDIAN_HOST or BIG_ENDIAN_HOST 122dnl 123define([GNUPG_CHECK_ENDIAN], 124 [ 125 tmp_assumed_endian=big 126 if test "$cross_compiling" = yes; then 127 case "$host_cpu" in 128 i@<:@345678@:>@* ) 129 tmp_assumed_endian=little 130 ;; 131 *) 132 ;; 133 esac 134 AC_MSG_WARN(cross compiling; assuming $tmp_assumed_endian endianess) 135 fi 136 AC_MSG_CHECKING(endianess) 137 AC_CACHE_VAL(gnupg_cv_c_endian, 138 [ gnupg_cv_c_endian=unknown 139 # See if sys/param.h defines the BYTE_ORDER macro. 140 AC_TRY_COMPILE([#include <sys/types.h> 141 #include <sys/param.h>], [ 142 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN 143 bogus endian macros 144 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not. 145 AC_TRY_COMPILE([#include <sys/types.h> 146 #include <sys/param.h>], [ 147 #if BYTE_ORDER != BIG_ENDIAN 148 not big endian 149 #endif], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)]) 150 if test "$gnupg_cv_c_endian" = unknown; then 151 AC_TRY_RUN([main () { 152 /* Are we little or big endian? From Harbison&Steele. */ 153 union 154 { 155 long l; 156 char c[sizeof (long)]; 157 } u; 158 u.l = 1; 159 exit (u.c[sizeof (long) - 1] == 1); 160 }], 161 gnupg_cv_c_endian=little, 162 gnupg_cv_c_endian=big, 163 gnupg_cv_c_endian=$tmp_assumed_endian 164 ) 165 fi 166 ]) 167 AC_MSG_RESULT([$gnupg_cv_c_endian]) 168 if test "$gnupg_cv_c_endian" = little; then 169 AC_DEFINE(LITTLE_ENDIAN_HOST,1, 170 [Defined if the host has little endian byte ordering]) 171 else 172 AC_DEFINE(BIG_ENDIAN_HOST,1, 173 [Defined if the host has big endian byte ordering]) 174 fi 175 ]) 176 177dnl GNUPG_CHECK_CACHE 178dnl 179define(GNUPG_CHECK_CACHE, 180 [ AC_MSG_CHECKING(cached information) 181 gnupg_hostcheck="$target" 182 AC_CACHE_VAL(gnupg_cv_hostcheck, [ gnupg_cv_hostcheck="$gnupg_hostcheck" ]) 183 if test "$gnupg_cv_hostcheck" != "$gnupg_hostcheck"; then 184 AC_MSG_RESULT(changed) 185 AC_MSG_WARN(config.cache exists!) 186 AC_MSG_ERROR(you must do 'make distclean' first to compile for 187 different target or different parameters.) 188 else 189 AC_MSG_RESULT(ok) 190 fi 191 ]) 192 193 194###################################################################### 195# Check for -fPIC etc (taken from libtool) 196# This sets CFLAGS_PIC to the required flags 197# NO_PIC to yes if it is not possible to 198# generate PIC 199###################################################################### 200dnl GNUPG_CHECK_PIC 201dnl 202define(GNUPG_CHECK_PIC, 203 [ AC_MSG_CHECKING(for option to create PIC) 204 CFLAGS_PIC= 205 NO_PIC=no 206 if test "$cross_compiling" = yes; then 207 AC_MSG_RESULT(assume none) 208 else 209 if test "$GCC" = yes; then 210 CFLAGS_PIC="-fPIC" 211 else 212 case "$host_os" in 213 aix3* | aix4*) 214 # All rs/6000 code is PIC 215 # but is there any non-rs/6000 AIX platform? 216 ;; 217 218 hpux9* | hpux10*) 219 CFLAGS_PIC="+Z" 220 ;; 221 222 irix5* | irix6*) 223 # PIC (with -KPIC) is the default. 224 ;; 225 226 osf3* | osf4*) 227 # FIXME - pic_flag is probably required for 228 # hppa*-osf* and i860-osf* 229 ;; 230 231 sco3.2v5*) 232 CFLAGS_PIC='-Kpic' 233 ;; 234 235 solaris2* | solaris7* ) 236 CFLAGS_PIC='-KPIC' 237 ;; 238 239 sunos4*) 240 CFLAGS_PIC='-PIC' 241 ;; 242 243 *) 244 NO_PIC=yes 245 ;; 246 esac 247 fi 248 249 case "$host_cpu" in 250 rs6000 | powerpc | powerpcle) 251 # Yippee! All RS/6000 and PowerPC code is position-independent. 252 CFLAGS_PIC="" 253 ;; 254 esac 255 256 if test "$NO_PIC" = yes; then 257 AC_MSG_RESULT(not possible) 258 else 259 if test -z "$CFLAGS_PIC"; then 260 AC_MSG_RESULT(none) 261 else 262 AC_MSG_RESULT($CFLAGS_PIC) 263 fi 264 fi 265 fi 266 ]) 267 268 269###################################################################### 270# Check for export-dynamic flag 271# This sets CFLAGS_EXPORTDYNAMIC to the required flags 272###################################################################### 273dnl GNUPG_CHECK_EXPORTDYNAMIC 274dnl 275define(GNUPG_CHECK_EXPORTDYNAMIC, 276 [ AC_MSG_CHECKING(how to specify -export-dynamic) 277 if test "$cross_compiling" = yes; then 278 AC_MSG_RESULT(assume none) 279 CFLAGS_EXPORTDYNAMIC="" 280 else 281 AC_CACHE_VAL(gnupg_cv_export_dynamic,[ 282 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -Wl,--version 2>&1 | 283 grep "GNU ld" >/dev/null]); then 284 # using gnu's linker 285 gnupg_cv_export_dynamic="-Wl,-export-dynamic" 286 else 287 case "$host_os" in 288 hpux* ) 289 gnupg_cv_export_dynamic="-Wl,-E" 290 ;; 291 * ) 292 gnupg_cv_export_dynamic="" 293 ;; 294 esac 295 fi 296 ]) 297 AC_MSG_RESULT($gnupg_cv_export_dynamic) 298 CFLAGS_EXPORTDYNAMIC="$gnupg_cv_export_dynamic" 299 fi 300 ]) 301 302##################################################################### 303# Check for SysV IPC (from GIMP) 304# And see whether we have a SHM_LOCK (FreeBSD does not have it). 305##################################################################### 306dnl GNUPG_CHECK_IPC 307dnl 308define(GNUPG_CHECK_IPC, 309 [ AC_CHECK_HEADERS(sys/ipc.h sys/shm.h) 310 if test "$ac_cv_header_sys_shm_h" = "yes"; then 311 AC_MSG_CHECKING(whether IPC_RMID allowes subsequent attaches) 312 AC_CACHE_VAL(gnupg_cv_ipc_rmid_deferred_release, 313 AC_TRY_RUN([ 314 #include <sys/types.h> 315 #include <sys/ipc.h> 316 #include <sys/shm.h> 317 int main() 318 { 319 int id; 320 char *shmaddr; 321 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777); 322 if (id == -1) 323 exit (2); 324 shmaddr = shmat (id, 0, 0); 325 shmctl (id, IPC_RMID, 0); 326 if ((char*) shmat (id, 0, 0) == (char*) -1) 327 { 328 shmdt (shmaddr); 329 exit (1); 330 } 331 shmdt (shmaddr); 332 shmdt (shmaddr); 333 exit (0); 334 } 335 ], 336 gnupg_cv_ipc_rmid_deferred_release="yes", 337 gnupg_cv_ipc_rmid_deferred_release="no", 338 gnupg_cv_ipc_rmid_deferred_release="assume-no") 339 ) 340 if test "$gnupg_cv_ipc_rmid_deferred_release" = "yes"; then 341 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE,1, 342 [Defined if we can do a deferred shm release]) 343 AC_MSG_RESULT(yes) 344 else 345 if test "$gnupg_cv_ipc_rmid_deferred_release" = "no"; then 346 AC_MSG_RESULT(no) 347 else 348 AC_MSG_RESULT([assuming no]) 349 fi 350 fi 351 352 AC_MSG_CHECKING(whether SHM_LOCK is available) 353 AC_CACHE_VAL(gnupg_cv_ipc_have_shm_lock, 354 AC_TRY_COMPILE([#include <sys/types.h> 355 #include <sys/ipc.h> 356 #include <sys/shm.h>],[ 357 int shm_id; 358 shmctl(shm_id, SHM_LOCK, 0); 359 ], 360 gnupg_cv_ipc_have_shm_lock="yes", 361 gnupg_cv_ipc_have_shm_lock="no" 362 ) 363 ) 364 if test "$gnupg_cv_ipc_have_shm_lock" = "yes"; then 365 AC_DEFINE(IPC_HAVE_SHM_LOCK,1, 366 [Defined if a SysV shared memory supports the LOCK flag]) 367 AC_MSG_RESULT(yes) 368 else 369 AC_MSG_RESULT(no) 370 fi 371 fi 372 ]) 373 374 375###################################################################### 376# Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock 377# is not called from uid 0 (not tested whether uid 0 works) 378# For DECs Tru64 we have also to check whether mlock is in librt 379# mlock is there a macro using memlk() 380###################################################################### 381dnl GNUPG_CHECK_MLOCK 382dnl 383define(GNUPG_CHECK_MLOCK, 384 [ AC_CHECK_FUNCS(mlock) 385 if test "$ac_cv_func_mlock" = "no"; then 386 AC_CHECK_HEADERS(sys/mman.h) 387 if test "$ac_cv_header_sys_mman_h" = "yes"; then 388 # Add librt to LIBS: 389 AC_CHECK_LIB(rt, memlk) 390 AC_CACHE_CHECK([whether mlock is in sys/mman.h], 391 gnupg_cv_mlock_is_in_sys_mman, 392 [AC_TRY_LINK([ 393 #include <assert.h> 394 #ifdef HAVE_SYS_MMAN_H 395 #include <sys/mman.h> 396 #endif 397 ], [ 398 int i; 399 400 /* glibc defines this for functions which it implements 401 * to always fail with ENOSYS. Some functions are actually 402 * named something starting with __ and the normal name 403 * is an alias. */ 404 #if defined (__stub_mlock) || defined (__stub___mlock) 405 choke me 406 #else 407 mlock(&i, 4); 408 #endif 409 ; return 0; 410 ], 411 gnupg_cv_mlock_is_in_sys_mman=yes, 412 gnupg_cv_mlock_is_in_sys_mman=no)]) 413 if test "$gnupg_cv_mlock_is_in_sys_mman" = "yes"; then 414 AC_DEFINE(HAVE_MLOCK,1, 415 [Defined if the system supports an mlock() call]) 416 fi 417 fi 418 fi 419 if test "$ac_cv_func_mlock" = "yes"; then 420 AC_CHECK_FUNCS(sysconf getpagesize) 421 AC_MSG_CHECKING(whether mlock is broken) 422 AC_CACHE_VAL(gnupg_cv_have_broken_mlock, 423 AC_TRY_RUN([ 424#include <stdlib.h> 425#include <unistd.h> 426#include <errno.h> 427#include <sys/mman.h> 428#include <sys/types.h> 429#include <fcntl.h> 430 431int main() 432{ 433 char *pool; 434 int err; 435 long int pgsize; 436 437#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) 438 pgsize = sysconf(_SC_PAGESIZE); 439#elif defined(HAVE_GETPAGESIZE) 440 pgsize = getpagesize(); 441#else 442 pgsize = -1; 443#endif 444 445 if(pgsize==-1) 446 pgsize = 4096; 447 448 pool = malloc( 4096 + pgsize ); 449 if( !pool ) 450 return 2; 451 pool += (pgsize - ((long int)pool % pgsize)); 452 453 err = mlock( pool, 4096 ); 454 if( !err || errno == EPERM ) 455 return 0; /* okay */ 456 457 return 1; /* hmmm */ 458} 459 460 ], 461 gnupg_cv_have_broken_mlock="no", 462 gnupg_cv_have_broken_mlock="yes", 463 gnupg_cv_have_broken_mlock="assume-no" 464 ) 465 ) 466 if test "$gnupg_cv_have_broken_mlock" = "yes"; then 467 AC_DEFINE(HAVE_BROKEN_MLOCK,1, 468 [Defined if the mlock() call does not work]) 469 AC_MSG_RESULT(yes) 470 AC_CHECK_FUNCS(plock) 471 else 472 if test "$gnupg_cv_have_broken_mlock" = "no"; then 473 AC_MSG_RESULT(no) 474 else 475 AC_MSG_RESULT(assuming no) 476 fi 477 fi 478 fi 479 ]) 480 481 482################################################################ 483# GNUPG_PROG_NM - find the path to a BSD-compatible name lister 484AC_DEFUN([GNUPG_PROG_NM], 485[AC_MSG_CHECKING([for BSD-compatible nm]) 486AC_CACHE_VAL(ac_cv_path_NM, 487[if test -n "$NM"; then 488 # Let the user override the test. 489 ac_cv_path_NM="$NM" 490else 491 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" 492 for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do 493 test -z "$ac_dir" && ac_dir=. 494 if test -f $ac_dir/nm; then 495 # Check to see if the nm accepts a BSD-compat flag. 496 # Adding the `sed 1q' prevents false positives on HP-UX, which says: 497 # nm: unknown option "B" ignored 498 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then 499 ac_cv_path_NM="$ac_dir/nm -B" 500 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then 501 ac_cv_path_NM="$ac_dir/nm -p" 502 else 503 ac_cv_path_NM="$ac_dir/nm" 504 fi 505 break 506 fi 507 done 508 IFS="$ac_save_ifs" 509 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm 510fi]) 511NM="$ac_cv_path_NM" 512AC_MSG_RESULT([$NM]) 513AC_SUBST(NM) 514]) 515 516# GNUPG_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed 517# by C symbol name from nm. 518AC_DEFUN([GNUPG_SYS_NM_PARSE], 519[AC_REQUIRE([AC_CANONICAL_HOST])dnl 520AC_REQUIRE([GNUPG_PROG_NM])dnl 521# Check for command to grab the raw symbol name followed by C symbol from nm. 522AC_MSG_CHECKING([command to parse $NM output]) 523AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe, 524[# These are sane defaults that work on at least a few old systems. 525# {They come from Ultrix. What could be older than Ultrix?!! ;)} 526 527changequote(,)dnl 528# Character class describing NM global symbol codes. 529ac_symcode='[BCDEGRSTU]' 530 531# Regexp to match symbols that can be accessed directly from C. 532ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' 533 534# Transform the above into a raw symbol and a C symbol. 535ac_symxfrm='\1 \1' 536 537# Define system-specific variables. 538case "$host_os" in 539aix*) 540 ac_symcode='[BCDTU]' 541 ;; 542freebsd* | netbsd* | openbsd* | bsdi* | sunos* | cygwin32* | mingw32*) 543 ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)' 544 ac_symxfrm='_\1 \1' 545 ;; 546irix*) 547 # Cannot use undefined symbols on IRIX because inlined functions mess us up. 548 ac_symcode='[BCDEGRST]' 549 ;; 550solaris*) 551 ac_symcode='[BDTU]' 552 ;; 553esac 554 555# If we're using GNU nm, then use its standard symbol codes. 556if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then 557 ac_symcode='[ABCDGISTUW]' 558fi 559 560case "$host_os" in 561cygwin32* | mingw32*) 562 # We do not want undefined symbols on cygwin32. The user must 563 # arrange to define them via -l arguments. 564 ac_symcode='[ABCDGISTW]' 565 ;; 566esac 567changequote([,])dnl 568 569# Write the raw and C identifiers. 570ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'" 571 572# Check to see that the pipe works correctly. 573ac_pipe_works=no 574cat > conftest.$ac_ext <<EOF 575#ifdef __cplusplus 576extern "C" { 577#endif 578char nm_test_var; 579void nm_test_func(){} 580#ifdef __cplusplus 581} 582#endif 583int main(){nm_test_var='a';nm_test_func;return 0;} 584EOF 585if AC_TRY_EVAL(ac_compile); then 586 # Now try to grab the symbols. 587 ac_nlist=conftest.nm 588 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then 589 590 # Try sorting and uniquifying the output. 591 if sort "$ac_nlist" | uniq > "$ac_nlist"T; then 592 mv -f "$ac_nlist"T "$ac_nlist" 593 ac_wcout=`wc "$ac_nlist" 2>/dev/null` 594changequote(,)dnl 595 ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` 596changequote([,])dnl 597 (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1 598 else 599 rm -f "$ac_nlist"T 600 ac_count=-1 601 fi 602 603 # Make sure that we snagged all the symbols we need. 604 if egrep ' _?nm_test_var$' "$ac_nlist" >/dev/null; then 605 if egrep ' _?nm_test_func$' "$ac_nlist" >/dev/null; then 606 cat <<EOF > conftest.c 607#ifdef __cplusplus 608extern "C" { 609#endif 610 611EOF 612 # Now generate the symbol file. 613 sed 's/^.* _\{0,1\}\(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c 614 615 cat <<EOF >> conftest.c 616#if defined (__STDC__) && __STDC__ 617# define __ptr_t void * 618#else 619# define __ptr_t char * 620#endif 621 622/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ 623int dld_preloaded_symbol_count = $ac_count; 624 625/* The mapping between symbol names and symbols. */ 626struct { 627 char *name; 628 __ptr_t address; 629} 630changequote(,)dnl 631dld_preloaded_symbols[] = 632changequote([,])dnl 633{ 634EOF 635 sed 's/^_\{0,1\}\(.*\) _\{0,1\}\(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c 636 cat <<\EOF >> conftest.c 637 {0, (__ptr_t) 0} 638}; 639 640#ifdef __cplusplus 641} 642#endif 643EOF 644 # Now try linking the two files. 645 mv conftest.$ac_objext conftestm.$ac_objext 646 ac_save_LIBS="$LIBS" 647 ac_save_CFLAGS="$CFLAGS" 648 LIBS="conftestm.$ac_objext" 649 CFLAGS="$CFLAGS$no_builtin_flag" 650 if AC_TRY_EVAL(ac_link) && test -s conftest; then 651 ac_pipe_works=yes 652 else 653 echo "configure: failed program was:" >&AC_FD_CC 654 cat conftest.c >&AC_FD_CC 655 fi 656 LIBS="$ac_save_LIBS" 657 CFLAGS="$ac_save_CFLAGS" 658 else 659 echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC 660 fi 661 else 662 echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC 663 fi 664 else 665 echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC 666 fi 667else 668 echo "$progname: failed program was:" >&AC_FD_CC 669 cat conftest.c >&AC_FD_CC 670fi 671rm -rf conftest* 672 673# Do not use the global_symbol_pipe unless it works. 674test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe= 675]) 676 677ac_result=yes 678if test -z "$ac_cv_sys_global_symbol_pipe"; then 679 ac_result=no 680fi 681AC_MSG_RESULT($ac_result) 682]) 683 684# GNUPG_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32 685AC_DEFUN([GNUPG_SYS_LIBTOOL_CYGWIN32], 686[AC_CHECK_TOOL(DLLTOOL, dlltool, false) 687AC_CHECK_TOOL(AS, as, false) 688]) 689 690# GNUPG_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols 691# with an underscore? 692AC_DEFUN([GNUPG_SYS_SYMBOL_UNDERSCORE], 693[tmp_do_check="no" 694case "${host}" in 695 *-mingw32*) 696 ac_cv_sys_symbol_underscore=yes 697 ;; 698 i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp) 699 ac_cv_sys_symbol_underscore=yes 700 ;; 701 *) 702 if test "$cross_compiling" = yes; then 703 if test "x$ac_cv_sys_symbol_underscore" = x; then 704 ac_cv_sys_symbol_underscore=yes 705 fi 706 else 707 tmp_do_check="yes" 708 fi 709 ;; 710esac 711 712if test "$tmp_do_check" = "yes"; then 713AC_REQUIRE([GNUPG_PROG_NM])dnl 714AC_REQUIRE([GNUPG_SYS_NM_PARSE])dnl 715AC_MSG_CHECKING([for _ prefix in compiled symbols]) 716AC_CACHE_VAL(ac_cv_sys_symbol_underscore, 717[ac_cv_sys_symbol_underscore=no 718cat > conftest.$ac_ext <<EOF 719void nm_test_func(){} 720int main(){nm_test_func;return 0;} 721EOF 722if AC_TRY_EVAL(ac_compile); then 723 # Now try to grab the symbols. 724 ac_nlist=conftest.nm 725 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then 726 # See whether the symbols have a leading underscore. 727 if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then 728 ac_cv_sys_symbol_underscore=yes 729 else 730 if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then 731 : 732 else 733 echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC 734 fi 735 fi 736 else 737 echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC 738 fi 739else 740 echo "configure: failed program was:" >&AC_FD_CC 741 cat conftest.c >&AC_FD_CC 742fi 743rm -rf conftest* 744]) 745else 746AC_MSG_CHECKING([for _ prefix in compiled symbols]) 747fi 748AC_MSG_RESULT($ac_cv_sys_symbol_underscore) 749if test x$ac_cv_sys_symbol_underscore = xyes; then 750 AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1, 751 [Defined if compiled symbols have a leading underscore]) 752fi 753]) 754 755dnl Stolen from gcc 756dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead 757dnl of the usual 2. 758AC_DEFUN([GNUPG_FUNC_MKDIR_TAKES_ONE_ARG], 759[AC_CHECK_HEADERS(sys/stat.h unistd.h direct.h) 760AC_CACHE_CHECK([if mkdir takes one argument], gnupg_cv_mkdir_takes_one_arg, 761[AC_TRY_COMPILE([ 762#include <sys/types.h> 763#ifdef HAVE_SYS_STAT_H 764# include <sys/stat.h> 765#endif 766#ifdef HAVE_UNISTD_H 767# include <unistd.h> 768#endif 769#ifdef HAVE_DIRECT_H 770# include <direct.h> 771#endif], [mkdir ("foo", 0);], 772 gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)]) 773if test $gnupg_cv_mkdir_takes_one_arg = yes ; then 774 AC_DEFINE(MKDIR_TAKES_ONE_ARG,1, 775 [Defined if mkdir() does not take permission flags]) 776fi 777]) 778 779# GNUPG_AC_INIT([PACKAGE, VERSION, [ISDEVEL], BUG-REPORT) 780# ---------------------------------------- 781# Call AC_INIT with an additional argument to indicate a development 782# version. If this is called ""svn", the global revision of the 783# repository will be appended, so that a version. The variable 784# SVN_REVISION will always be set. In case svn is not available 0 785# will be used for the revision. 786m4_define([GNUPG_AC_INIT], 787[ 788m4_define(gnupg_ac_init_tmp, m4_esyscmd([echo -n $((svn info 2>/dev/null || \ 789 echo 'Revision: 0') |sed -n '/^Revision:/ {s/[^0-9]//gp;q}')])) 790SVN_REVISION="gnupg_ac_init_tmp[]" 791AC_INIT([$1], [$2][]m4_ifval([$3],[-[$3][]gnupg_ac_init_tmp],[]), [$4]) 792]) 793 794