dnl ##define([AC_CACHE_LOAD], )dnl
dnl---------------------------------------------------------------------------
dnl configure-script template
dnl
dnl---------------------------------------------------------------------------
dnl TODO: allow the use of hosts/<foo>/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,"/etc/ssl/certs",,[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 <settings/$withval`
rm conftest.sed
else
AC_MSG_ERROR(Setting \"$withval\" not available)
fi
])
dnl
dnl process package arguments
dnl (here the variable names are used; with a "_" instead of a dash "-" !)
dnl
AC_UPDATE_VAR(enable_erq)
if test "x$enable_erq" = "xerq" || test "x$enable_erq" = "xyes"; then
cdef_erq_demon="#define"
erq_sub=erq
AC_DEFINE(ERQ_INCLUDE,"util/erq/erq.h",[define the erq include file.])
elif test "x$enable_erq" = "xxerq"; then
cdef_erq_demon="#define"
erq_sub=xerq
AC_DEFINE(ERQ_INCLUDE,"util/xerq/erq.h")
else
cdef_erq_demon="#undef"
erq_sub=
fi
AC_UPDATE_VAR(enable_use_pcre)
if test "x$enable_use_pcre" = "x" || test "x$enable_use_pcre" = "xyes"; then
cdef_use_pcre="#define"
cdef_use_builtin_pcre="#undef"
enable_use_builtin_pcre="no"
elif test "x$enable_use_pcre" = "xbuiltin"; then
cdef_use_pcre="#define"
cdef_use_builtin_pcre="#define"
enable_use_pcre="yes"
enable_use_builtin_pcre="yes"
elif test "x$enable_use_pcre" = "xno-builtin"; then
cdef_use_pcre="#undef"
cdef_use_builtin_pcre="#define"
enable_use_pcre="no"
enable_use_builtin_pcre="yes"
else
cdef_use_pcre="#undef"
cdef_use_builtin_pcre="#undef"
enable_use_pcre="no"
enable_use_builtin_pcre="no"
fi
AC_UPDATE_VAR(enable_use_mysql)
if test "x$enable_use_mysql" = "x" || test "x$enable_use_mysql" = "xyes"; then
cdef_use_mysql="#define"
mysql_path=
enable_use_mysql="yes"
elif test "x$enable_use_mysql" = "xno"; then
cdef_use_mysql="#undef"
mysql_path=
else
cdef_use_mysql="#define"
mysql_path="$enable_use_mysql"
enable_use_mysql="yes"
fi
AC_UPDATE_VAR(enable_use_pgsql)
if test "x$enable_use_pgsql" = "x" || test "x$enable_use_pgsql" = "xyes"; then
cdef_use_pgsql="#define"
pgsql_path=
enable_use_pgsql="yes"
elif test "x$enable_use_pgsql" = "xno"; then
cdef_use_pgsql="#undef"
pgsql_path=
else
cdef_use_pgsql="#define"
pgsql_path="$enable_use_pgsql"
enable_use_pgsql="yes"
fi
AC_UPDATE_VAR(enable_use_sqlite)
if test "x$enable_use_sqlite" = "x" || test "x$enable_use_sqlite" = "xyes"; then
cdef_use_sqlite="#define"
sqlite_path=
enable_use_sqlite="yes"
elif test "x$enable_use_sqlite" = "xno"; then
cdef_use_sqlite="#undef"
sqlite_path=
else
cdef_use_sqlite="#define"
sqlite_path="$enable_use_sqlite"
enable_use_sqlite="yes"
fi
AC_UPDATE_VAR(enable_use_xml)
if test "x$enable_use_xml" = "x" || test "x$enable_use_xml" = "xyes"; then
cdef_use_xml="#define"
xml_package="any"
enable_use_xml="yes"
elif test "x$enable_use_xml" = "xno"; then
cdef_use_xml="#undef"
xml_package="any"
else
cdef_use_xml="#define"
xml_package="$enable_use_xml"
enable_use_xml="yes"
fi
AC_UPDATE_VAR(with_xml_path)
if test "x$with_xml_path" = "x" -o "x$with_xml_path" = "xno" ; then
xml_path=""
else
xml_path="$with_xml_path"
fi
AC_UPDATE_VAR(enable_use_tls)
if test "x$enable_use_tls" = "x" || test "x$enable_use_tls" = "xyes"; then
cdef_use_tls="#define"
tls_package="any"
enable_use_tls="yes"
elif test "x$enable_use_tls" = "xno"; then
cdef_use_tls="#undef"
tls_package="any"
else
cdef_use_tls="#define"
tls_package="$enable_use_tls"
enable_use_tls="yes"
fi
AC_UPDATE_VAR(with_tls_path)
if test "x$with_tls_path" = "x" -o "x$with_tls_path" = "xno" ; then
tls_include_path=""
tls_lib_path=""
else
tls_include_path="${with_tls_path}/include"
tls_lib_path="${with_tls_path}/lib"
fi
AC_UPDATE_VAR(enable_use_gcrypt)
if test "x$enable_use_gcrypt" = "x" || test "x$enable_use_gcrypt" = "xyes"; then
cdef_use_gcrypt="#define"
gcrypt_path=
enable_use_gcrypt="yes"
elif test "x$enable_use_gcrypt" = "xno"; then
cdef_use_gcrypt="#undef"
gcrypt_path=
else
cdef_use_gcrypt="#define"
gcrypt_path="$enable_use_gcrypt"
enable_use_gcrypt="yes"
fi
AC_CDEF_FROM_ENABLE(access_control)
AC_CDEF_FROM_ENABLE(access_log)
AC_CDEF_FROM_ENABLE(compat_mode)
AC_CDEF_FROM_ENABLE(strict_euids)
AC_CDEF_FROM_ENABLE(filename_spaces)
AC_CDEF_FROM_ENABLE(share_variables)
AC_CDEF_FROM_ENABLE(use_alists)
AC_CDEF_FROM_ENABLE(use_mccp)
AC_CDEF_FROM_ENABLE(use_ipv6)
AC_CDEF_FROM_ENABLE(use_deprecated)
AC_CDEF_FROM_ENABLE(use_structs)
AC_CDEF_FROM_ENABLE(use_new_inlines)
AC_CDEF_FROM_ENABLE(use_set_light)
AC_CDEF_FROM_ENABLE(use_set_is_wizard)
AC_CDEF_FROM_ENABLE(use_parse_command)
AC_CDEF_FROM_ENABLE(use_process_string)
AC_CDEF_FROM_ENABLE(lpc_array_calls)
AC_CDEF_FROM_ENABLE(comm_stat)
AC_CDEF_FROM_ENABLE(apply_cache_stat)
AC_CDEF_FROM_ENABLE(malloc_sbrk)
AC_CDEF_FROM_ENABLE(malloc_check)
AC_CDEF_FROM_ENABLE(malloc_trace)
AC_CDEF_FROM_ENABLE(malloc_lpc_trace)
AC_CDEF_FROM_ENABLE(malloc_sbrk_trace)
AC_CDEF_FROM_ENABLE(dynamic_costs)
AC_CDEF_FROM_ENABLE(eval_cost_trace)
AC_CDEF_FROM_ENABLE(trace_code)
AC_CDEF_FROM_ENABLE(rxcache_table)
AC_CDEF_FROM_ENABLE(synchronous_heart_beat)
AC_CDEF_FROM_ENABLE(opcprof)
AC_CDEF_FROM_ENABLE(verbose_opcprof)
AC_CDEF_FROM_ENABLE(debug)
AC_CDEF_FROM_ENABLE(yydebug)
AC_CDEF_FROM_ENABLE(no_inlines)
AC_CDEF_FROM_ENABLE(debug_telnet)
AC_CDEF_FROM_ENABLE(debug_malloc_allocs)
AC_CDEF_FROM_ENABLE(check_object_stat)
AC_CDEF_FROM_ENABLE(check_mapping_total)
AC_CDEF_FROM_ENABLE(check_object_ref)
AC_CDEF_FROM_ENABLE(check_object_gc_ref)
AC_CDEF_FROM_ENABLE(dump_gc_refs)
AC_TEXT_VAL_FROM_WITH(optimize)
AC_STRING_VAL_FROM_WITH(access_file)
AC_STRING_VAL_FROM_WITH(access_log)
AC_STRING_VAL_FROM_WITH(swap_file)
AC_STRING_VAL_FROM_WITH(wizlist_file)
AC_STRING_VAL_FROM_WITH(master_name)
AC_STRING_VAL_FROM_WITH(input_escape)
AC_STRING_VAL_FROM_WITH(tls_keyfile)
AC_STRING_VAL_FROM_WITH(tls_certfile)
AC_STRING_VAL_FROM_WITH(tls_trustfile)
AC_STRING_VAL_FROM_WITH(tls_trustdirectory)
AC_STRING_VAL_FROM_WITH(tls_crlfile)
AC_STRING_VAL_FROM_WITH(tls_crldirectory)
AC_TEXT_VAL_FROM_WITH(malloc)
AC_INT_VAL_FROM_WITH(write_buffer_max_size)
AC_INT_VAL_FROM_WITH(erq_max_reply)
AC_INT_VAL_FROM_WITH(erq_max_send)
AC_INT_VAL_FROM_WITH(erq_debug)
AC_INT_VAL_FROM_WITH(read_file_max_size)
AC_INT_VAL_FROM_WITH(time_to_clean_up)
AC_INT_VAL_FROM_WITH(time_to_swap)
AC_INT_VAL_FROM_WITH(time_to_swap_variables)
AC_INT_VAL_FROM_WITH(time_to_reset)
AC_INT_VAL_FROM_WITH(alarm_time)
AC_INT_VAL_FROM_WITH(heart_beat_interval)
AC_INT_VAL_FROM_WITH(evaluator_stack_size)
AC_INT_VAL_FROM_WITH(max_user_trace)
AC_INT_VAL_FROM_WITH(max_trace)
AC_INT_VAL_FROM_WITH(compiler_stack_size)
AC_INT_VAL_FROM_WITH(max_bits)
AC_INT_VAL_FROM_WITH(portno)
AC_INT_VAL_FROM_WITH(maxnumports)
AC_INT_VAL_FROM_WITH(max_cost)
AC_INT_VAL_FROM_WITH(catch_reserved_cost)
AC_INT_VAL_FROM_WITH(master_reserved_cost)
AC_INT_VAL_FROM_WITH(max_array_size)
AC_INT_VAL_FROM_WITH(max_mapping_keys)
AC_INT_VAL_FROM_WITH(max_mapping_size)
AC_INT_VAL_FROM_WITH(max_callouts)
AC_INT_VAL_FROM_WITH(max_players)
AC_INT_VAL_FROM_WITH(max_local)
AC_INT_VAL_FROM_WITH(allowed_ed_cmds)
AC_INT_VAL_FROM_WITH(max_command_length)
AC_INT_VAL_FROM_WITH(reserved_user_size)
AC_INT_VAL_FROM_WITH(reserved_master_size)
AC_INT_VAL_FROM_WITH(reserved_system_size)
AC_INT_VAL_FROM_WITH(htable_size)
AC_INT_VAL_FROM_WITH(itable_size)
AC_INT_VAL_FROM_WITH(otable_size)
AC_INT_VAL_FROM_WITH(defmax)
AC_INT_VAL_FROM_WITH(apply_cache_bits)
AC_INT_VAL_FROM_WITH(rxcache_table)
AC_INT_VAL_FROM_WITH(max_byte_transfer)
AC_INT_VAL_FROM_WITH(udp_port)
AC_INT_VAL_FROM_WITH(set_buffer_size_max)
AC_INT_VAL_FROM_WITH(min_malloced)
AC_INT_VAL_FROM_WITH(min_small_malloced)
AC_INT_VAL_FROM_WITH(hard_malloc_limit)
AC_INT_VAL_FROM_WITH(soft_malloc_limit)
AC_INT_VAL_FROM_WITH(total_trace_length)
AC_INT_VAL_FROM_WITH(pcre_recursion_limit)
AC_INT_VAL_FROM_WITH(max_net_connects)
AC_INT_VAL_FROM_WITH(random_period_length)
if test "x$cdef_access_control" = "x#undef"; then
cdef_access_log="#undef"
val_access_file=
val_access_log=
fi
if test "x$cdef_access_log" = "x#undef"; then
val_access_log=
fi
if test "x$cdef_rxcache_table" = "x#undef"; then
val_rxcache_table=
fi
if test "x$with_wizlist_file" != "xno"; then
cdef_wizlist_file="#define"
if test "x$with_wizlist_file" = "xyes"; then
with_wizlist_file=""
fi
else
cdef_wizlist_file="#undef"
fi
if test "x$cdef_wizlist_file" = "x#undef"; then
val_wizlist_file=
fi
if test "x$with_tls_keyfile" != "xno"; then
cdef_tls_keyfile="#define"
else
cdef_tls_keyfile="#undef"
fi
if test "x$cdef_tls_keyfile" = "x#undef"; then
val_tls_keyfile=
fi
if test "x$with_tls_certfile" != "xno"; then
cdef_tls_certfile="#define"
else
cdef_tls_certfile="#undef"
fi
if test "x$cdef_tls_certfile" = "x#undef"; then
val_tls_certfile=
fi
if test "x$with_tls_trustfile" != "xno"; then
cdef_tls_trustfile="#define"
else
cdef_tls_trustfile="#undef"
fi
if test "x$cdef_tls_trustfile" = "x#undef"; then
val_tls_trustfile=
fi
if test "x$with_tls_trustdirectory" != "xno"; then
cdef_tls_trustdirectory="#define"
else
cdef_tls_trustdirectory="#undef"
fi
if test "x$cdef_tls_trustdirectory" = "x#undef"; then
val_tls_trustdirectory=
fi
if test "x$with_tls_crlfile" != "xno"; then
cdef_tls_crlfile="#define"
else
cdef_tls_crlfile="#undef"
fi
if test "x$cdef_tls_crlfile" = "x#undef"; then
val_tls_crlfile=
fi
if test "x$with_tls_crldirectory" != "xno"; then
cdef_tls_crldirectory="#define"
else
cdef_tls_crldirectory="#undef"
fi
if test "x$cdef_tls_crldirectory" = "x#undef"; then
val_tls_crldirectory=
fi
if test "x$cdef_opcprof" = "x#undef"; then
cdef_verbose_opcprof="#undef"
fi
val_optimize=`echo ${val_optimize} | tr '[a-z]' '[A-Z]'`
dnl
dnl select a C-Compiler
dnl
AC_PROG_CC
# check for ANSI-C (for compiling LDMUD project)
AC_PROG_CC_STDC
if test "${ac_cv_prog_cc_stdc}" = "no"; then
AC_MSG_ERROR(You need an ANSI-C89 or ISO-C (C99) compiler! sorry..)
fi
# --- check for support of various command line switches ---
# -fwrapv is currently needed to enforce defined signed integr overflow (wrap)
# in gcc.
LD_CHECK_CC_SWITCH(-fwrapv, EXTRA_CFLAGS CFLAGS)
# gcc should warn about optimizations based on the assumption, signed integers
# do not overflow/wrap.
LD_CHECK_CC_SWITCH(-Wall, WCFLAGS)
LD_CHECK_CC_SWITCH(-Wparentheses, WCFLAGS)
LD_CHECK_CC_SWITCH(-Wshadow, WCFLAGS)
LD_CHECK_CC_SWITCH(-Wstrict-overflow=2, WCFLAGS)
AC_MSG_CHECKING(warning CFLAGS)
AC_MSG_RESULT($WCFLAGS)
# does the compile have an inline keyword?
AC_C_INLINE
if test "x$ac_cv_c_inline" != "xno"; then
AC_DEFINE(HAS_INLINE, 1, [Does the compiler provide inline functions?])
fi
# does the compile have an restrict keyword?
# temporarily deactivated because it introduces an #if defined x into
# machine.h and mkfunc.c can't deal with 'defined' without parentheses.
#AC_C_RESTRICT
# does the compile have an typeof keyword?
AC_C_TYPEOF
# does the preprocessor support the stringenizing operator?
AC_C_STRINGIZE
# does the compiler support variable length arrays?
AC_C_VARARRAYS
# does the compuler support the volatile keyword?
AC_C_VOLATILE
# check for some types
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INTMAX_T
AC_TYPE_INTPTR_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_TYPE_LONG_DOUBLE
AC_TYPE_LONG_DOUBLE_WIDER
AC_TYPE_SSIZE_T
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
# Check some sizes
AC_CHECK_SIZEOF(char *)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(intptr_t)
AC_CHECK_SIZEOF(intmax_t)
# Checking for programs
AC_PROG_INSTALL
AC_CONFIG_HEADERS(machine.h)
AC_CHECK_PROGS(YACC, byacc "bison -y", yacc)
AC_PROG_CPP
AH_TOP([
#ifndef MACHINE_H
#define MACHINE_H])
AH_BOTTOM([
#endif])
dnl Recognize some unusual systems.
dnl Not all checks happen here - the check for solaris for example requires
dnl some library checks first.
AC_EGREP_CPP(yes,[
#if defined(__CYGWIN32__) || defined(__CYGWIN__)
yes
#endif
],
[ EXTRA_CFLAGS="${EXTRA_CFLAGS} -DMSWIN" ])
dnl Checking for headers
AC_HEADER_STDBOOL
AC_CHECK_HEADERS(sys/rusage.h sys/time.h unistd.h stdlib.h libc.h memory.h)
AC_CHECK_HEADERS(string.h bstring.h netdb.h crypt.h sys/param.h sys/termios.h)
dnl extra check for <limits.h>; 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 <netdb.h>
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 <sys/types.h> /* needed for netinet/in.h */
#include <netinet/in.h>
#include <arpa/inet.h>
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 <sys/types.h> /* needed for netinet/in.h */
#include <netinet/in.h>
#include <arpa/inet.h>
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 <sys/types.h>
#include <netinet/in.h>
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 <sys/types.h>
#include <netinet/in.h>
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 <openssl/ssl.h>
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 <openssl/ssl.h>
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 <openssl/ssl.h>
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 <gnutls/gnutls.h>
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 <gnutls/gnutls.h>
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 <gnutls/gnutls.h>
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 <gcrypt.h>
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.h>
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.h>
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 <<EOF
#include <stdlib.h>
#include <iconv.h>
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 <stdlib.h>
#include <iconv.h>
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 <sys/types.h>
#include <mysql.h>
#include <errmsg.h>
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 <mysql/mysql.h>
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 <mysql/mysql.h>
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 <libpq-fe.h>
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 <libpq-fe.h>
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 <libpq-fe.h>
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.h>
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 <libxml/parser.h>
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 <iksemel.h>
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 <sys/types.h> /* BSDI 2.0.1 / 2.1 needs this for resource.h */
#include <sys/time.h>
#ifdef HAVE_SYS_RUSAGE_H
#include <sys/rusage.h>
#endif
#include <sys/resource.h>
#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 <sys/types.h> /* BSDI 2.0.1 / 2.1 needs this for resource.h */
#include <sys/time.h>
#ifdef HAVE_SYS_RUSAGE_H
#include <sys/rusage.h>
#endif
#include <sys/resource.h>
#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 <sys/types.h> /* BSDI 2.0.1 / 2.1 needs this for resource.h */
#include <sys/syscall.h>
#include <sys/resource.h>
#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 <memory.h> 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 <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
#include <memory.h>
#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 <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
#include <memory.h>
#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 <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#ifdef HAVE_VALUES_H
#include <values.h>
#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 <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#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 <sys/types.h> /* needed for netinet/in.h */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
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 <sys/types.h> /* needed for netinet/in.h */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
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 <sys/types.h> /* needed for netinet/in.h */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
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 <sys/types.h> /* needed for netinet/in.h */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
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 <sys/types.h> /* needed for netinet/in.h */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
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 <stdlib.h>
#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 <<EOF
#include <stdio.h>
#include <math.h>
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 <<EOF
%{
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
#include <memory.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#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} / <malloc.h> / -DSGI_SOURCE / afree name clash)
cat > conftest.y <<EOF
%{
#include "confdefs.h"
#define afree free
%}
%%
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
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 <<EOF
42
EOF
AC_TRY_RUN([
#include <sys/types.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
#include <memory.h>
#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 <<EOF
#include "confdefs.h"
#include "${srcdir}/util/overhead.c"
EOF
${CC-cc} -o conftest conftest.c
lp_cv_sys_malloc_overhead=`./conftest --terse`
rm -f conftest*
)
AC_DEFINE_UNQUOTED(EXTERN_MALLOC_OVERHEAD,$lp_cv_sys_malloc_overhead,
[The following is needed for smalloc without SBRK_OK to use memory
efficiently. smalloc will malloc blocks that are a large power of
two, minus EXTERN_MALLOC_OVERHEAD. If you have no idea what number to
choose, compile & run util/overhead.c
])
if test -z "${CONFIG_SHELL}"; then
CONFIG_SHELL='/bin/sh'
fi
dnl
dnl --- Postprocessing of settings ---
dnl
AC_UPDATE_VAR(with_malloc)
if test "x$with_malloc" = "x" || test "x$with_malloc" = "xdefault"; then
with_malloc="slaballoc"
AC_TEXT_VAL_FROM_WITH(malloc)
fi
dnl
dnl Standard Replacements:
dnl
AC_SUBST(val_optimize)
AC_SUBST(WCFLAGS)
AC_SUBST(OCFLAGS)
AC_SUBST(LCFLAGS)
AC_SUBST(MCFLAGS)
AC_SUBST(DCFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(OPTIMIZE_LINKING)
AC_SUBST(MOVE_YACC_TAB)
AC_SUBST(CLEAN_YACC_TAB)
AC_SUBST(YACCTAB)
AC_SUBST(CONFIG_SHELL)
AC_SUBST(EXEEXT)
dnl
dnl additional replacements:
dnl
dnl first: the conditional defines:
dnl
AC_SUBST(cdef_erq_demon)
AC_SUBST(cdef_access_control)
AC_SUBST(cdef_access_log)
AC_SUBST(cdef_compat_mode)
AC_SUBST(cdef_strict_euids)
AC_SUBST(cdef_filename_spaces)
AC_SUBST(cdef_share_variables)
AC_SUBST(cdef_use_ipv6)
AC_SUBST(cdef_use_mysql)
AC_SUBST(cdef_use_pgsql)
AC_SUBST(cdef_use_sqlite)
AC_SUBST(cdef_use_xml)
AC_SUBST(cdef_use_alists)
AC_SUBST(cdef_use_mccp)
AC_SUBST(cdef_use_pcre)
AC_SUBST(cdef_use_builtin_pcre)
AC_SUBST(cdef_use_deprecated)
AC_SUBST(cdef_use_structs)
AC_SUBST(cdef_use_tls)
AC_SUBST(cdef_use_gcrypt)
AC_SUBST(cdef_use_new_inlines)
AC_SUBST(cdef_use_set_light)
AC_SUBST(cdef_use_set_is_wizard)
AC_SUBST(cdef_use_parse_command)
AC_SUBST(cdef_use_process_string)
AC_SUBST(cdef_lpc_array_calls)
AC_SUBST(cdef_comm_stat)
AC_SUBST(cdef_trace_code)
AC_SUBST(cdef_apply_cache_stat)
AC_SUBST(cdef_malloc_sbrk)
AC_SUBST(cdef_malloc_check)
AC_SUBST(cdef_malloc_trace)
AC_SUBST(cdef_malloc_lpc_trace)
AC_SUBST(cdef_malloc_sbrk_trace)
AC_SUBST(cdef_dynamic_costs)
AC_SUBST(cdef_eval_cost_trace)
AC_SUBST(cdef_rxcache_table)
AC_SUBST(cdef_wizlist_file)
AC_SUBST(cdef_synchronous_heart_beat)
AC_SUBST(cdef_tls_keyfile)
AC_SUBST(cdef_tls_certfile)
AC_SUBST(cdef_tls_trustfile)
AC_SUBST(cdef_tls_trustdirectory)
AC_SUBST(cdef_tls_crlfile)
AC_SUBST(cdef_tls_crldirectory)
AC_SUBST(cdef_opcprof)
AC_SUBST(cdef_verbose_opcprof)
AC_SUBST(cdef_debug)
AC_SUBST(cdef_yydebug)
AC_SUBST(cdef_no_inlines)
AC_SUBST(cdef_debug_telnet)
AC_SUBST(cdef_debug_malloc_allocs)
AC_SUBST(cdef_check_object_stat)
AC_SUBST(cdef_check_mapping_total)
AC_SUBST(cdef_check_object_ref)
AC_SUBST(cdef_check_object_gc_ref)
AC_SUBST(cdef_dump_gc_refs)
dnl second: valued defines
dnl
AC_SUBST(val_access_file)
AC_SUBST(val_access_log)
AC_SUBST(val_erq_max_reply)
AC_SUBST(val_erq_max_send)
AC_SUBST(val_erq_debug)
AC_SUBST(val_write_buffer_max_size)
AC_SUBST(val_read_file_max_size)
AC_SUBST(val_time_to_clean_up)
AC_SUBST(val_time_to_swap)
AC_SUBST(val_time_to_swap_variables)
AC_SUBST(val_time_to_reset)
AC_SUBST(val_alarm_time)
AC_SUBST(val_heart_beat_interval)
AC_SUBST(val_evaluator_stack_size)
AC_SUBST(val_max_user_trace)
AC_SUBST(val_max_trace)
AC_SUBST(val_compiler_stack_size)
AC_SUBST(val_max_bits)
AC_SUBST(val_portno)
AC_SUBST(val_maxnumports)
AC_SUBST(val_max_cost)
AC_SUBST(val_max_local)
AC_SUBST(val_catch_reserved_cost)
AC_SUBST(val_master_reserved_cost)
AC_SUBST(val_swap_file)
AC_SUBST(val_max_array_size)
AC_SUBST(val_max_mapping_keys)
AC_SUBST(val_max_mapping_size)
AC_SUBST(val_max_callouts)
AC_SUBST(val_max_players)
AC_SUBST(val_allowed_ed_cmds)
AC_SUBST(val_max_command_length)
AC_SUBST(val_reserved_user_size)
AC_SUBST(val_reserved_master_size)
AC_SUBST(val_reserved_system_size)
AC_SUBST(val_htable_size)
AC_SUBST(val_itable_size)
AC_SUBST(val_otable_size)
AC_SUBST(val_defmax)
AC_SUBST(val_apply_cache_bits)
AC_SUBST(val_rxcache_table)
AC_SUBST(val_master_name)
AC_SUBST(val_input_escape)
AC_SUBST(val_max_byte_transfer)
AC_SUBST(val_udp_port)
AC_SUBST(val_set_buffer_size_max)
AC_SUBST(val_malloc)
AC_SUBST(val_min_malloced)
AC_SUBST(val_min_small_malloced)
AC_SUBST(val_hard_malloc_limit)
AC_SUBST(val_soft_malloc_limit)
AC_SUBST(val_total_trace_length)
AC_SUBST(val_wizlist_file)
AC_SUBST(val_pcre_recursion_limit)
AC_SUBST(val_max_net_connects)
AC_SUBST(val_random_period_length)
AC_SUBST(val_tls_keyfile)
AC_SUBST(val_tls_certfile)
AC_SUBST(val_tls_trustfile)
AC_SUBST(val_tls_trustdirectory)
AC_SUBST(val_tls_crlfile)
AC_SUBST(val_tls_crldirectory)
dnl finally: some remaining stuff
dnl
AC_SUBST(erq_sub)
AC_SUBST(PKGLIBS)
AC_SUBST(ERQ_LIBS)
dnl
dnl Ok. now lets make the Makefiles; also these in subdirs! [Mubo]
dnl make config.h, too. [Mubo]
dnl
AC_OUTPUT(Makefile config.h util/Makefile util/indent/Makefile
util/xerq/Makefile util/erq/Makefile)
dnl
dnl At last, warn if any feature could not be enabled
dnl
if test "x$not_available" != "x"; then
echo ""
echo "WARNING: The following options were disabled because the system"
echo "lacked the necessary support: $not_available."
exit 1
fi