dnl ##define([AC_CACHE_LOAD], )dnl dnl--------------------------------------------------------------------------- dnl configure-script template dnl dnl--------------------------------------------------------------------------- dnl TODO: allow the use of hosts//machine.h.in resp Makefile.in dnl TODO:: when existing instead of the normal ones. dnl dnl some helper macros dnl dnl Check if the compiler in use supports the given argument as command-line dnl switch and adds it to the list of variables given as second argument if dnl supported. AC_DEFUN([LD_CHECK_CC_SWITCH], [ ld_cc_switch_savecflags="$CFLAGS" CFLAGS="${CFLAGS} $1" AC_MSG_CHECKING([whether compiler supports $1]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[]], [[]])], [AC_MSG_RESULT([yes])] CFLAGS="$ld_cc_switch_savecflags" for v in $2; do todo="$v=\"\$$v $1\"" eval "$todo"; done, [AC_MSG_RESULT([no])] CFLAGS="$ld_cc_switch_savecflags" ) ] ) AC_DEFUN([AC_UPDATE_VAR], [if test "x$[$1]" = "x" && test "x$DEFAULT[$1]" != "x"; then [$1]=$DEFAULT[$1] fi] ) AC_DEFUN([AC_CDEF_FROM_ENABLE], [AC_UPDATE_VAR(enable_[$1]) if test "x$enable_[$1]" = "xyes"; then cdef_[$1]="#define" else cdef_[$1]="#undef" fi ]) AC_DEFUN([AC_INT_VAL_FROM_WITH], [if test "x$with_[$1]" != "x"; then with_[$1]=`echo $with_[$1]| changequote(, )dnl sed -e 's/^\(-\?\(0x[0-9a-fA-F]\+\)\?[0-9]*\)[^0-9]\?.*$/\1/'` changequote([, ])dnl fi AC_UPDATE_VAR(with_[$1]) val_[$1]=$with_[$1]] ) AC_DEFUN([AC_STRING_VAL_FROM_WITH], [if test "x$with_[$1]" != "x"; then with_[$1]=`echo $with_[$1]| changequote(, )dnl sed -e 's/^\([^"]*\)\?.*$/\1/'` changequote([, ])dnl fi AC_UPDATE_VAR(with_[$1]) val_[$1]="\"$with_[$1]\""] ) AC_DEFUN([AC_TEXT_VAL_FROM_WITH], [if test "x$with_[$1]" != "x"; then with_[$1]=`echo $with_[$1]| changequote(, )dnl sed -e 's/^\([^"]*\)\?.*$/\1/'` changequote([, ])dnl fi AC_UPDATE_VAR(with_[$1]) val_[$1]="$with_[$1]"] ) AC_DEFUN([AC_FORM_HELP],[ --$1[]dnl ifelse([$2],,,dnl builtin(format,%[.]builtin(eval,(len([$1])<50)*(50-len([$1])))s,) [default=$2])[]dnl ifelse([$3],,,[[ ]patsubst([$3],[^],[ ])])[]dnl ]) AC_DEFUN([AC_MY_ARG_ENABLE], [DEFAULTenable_[]translit([$1],[-],[_])=[$2] AC_ARG_ENABLE([$1],[AC_FORM_HELP([enable-$1]ifelse([$3],,,[=($3)]), ifelse([$2],,[disabled],[$2],no,[disabled],[$2],yes,[enabled],[enabled($2)]), [$4])],[$5],[$6]) ]) AC_DEFUN([AC_MY_ARG_WITH], [DEFAULTwith_[]translit([$1],[-],[_])=[$2] AC_ARG_WITH([$1],[AC_FORM_HELP([with-$1]ifelse([$3],,[=VALUE],[=$3]), [$2], [$4])],[$5],[$6]) ]) AC_DEFUN([AC_NOT_AVAILABLE], [if test "x$not_available" = "x"; then not_available="$1" else not_available="[$not_available], $1" fi]) dnl Search for library $2. dnl First try using pkg-config, put its results into $1_LIBS and $1_CFLAGS. dnl Then try searching in /usr/include, /usr/include/$4 and ${$5}. dnl Try to compile $6. dnl Look for library $7 with function $8 dnl If successful set $3 to yes, otherwise to no. dnl Only do this if $9 is set to "yes" AC_DEFUN([AC_MY_SEARCH_LIB], [ if test "x$[$9]" = "xyes"; then saveflags="$CFLAGS" saveeflags="$EXTRA_CFLAGS" ifdef([PKG_CHECK_MODULES],[ PKG_CHECK_MODULES([$1],[$2],[$3]=yes,[$3]=no) ],[ [$3]=no ]) # No pkg-config, search manually. if test "$[$3]" = "no"; then AC_MSG_CHECKING(for [$4] support) for TESTPATH in "" "${[$5]}" "${[$5]}/include" "${[$5]}/include/[$4]" "/usr/include/[$4]" "/usr/local/include" "/usr/local/include/[$4]" ; do if test "x$TESTPATH" != "x"; then CFLAGS="$saveflags -I$TESTPATH" else CFLAGS="$saveflags" fi AC_TRY_COMPILE([$6],, [$3]=yes if test "x$TESTPATH" != "x"; then EXTRA_CFLAGS="-I$TESTPATH $EXTRA_CFLAGS" fi break; , CFLAGS="$saveflags" ) done AC_MSG_RESULT($[$3]) elif test "x$[$1]_CFLAGS" != "x"; then EXTRA_CFLAGS="$[$1]_CFLAGS $EXTRA_CFLAGS" fi if test "$[$3]" = "yes"; then if test "x$[$1]_LIBS" != "x"; then PKGLIBS="$PKGLIBS $[$1]_LIBS" else tmp="" for TESTPATH in "" "${[$5]}" "${[$5]}/lib" "${[$5]}/lib/[$4]" "/usr/lib/[$4]" "/usr/local/lib" "/usr/local/lib/[$4]" ; do if test "x$TESTPATH" != "x"; then CFLAGS="$saveflags -L$TESTPATH" else CFLAGS="$saveflags" fi AC_CHECK_LIB([$7],[$8], if test "x$TESTPATH" != "x"; then tmp="$PKGLIBS -L$TESTPATH -l[$7]" else tmp="$PKGLIBS -l[$7]" fi break ) done if test "x$tmp" = "x"; then [$3]=no EXTRA_CFLAGS="$saveeflags" else PKGLIBS="$tmp" fi fi CFLAGS="$saveflags" fi fi ]) dnl dnl let's start AC_INIT(prolang.y) dnl set the default prefix AC_PREFIX_DEFAULT(/usr/local/mud) dnl dnl This variable collects those requested features for which the system dnl doesn't offer the right support. not_available="" dnl dnl define default values for package arguments dnl and declare the package arguments dnl AC_MY_ARG_ENABLE(erq,erq,[no/erq/xerq],[Enables and or selects ERQ demon]) AC_MY_ARG_ENABLE(access-control,yes,,[Enable access control]) AC_MY_ARG_ENABLE(access-log,no,,[Log all connection attempts]) AC_MY_ARG_ENABLE(compat-mode,no,,[Enable compat mode]) AC_MY_ARG_ENABLE(strict-euids,no,,[Enforce euids for loading objects]) AC_MY_ARG_ENABLE(filename-spaces,no,,[Allow space characters in filenames]) AC_MY_ARG_ENABLE(share-variables,no,,[Enable clone initialization from blueprint variable values]) AC_MY_ARG_ENABLE(use-ipv6,no,,[Enables support for IPv6]) AC_MY_ARG_ENABLE(use-alists,no,,[Enables alist support]) AC_MY_ARG_ENABLE(use-mccp,no,,[Enables MCCP support]) AC_MY_ARG_ENABLE(use-mysql,no,,[Enables mySQL support]) AC_MY_ARG_ENABLE(use-pgsql,no,,[Enables PostgreSQL support]) AC_MY_ARG_ENABLE(use-sqlite,no,,[Enables SQLite support]) AC_MY_ARG_ENABLE(use-pcre,yes,,[Enables PCRE: no/yes/builtin/no-builtin]) AC_MY_ARG_ENABLE(use-xml,no,,[Enables XML support: no/xml2/iksemel/yes]) AC_MY_ARG_WITH(xml-path,,,[Optional location of the XML include/ and lib/ directory]) AC_MY_ARG_ENABLE(use-deprecated,yes,,[Enables obsolete and deprecated efuns]) AC_MY_ARG_ENABLE(use-structs,yes,,[Enables structs]) AC_MY_ARG_ENABLE(use-tls,no,,[Enables Transport Layer Security over Telnet: no/gnu/ssl/yes]) AC_MY_ARG_WITH(tls-path,,,[Optional location of the TLS include/ and lib/ directory]) AC_MY_ARG_WITH(tls-keyfile,key.pem,,[Default x509 keyfile]) AC_MY_ARG_WITH(tls-certfile,cert.pem,,[Default x509 certificate file]) AC_MY_ARG_WITH(tls-trustfile,no,,[Default filename holding trusted PEM certificates]) AC_MY_ARG_WITH(tls-trustdirectory,no,,[Default directory holding trusted PEM certificates]) AC_MY_ARG_WITH(tls-crlfile,no,,[Default filename holding certificate revocation lists]) AC_MY_ARG_WITH(tls-crldirectory,no,,[Default directory holding certificate revocation lists]) AC_MY_ARG_ENABLE(use-gcrypt,yes,,[Enables support for libgcrypt]) AC_MY_ARG_ENABLE(use-new-inlines,yes,,[Enables new inline syntax]) AC_MY_ARG_ENABLE(use-set-light,yes,,[Enables efun set_light()]) AC_MY_ARG_ENABLE(use-set-is-wizard,yes,,[Enables efun set_is_wizard()]) AC_MY_ARG_ENABLE(use-parse-command,yes,,[Enables efun parse_command()]) AC_MY_ARG_ENABLE(use-process-string,yes,,[Enables efun process_string()]) AC_MY_ARG_ENABLE(lpc-array-calls,yes,,[Enables call_others on arrays of objects]) AC_MY_ARG_ENABLE(comm-stat,yes,,[Enable statistics for outgoing packets]) AC_MY_ARG_ENABLE(apply-cache_stat,yes,,[Enable statistics for apply cache]) AC_MY_ARG_ENABLE(malloc-sbrk,yes,,[Use sbrk() if possible (smalloc,slaballoc)]) AC_MY_ARG_ENABLE(malloc-check,yes,,[Enable simple malloc checks (smalloc,slaballoc)]) AC_MY_ARG_ENABLE(malloc-trace,no,,[Annotate allocations with source file:line]) AC_MY_ARG_ENABLE(malloc-lpc-trace,no,,[Annotate allocations with LPC object info]) AC_MY_ARG_ENABLE(malloc-sbrk-trace,no,,[Log all esbrk() calls (smalloc,slaballoc)]) AC_MY_ARG_ENABLE(dynamic-costs,no,,[Assign eval costs dynamically]) AC_MY_ARG_ENABLE(eval-cost-trace,no,,[Writes the evaluation costs in the stracktrace]) AC_MY_ARG_ENABLE(trace-code,yes,,[trace the most recently executed bytecode]) AC_MY_ARG_ENABLE(rxcache_table,yes,,[Cache compiled regular expressions]) AC_MY_ARG_ENABLE(synchronous-heart-beat,yes,,[Do all heart beats at once.]) AC_MY_ARG_ENABLE(opcprof,no,,[create VM instruction usage statistics]) AC_MY_ARG_ENABLE(verbose-opcprof,no,,[with opcprof: include instruction names]) AC_MY_ARG_ENABLE(debug,yes,,[enable sanity checks]) AC_MY_ARG_ENABLE(yydebug,no,,[enable LPC compiler debug output]) AC_MY_ARG_ENABLE(no-inlines,no,,[disable inlining]) AC_MY_ARG_ENABLE(debug-telnet,no,,[enable telnet machine diagnostics]) AC_MY_ARG_ENABLE(debug-malloc-allocs,no,,[enable small block diagnostics]) AC_MY_ARG_ENABLE(check-object-stat,no,,[trace changes to the object statistics]) AC_MY_ARG_ENABLE(check-mapping-total,no,,[check the mapping statistic]) AC_MY_ARG_ENABLE(check-object-ref,no,,[check object references]) AC_MY_ARG_ENABLE(check-object-gc-ref,yes,,[check object references in GC]) AC_MY_ARG_ENABLE(dump-gc-refs,no,,[trace GC references]) AC_MY_ARG_WITH(optimize,med,,[Optimization level: no/low/med/high]) AC_MY_ARG_WITH(access-file,ACCESS.ALLOW,,[access permissions file]) AC_MY_ARG_WITH(access-log,access.allow.log,,[access log file]) AC_MY_ARG_WITH(write-buffer-max-size,100000,,[max size of write buffer per interactive]) AC_MY_ARG_WITH(erq-max-reply,1024,,[max size of replies from ERQ]) AC_MY_ARG_WITH(erq-max-send,1024,,[max size of commands sent to ERQ, xerq only]) AC_MY_ARG_WITH(erq-debug,0,,[ERQ debug level]) AC_MY_ARG_WITH(read-file-max-size,50000,[BYTES], [maximum size of a file allowed to be read by 'read_file()']) AC_MY_ARG_WITH(master-name,secure/master,,[name of the master object]) AC_MY_ARG_WITH(input-escape,"!",,[input escape character]) AC_MY_ARG_WITH(time-to-clean_up,3600,[SECONDS],[time before cleaning up unused objects]) AC_MY_ARG_WITH(time-to-swap,900,[SECONDS],[time before swapping out unused objects]) AC_MY_ARG_WITH(time-to-swap-variables,1800,[SECONDS],[time before swapping out variables]) AC_MY_ARG_WITH(time-to-reset,1800,[SECONDS],[time between resetting objects]) AC_MY_ARG_WITH(alarm-time,2,[SECONDS],[timer granularity]) AC_MY_ARG_WITH(heart-beat-interval,2,[SECONDS],[time between heartbeats]) AC_MY_ARG_WITH(evaluator-stack-size,2000,,[virtual machine stack size]) AC_MY_ARG_WITH(max-user-trace,60,,[maximum user function call depth]) AC_MY_ARG_WITH(max-trace,65,,[maximum function call depth during error handling]) AC_MY_ARG_WITH(compiler-stack-size,400,,[depth of parser stack]) AC_MY_ARG_WITH(max-bits,6144,,[maximum number of bits in a bit string]) AC_MY_ARG_WITH(portno,4242,,[tcp port to listen on]) AC_MY_ARG_WITH(udp-port,4246,,[udp port to listen on]) AC_MY_ARG_WITH(maxnumports,20,,[maximum number of tcp ports to listen on]) AC_MY_ARG_WITH(max-cost,1000000,,[maximum eval cost for a single evaluation]) AC_MY_ARG_WITH(catch-reserved-cost,2000,,[eval cost reserved for catch()]) AC_MY_ARG_WITH(master-reserved-cost,512,,[eval cost reserved for master]) AC_MY_ARG_WITH(swap-file,LP_SWAP,,[name of the swap file]) AC_MY_ARG_WITH(max-array-size,5000,,[max number of array elements]) AC_MY_ARG_WITH(max-mapping-keys,5000,,[max number of mapping entries]) AC_MY_ARG_WITH(max-mapping-size,15000,,[max number of mapping elements]) AC_MY_ARG_WITH(max-callouts,0,,[max number of callouts; 0=unlimited]) AC_MY_ARG_WITH(max-players,50,,[maximum number of simultaneous players]) AC_MY_ARG_WITH(max-local,50,,[maximum number of local variables per function]) AC_MY_ARG_WITH(allowed-ed-cmds,20,,[number of ed commands per backend cycle]) AC_MY_ARG_WITH(max-command-length,1000,,[maximum length of a command]) AC_MY_ARG_WITH(reserved-user-size,700000,,[memory reserved for user usage]) AC_MY_ARG_WITH(reserved-master-size,100000,,[memory reserved for master usage]) AC_MY_ARG_WITH(reserved-system-size,200000,,[memory reserved for internal usage]) AC_MY_ARG_WITH(htable-size,4096,,[shared string hash table size]) AC_MY_ARG_WITH(itable-size,256,,[identifier hash table size]) AC_MY_ARG_WITH(otable-size,1024,,[object hash table size]) AC_MY_ARG_WITH(defmax,65000,,[maximum expanded size of preprocessor macro]) AC_MY_ARG_WITH(apply-cache-bits,12,,[2^N = size of apply cache]) AC_MY_ARG_WITH(rxcache-table,8192,,[cache size for compiled regular expressions]) AC_MY_ARG_WITH(max-byte-transfer,50000,,[maximum write/read size for read/write_bytes]) AC_MY_ARG_WITH(set-buffer-size-max,65536,,[maximum size of socket send buffer]) AC_MY_ARG_WITH(malloc,default,[default/smalloc/slaballoc/sysmalloc/ptmalloc],[memory manager to use]) AC_MY_ARG_WITH(min-malloced,0,,[amount of memory to allocate on startup]) AC_MY_ARG_WITH(min-small-malloced,0,,[amount of memory to allocate for small blocks on startup]) AC_MY_ARG_WITH(hard-malloc-limit,0x4000000,,[maximum amount of memory to allocate; 0=unlimited]) AC_MY_ARG_WITH(soft-malloc-limit,0,,[soft limit for the amount of memory to allocate; 0=unlimited]) AC_MY_ARG_WITH(total-trace-length,4096,,[number of operations stored in bytecode trace]) AC_MY_ARG_WITH(pcre-recursion-limit,3000,,[maximum number of recursions in PCRE package]) AC_MY_ARG_WITH(wizlist-file,WIZLIST,,[name of the wizlist file]) AC_MY_ARG_WITH(max_net_connects,10,,[maximum number of concurrent connection attempts]) AC_MY_ARG_WITH(random-period-length,19937,[607 / 1279 / 2281 / 4253 / 11213 / 19937 / 44497 / 86243 / 132049 / 216091],[period length of the random number generator]) AC_ARG_WITH(setting,[ --with-setting=SETTING include a predefined setting],[ if test -f "settings/$withval" ; then cat >conftest.sed <<\EOF /^#.*/ d /^[[ \t]]*$/ d s/#.*$// s/disable_\([[^= \t]]*\)/enable_\1=no/ /^enable_/ s/^/DEFAULT/p /^with_/ s/^/DEFAULT/p [] EOF eval `sed -n -f conftest.sed ; must be there! AC_CHECK_HEADERS(limits.h) AC_HEADER_DIRENT dnl check for some functions AC_FUNC_MKTIME AC_FUNC_ALLOCA AC_CHECK_FUNCS(fchmod getrusage bzero memset memcpy memmem strdup strcspn) AC_CHECK_FUNCS(strchr strrchr getcwd memmove sysconf gettimeofday wait3 waitpid) AC_CHECK_FUNCS(fcntl getdomainname poll strtoul trunc) AC_CHECK_FUNCS(mmap getpagesize) if test "x$ac_cv_type_signal" = "xvoid"; then AC_DEFINE(RETSIGTYPE_VOID, 1, [Set in response to the signal handler return type, since not all compilers understand direct definition comparisons. ]) fi # --- Check for common system libraries --- AC_CHECK_LIB(m,main) AC_CHECK_LIB(socket,main) AC_CHECK_LIB(nsl,main) ERQ_LIBS="$LIBS" AC_CHECK_LIB(ucb,main, LIBS="$LIBS -lc -lucb") if test "$ac_cv_lib_socket_main" = "yes" || test "$ac_cv_lib_ucb_main" = "yes"; then AC_CHECK_LIB(nsl,main) fi AC_CACHE_CHECK(if -lresolv is needed, lp_cv_need_lib_resolv, AC_TRY_RUN([ #include void t (void) { herror("foo"); } int main(void) { return 0; } ], lp_cv_need_lib_resolv=no, lp_cv_need_lib_resolv=yes )) if test "$lp_cv_need_lib_resolv" = "yes"; then AC_CHECK_LIB(resolv,main, LIBS="$LIBS -lresolv") fi # --- Check if we need the crypto libraries --- AC_CHECK_FUNCS(crypt _crypt) for lp_lib in crypt crypto; do if test "$ac_cv_func_crypt" != "yes" -a "$ac_cv_func__crypt" != "yes"; then # Try linking with lib$lp_lib unset ac_cv_func_crypt unset ac_cv_func__crypt lp_save_libs="$LIBS" AC_CHECK_LIB($lp_lib,main, LIBS="$LIBS -l$lp_lib") if test "$SAVE_LIBS" != "$LIBS" ; then AC_CHECK_FUNCS(crypt _crypt) if test "$ac_cv_func_crypt" != "yes" -a "$ac_cv_func__crypt" != "yes"; then # They are not in this library LIBS="$lp_save_libs" else eval "lp_cv_need_lib_${lp_lib}=yes" fi fi fi done AC_CACHE_CHECK(if inet_ntoa() ok,lp_cv_func_inet_ntoa_ok, AC_TRY_RUN([ #include /* needed for netinet/in.h */ #include #include main() { char addr1[[]] = "176.88.1.16"; char addr2[[]] = "88.176.128.2"; struct in_addr tmp; #if SIZEOF_INT == 4 #define ADDR_TYPE unsigned int #else #define ADDR_TYPE unsigned long #endif *((ADDR_TYPE *)&tmp) = inet_addr(addr1); if (strcmp(addr1, inet_ntoa(tmp))) exit(1); *((ADDR_TYPE *)&tmp) = inet_addr(addr2); if (strcmp(addr2, inet_ntoa(tmp))) exit(1); exit(0); } ],lp_cv_func_inet_ntoa_ok=yes, lp_cv_func_inet_ntoa_ok=no, AC_TRY_COMPILE([ #if defined(sun) && !defined(__svr4__) #include /* needed for netinet/in.h */ #include #include char *inet_ntoa(ad) struct in_addr ad; { static char addr[[[20]]]; return addr; } #else use inet_ntoa() from the library. #endif ],,lp_cv_func_inet_ntoa_ok=no, lp_cv_func_inet_ntoa_ok=yes ))) if test "$lp_cv_func_inet_ntoa_ok" = "yes" ; then dnl TODO: Is there any platform where this is not the case? AC_DEFINE(INET_NTOA_OK, 1, [Is the library function inet_ntoa() compatible with the compiler?]) fi # --- IPV6 --- AC_CACHE_CHECK(for IPv6 support,lp_cv_has_ipv6, saveflags="$CFLAGS" CFLAGS="$CFLAGS -I/usr/inet6/include" AC_TRY_COMPILE([ #include #include struct sockaddr_in6 foo(void) { static struct sockaddr_in6 ad; return ad; } ],,lp_cv_has_ipv6=yes, lp_cv_has_ipv6=no CFLAGS="$saveflags" )) if test "$lp_cv_has_ipv6" = "yes"; then AC_DEFINE(HAS_IPV6, 1, [Does the machine offer IPv6?]) if test "$enable_use_ipv6" = "yes"; then AC_CACHE_CHECK(if -linet6 is needed, lp_cv_need_lib_inet6, AC_TRY_RUN([ #include #include void t (void) { struct sockaddr_in6 ad; inet6_ntoa(ad.sin_addr); } int main(void) { return 0; } ], lp_cv_need_lib_inet6=no, lp_cv_need_lib_inet6=yes )) if test "$lp_cv_need_lib_inet6" = "yes"; then AC_CHECK_LIB(inet6,main, LIBS="$LIBS -linet6") fi fi else if test "$enable_use_ipv6" = "yes"; then echo "IPV6 not supported - disabling IPV6 support." AC_NOT_AVAILABLE(use-ipv6) fi cdef_use_ipv6="#undef" enable_use_ipv6=no fi # --- TLS --- has_tls=no saveflags="$CFLAGS" saveeflags="$EXTRA_CFLAGS" savelibs="$LIBS" savepkglibs="$PKGLIBS" # Check for OpenSSL unless not desired # Check for the libraries only if tls is actually enabled. if test ! "x${tls_include_path}" = "x"; then CFLAGS="$CFLAGS -I${tls_include_path}" EXTRA_CFLAGS="$EXTRA_CFLAGS -I${tls_include_path}" fi if test ! "x${tls_lib_path}" = "x"; then LIBS="$LIBS -L${tls_lib_path}" PKGLIBS="$PKGLIBS -L${tls_lib_path}" fi if test "$tls_package" = "any" -o "$tls_package" = "ssl"; then AC_CACHE_CHECK(for OpenSSL support,lp_cv_has_openssl, AC_TRY_COMPILE([ #include void foo(void) { int i = SSL_MAX_SSL_SESSION_ID_LENGTH; } ],,lp_cv_has_openssl=yes, lp_cv_has_openssl=no )) if test "$lp_cv_has_openssl" = "yes"; then has_tls=yes tls_package=ssl AC_DEFINE(HAS_OPENSSL, 1, [Does the machine offer OpenSSL/SSL?]) if test "$enable_use_tls" = "yes"; then AC_CACHE_CHECK(if -lssl or similar is needed, lp_cv_need_lib_ssl, AC_TRY_RUN([ #include void t (void) { SSL_library_init(); } int main(void) { return 0; } ], lp_cv_need_lib_ssl=no, lp_cv_need_lib_ssl=yes )) if test "$lp_cv_need_lib_ssl" = "yes"; then lp_cv_has_lib_ssl=no AC_CHECK_LIB(ssl,SSL_library_init, PKGLIBS="$PKGLIBS -lssl" lp_cv_has_lib_ssl=yes ) fi if test "x$lp_cv_need_lib_crypto" != "xyes"; then AC_CACHE_CHECK(if -lcrypto is needed for SSL, lp_cv_need_lib_crypto, AC_TRY_RUN([ #include void t (void) { DH *dhe1024 = NULL; DH_free(dhe1024); } int main(void) { return 0; } ], lp_cv_need_lib_crypto=no, lp_cv_need_lib_crypto=yes )) if test "$lp_cv_need_lib_crypto" = "yes"; then AC_CHECK_LIB(crypto,main, PKGLIBS="$PKGLIBS -lcrypto") fi fi fi else has_tls=no fi fi # Check for GnuTLS unless not desired if test "$tls_package" = "any" -o "$tls_package" = "gnu"; then AC_CACHE_CHECK(for GnuTLS support,lp_cv_has_gnutls, AC_TRY_COMPILE([ #include void foo(void) { int i = GNUTLS_CIPHER_RIJNDAEL_256_CBC; } ],,lp_cv_has_gnutls=yes, lp_cv_has_gnutls=no )) if test "$lp_cv_has_gnutls" = "yes"; then has_tls=yes tls_package=gnu AC_DEFINE(HAS_GNUTLS, 1, [Does the machine offer GnuTLS?]) if test "$enable_use_tls" = "yes"; then AC_CACHE_CHECK(if -lgnutls or similar is needed, lp_cv_need_lib_gnutls, AC_TRY_RUN([ #include void t (void) { gnutls_global_init(); gnutls_global_deinit(); } int main(void) { return 0; } ], lp_cv_need_lib_gnutls=no, lp_cv_need_lib_gnutls=yes )) if test "$lp_cv_need_lib_gnutls" = "yes"; then lp_cv_has_lib_gnutls=no AC_CHECK_LIB(gnutls,gnutls_global_init, PKGLIBS="$PKGLIBS -lgnutls" lp_cv_has_lib_gnutls=yes ) fi AC_CACHE_CHECK(gnutls version, lp_cv_has_gnutls_version, savelibs="$LIBS" LIBS="$PKGLIBS" AC_TRY_RUN([ #include void t (void) { gnutls_dh_params dh_params; gnutls_dh_params_generate2( dh_params, 1024); } int main(void) { return 0; } ], lp_cv_has_gnutls_version=8, lp_cv_has_gnutls_version=7 )) LIBS="$savelibs" AC_DEFINE_UNQUOTED(HAS_GNUTLS_VERSION, $lp_cv_has_gnutls_version, [version of GNUTLS library]) fi else has_tls=no fi fi # Evaluate the results of the checks if test "$has_tls" = "no"; then if test "$enable_use_tls" = "yes"; then echo "TLS not supported - disabling TLS support." AC_NOT_AVAILABLE(use-tls) fi cdef_use_tls="#undef" enable_use_tls=no EXTRA_CFLAGS="$saveeflags" PKGLIBS="$savepkglibs" fi CFLAGS="$saveflags" LIBS="$savelibs" # --- Gcrypt --- if test "$tls_package" != "ssl"; then AC_CACHE_CHECK(for libgcrypt,lp_cv_has_gcrypt, for TESTPATH in "" "$gcrypt_path" "$gcrypt_path/include" "/usr/local/include" ; do saveflags="$CFLAGS" if test "x$TESTPATH" != "x"; then CFLAGS="$saveflags -I$TESTPATH" fi AC_TRY_COMPILE([ #include void foo(void) { int algo = GCRY_MD_SHA1; } ],, lp_cv_has_gcrypt=yes if test "x$TESTPATH" != "x"; then EXTRA_CFLAGS="-I$TESTPATH $EXTRA_CFLAGS" fi break; , lp_cv_has_gcrypt=no CFLAGS="$saveflags" ) done ) if test "$lp_cv_has_gcrypt" = "yes"; then saveflags="$CFLAGS" AC_DEFINE(HAS_GCRYPT, 1, [Does the machine offer libgcrypt?]) if test "$enable_use_gcrypt" = "yes"; then tmp="" AC_CHECK_LIB(gcrypt,gcry_check_version, tmp="$PKGLIBS -lgcrypt") if test "x$tmp" == "x" && test "x$gcrypt_path" != "x"; then unset ac_cv_lib_gcrypt_main if test -d "${gcrypt_path}/lib/gcrypt"; then CFLAGS="$saveflags -L${gcrypt_path}/lib/gcrypt" AC_CHECK_LIB(gcrypt,gcry_check_version, tmp="$PKGLIBS -L${gcrypt_path}/lib/gcrypt -lgcrypt") elif test -d "${gcrypt_path}/lib"; then CFLAGS="$saveflags -L${gcrypt_path}/lib" AC_CHECK_LIB(gcrypt,gcry_check_version, tmp="$PKGLIBS -L${gcrypt_path}/lib -lgcrypt") elif test -d "${gcrypt_patch}"; then CFLAGS="$saveflags -L$gcrypt_path" AC_CHECK_LIB(gcrypt,gcry_check_version, tmp="$PKGLIBS -L$gcrypt_path -lgcrypt") fi fi if test "x$tmp" == "x"; then echo "libgcrypt library not found - disabling gcrypt support" AC_NOT_AVAILABLE(use-gcrypt) cdef_use_gcrypt="#undef" enable_use_gcrypt="no" lp_cv_has_gcrypt="no" else PKGLIBS="$tmp" fi fi CFLAGS="$saveflags" else if test "$enable_use_gcrypt" = "yes"; then AC_NOT_AVAILABLE(use-gcrypt) cdef_use_gcrypt="#undef" enable_use_gcrypt=no fi fi else cdef_use_gcrypt="#undef" enable_use_gcrypt=no fi # --- PCRE --- lp_cv_has_pcre_lib="no" AC_CHECK_LIB(pcre,main, lp_cv_has_pcre_lib="yes") if test "$lp_cv_has_pcre_lib" = "yes"; then saveflags="$CFLAGS" CFLAGS="$CFLAGS -lpcre" AC_CACHE_CHECK(for PCRE usability,lp_cv_has_pcre, AC_TRY_RUN([ #include pcre_extra foo(void) { pcre_version(); } int main(void) { return 0; } ], lp_cv_has_pcre=yes, lp_cv_has_pcre=no )) CFLAGS="$saveflags" if test "$lp_cv_has_pcre" = "yes"; then AC_DEFINE(HAS_PCRE, 1, [Does the machine offer PCRE?]) PKGLIBS="$PKGLIBS -lpcre" else if test "$enable_use_builtin_pcre" = "no" ; then echo "PCRE not available in the system - using builtin version." enable_use_builtin_pcre="yes" cdef_use_builtin_pcre="#define" fi fi fi # --- iconv --- # iconv in glibc 2.2.5 is broken - but not every system even # uses glibc. changequote(,)dnl echo "$as_me:$LINENO: checking for broken iconv in glibc 2.0-2.2" >&5 echo $ECHO_N "checking for broken iconv in glibc 2.0-2.2... $ECHO_C" >&6 if test -f /usr/sbin/iconvconfig; then if /usr/sbin/iconvconfig -V | egrep ' 2\.[0-2]' >/dev/null 2>&1; then lp_cv_has_broken_iconv="yes" lp_cv_has_iconv="no" else lp_cv_has_broken_iconv="no" fi else lp_cv_has_broken_iconv="no" fi echo "$as_me:$LINENO: result: $lp_cv_has_broken_iconv" >&5 echo "${ECHO_T}$lp_cv_has_broken_iconv" >&6 changequote([,])dnl AC_CACHE_CHECK(for iconv,lp_cv_has_iconv, for TESTPATH in "" "/usr/local/include"; do saveflags="$CFLAGS" if test "x$TESTPATH" != "x"; then CFLAGS="-I$TESTPATH $saveflags" fi AC_TRY_COMPILE([ #include iconv_t * foo(void) { return 0; } ],, lp_cv_has_iconv=yes if test "x$TESTPATH" != "x"; then EXTRA_CFLAGS="-I$TESTPATH $EXTRA_CFLAGS" fi break; , lp_cv_has_iconv=no CFLAGS="$saveflags" ) done ) # The system has the include files - now perform further checks if test "x$lp_cv_has_iconv" = "xyes"; then saveflags="$CFLAGS" # Some systems define iconv() to take a non-const 'char**' as first arg. AC_MSG_CHECKING(if iconv takes a non-const char**) CFLAGS="$CFLAGS $EXTRA_CFLAGS" tcomp2='${CC-cc} ${CFLAGS} -o conftest.o -c conftest.c 2>&1' cat > conftest.c < #include int foo(void) { const char * in; return iconv(NULL, &in, NULL, NULL, NULL); } EOF changequote(,)dnl if echo `eval $tcomp2` | egrep '[a-z]' >/dev/null; then # Success means 'we got output' here :-( lp_cv_has_iconv_nonconst_in=yes else lp_cv_has_iconv_nonconst_in=no fi CFLAGS="$saveflags" changequote([,])dnl AC_MSG_RESULT($lp_cv_has_iconv_nonconst_in) # Does the system need to link in libiconv? AC_CACHE_CHECK(if -liconv is needed, lp_cv_need_lib_iconv, AC_TRY_RUN([ #include #include int t (void) { return iconv(NULL, NULL, NULL, NULL, NULL); } int main(void) { return 0; } ], lp_cv_need_lib_iconv=no, lp_cv_need_lib_iconv=yes )) if test "$lp_cv_need_lib_iconv" = "yes"; then # Search the libraries tmp="" AC_CHECK_LIB(iconv,libiconv_close, tmp="$PKGLIBS -liconv") if test "x$tmp" = "x"; then CFLAGS="$saveflags -L/usr/local/lib" AC_CHECK_LIB(iconv,libiconv_close, tmp="$PKGLIBS -L/usr/local/lib -liconv") fi if test "x$tmp" = "x"; then echo "iconv library not found." lp_cv_has_iconv="no" else PKGLIBS="$tmp" fi CFLAGS="$saveflags" fi fi if test "x$lp_cv_has_iconv" = "xyes"; then AC_DEFINE(HAS_ICONV, 1, [Does the machine offer iconv?]) fi if test "x$lp_cv_has_iconv_nonconst_in" = "xyes"; then AC_DEFINE(HAS_ICONV_NONCONST_IN, 1, [Does the machine's iconv take a non-const 'char**' as first arg?]) fi # --- libidn --- AC_CHECK_HEADER(idna.h, lp_cv_has_idn=yes,lp_cv_has_idn=no) AC_CHECK_HEADER(stringprep.h, lp_cv_has_idn=yes,lp_cv_has_idn=no) AC_CHECK_LIB(idn, stringprep_check_version, [lp_cv_has_idn=yes LIBS="${LIBS} -lidn"],lp_cv_has_idn=no) if test "x$lp_cv_has_idn" = "xyes"; then AC_DEFINE(HAS_IDN, 1, [Does the machine offer IDNA?]) fi # --- mySQL --- # Note: Some compilers don't have /usr/local/include in their standard # searchpath. # Note: Some systems require zlib together with mysqlclient, but don't # like it if -lz precedes the -lmysqlclient in the link command. AC_CACHE_CHECK(for mySQL,lp_cv_has_mysql, for TESTPATH in "" "${mysql_path}/include/mysql" "${mysql_path}/include" "${mysql_path}" "/usr/local/mysql/include/mysql" "/usr/local/mysql/include" "/usr/local/include/mysql" "/usr/local/include" "/usr/lib/mysql/include" "/usr/lib/mysql/mysql" "/usr/lib/mysql" "/usr/include/mysql"; do saveflags="$CFLAGS" if test "x$TESTPATH" != "x"; then CFLAGS="-I$TESTPATH $saveflags" fi AC_TRY_COMPILE([ #include #include #include struct MYSQL * foo(void) { static MYSQL var; return &var; } ],, lp_cv_has_mysql=yes if test "x$TESTPATH" != "x"; then EXTRA_CFLAGS="-I$TESTPATH $EXTRA_CFLAGS" fi break; , lp_cv_has_mysql=no CFLAGS="$saveflags" ) done ) # The system has the include files - now search for the libraries. if test "$lp_cv_has_mysql" = "yes"; then saveflags="$CFLAGS" AC_DEFINE(HAS_MYSQL, 1, [Does the machine offer mySQL?]) if test "$enable_use_mysql" = "yes"; then tmp="" if test "x$mysql_path" = "x"; then AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -lmysqlclient") if test "x$tmp" = "x"; then if test -d "/usr/local/mysql/lib/mysql"; then unset ac_cv_lib_mysqlclient_main CFLAGS="$saveflags -L/usr/local/mysql/lib/mysql" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L/usr/local/mysql/lib/mysql -lmysqlclient") elif test -d "/usr/local/mysql/lib"; then unset ac_cv_lib_mysqlclient_main CFLAGS="$saveflags -L/usr/local/mysql/lib" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L/usr/local/mysql/lib -lmysqlclient") elif test -d "/usr/local/lib"; then unset ac_cv_lib_mysqlclient_main CFLAGS="$saveflags -L/usr/local/lib" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L/usr/local/lib -lmysqlclient") elif test -d "/usr/lib/mysql/lib"; then unset ac_cv_lib_mysqlclient_main CFLAGS="$saveflags -L/usr/lib/mysql/lib" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L/usr/lib/mysql/lib -lmysqlclient") fi fi else if test -d "${mysql_path}/lib/mysql"; then CFLAGS="$saveflags -L${mysql_path}/lib/mysql" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L${mysql_path}/lib/mysql -lmysqlclient") elif test -d "${mysql_path}/lib"; then CFLAGS="$saveflags -L${mysql_path}/lib" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L${mysql_path}/lib -lmysqlclient") else CFLAGS="$saveflags -L$mysql_path" AC_CHECK_LIB(mysqlclient,main, tmp="$PKGLIBS -L$mysql_path -lmysqlclient") fi fi if test "x$tmp" = "x"; then echo "mysqlclient library not found - disabling mySQL support" AC_NOT_AVAILABLE(use-mysql) cdef_use_mysql="#undef" enable_use_mysql="no" mysql_path= lp_cv_has_mysql="no" else PKGLIBS="$tmp" fi fi if test "$enable_use_mysql" = "yes"; then # Some systems need additional libraries savelibs="$LIBS" LIBS="$LIBS $PKGLIBS" AC_CACHE_CHECK(if -lz is needed, lp_cv_need_lib_z, AC_TRY_RUN([ #include void t (void) { MYSQL *dat; mysql_real_connect(dat, "localhost", "user", "pwd", "db", 0, 0, 0); } int main(void) { return 0; } ], lp_cv_need_lib_z=no, lp_cv_need_lib_z=yes )) if test "$lp_cv_need_lib_z" = "yes"; then AC_CHECK_LIB(z,main, PKGLIBS="$PKGLIBS -lz") fi AC_CACHE_CHECK(if -lnsl is needed, lp_cv_need_lib_nsl, AC_TRY_RUN([ #include void t (void) { MYSQL *dat; mysql_real_connect(dat, "localhost", "user", "pwd", "db", 0, 0, 0); } int main(void) { return 0; } ], lp_cv_need_lib_nsl=no, lp_cv_need_lib_nsl=yes )) if test "$lp_cv_need_lib_nsl" = "yes"; then AC_CHECK_LIB(nsl,main, PKGLIBS="$PKGLIBS -lnsl") fi LIBS="$savelibs" fi CFLAGS="$saveflags" else if test "$enable_use_mysql" = "yes"; then AC_NOT_AVAILABLE(use-mysql) cdef_use_mysql="#undef" enable_use_mysql=no fi fi # --- # --- PostgreSQL --- # Note: Some compilers don't have /usr/local/include in their standard # searchpath. AC_CACHE_CHECK(for PostgresSQL,lp_cv_has_pgsql, for TESTPATH in "" "$pgsql_path" "$pgsql_path/include" "/usr/local/pgsql/include" "/usr/local/include/pgsql" "/usr/include/pgsql" "/usr/lib/pgsql" "/usr/local/include"; do saveflags="$CFLAGS" if test "x$TESTPATH" != "x"; then CFLAGS="$saveflags -I$TESTPATH" fi AC_TRY_COMPILE([ #include PGconn * foo(void) { static PGconn * var; return var; } ],, lp_cv_has_pgsql=yes if test "x$TESTPATH" != "x"; then EXTRA_CFLAGS="-I$TESTPATH $EXTRA_CFLAGS" fi break; , lp_cv_has_pgsql=no CFLAGS="$saveflags" ) done ) # The system has the include files - now search for the libraries. if test "$lp_cv_has_pgsql" = "yes"; then saveflags="$CFLAGS" AC_DEFINE(HAS_PGSQL, 1, [Does the machine offer PostgreSQL?]) if test "$enable_use_pgsql" = "yes"; then tmp="" AC_CHECK_LIB(pq,main, tmp="$PKGLIBS -lpq") if test "x$pgsql_path" == "x"; then unset ac_cv_lib_pq_main if test -d "${pgsql_path}/lib/pgsql"; then CFLAGS="$saveflags -L${pgsql_path}/lib/pgsql" AC_CHECK_LIB(pq,main, tmp="$PKGLIBS -L${pgsql_path}/lib/pgsql -lpq") elif test -d "${pgsql_path}/lib"; then CFLAGS="$saveflags -L${pgsql_path}/lib" AC_CHECK_LIB(pq,main, tmp="$PKGLIBS -L${pgsql_path}/lib -lpq") elif test -d "${pgsql_patch}"; then CFLAGS="$saveflags -L$pgsql_path" AC_CHECK_LIB(pq,main, tmp="$PKGLIBS -L$pgsql_path -lpq") fi fi if test "x$tmp" == "x"; then unset ac_cv_lib_pq_main if test -d "/usr/local/pgsql/lib"; then CFLAGS="$saveflags -L/usr/local/pgsql/lib" AC_CHECK_LIB(pq,main, tmp="$PKGLIBS -L/usr/local/pgsql/lib -lpq") fi fi if test "x$tmp" == "x"; then echo "libpq library not found - disabling PostgreSQL support" AC_NOT_AVAILABLE(use-pgsql) cdef_use_pgsql="#undef" enable_use_pgsql="no" pgsql_path= lp_cv_has_pgsql="no" else PKGLIBS="$tmp" fi fi if test "x$enable_use_pgsql" = "xyes"; then # Some systems need additional libraries savelibs="$LIBS" LIBS="$LIBS $PKGLIBS" AC_CACHE_CHECK(if -lssl is needed, lp_cv_need_lib_ssl, AC_TRY_RUN([ #include void t (void) { PQconnectStart(""); } int main(void) { return 0; } ], lp_cv_need_lib_ssl=no, lp_cv_need_lib_ssl=yes )) if test "$lp_cv_need_lib_ssl" = "yes"; then AC_CHECK_LIB(ssl,main, PKGLIBS="$PKGLIBS -lssl") fi if test "x$lp_cv_need_lib_crypto" != "xyes"; then AC_CACHE_CHECK(if -lcrypto is needed, lp_cv_need_lib_crypto, AC_TRY_RUN([ #include void t (void) { PQconnectStart(""); } int main(void) { return 0; } ], lp_cv_need_lib_crypto=no, lp_cv_need_lib_crypto=yes )) if test "$lp_cv_need_lib_crypto" = "yes"; then AC_CHECK_LIB(crypto,main, PKGLIBS="$PKGLIBS -lcrypto") fi fi LIBS="$savelibs" fi CFLAGS="$saveflags" else if test "$enable_use_pgsql" = "yes"; then AC_NOT_AVAILABLE(use-pgsql) cdef_use_pgsql="#undef" enable_use_pgsql=no fi fi # --- SQLite3 --- ifdef([PKG_PROG_PKG_CONFIG],[PKG_PROG_PKG_CONFIG()],[]) AC_MY_SEARCH_LIB(SQLITE3,sqlite3,lp_cv_has_sqlite3,sqlite3,xml_path, [ #include sqlite3 * foo(void) { return (sqlite3*)0; } ],sqlite3,sqlite3_exec,enable_use_sqlite) if test "$lp_cv_has_sqlite3" = "yes"; then AC_DEFINE(HAS_SQLITE3, 1, [Does the machine offer SQLite3?]) if test "x$enable_use_sqlite" = "xyes"; then savelibs="$LIBS" LIBS="$LIBS $PKGLIBS" # Check if it uses pthreads AC_SEARCH_LIBS(pthread_create,, lp_cv_sqlite3_uses_pthreads=yes, lp_cv_sqlite3_uses_pthreads=no ) if test "$lp_cv_sqlite3_uses_pthreads" = "yes" ; then AC_DEFINE(SQLITE3_USES_PTHREADS, 1, [Does SQLite3 use pthreads?]) fi LIBS="$savelibs" fi else if test "$enable_use_sqlite" = "yes"; then echo "libsqlite3 library not found - disabling SQLite support" AC_NOT_AVAILABLE(use-sqlite) fi cdef_use_sqlite="#undef" enable_use_sqlite="no" sqlite= fi # --- XML --- has_xml=no if test "$xml_package" = "any" -o "$xml_package" = "xml2"; then AC_MY_SEARCH_LIB(XML2,libxml-2.0,lp_cv_has_xml2,libxml2,xml_path, [ #include void foo(void) { xmlElementType type = XML_ELEMENT_NODE; } ],xml2,xmlParseFile,enable_use_xml) if test "$lp_cv_has_xml2" = "yes"; then if test "$enable_use_xml" = "yes"; then has_xml=yes xml_package=xml2 AC_DEFINE(HAS_XML2, 1, [Does the machine have libxml2?]) fi fi fi if test "$xml_package" = "any" -o "$xml_package" = "iksemel"; then AC_MY_SEARCH_LIB(IKSEMEL,iksemel,lp_cv_has_iksemel,iksemel,xml_path, [ #include iks * foo(void) { return (iks*)0; } ],iksemel,iks_parse,enable_use_xml) if test "$lp_cv_has_iksemel" = "yes"; then if test "$enable_use_xml" = "yes"; then has_xml=yes xml_package=iksemel AC_DEFINE(HAS_IKSEMEL, 1, [Does the machine have Iksemel?]) fi fi fi if test "$has_xml" = "no"; then if test "$enable_use_xml" = "yes"; then echo "XML not supported - disabling XML support." AC_NOT_AVAILABLE(use-xml) fi cdef_use_xml="#undef" enable_use_xml=no fi # --- Check if we need zlib libraries for mccp --- if test "x$enable_use_mccp" = "x" || test "x$enable_use_mccp" = "xyes"; then if test "$lp_cv_need_lib_z" != "yes"; then AC_CHECK_LIB(z,main, PKGLIBS="$PKGLIBS -lz" lp_cv_need_lib_z="yes" ) fi if test "$lp_cv_need_lib_z" != "yes"; then echo "libz library not found - disabling MCCP support" AC_NOT_AVAILABLE(use-mccp) cdef_use_mccp="#undef" enable_use_mccp="no" fi fi # --- AC_CACHE_CHECK(if rename handles directories, lp_cv_sys_rename_handles_directories, AC_TRY_RUN([ main() { mkdir("conftestdirfrom", 0770); exit(rename("conftestdirfrom", "conftestdirto")); } ], lp_cv_sys_rename_handles_directories=yes, lp_cv_sys_rename_handles_directories=no)) if test "$lp_cv_sys_rename_handles_directories" = "yes"; then AC_DEFINE(RENAME_HANDLES_DIRECTORIES, 1, [Can rename handle directories?]) fi rmdir conftestdirfrom conftestdirto 2> /dev/null if test "$ac_cv_func_getrusage" = "yes" ; then AC_CACHE_CHECK(full availability of struct rusage members, lp_cv_struct_rusage_full, AC_TRY_COMPILE([ #include /* BSDI 2.0.1 / 2.1 needs this for resource.h */ #include #ifdef HAVE_SYS_RUSAGE_H #include #endif #include #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif ],[ struct rusage rus; long *v = (long *)main; getrusage(RUSAGE_SELF, &rus); *v++ = rus.ru_maxrss; *v++ = rus.ru_ixrss; *v++ = rus.ru_idrss; *v++ = rus.ru_isrss; *v++ = rus.ru_minflt; *v++ = rus.ru_majflt; *v++ = rus.ru_nswap; *v++ = rus.ru_inblock; *v++ = rus.ru_oublock; *v++ = rus.ru_msgsnd; *v++ = rus.ru_msgrcv; *v++ = rus.ru_nsignals; *v++ = rus.ru_nvcsw; *v++ = rus.ru_nivcsw; ],lp_cv_struct_rusage_full=yes,lp_cv_struct_rusage_full=no)) if test "$lp_cv_struct_rusage_full" = "no"; then AC_DEFINE(GETRUSAGE_RESTRICTED, 1, [If so, is it restricted to user and system time?]) fi AC_CACHE_CHECK(struct rusage timeval members with tv_usec, lp_cv_struct_rusage_usec, AC_TRY_COMPILE([ #include /* BSDI 2.0.1 / 2.1 needs this for resource.h */ #include #ifdef HAVE_SYS_RUSAGE_H #include #endif #include #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif ],[ struct rusage rus; long *v = (long *)main; getrusage(RUSAGE_SELF, &rus); *v++ = rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000; *v++ = rus.ru_stime.tv_sec * 1000 + rus.ru_stime.tv_usec / 1000; ], lp_cv_struct_rusage_usec=yes, lp_cv_struct_rusage_usec=no)) if test "$lp_cv_struct_rusage_usec" = "yes"; then AC_DEFINE(RUSAGE_USEC, 1, [Can ru_utime / ru_stime be accessed as a timeval with tv_sec and tv_usec?]) fi else AC_CACHE_CHECK(for getrusage() via syscall(), lp_cv_func_getrusage_via_syscall, AC_TRY_COMPILE([ #include /* BSDI 2.0.1 / 2.1 needs this for resource.h */ #include #include #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif ],[ struct rusage rus; syscall(SYS_GETRUSAGE, RUSAGE_SELF, rus); ], lp_cv_func_getrusage_via_syscall=yes, lp_cv_func_getrusage_via_syscall=no)) if test "$lp_cv_func_getrusage_via_syscall" = "yes"; then AC_DEFINE(HAVE_GETRUSAGE, 1, [Does the system have a getrusage call?]) AC_DEFINE(GETRUSAGE_VIA_SYSCALL, 1, [Is it available as a subfunction of syscall()?]) fi fi dnl I have seen malloc() being declared in on some machines. AC_CACHE_CHECK(if return type of free is void, lp_cv_prop_free_returns_void, AC_TRY_COMPILE([ #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include #endif void free(); ],, lp_cv_prop_free_returns_void=yes, lp_cv_prop_free_returns_void=no)) if test "$lp_cv_prop_free_returns_void" = "yes"; then AC_DEFINE(FREE_RETURNS_VOID, 1, [does free() have void as its returntype?]) fi AC_CACHE_CHECK(if void* or char* from malloc, lp_cv_prop_malloc_return_type, AC_TRY_COMPILE([ #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include #endif #ifdef __STDC__ #define PROT(x) x #else #define PROT(x) () #endif #define POINTER void * POINTER malloc(size_t); #ifdef FREE_RETURNS_VOID void free PROT((POINTER)); #else int free PROT((POINTER)); #endif ],,lp_cv_prop_malloc_return_type="void *", lp_cv_prop_malloc_return_type="char *")) AC_DEFINE_UNQUOTED(POINTER,$lp_cv_prop_malloc_return_type,[what kind of pointer is used by malloc() et al]) AC_CACHE_CHECK(if CHAR_BIT == 8 or undef, lp_cv_prop_charbits_eq_8, AC_TRY_COMPILE([ #include #include #include #include #ifdef HAVE_VALUES_H #include #endif int i=[1/(CHAR_BIT-8)]; ],,lp_cv_prop_charbits_eq_8=no, lp_cv_prop_charbits_eq_8=yes)) if test "$lp_cv_prop_charbits_eq_8" = "yes"; then AC_DEFINE(CHARBIT_MASK, 0xff, [A mask that allows to extract an unsigned char from a signed]) else dnl TODO: this is something I don't really understand... am I too stupid? dnl TODO:: bitmask set to number of bits ?????? *shudder* [Mubo] AC_DEFINE(CHARBIT_MASK, CHAR_BIT) fi AC_CACHE_CHECK(if strtol broken, lp_cv_prop_strtol_broken, dnl the quoting hell wants two start quotes here, but only one end quote... dnl M4 can be wonderful... :-( [Mubo] AC_TRY_RUN([[ #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif int main() { if (strtol("1]", (char **)0, 10) != 1) exit(1); exit(0); } ], lp_cv_prop_strtol_broken=no, lp_cv_prop_strtol_broken=yes)) if test "$lp_cv_prop_strtol_broken" = "yes"; then AC_DEFINE(STRTOL_BROKEN, 1, [the atari strtol() used to consider characters '9' < c < 'A' to be numeric]) fi dnl the following three tests would better be nested, but it seems to overflow dnl internal buffers of m4 AC_CACHE_CHECK(nonblocking using ioctl with FIONBIO, lp_cv_prop_use_ioctl_fionbio, AC_TRY_RUN([ #include /* needed for netinet/in.h */ #include #include #include #include #include #include #include main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; alarm(10); for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); tmp = 1; if (ioctl(s, FIONBIO, &tmp) == -1) exit(1); tmp = sizeof my_sin; s = accept(s, (struct sockaddr *)&my_sin, &tmp); if (s == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) { /* hpux has special problems with sockets from pipe() */ int sockets[[2]]; FILE *fp_read; if(pipe(sockets) < 0) exit(1); fp_read = fdopen(sockets[[0]], "r"); if (fp_read == NULL) exit(1); if (ioctl(fileno(fp_read) , FIONBIO, &tmp) == -1) exit(1); exit(0); } if (errno == EINTR) { close(s); continue; } } break; } exit(1); } ], lp_cv_prop_use_ioctl_fionbio=yes, lp_cv_prop_use_ioctl_fionbio=no, lp_cv_prop_use_ioctl_fionbio=unknown AC_MSG_WARN(You have to supply the correct way to set sockets non-blocking by hand.) )) if test "$lp_cv_prop_use_ioctl_fionbio" = "yes"; then AC_DEFINE(USE_IOCTL_FIONBIO, 1, [How to set a socket non-blocking]) fi AC_CACHE_CHECK(nonblocking using fcntl with O_NDELAY, lp_cv_prop_use_fnctl_o_ndelay, AC_TRY_RUN([ #include /* needed for netinet/in.h */ #include #include #include #include #include #include main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; alarm(10); for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); if (fcntl(s, F_SETFL, O_NDELAY) == -1) exit(1); tmp = sizeof my_sin; s = accept(s, (struct sockaddr *)&my_sin, &tmp); if (s == -1) { if (errno == EWOULDBLOCK) exit(0); if (errno == EAGAIN) exit(0); if (errno == EINTR) { close(s); continue; } } break; } exit(1); } ], lp_cv_prop_use_fnctl_o_ndelay=yes, lp_cv_prop_use_fnctl_o_ndelay=no, lp_cv_prop_use_fnctl_o_ndelay=unknown)) if test "$lp_cv_prop_use_fnctl_o_ndelay" = "yes"; then AC_DEFINE(USE_FCNTL_O_NDELAY, 1, [nonblocking using fcntl with O_NDELAY]) fi AC_CACHE_CHECK(nonblocking using fcntl with FNDELAY, lp_cv_prop_use_fcntl_fndelay, AC_TRY_RUN([ #include /* needed for netinet/in.h */ #include #include #include #include #include #include main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; alarm(10); for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); if (fcntl(s, F_SETFL, FNDELAY) == -1) exit(1); tmp = sizeof my_sin; s = accept(s, (struct sockaddr *)&my_sin, &tmp); if (s == -1) { if (errno == EWOULDBLOCK) exit(0); if (errno == EAGAIN) exit(0); if (errno == EINTR) { close(s); continue; } } break; } exit(1); } ],lp_cv_prop_use_fcntl_fndelay=yes, lp_cv_prop_use_fcntl_fndelay=no, lp_cv_prop_use_fcntl_fndelay=unknown)) if test "$lp_cv_prop_use_fcntl_fndelay" = "yes"; then AC_DEFINE(USE_FCNTL_FNDELAY, 1, [nonblocking using fcntl with FNDELAY]) fi AC_CACHE_CHECK(if fcntl with SETOWN works, lp_cv_prop_use_fcntl_setown, AC_TRY_RUN([ #include /* needed for netinet/in.h */ #include #include #include #include #include #include main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; alarm(10); for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); #ifndef F_SETOWN exit(1); #else if (fcntl(s, F_SETOWN, getpid()) == -1) exit(1); exit(0); #endif } exit(1); } ],lp_cv_prop_use_fcntl_setown=yes, lp_cv_prop_use_fcntl_setown=no, lp_cv_prop_use_fcntl_setown=unknown)) if test "$lp_cv_prop_use_fcntl_setown" = "yes"; then AC_DEFINE(USE_FCNTL_SETOWN, 1, [Can F_SETOWN be used on a socket?]) fi AC_CACHE_CHECK(if OOBINLINE works, lp_cv_prop_use_oobinline, AC_TRY_RUN([ #include /* needed for netinet/in.h */ #include #include #include #include #include #include main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; alarm(10); for (port = 2000; port < 10000; port++) { int on; my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); #ifndef SO_OOBINLINE exit(1); #else on = 1; if (setsockopt(s, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof on) == -1) exit(1); exit(0); #endif } exit(1); } ],lp_cv_prop_use_oobinline=yes, lp_cv_prop_use_oobinline=no, lp_cv_prop_use_oobinline=unknown)) if test "$lp_cv_prop_use_oobinline" = "yes"; then AC_DEFINE(USE_OOBINLINE, 1, [Can SO_OOBINLINE be used on a socket?]) fi AC_CACHE_CHECK(for overlapping bcopy, lp_cv_prop_overlapping_bcopy, AC_TRY_RUN([ main(){ char str[[99]] = "hello world"; bcopy(str, str+2, 12); if(strcmp("hehello world", str)) exit(1); bcopy(str+2, str, 11); if(strcmp("hello worldld", str)) exit(1); exit(0); } ], lp_cv_prop_overlapping_bcopy=yes, lp_cv_prop_overlapping_bcopy=no, lp_cv_prop_overlapping_bcopy=yes)) if test "$lp_cv_prop_overlapping_bcopy" = "yes"; then AC_DEFINE(OVERLAPPING_BCOPY, 1, [Define if you have bcopy, and it handles overlapping ranges correctly.]) fi AC_CACHE_CHECK(if strtol needs const char*, lp_cv_prop_strtol_const_charp, AC_TRY_COMPILE([#ifdef HAVE_STDLIB_H #include #endif long strtol(str, ptr, base) char *str; char **ptr; int base; { return 0; } ],,lp_cv_prop_strtol_const_charp=no, lp_cv_prop_strtol_const_charp=yes)) if test "$lp_cv_prop_strtol_const_charp" = "yes"; then AC_DEFINE(STRTOL_CONST_CHARP, 1, [needs the first argument of strtol be declared as const?]) fi # --- Check for compiler options --- tcomp='${CC-cc} ${CFLAGS} ${TESTFLAG} -o conftest conftest.c >/dev/null 2>&1' tcomp2='${CC-cc} ${CFLAGS} ${TESTFLAG} -o conftest conftest.c 2>&1' tcomp3='${CC-cc} ${CFLAGS} ${TESTFLAG} -c conftest.c >/dev/null 2>&1' cat > conftest.c < #include double d = 4.5; int main(void) { printf("hello world\n"); return 0; } EOF AC_MSG_CHECKING(low optimization CFLAGS) changequote(,)dnl for TESTFLAG in -O; do if eval $tcomp; then if echo `eval $tcomp2` | egrep '[uU]n(recognized|known) [oO]ption' >/dev/null; then : #the [e]grep option -v will not give a failure exit status on the atari else if eval $tcomp; then CFLAGS=$TESTFLAG break fi fi fi done changequote([,])dnl for TESTFLAG in -g; do if eval $tcomp; then CFLAGS="$CFLAGS $TESTFLAG" fi done LCFLAGS=$CFLAGS AC_MSG_RESULT($LCFLAGS) AC_MSG_CHECKING(medium optimization CFLAGS) changequote(,)dnl for TESTFLAG in -O2 -O; do if eval $tcomp; then if echo `eval $tcomp2` | egrep '[uU]n(recognized|known) [oO]ption' >/dev/null; then : #the [e]grep option -v will not give a failure exit status on the atari else if eval $tcomp; then CFLAGS=$TESTFLAG break fi fi fi done for TESTFLAG in -g; do if eval $tcomp; then OPTFLAGS="$OPTFLAGS $TESTFLAG" CFLAGS="$CFLAGS $TESTFLAG" fi done changequote([,])dnl MCFLAGS=$CFLAGS AC_MSG_RESULT($MCFLAGS) AC_MSG_CHECKING(highest optimization CFLAGS) changequote(,)dnl for TESTFLAG in -O4 -O3 -O2 -O; do if eval $tcomp; then if echo `eval $tcomp2` | egrep '[uU]n(recognized|known) [oO]ption' >/dev/null; then : #the [e]grep option -v will not give a failure exit status on the atari else if eval $tcomp; then CFLAGS=$TESTFLAG break fi fi fi done if test "$ac_cv_c_compiler_gnu" = "no"; then for TESTFLAG in -qstrict -qipa -ipo; do if eval $tcomp; then if echo `eval $tcomp2` | egrep '[uU]n(recognized|known) [oO]ption' >/dev/null; then : #the [e]grep option -v will not give a failure exit status on the atari else if eval $tcomp; then CFLAGS="$CFLAGS $TESTFLAG" break fi fi fi done fi changequote([,])dnl # -funroll-all-loops causes some versions of gcc to produce buggy code for TESTFLAG in -fomit-frame-pointer; do if eval $tcomp; then CFLAGS="$CFLAGS $TESTFLAG" fi done OCFLAGS="$CFLAGS $OPTFLAGS" AC_MSG_RESULT($OCFLAGS) if ${CC-cc} -g -c conftest.c ; then DCFLAGS='-g' else DCFLAGS='' fi OPTIMIZE_LINKING='' if ${CC-cc} $OFLAGS -o conftest conftest.c ; then OPTIMIZE_LINKING='$(OPTIMIZE)' fi rm -f conftest.c if test "$ac_cv_lib_socket_main" = "yes"; then AC_EGREP_CPP(yes,[ #if defined(sun) yes #endif ], [ EXTRA_CFLAGS="${EXTRA_CFLAGS} -Dsolaris" ]) fi # Some Unixes require the -n parameter for tail to work properly AC_MSG_CHECKING(if tail accepts the -n parameter) TAIL_N="" if tail -n +2 confdefs.h > /dev/null 2>&1; then AC_MSG_RESULT(yes) TAIL_N="-n" else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(if ${YACC} includes bogus malloc prototypes) cat > conftest.y < #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include #endif #ifdef HAVE_STDLIB_H #include #endif %} %% all: 'a'; %% int main(){ return 0; } int yyerror(){} int yylex(){ return 0; } EOF rm -f y.tab.c y_tab.c ${YACC} conftest.y if mv y.tab.c conftest.c > /dev/null 2>&1; then YACCTAB=y.tab. else mv y_tab.c conftest.c YACCTAB=y_tab. fi if eval $ac_compile 2>&5; then MOVE_YACC_TAB='$(MV) $(YACCTAB)c' CLEAN_YACC_TAB='' AC_MSG_RESULT(no) else MOVE_YACC_TAB='tail $TAIL_N +2 $(YACCTAB)c >' CLEAN_YACC_TAB='$(RM) $(YACCTAB)c' AC_MSG_RESULT(yes) fi rm -f conftest* AC_MSG_CHECKING(for ${YACC} / / -DSGI_SOURCE / afree name clash) cat > conftest.y < /dev/null 2>&1; then YACCTAB=y.tab. else mv y_tab.c conftest.c YACCTAB=y_tab. fi if eval $ac_compile 2>&5 ; then AC_MSG_RESULT(no) else EXTRA_CFLAGS="${EXTRA_CFLAGS} -U_SGI_SOURCE" AC_MSG_RESULT(yes) fi rm -f conftest* SAVE_LIBS="${LIBS}" SAVE_CFLAGS="${CFLAGS}" CFLAGS='' for TESTFLAG in '' -static -Bstatic -n; do AC_MSG_CHECKING(malloc redefinition with linking flag ${TESTFLAG}) LIBS="${SAVE_LIBS} ${TESTFLAG}" cat > conftest.data < #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #else #include #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include #endif #undef malloc #undef calloc int my_malloc_used; int main() { int i, j; FILE *f; alarm(10); /* a crash can be an infinite loop... */ for (i = 0; i < 100; i++) { my_malloc_used = 0; /* strdup seems to be partially unavailable */ f = fopen("conftest.data", "r"); fscanf(f, "%d", &j); fclose(f); if (!my_malloc_used || j != 6*7) exit(1); } /* linking in printf called with variable format makes shared libs * worthwhile. Moreover, calling it is a good test */ printf(f?"%f%% successful\n":(char*)f, 100.); exit(0); } POINTER malloc(size) size_t size; { size_t size2; static char *current_break = 0; char *q; my_malloc_used = 1; if (!current_break) current_break = sbrk(0); size2 = sizeof size + size+7 & ~7; q = current_break; if (brk(current_break+=size2)) exit(1); *(size_t *)q = size; return q + sizeof size; } POINTER calloc(size, num) size_t size, num; { char *q; q = malloc(size*num); memset(q, 0, size); } POINTER realloc(p, size) POINTER p; size_t size; { char *q; if (*(size_t *)p >= size) return p; q = malloc(size); #ifdef HAVE_MEMCPY memcpy(q, p, size); #else bcopy(p, q, size); #endif *(size_t *)q = size; return q + sizeof size; } #ifdef FREE_RETURNS_VOID void free(p) POINTER p; {} #else int free(p) POINTER p; { return 1; } #endif ],SBRK_OK=1) if test -n "${SBRK_OK}"; then if test -z "${TESTFLAG}"; then AC_DEFINE(SBRK_OK, 1, [can we define our own malloc() safely?]) else LDFLAGS="${LDFLAGS} ${TESTFLAG}" EXTRA_CFLAGS="${EXTRA_CFLAGS} -DSBRK_OK" fi break AC_MSG_RESULT(ok) else AC_MSG_RESULT(failed) fi done LIBS="${SAVE_LIBS}" CFLAGS="${SAVE_CFLAGS}" case "$EXTRA_CFLAGS" in *-Dsolaris*) if test "$ac_cv_lib_ucb_main" = "yes"; then LIBS="${LDFLAGS} -lm -lgcc -lc -lnsl -lgcc -lc -ldl_stubs\ -lnswnis -lnswnisplus -lnswfiles -lnswcompat -lstraddr -lswitch\ -ltcpip -lsocket -lnsl -lgcc -lc /usr/ucblib/libucb.a" LDFLAGS= "-u dgettext -lintl" fi ;; *-MSWIN*) LDFLAGS= "$LDFLAGS -luser32 -lwinmm -lkernel32 -lwsock32" ;; esac AC_CACHE_CHECK(malloc overhead,lp_cv_sys_malloc_overhead, cat > conftest.c <