--- libelwix/configure.in 2013/01/17 10:05:35 1.1 +++ libelwix/configure.in 2024/10/29 01:16:12 1.75 @@ -1,11 +1,14 @@ # # $Author: misho $ -# $Id: configure.in,v 1.1 2013/01/17 10:05:35 misho Exp $ +# $Id: configure.in,v 1.75 2024/10/29 01:16:12 misho Exp $ # -AC_INIT(libelwix, 1.0, misho@elwix.org) +AC_INIT(libelwix, 6.5, misho@elwix.org) AC_CONFIG_SRCDIR([src/elwix.c]) AC_CONFIG_HEADERS([inc/config.h]) +ac_cv_func_malloc_0_nonnull="yes" +ac_cv_func_realloc_0_nonnull="yes" + # Checks for programs. AC_PROG_CC AC_PROG_INSTALL @@ -14,11 +17,17 @@ AC_PROG_RANLIB AC_CANONICAL_HOST AC_CANONICAL_TARGET -AC_CHECK_TOOL(MKDEP, mkdep, no) +AC_CHECK_TOOL(MKDEP, mkdep, ../mkdep) AC_SUBST(MKDEP) -CFLAGS="-Wall -O2 -fPIC -I/usr/local/include ${CFLAGS}" -LDFLAGS="-L/usr/local/lib ${LDFLAGS}" +if test "${ac_cv_env_CFLAGS_set}" != "set"; then + CFLAGS="-Wall -O2" +else + CFLAGS="${ac_cv_env_CFLAGS_value}" +fi +if test "${ac_cv_env_LDFLAGS_set}" = "set"; then + LDFLAGS="${ac_cv_env_LDFLAGS_value}" +fi AC_CHECK_LIB([pthread], [pthread_mutex_init]) @@ -31,7 +40,7 @@ AC_C_INLINE # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC -AC_CHECK_FUNCS([memset regcomp strchr strerror]) +AC_CHECK_FUNCS([memset regcomp strchr strerror link_addr strlcpy strlcat]) DEBUG=no AC_MSG_CHECKING(Debug Build) @@ -48,8 +57,77 @@ AC_ARG_ENABLE(debug, esac ],) AC_MSG_RESULT($DEBUG) +MEMMGR="elwix" +AC_MSG_CHECKING(Memory management) +AC_ARG_WITH(memmgr, + [ --with-memmgr= Memory manager for ELWIX (elwix|system)], + [ case "$withval" in + sys|system) + MEMMGR="system" + AC_DEFINE(MEMMGR, ELWIX_SYSM, [ELWIX memory manager]) + ;; + *) + MEMMGR="elwix" + AC_DEFINE(MEMMGR, ELWIX_MPOOL, [ELWIX memory manager]) + ;; + esac ], AC_DEFINE(MEMMGR, ELWIX_MPOOL, [ELWIX memory manager])) +AC_MSG_RESULT($MEMMGR) + +MPOOL_MEM_ZERO=no +AC_MSG_CHECKING(MPoll zeroing allocated memory) +AC_ARG_ENABLE(mpool-mem-zero, + [ --enable-mpool-mem-zero MPool zeroing allocated memory], + [ case "$enableval" in + yes) + AC_DEFINE(MPOOL_MEM_ZERO,, [MPool zeroing memory]) + MPOOL_MEM_ZERO=yes + ;; + *) + MPOOL_MEM_ZERO=no + ;; + esac ],) +AC_MSG_RESULT($MPOOL_MEM_ZERO) + +PATRICIA=no +AC_MSG_CHECKING(Patricia support) +AC_ARG_ENABLE(patricia, + [ --enable-patricia Patricia support for ELWIX], + [ case "$enableval" in + yes) + AC_DEFINE(PATRICIA_SUPPORT,, [Patricia support]) + PATRICIA=yes + ;; + *) + ;; + esac ],) +AC_MSG_RESULT($PATRICIA) + +PELCO=no +AC_MSG_CHECKING(Pelco support) +AC_ARG_ENABLE(pelco, + [ --enable-pelco Pelco support for ELWIX], + [ case "$enableval" in + yes) + AC_DEFINE(PELCO_SUPPORT,, [Pelco support]) + PELCO=yes + ;; + *) + ;; + esac ],) +AC_MSG_RESULT($PELCO) + +DEBIAN_ARCH=$target_cpu +AS_IF([ test "x$target_cpu" = "xarm6l" -o "x$target_cpu" = "xarm7l" ], DEBIAN_ARCH="armhf") +AS_IF([ test "x$target_cpu" = "xaarch64" ], DEBIAN_ARCH="arm64") +AS_IF([ test "x$target_cpu" = "xi686" ], DEBIAN_ARCH="i386") +AS_IF([ test "x$target_cpu" = "xx86_64" ], DEBIAN_ARCH="amd64") +AC_SUBST(DEBIAN_ARCH) + + AC_CONFIG_FILES([Makefile inc/Makefile lib/Makefile + debian/Makefile + debian/control src/Makefile]) AC_OUTPUT