# SPDX-License-Identifier: GPL-3.0-or-later
#
# configure.ac for GNUtrition
#
# Copyright (C) 2026 Free Software Foundation, Inc.
#
# Author: Jason Self <jself@gnu.org>
#         Anton McClure <asm@gnu.org>

AC_INIT([gnutrition], [0.33.0rc5], [bug-gnutrition@gnu.org], [gnutrition], [http://www.gnu.org/software/gnutrition/])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects dist-xz dist-zip])

# Checks for programs.
AC_PROG_CC

# Use C99.
CFLAGS="${CFLAGS:-} -D_POSIX_C_SOURCE=200809L -std=c99"

# Checks for header files.
AC_CHECK_HEADERS([stdio.h stdlib.h string.h ctype.h errno.h getopt.h libgen.h locale.h])

# Checks for library functions.
AC_CHECK_FUNCS([strdup strerror getopt_long setlocale])

# Check for math library.
AC_CHECK_LIB([m], [fmod])

# Check for SQLite3.
PKG_CHECK_MODULES([SQLITE3], [sqlite3])

# Optional: GTK 3 and GIO for the GUI binary.
PKG_CHECK_MODULES([GTK], [gtk+-3.0])
PKG_CHECK_MODULES([GIO], [gio-2.0])

# Check for Windows
AC_CANONICAL_HOST
AS_CASE([$host_os],
  [mingw* | msys* | cygwin*], [
    LDFLAGS="$LDFLAGS -mwindows"
  ]
)

AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
