#
# $Id: configure.ac,v 1.39 2025/05/19 13:14:33 snw Exp $
# autoconf rules for FreeM
#
#
# Author: Serena Willis <jpw@coherent-logic.com>
# Copyright (C) 1998 MUG Deutschland
# Copyright (C) 2020, 2025 Coherent Logic Development LLC
#
#
# This file is part of FreeM.
#
# FreeM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FreeM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero Public License for more details.
#
# You should have received a copy of the GNU Affero Public License
# along with FreeM. If not, see <https://www.gnu.org/licenses/>.
#
# $Log: configure.ac,v $
# Revision 1.39 2025/05/19 13:14:33 snw
# Bump version
#
# Revision 1.38 2025/05/17 17:00:04 snw
# Make it possible to select the modernized global handler with the configure script and update documentation and README.md
#
# Revision 1.37 2025/05/16 13:22:57 snw
# Bump version to account for shared memory changes
#
# Revision 1.36 2025/05/14 12:22:03 snw
# Further work on shared memory
#
# Revision 1.35 2025/05/08 12:52:52 snw
# Begin development on 0.65.0
#
# Revision 1.34 2025/05/07 19:03:05 snw
# Release 0.65.1-rc1, prepare to begin shared memory rewrite
#
# Revision 1.33 2025/04/19 01:10:04 snw
# Update documentation
#
# Revision 1.32 2025/04/15 03:42:30 snw
# Remove -fno-stack-protector to fix dynamic executable builds on SunCC on Solaris
#
# Revision 1.31 2025/04/15 03:37:30 snw
# Remove -fno-mudflap to fix Solaris builds
#
# Revision 1.30 2025/04/12 00:54:16 snw
# Set -fno-stack-protector and -fno-mudflap where available, and set _FORTIFY_SOURCE to 0 everywhere
#
# Revision 1.29 2025/04/12 00:42:05 snw
# Remove -Wall and all supporting directives
#
# Revision 1.28 2025/04/11 20:55:47 snw
# Disable -Wunused-result where possible
#
# Revision 1.27 2025/04/10 18:01:34 snw
# Further tweaks to the autoconf configuration
#
# Revision 1.26 2025/04/10 01:24:38 snw
# Remove C++ style comments
#
# Revision 1.25 2025/04/09 21:10:14 snw
# Only use -Wno-format-truncation et al when the compiler supports them
#
# Revision 1.24 2025/04/09 20:06:02 snw
# Add macros to check for compiler flags to suppress unavoidable warnings
#
# Revision 1.23 2025/04/07 23:40:30 snw
# Move to 0.65.1-rc1 and prepare to optimize global file lookup
#
# Revision 1.22 2025/04/07 21:19:38 snw
# Release FreeM 0.65.1-rc1
#
# Revision 1.21 2025/04/04 18:00:00 snw
# *** empty log message ***
#
# Revision 1.20 2025/04/04 12:46:13 snw
# Patch Solaris 8 crash and bump version to 0.65.1-rc1
#
# Revision 1.19 2025/04/04 02:40:32 snw
# Release 0.65.1-rc1
#
# Revision 1.18 2025/04/04 02:12:24 snw
# Bump to 0.65.1-rc1 and make sure m_log function is never empty
#
# Revision 1.17 2025/04/04 01:18:20 snw
# Remove vestigial logging code and bump to 0.65.1-rc1
#
# Revision 1.16 2025/04/03 20:48:14 snw
# Improve daemon error diagnostics and bump to 0.65.1-rc1
#
# Revision 1.15 2025/04/03 15:51:17 snw
# Add fmadm man page and apply minor updates to freem man page
#
# Revision 1.14 2025/04/03 01:41:01 snw
# New features frozen; prepare 0.65.1-rc1
#
# Revision 1.13 2025/03/30 01:36:58 snw
# Make it easier to bring back fma_gedit, fix double-free in global handler, limit $CHAR to 7-bit ASCII
#
# Revision 1.12 2025/03/29 16:50:42 snw
# Back to 0.65.1-rc1 as version for development; temp fix for double-free issue in global_dispatch
#
# Revision 1.11 2025/03/27 03:31:16 snw
# Prepare for release of FreeM 0.65.1-rc1
#
# Revision 1.10 2025/03/23 19:42:18 snw
# Back to 0.65.1-rc1 versioning for continued development work
#
# Revision 1.9 2025/03/23 04:42:33 snw
# Prepare for release of FreeM 0.65.1-rc1
#
# Revision 1.8 2025/03/16 16:08:26 snw
# Back on 0.65.1-rc1 versioning for continued development
#
# Revision 1.7 2025/03/15 03:19:33 snw
# Fix broken build and update to 0.65.1-rc1
#
# Revision 1.6 2025/03/15 02:26:35 snw
# Prepare for 0.65.1-rc1 release
#
# Revision 1.5 2025/03/09 19:14:24 snw
# First phase of REUSE compliance and header reformat
#
#
# SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
# SPDX-License-Identifier: AGPL-3.0-or-later
AC_INIT([freem],[0.65.1-rc1],[snw@coherent-logic.com])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AX_LIB_READLINE
##
# The following may be needed once we get back to enabling -Wall -Wextra -pedantic
#
# AX_CHECK_COMPILE_FLAG([-Wno-format-truncation], [AX_APPEND_FLAG([-Wno-format-truncation])])
# AX_CHECK_COMPILE_FLAG([-Wno-format-contains-nul], [AX_APPEND_FLAG([-Wno-format-contains-nul])])
# AX_CHECK_COMPILE_FLAG([-Wno-stringop-truncation], [AX_APPEND_FLAG([-Wno-stringop-truncation])])
# AX_CHECK_COMPILE_FLAG([-Wno-parentheses], [AX_APPEND_FLAG([-Wno-parentheses])])
# AX_CHECK_COMPILE_FLAG([-Wno-pointer-sign], [AX_APPEND_FLAG([-Wno-pointer-sign])])
# AX_CHECK_COMPILE_FLAG([-fstack-protector], [AX_APPEND_FLAG([-fstack-protector])])
# check for libm
AC_CHECK_LIB([m], [powf])
AC_CHECK_LIB([m], [pow])
AC_CANONICAL_HOST
#AX_WITH_CURSES
# find out if we need to link with -lsocket and/or -lnsl to get
# BSD sockets support
AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
AC_DEFUN([AX_LIB_SOCKET_NSL],
[
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket], [], [
AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
[], [-lnsl])])
])
AX_LIB_SOCKET_NSL
#
# check for getopt.h and getopt_long
#
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_FUNCS([getopt_long])
#
# bring in X11, X Toolkit, and Motif if --enable-mwapi is passed to configure
#
AC_ARG_ENABLE([mwapi], AS_HELP_STRING([--enable-mwapi], [Enable MWAPI (OSF/Motif) support (EXPERIMENTAL)]))
AS_IF([test "x$enable_mwapi" = "xyes"], [
AX_LIB_MOTIF
])
#
# enable new global handler
#
AC_ARG_ENABLE([newglobals], AS_HELP_STRING([--enable-newglobals], [Enable modernized global handler (EXPERIMENTAL)]))
AM_CONDITIONAL([USE_NEWGLOBALS], [test "x$enable_newglobals" = "xyes"])
AS_IF([test "x$enable_newglobals" = "xyes"], [
AC_DEFINE(USE_NEW_GLOBALS, 1, [Define if using new global handler])
])
# check for wiringPi headers and library linkage for
# ^$ZRPI ssv on Raspberry Pi SBCs
AC_CHECK_HEADERS(wiringPi.h)
AC_DEFUN([AX_LIB_WIRINGPI],
[
AC_SEARCH_LIBS([wiringPiSetup], [wiringPi], [], [
AC_CHECK_LIB([wiringPi], [wiringPiSetup], [LIBS="-lwiringPi $LIBS"],
[], [-lwiringPi])])
])
AX_LIB_WIRINGPI
AC_ENABLE_SHARED
AC_DISABLE_STATIC
LT_INIT
AM_INIT_AUTOMAKE
AC_CONFIG_FILES(Makefile src/Makefile doc/Makefile)
AC_PROG_CC
# AC_PATH_XTRA
AC_OUTPUT
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>