2017-01-26 23:27:55 +01:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# This file has been dedicated to the public domain, to the extent
# possible under applicable law, via CC0. See
# http://creativecommons.org/publicdomain/zero/1.0/ for more
# information. This file is offered as-is, without any warranty.
AC_PREREQ([2.69])
2020-12-26 23:09:18 +01:00
AC_INIT([Project: Starfighter], [2.4], [diligentcircle@riseup.net], [starfighter])
2017-01-26 23:27:55 +01:00
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
2019-05-23 17:02:48 +02:00
AC_CONFIG_SRCDIR([src/Starfighter.c])
2017-01-26 23:27:55 +01:00
AC_CONFIG_HEADERS([config.h])
PKG_PROG_PKG_CONFIG
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
2020-03-12 21:42:37 +01:00
STARFIGHTER_CPPFLAGS="-DVERSION=\\\"$PACKAGE_VERSION\\\""
2017-01-26 23:27:55 +01:00
2020-03-09 10:31:59 +01:00
# Detect MacOS
AC_CANONICAL_HOST
case $host_os in
2020-03-12 21:01:13 +01:00
darwin*)
build_mac=1
;;
2020-03-09 10:31:59 +01:00
esac
2020-03-12 21:29:43 +01:00
# Checks for libraries.
2019-07-07 03:17:41 +02:00
AC_SEARCH_LIBS([atanf], [m])
2017-01-26 23:27:55 +01:00
PKG_CHECK_EXISTS([SDL2_mixer], [
2019-06-04 02:20:13 +02:00
PKG_CHECK_EXISTS([SDL2_ttf], [
PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_mixer SDL2_ttf])
], [
PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_mixer])
2020-03-07 01:06:48 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DNOFONT"
2021-01-21 20:24:48 +01:00
echo -e "\033[1mWARNING: SDL_ttf not found; Unicode will not be supported.\033[0m"
2019-06-04 02:20:13 +02:00
])
2017-01-26 23:27:55 +01:00
], [
2019-06-04 02:20:13 +02:00
PKG_CHECK_EXISTS([SDL2_ttf], [
PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_ttf])
], [
PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image])
2020-03-07 01:06:48 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DNOFONT"
2021-01-21 20:24:48 +01:00
echo -e "\033[1mWARNING: SDL_ttf not found; Unicode will not be supported.\033[0m"
2019-06-04 02:20:13 +02:00
])
2020-03-07 01:06:48 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DNOSOUND"
2021-01-21 20:24:48 +01:00
echo -e "\033[1mWARNING: SDL_mixer not found; audio will not be supported.\033[0m"
2017-01-26 23:27:55 +01:00
])
2019-06-04 04:36:03 +02:00
PKG_CHECK_MODULES([PANGO], [pango], [
2019-06-04 02:20:13 +02:00
], [
2020-03-07 01:06:48 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DNOFONT"
2021-01-21 20:24:48 +01:00
echo -e "\033[1mWARNING: Pango not found; Unicode will not be supported.\033[0m"
2019-06-04 02:20:13 +02:00
])
2017-01-26 23:27:55 +01:00
2020-09-09 09:03:22 +02:00
AC_ARG_VAR([SF_WARN], [Set to 1 to enable compiler warnings])
2020-12-27 00:05:10 +01:00
AC_ARG_VAR([SF_UNHARDEN], [Set to 1 to disable hardening flags (for compatibility)])
2017-01-28 06:43:17 +01:00
AC_ARG_VAR([SF_SCREEN_WIDTH], [The width of the game window in pixels])
AC_ARG_VAR([SF_SCREEN_HEIGHT], [The height of the game window in pixels])
2020-03-07 01:06:48 +01:00
AC_ARG_VAR([SF_NOFONT], [Set to 1 to manually force the compiler not to include font/Unicode support])
2020-12-26 19:33:15 +01:00
AC_ARG_VAR([SF_OLD_MUSIC], [Set to 1 to compile for use with the MOD-based music originally packaged with the game by Parallel Realities (note: you must supply said music if you use this option; all files must have the same name and format as distributed with Project: Starfighter 1.1)])
2019-06-12 17:03:24 +02:00
AC_ARG_VAR([SF_RUN_IN_PLACE], [Set to 1 to compile Starfighter to run in-place (instead of installing)])
2020-09-09 09:03:22 +02:00
AS_IF([test -n "$SF_WARN"], [
2020-03-12 21:42:37 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -Wall -Wformat-truncation=0"
])
2020-12-27 00:05:10 +01:00
AS_IF([test -n "$SF_UNHARDEN"], [
echo "Building without hardening flags"
], [
STARFIGHTER_LDADD="-Wl,-z,now"
])
2017-01-28 06:43:17 +01:00
AS_IF([test -n "$SF_SCREEN_WIDTH"], [
2020-03-07 01:06:48 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DSCREEN_WIDTH=$SF_SCREEN_WIDTH"
2019-05-20 17:25:05 +02:00
echo "Using default screen width of $SF_SCREEN_WIDTH"
], [
echo "Using built-in screen width default"
2017-01-28 06:43:17 +01:00
])
AS_IF([test -n "$SF_SCREEN_HEIGHT"], [
2020-03-07 01:06:48 +01:00
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DSCREEN_HEIGHT=$SF_SCREEN_HEIGHT"
2019-05-20 17:25:05 +02:00
echo "Using default screen height of $SF_SCREEN_HEIGHT"
], [
echo "Using built-in screen height default"
2017-01-28 06:43:17 +01:00
])
2020-03-07 01:06:48 +01:00
AS_IF([test -n "$SF_NOFONT"], [
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DNOFONT"
echo "Font/Unicode support manually disabled"
])
2020-12-26 19:33:15 +01:00
AS_IF([test -n "$SF_OLD_MUSIC"], [
STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DOLD_MUSIC"
echo "Building for use with old music"
])
2019-06-06 04:13:48 +02:00
AS_IF([test -n "$SF_RUN_IN_PLACE"], [
echo "Preparing a run-in-place build"
])
2020-03-12 21:01:13 +01:00
AS_IF([test -n "$build_mac"], [
STARFIGHTER_LDADD="$STARFIGHTER_LDADD -framework CoreFoundation"
echo "Building for MacOS"
])
2019-07-07 20:47:57 +02:00
AM_CONDITIONAL([RUN_IN_PLACE], [test -n "$SF_RUN_IN_PLACE"])
2019-06-06 04:13:48 +02:00
2020-03-07 01:06:48 +01:00
AC_SUBST([STARFIGHTER_CPPFLAGS])
2020-03-12 21:01:13 +01:00
AC_SUBST([STARFIGHTER_LDADD])
2017-01-26 23:27:55 +01:00
# Checks for header files.
2019-06-06 04:13:48 +02:00
AC_CHECK_HEADERS([ctype.h errno.h libintl.h locale.h stdio.h stdlib.h string.h time.h math.h pwd.h sys/stat.h unistd.h])
2017-01-26 23:27:55 +01:00
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([atexit mkdir])
AC_CONFIG_FILES([
Makefile
2020-09-16 05:04:17 +02:00
gfx/Makefile
locale/Makefile
2017-02-06 18:20:15 +01:00
misc/Makefile
2020-09-16 05:04:17 +02:00
music/Makefile
sound/Makefile
src/Makefile
2017-01-26 23:27:55 +01:00
])
AC_OUTPUT