sdl: added autotools build system
This commit is contained in:
parent
9a6d4f50cf
commit
4cc9274d71
|
@ -1,72 +0,0 @@
|
|||
Authors
|
||||
=======
|
||||
|
||||
A list of people who have contributed code to FCE Ultra, or have had their code
|
||||
placed in FCE Ultra by others.
|
||||
|
||||
Pre-2.0 FCE / FCE Ultra Contributors
|
||||
------------------------------------
|
||||
_These authors contributed exclusively to pre-2.0 versions,
|
||||
but much of their code remains in 2.0 builds_
|
||||
|
||||
* BERO - bero at geocities.co.jp - Base FCE code.
|
||||
|
||||
* Xodnizel - Most of the base FCE Ultra code
|
||||
|
||||
* Aaron Oneal - http://www.morphgear.com - Many changes to compile with MSVC and first frame skipping code
|
||||
|
||||
* Joe Nahmias - Man pages
|
||||
|
||||
* Paul Kuliniewicz - kuliniew at purdue.edu - Various code for the original SDL port.
|
||||
|
||||
* Quietust - quietust at ircN dot org - VRC7 "translation" code.
|
||||
|
||||
* Ben Parnell - Windows debugging tools
|
||||
|
||||
* Parasyte & bbitmaster - Enhanced Windows debugging tools
|
||||
|
||||
* blip & nitsuja - Rerecording support
|
||||
|
||||
FCEUX >= 2.0 Contributors
|
||||
-------------------------
|
||||
* SP - document thyself (sf:rheiny) - Enhanced Windows debugging tools
|
||||
|
||||
* zeromus - mgambrell at gmail dot com (sf:zeromus) - Core architecture refactoring and merging - Windows driver maintenance
|
||||
|
||||
* adelikat - document thyself (sf:adelikat) - UI cleanup, project management, Win32 features & maintenance, TAS tools, documentation
|
||||
|
||||
* CaH4e3 - CaH4e3 at mail dot ru (sf: cah4e3) - Mappers
|
||||
|
||||
* Luke Gustafson - (sf:???) - Windows TAS and movie recording enhancements
|
||||
|
||||
* qfox - (sf:qfox) - lua scripting fucntions, luabot, basicbot (no longer implemented), various lua scripts
|
||||
|
||||
* _mz - document thyself (mauzus) - Windows driver maintenance and cleanup
|
||||
|
||||
* UncombedCoconut - UncombedCoconut at gmail dot com (sf:jeblanchard) - Build system and cross-compilation support - Driver maintenance and refactoring
|
||||
|
||||
* DWEdit - Debugger additions
|
||||
|
||||
* AnS - ansstuff at yandex dot ru (sf:ansstuff) - Win32 features & maintenance, TAS Editor, debugging tools, documentation
|
||||
|
||||
FCEUX (>=2.0) Linux/SDL Developers
|
||||
----------------------------------
|
||||
_These guys concentrated on keeping fceux the premiere linux/portable nes emu._
|
||||
|
||||
* Lukas Sabota - ltsmooth42 at gmail dot com (sf:punkrockguy318) - Head FceuX-SDL developer - GTK GUI, complete overhaul of SDL port, build scripts; maintainence; docs
|
||||
|
||||
* Shinydoofy - sf:shinydoofy - SDL maintenence
|
||||
|
||||
* Soules - gimmedonutnow at gmail dot com (sf:gimmedonutnow) - Linux SDL driver maintenance
|
||||
|
||||
* radsaq - radsaq at gmail dot com (sf:radsaq) - Build system, testing, and random cleanups
|
||||
|
||||
* Bryan Cain - sf:plombo - Patch to embed SDL in the GTK+ GUI, miscellaneous other SDL and GTK+ contributions
|
||||
|
||||
Included components:
|
||||
--------------------
|
||||
* Mitsutaka Okazaki - YM2413 emulator.
|
||||
|
||||
* Andrea Mazzoleni - Scale2x/Scale3x scalers
|
||||
|
||||
* Gilles Vollant - unzip.c PKZIP fileio
|
|
@ -0,0 +1,2 @@
|
|||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
SUBDIRS = src
|
|
@ -0,0 +1,158 @@
|
|||
AC_INIT([fceux], [2.2.3])
|
||||
AC_CONFIG_SRCDIR([src/fceu.cpp])
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_CXX
|
||||
AC_PROG_INSTALL
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_CHECK_FUNC(asprintf, AC_DEFINE([HAVE_ASPRINTF]))
|
||||
|
||||
## This is almost sure to not work
|
||||
AC_ARG_WITH(nativewin32,
|
||||
[AC_HELP_STRING([--with-nativewin32],
|
||||
[use nativewin32])],
|
||||
use_nativewin32=$withval,
|
||||
use_nativewin32="no")
|
||||
|
||||
AM_CONDITIONAL(WIN32, false)
|
||||
AM_CONDITIONAL(UNIX, false)
|
||||
AM_CONDITIONAL(NATIVEWIN32,false)
|
||||
AM_CONDITIONAL(OPENGL, false)
|
||||
AM_CONDITIONAL(GTK2, false)
|
||||
AM_CONDITIONAL(GTK3, false)
|
||||
AM_CONDITIONAL(LUA, false)
|
||||
AM_CONDITIONAL(LUA_BUILTIN, false)
|
||||
AM_CONDITIONAL(SYSTEM_MINIZIP, false)
|
||||
AM_CONDITIONAL(GD, false)
|
||||
AM_CONDITIONAL(FRAMESKIP, true)
|
||||
|
||||
## Check for zlib
|
||||
AC_CHECK_LIB([z], [zlibVersion],[], AC_MSG_ERROR([*** zlib not found!]))
|
||||
LIBS="$LIBS -lz"
|
||||
AC_CHECK_LIB([pthread], [pthread_create],[], AC_MSG_ERROR([*** pthread not found!]))
|
||||
LIBS="$LIBS -lpthread"
|
||||
|
||||
## Platform specific setup
|
||||
if expr x"$target" : 'x.*beos' > /dev/null; then
|
||||
CFLAGS="-no-fpic $CFLAGS"
|
||||
CPPFLAGS="-no-fpic $CPPFLAGS"
|
||||
AC_DEFINE([PSS_STYLE],[1])
|
||||
elif expr x"$target" : 'x.*mingw' > /dev/null; then
|
||||
## Probably doesn't work
|
||||
AC_DEFINE([PSS_STYLE],[2])
|
||||
AC_DEFINE([WIN32])
|
||||
AM_CONDITIONAL(WIN32, true)
|
||||
|
||||
if test x$use_nativewin32 = xyes; then
|
||||
LIBS="$LIBS -mwindows -lddraw -ldinput -ldsound -lgdi32 -ldxguid -lwinmm -lshell32 -lwsock32 -lcomdlg32 -lole32"
|
||||
AM_CONDITIONAL(NATIVEWIN32,true)
|
||||
else
|
||||
LIBS="$LIBS -ldsound -lwinmm"
|
||||
fi
|
||||
elif expr x"$target" : 'x.*darwin' > /dev/null; then
|
||||
## Probably doesn't work
|
||||
AC_DEFINE([MACOSX])
|
||||
else
|
||||
AM_CONDITIONAL(UNIX, true)
|
||||
AC_DEFINE([UNIX])
|
||||
AC_DEFINE([PSS_STYLE],[1])
|
||||
fi
|
||||
if test x$use_nativewin32 = xno; then
|
||||
## Check for SDL
|
||||
SDL_VERSION=1.2.0
|
||||
AM_PATH_SDL($SDL_VERSION, [:],
|
||||
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
|
||||
AC_DEFINE([SDL])
|
||||
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
CFLAGS="-Wall -fomit-frame-pointer $CFLAGS $SDL_CFLAGS"
|
||||
CPPFLAGS="-Wall -fomit-frame-pointer $CPPFLAGS $SDL_CFLAGS"
|
||||
|
||||
## Check for OpenGL
|
||||
AC_ARG_ENABLE([opengl],
|
||||
AS_HELP_STRING([--enable-opengl], [Enable OpenGL support]))
|
||||
AS_IF([test "x$enable_opengl" != "xno"], [
|
||||
AC_CHECK_HEADER([GL/gl.h],[AC_DEFINE([OPENGL]) AM_CONDITIONAL(OPENGL, true)],
|
||||
[
|
||||
AC_CHECK_HEADER([OpenGL/gl.h],[AC_DEFINE([OPENGL]) AM_CONDITIONAL(OPENGL, true)],[])
|
||||
AC_DEFINE([APPLEOPENGL])
|
||||
])
|
||||
LIBS="$LIBS -lGL -lGLU"
|
||||
])
|
||||
|
||||
## Check for GTK2
|
||||
AC_ARG_ENABLE([gtk2],
|
||||
AS_HELP_STRING([--enable-gtk2], [Enable GTK2 GUI]))
|
||||
AS_IF([test "x$enable_gtk2" = "xyes"], [
|
||||
AM_PATH_GTK_2_0([2.10.0],AM_CONDITIONAL(GTK2, true),AC_MSG_ERROR([Gtk+ 2.10.0 or higher required.]))
|
||||
AC_DEFINE([_GTK])
|
||||
AC_DEFINE([GTK2])
|
||||
])
|
||||
|
||||
## Check for GTK3
|
||||
AC_ARG_ENABLE([gtk3],
|
||||
AS_HELP_STRING([--enable-gtk3], [Enable GTK3 GUI]))
|
||||
AS_IF([test "x$enable_gtk2" = "xyes" -a "x$enable_gtk3" = "xyes"], [
|
||||
AC_MSG_ERROR([GTK2 and GTK3 cannot be simulatenously enabled.])
|
||||
])
|
||||
AS_IF([test "x$enable_gtk3" = "xyes"], [
|
||||
AM_PATH_GTK_3_0([3.0.0],AM_CONDITIONAL(GTK3, true),AC_MSG_ERROR([Gtk+ 3.0.0 or higher required.]))
|
||||
AC_DEFINE([_GTK])
|
||||
AC_DEFINE([GTK3])
|
||||
])
|
||||
fi
|
||||
|
||||
## Check for system lua
|
||||
AC_ARG_ENABLE([lua],
|
||||
AS_HELP_STRING([--enable-lua], [Use lua libraries found on this system]))
|
||||
AS_IF([test "x$enable_lua" = "xyes"], [
|
||||
AC_SUBST(LUA, lua5.1)
|
||||
AX_PROG_LUA([5.1],[5.2])
|
||||
PKG_CHECK_MODULES([lua51], [lua51])
|
||||
AX_LUA_LIBS([], AC_MSG_ERROR([Lua libs not found!]))
|
||||
AC_DEFINE([_S9XLUA_H])
|
||||
AM_CONDITIONAL(LUA, true)
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
])
|
||||
|
||||
## Check for lua builtin
|
||||
AC_ARG_ENABLE([lua-builtin],
|
||||
AS_HELP_STRING([--enable-lua-builtin], [Use lua5.1 included with fceux]))
|
||||
AS_IF([test "x$enable_lua-builtin" = "xyes"], [
|
||||
#AX_LUA_HEADERS([], AC_MSG_ERROR([Lua 5.1 headers not found!]))
|
||||
AC_DEFINE([_S9XLUA_H])
|
||||
AM_CONDITIONAL(LUA_BUILTIN, true)
|
||||
])
|
||||
|
||||
## Check for gd
|
||||
AC_ARG_ENABLE([gd],
|
||||
AS_HELP_STRING([--enable-gd], [Use libgd for AVI creation]))
|
||||
AS_IF([test "x$enable_gd" = "xyes"], [
|
||||
#AX_LUA_HEADERS([], AC_MSG_ERROR([Lua 5.1 headers not found!]))
|
||||
AX_CHECK_GD
|
||||
AC_DEFINE([CREATE_AVI])
|
||||
])
|
||||
|
||||
## Check for system minizip
|
||||
AC_ARG_ENABLE([system-minizip],
|
||||
AS_HELP_STRING([--enable-system-minizip], [Use minizip from system instead of fceux distribution]))
|
||||
AS_IF([test "x$enable_system_minizip" = "xyes"], [
|
||||
PKG_CHECK_MODULES([minizip], [minizip])
|
||||
AM_CONDITIONAL(SYSTEM_MINIZIP, true)
|
||||
LIBS="$LIBS $minizip_LIBS"
|
||||
])
|
||||
|
||||
AC_C_BIGENDIAN([], [AC_DEFINE([LSB_FIRST])])
|
||||
|
||||
## Check for frameskip disable
|
||||
AC_ARG_ENABLE([frameskip],
|
||||
AS_HELP_STRING([--disable-frameskip], [Disable frameskip feature]))
|
||||
|
||||
AS_IF([test "x$enable_frameskip" != "xno"], [
|
||||
AC_DEFINE([FRAMESKIP])
|
||||
])
|
||||
|
||||
AC_OUTPUT([Makefile src/Makefile])
|
|
@ -0,0 +1,82 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_gd.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_GD
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for the gd library. (See http://www.boutell.com/gd/) If gd is
|
||||
# found, the output variables GD_CFLAGS, GD_LDFLAGS and GD_LIBS will
|
||||
# contain the compiler flags, linker flags and libraries necessary to use
|
||||
# gd; otherwise, those variables will be empty. In addition, the symbol
|
||||
# HAVE_GD is defined if the library is found, and the symbols HAVE_GD_GIF,
|
||||
# HAVE_GD_JPEG and HAVE_GD_PNG are defined if the lirbary supports
|
||||
# creating images in gif, jpeg and png formats, respectively.
|
||||
#
|
||||
# The user may use --with-gd=no or --without-gd to skip checking for the
|
||||
# library. (The default is --with-gd=yes.) If the library is installed in
|
||||
# an unusual location, --with-gd=DIR will cause the macro to look for
|
||||
# gdlib-config in DIR/bin or, failing that, for the headers and libraries
|
||||
# in DIR/include and DIR/lib.
|
||||
#
|
||||
# Feedback welcome!
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Nick Markham <markhn@rpi.edu>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
|
||||
AC_DEFUN([AX_CHECK_GD], [
|
||||
AC_ARG_WITH(gd,
|
||||
AS_HELP_STRING([--with-gd(=DIR)], [use the gd library (in DIR)]),,
|
||||
with_gd=yes)
|
||||
|
||||
if test "$with_gd" != no; then
|
||||
AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, , [$with_gd/bin:$PATH])
|
||||
if test -n "$GDLIB_CONFIG"; then
|
||||
GD_CFLAGS=`$GDLIB_CONFIG --cflags`
|
||||
GD_LDFLAGS=`$GDLIB_CONFIG --ldflags`
|
||||
GD_LIBS=`$GDLIB_CONFIG --libs`
|
||||
elif test -d "$with_gd"; then
|
||||
GD_CFLAGS="-I$with_gd/include"
|
||||
GD_LDFLAGS="-L$with_gd/lib"
|
||||
AC_CHECK_LIB(z, inflateReset, GD_LIBS="-lz")
|
||||
AC_CHECK_LIB(png, png_check_sig, GD_LIBS="-lpng $GD_LIBS", , $GD_LIBS)
|
||||
fi
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$GD_CFLAGS $CFLAGS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$GD_LDFLAGS $LDFLAGS"
|
||||
|
||||
AC_CHECK_LIB(gd, gdImageCreate, [
|
||||
AC_DEFINE(HAVE_GD, 1, [ Define if you have gd library. ])
|
||||
AC_CHECK_LIB(gd, gdImageGif, AC_DEFINE(HAVE_GD_GIF, 1, [ Define if GD supports gif. ]), , "$GD_LIBS")
|
||||
AC_CHECK_LIB(gd, gdImageJpeg, AC_DEFINE(HAVE_GD_JPEG, 1, [ Define if GD supports jpeg. ]), , "$GD_LIBS")
|
||||
AC_CHECK_LIB(gd, gdImagePng, AC_DEFINE(HAVE_GD_PNG, 1, [ Define if GD supports png. ]), , "$GD_LIBS")
|
||||
GD_LIBS="-lgd $GD_LIBS"
|
||||
], with_gd=no, $GD_LIBS)
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
fi
|
||||
|
||||
if test "$with_gd" = "no"; then
|
||||
GD_CFLAGS="";
|
||||
GD_LDFLAGS="";
|
||||
GD_LIBS="";
|
||||
fi
|
||||
|
||||
AC_SUBST(GD_CFLAGS)
|
||||
AC_SUBST(GD_LDFLAGS)
|
||||
AC_SUBST(GD_LIBS)
|
||||
])
|
|
@ -0,0 +1,664 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_lua.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PROG_LUA[([MINIMUM-VERSION], [TOO-BIG-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
# AX_LUA_HEADERS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
# AX_LUA_LIBS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
# AX_LUA_READLINE[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Detect a Lua interpreter, optionally specifying a minimum and maximum
|
||||
# version number. Set up important Lua paths, such as the directories in
|
||||
# which to install scripts and modules (shared libraries).
|
||||
#
|
||||
# Also detect Lua headers and libraries. The Lua version contained in the
|
||||
# header is checked to match the Lua interpreter version exactly. When
|
||||
# searching for Lua libraries, the version number is used as a suffix.
|
||||
# This is done with the goal of supporting multiple Lua installs (5.1,
|
||||
# 5.2, and 5.3 side-by-side).
|
||||
#
|
||||
# A note on compatibility with previous versions: This file has been
|
||||
# mostly rewritten for serial 18. Most developers should be able to use
|
||||
# these macros without needing to modify configure.ac. Care has been taken
|
||||
# to preserve each macro's behavior, but there are some differences:
|
||||
#
|
||||
# 1) AX_WITH_LUA is deprecated; it now expands to the exact same thing as
|
||||
# AX_PROG_LUA with no arguments.
|
||||
#
|
||||
# 2) AX_LUA_HEADERS now checks that the version number defined in lua.h
|
||||
# matches the interpreter version. AX_LUA_HEADERS_VERSION is therefore
|
||||
# unnecessary, so it is deprecated and does not expand to anything.
|
||||
#
|
||||
# 3) The configure flag --with-lua-suffix no longer exists; the user
|
||||
# should instead specify the LUA precious variable on the command line.
|
||||
# See the AX_PROG_LUA description for details.
|
||||
#
|
||||
# Please read the macro descriptions below for more information.
|
||||
#
|
||||
# This file was inspired by Andrew Dalke's and James Henstridge's
|
||||
# python.m4 and Tom Payne's, Matthieu Moy's, and Reuben Thomas's ax_lua.m4
|
||||
# (serial 17). Basically, this file is a mash-up of those two files. I
|
||||
# like to think it combines the best of the two!
|
||||
#
|
||||
# AX_PROG_LUA: Search for the Lua interpreter, and set up important Lua
|
||||
# paths. Adds precious variable LUA, which may contain the path of the Lua
|
||||
# interpreter. If LUA is blank, the user's path is searched for an
|
||||
# suitable interpreter.
|
||||
#
|
||||
# If MINIMUM-VERSION is supplied, then only Lua interpreters with a
|
||||
# version number greater or equal to MINIMUM-VERSION will be accepted. If
|
||||
# TOO-BIG-VERSION is also supplied, then only Lua interpreters with a
|
||||
# version number greater or equal to MINIMUM-VERSION and less than
|
||||
# TOO-BIG-VERSION will be accepted.
|
||||
#
|
||||
# The Lua version number, LUA_VERSION, is found from the interpreter, and
|
||||
# substituted. LUA_PLATFORM is also found, but not currently supported (no
|
||||
# standard representation).
|
||||
#
|
||||
# Finally, the macro finds four paths:
|
||||
#
|
||||
# luadir Directory to install Lua scripts.
|
||||
# pkgluadir $luadir/$PACKAGE
|
||||
# luaexecdir Directory to install Lua modules.
|
||||
# pkgluaexecdir $luaexecdir/$PACKAGE
|
||||
#
|
||||
# These paths are found based on $prefix, $exec_prefix, Lua's
|
||||
# package.path, and package.cpath. The first path of package.path
|
||||
# beginning with $prefix is selected as luadir. The first path of
|
||||
# package.cpath beginning with $exec_prefix is used as luaexecdir. This
|
||||
# should work on all reasonable Lua installations. If a path cannot be
|
||||
# determined, a default path is used. Of course, the user can override
|
||||
# these later when invoking make.
|
||||
#
|
||||
# luadir Default: $prefix/share/lua/$LUA_VERSION
|
||||
# luaexecdir Default: $exec_prefix/lib/lua/$LUA_VERSION
|
||||
#
|
||||
# These directories can be used by Automake as install destinations. The
|
||||
# variable name minus 'dir' needs to be used as a prefix to the
|
||||
# appropriate Automake primary, e.g. lua_SCRIPS or luaexec_LIBRARIES.
|
||||
#
|
||||
# If an acceptable Lua interpreter is found, then ACTION-IF-FOUND is
|
||||
# performed, otherwise ACTION-IF-NOT-FOUND is preformed. If ACTION-IF-NOT-
|
||||
# FOUND is blank, then it will default to printing an error. To prevent
|
||||
# the default behavior, give ':' as an action.
|
||||
#
|
||||
# AX_LUA_HEADERS: Search for Lua headers. Requires that AX_PROG_LUA be
|
||||
# expanded before this macro. Adds precious variable LUA_INCLUDE, which
|
||||
# may contain Lua specific include flags, e.g. -I/usr/include/lua5.1. If
|
||||
# LUA_INCLUDE is blank, then this macro will attempt to find suitable
|
||||
# flags.
|
||||
#
|
||||
# LUA_INCLUDE can be used by Automake to compile Lua modules or
|
||||
# executables with embedded interpreters. The *_CPPFLAGS variables should
|
||||
# be used for this purpose, e.g. myprog_CPPFLAGS = $(LUA_INCLUDE).
|
||||
#
|
||||
# This macro searches for the header lua.h (and others). The search is
|
||||
# performed with a combination of CPPFLAGS, CPATH, etc, and LUA_INCLUDE.
|
||||
# If the search is unsuccessful, then some common directories are tried.
|
||||
# If the headers are then found, then LUA_INCLUDE is set accordingly.
|
||||
#
|
||||
# The paths automatically searched are:
|
||||
#
|
||||
# * /usr/include/luaX.Y
|
||||
# * /usr/include/lua/X.Y
|
||||
# * /usr/include/luaXY
|
||||
# * /usr/local/include/luaX.Y
|
||||
# * /usr/local/include/lua-X.Y
|
||||
# * /usr/local/include/lua/X.Y
|
||||
# * /usr/local/include/luaXY
|
||||
#
|
||||
# (Where X.Y is the Lua version number, e.g. 5.1.)
|
||||
#
|
||||
# The Lua version number found in the headers is always checked to match
|
||||
# the Lua interpreter's version number. Lua headers with mismatched
|
||||
# version numbers are not accepted.
|
||||
#
|
||||
# If headers are found, then ACTION-IF-FOUND is performed, otherwise
|
||||
# ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then
|
||||
# it will default to printing an error. To prevent the default behavior,
|
||||
# set the action to ':'.
|
||||
#
|
||||
# AX_LUA_LIBS: Search for Lua libraries. Requires that AX_PROG_LUA be
|
||||
# expanded before this macro. Adds precious variable LUA_LIB, which may
|
||||
# contain Lua specific linker flags, e.g. -llua5.1. If LUA_LIB is blank,
|
||||
# then this macro will attempt to find suitable flags.
|
||||
#
|
||||
# LUA_LIB can be used by Automake to link Lua modules or executables with
|
||||
# embedded interpreters. The *_LIBADD and *_LDADD variables should be used
|
||||
# for this purpose, e.g. mymod_LIBADD = $(LUA_LIB).
|
||||
#
|
||||
# This macro searches for the Lua library. More technically, it searches
|
||||
# for a library containing the function lua_load. The search is performed
|
||||
# with a combination of LIBS, LIBRARY_PATH, and LUA_LIB.
|
||||
#
|
||||
# If the search determines that some linker flags are missing, then those
|
||||
# flags will be added to LUA_LIB.
|
||||
#
|
||||
# If libraries are found, then ACTION-IF-FOUND is performed, otherwise
|
||||
# ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then
|
||||
# it will default to printing an error. To prevent the default behavior,
|
||||
# set the action to ':'.
|
||||
#
|
||||
# AX_LUA_READLINE: Search for readline headers and libraries. Requires the
|
||||
# AX_LIB_READLINE macro, which is provided by ax_lib_readline.m4 from the
|
||||
# Autoconf Archive.
|
||||
#
|
||||
# If a readline compatible library is found, then ACTION-IF-FOUND is
|
||||
# performed, otherwise ACTION-IF-NOT-FOUND is performed.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 Reuben Thomas <rrt@sc3d.org>
|
||||
# Copyright (c) 2014 Tim Perkins <tprk77@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program 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 General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 39
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
|
||||
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_PROG_LUA],
|
||||
[
|
||||
dnl Check for required tools.
|
||||
AC_REQUIRE([AC_PROG_GREP])
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
|
||||
dnl Make LUA a precious variable.
|
||||
AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1])
|
||||
|
||||
dnl Find a Lua interpreter.
|
||||
m4_define_default([_AX_LUA_INTERPRETER_LIST],
|
||||
[lua lua5.3 lua53 lua5.2 lua52 lua5.1 lua51 lua50])
|
||||
|
||||
m4_if([$1], [],
|
||||
[ dnl No version check is needed. Find any Lua interpreter.
|
||||
AS_IF([test "x$LUA" = 'x'],
|
||||
[AC_PATH_PROGS([LUA], [_AX_LUA_INTERPRETER_LIST], [:])])
|
||||
ax_display_LUA='lua'
|
||||
|
||||
AS_IF([test "x$LUA" != 'x:'],
|
||||
[ dnl At least check if this is a Lua interpreter.
|
||||
AC_MSG_CHECKING([if $LUA is a Lua interpreter])
|
||||
_AX_LUA_CHK_IS_INTRP([$LUA],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([not a Lua interpreter])
|
||||
])
|
||||
])
|
||||
],
|
||||
[ dnl A version check is needed.
|
||||
AS_IF([test "x$LUA" != 'x'],
|
||||
[ dnl Check if this is a Lua interpreter.
|
||||
AC_MSG_CHECKING([if $LUA is a Lua interpreter])
|
||||
_AX_LUA_CHK_IS_INTRP([$LUA],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([not a Lua interpreter])
|
||||
])
|
||||
dnl Check the version.
|
||||
m4_if([$2], [],
|
||||
[_ax_check_text="whether $LUA version >= $1"],
|
||||
[_ax_check_text="whether $LUA version >= $1, < $2"])
|
||||
AC_MSG_CHECKING([$_ax_check_text])
|
||||
_AX_LUA_CHK_VER([$LUA], [$1], [$2],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([version is out of range for specified LUA])])
|
||||
ax_display_LUA=$LUA
|
||||
],
|
||||
[ dnl Try each interpreter until we find one that satisfies VERSION.
|
||||
m4_if([$2], [],
|
||||
[_ax_check_text="for a Lua interpreter with version >= $1"],
|
||||
[_ax_check_text="for a Lua interpreter with version >= $1, < $2"])
|
||||
AC_CACHE_CHECK([$_ax_check_text],
|
||||
[ax_cv_pathless_LUA],
|
||||
[ for ax_cv_pathless_LUA in _AX_LUA_INTERPRETER_LIST none; do
|
||||
test "x$ax_cv_pathless_LUA" = 'xnone' && break
|
||||
_AX_LUA_CHK_IS_INTRP([$ax_cv_pathless_LUA], [], [continue])
|
||||
_AX_LUA_CHK_VER([$ax_cv_pathless_LUA], [$1], [$2], [break])
|
||||
done
|
||||
])
|
||||
dnl Set $LUA to the absolute path of $ax_cv_pathless_LUA.
|
||||
AS_IF([test "x$ax_cv_pathless_LUA" = 'xnone'],
|
||||
[LUA=':'],
|
||||
[AC_PATH_PROG([LUA], [$ax_cv_pathless_LUA])])
|
||||
ax_display_LUA=$ax_cv_pathless_LUA
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test "x$LUA" = 'x:'],
|
||||
[ dnl Run any user-specified action, or abort.
|
||||
m4_default([$4], [AC_MSG_ERROR([cannot find suitable Lua interpreter])])
|
||||
],
|
||||
[ dnl Query Lua for its version number.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA version],
|
||||
[ax_cv_lua_version],
|
||||
[ dnl Get the interpreter version in X.Y format. This should work for
|
||||
dnl interpreters version 5.0 and beyond.
|
||||
ax_cv_lua_version=[`$LUA -e '
|
||||
-- return a version number in X.Y format
|
||||
local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)")
|
||||
print(ver)'`]
|
||||
])
|
||||
AS_IF([test "x$ax_cv_lua_version" = 'x'],
|
||||
[AC_MSG_ERROR([invalid Lua version number])])
|
||||
AC_SUBST([LUA_VERSION], [$ax_cv_lua_version])
|
||||
AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | $SED 's|\.||'`])
|
||||
|
||||
dnl The following check is not supported:
|
||||
dnl At times (like when building shared libraries) you may want to know
|
||||
dnl which OS platform Lua thinks this is.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA platform],
|
||||
[ax_cv_lua_platform],
|
||||
[ax_cv_lua_platform=[`$LUA -e 'print("unknown")'`]])
|
||||
AC_SUBST([LUA_PLATFORM], [$ax_cv_lua_platform])
|
||||
|
||||
dnl Use the values of $prefix and $exec_prefix for the corresponding
|
||||
dnl values of LUA_PREFIX and LUA_EXEC_PREFIX. These are made distinct
|
||||
dnl variables so they can be overridden if need be. However, the general
|
||||
dnl consensus is that you shouldn't need this ability.
|
||||
AC_SUBST([LUA_PREFIX], ['${prefix}'])
|
||||
AC_SUBST([LUA_EXEC_PREFIX], ['${exec_prefix}'])
|
||||
|
||||
dnl Lua provides no way to query the script directory, and instead
|
||||
dnl provides LUA_PATH. However, we should be able to make a safe educated
|
||||
dnl guess. If the built-in search path contains a directory which is
|
||||
dnl prefixed by $prefix, then we can store scripts there. The first
|
||||
dnl matching path will be used.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA script directory],
|
||||
[ax_cv_lua_luadir],
|
||||
[ AS_IF([test "x$prefix" = 'xNONE'],
|
||||
[ax_lua_prefix=$ac_default_prefix],
|
||||
[ax_lua_prefix=$prefix])
|
||||
|
||||
dnl Initialize to the default path.
|
||||
ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION"
|
||||
|
||||
dnl Try to find a path with the prefix.
|
||||
_AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [script])
|
||||
AS_IF([test "x$ax_lua_prefixed_path" != 'x'],
|
||||
[ dnl Fix the prefix.
|
||||
_ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'`
|
||||
ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \
|
||||
$SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"`
|
||||
])
|
||||
])
|
||||
AC_SUBST([luadir], [$ax_cv_lua_luadir])
|
||||
AC_SUBST([pkgluadir], [\${luadir}/$PACKAGE])
|
||||
|
||||
dnl Lua provides no way to query the module directory, and instead
|
||||
dnl provides LUA_PATH. However, we should be able to make a safe educated
|
||||
dnl guess. If the built-in search path contains a directory which is
|
||||
dnl prefixed by $exec_prefix, then we can store modules there. The first
|
||||
dnl matching path will be used.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA module directory],
|
||||
[ax_cv_lua_luaexecdir],
|
||||
[ AS_IF([test "x$exec_prefix" = 'xNONE'],
|
||||
[ax_lua_exec_prefix=$ax_lua_prefix],
|
||||
[ax_lua_exec_prefix=$exec_prefix])
|
||||
|
||||
dnl Initialize to the default path.
|
||||
ax_cv_lua_luaexecdir="$LUA_EXEC_PREFIX/lib/lua/$LUA_VERSION"
|
||||
|
||||
dnl Try to find a path with the prefix.
|
||||
_AX_LUA_FND_PRFX_PTH([$LUA],
|
||||
[$ax_lua_exec_prefix], [module])
|
||||
AS_IF([test "x$ax_lua_prefixed_path" != 'x'],
|
||||
[ dnl Fix the prefix.
|
||||
_ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'`
|
||||
ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \
|
||||
$SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"`
|
||||
])
|
||||
])
|
||||
AC_SUBST([luaexecdir], [$ax_cv_lua_luaexecdir])
|
||||
AC_SUBST([pkgluaexecdir], [\${luaexecdir}/$PACKAGE])
|
||||
|
||||
dnl Run any user specified action.
|
||||
$3
|
||||
])
|
||||
])
|
||||
|
||||
dnl AX_WITH_LUA is now the same thing as AX_PROG_LUA.
|
||||
AC_DEFUN([AX_WITH_LUA],
|
||||
[
|
||||
AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA instead]])
|
||||
AX_PROG_LUA
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl _AX_LUA_CHK_IS_INTRP(PROG, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([_AX_LUA_CHK_IS_INTRP],
|
||||
[
|
||||
dnl A minimal Lua factorial to prove this is an interpreter. This should work
|
||||
dnl for Lua interpreters version 5.0 and beyond.
|
||||
_ax_lua_factorial=[`$1 2>/dev/null -e '
|
||||
-- a simple factorial
|
||||
function fact (n)
|
||||
if n == 0 then
|
||||
return 1
|
||||
else
|
||||
return n * fact(n-1)
|
||||
end
|
||||
end
|
||||
print("fact(5) is " .. fact(5))'`]
|
||||
AS_IF([test "$_ax_lua_factorial" = 'fact(5) is 120'],
|
||||
[$2], [$3])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl _AX_LUA_CHK_VER(PROG, MINIMUM-VERSION, [TOO-BIG-VERSION],
|
||||
dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([_AX_LUA_CHK_VER],
|
||||
[
|
||||
dnl Check that the Lua version is within the bounds. Only the major and minor
|
||||
dnl version numbers are considered. This should work for Lua interpreters
|
||||
dnl version 5.0 and beyond.
|
||||
_ax_lua_good_version=[`$1 -e '
|
||||
-- a script to compare versions
|
||||
function verstr2num(verstr)
|
||||
local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)")
|
||||
if majorver and minorver then
|
||||
return tonumber(majorver) * 100 + tonumber(minorver)
|
||||
end
|
||||
end
|
||||
local minver = verstr2num("$2")
|
||||
local _, _, trimver = string.find(_VERSION, "^Lua (.*)")
|
||||
local ver = verstr2num(trimver)
|
||||
local maxver = verstr2num("$3") or 1e9
|
||||
if minver <= ver and ver < maxver then
|
||||
print("yes")
|
||||
else
|
||||
print("no")
|
||||
end'`]
|
||||
AS_IF([test "x$_ax_lua_good_version" = "xyes"],
|
||||
[$4], [$5])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, SCRIPT-OR-MODULE-DIR)
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([_AX_LUA_FND_PRFX_PTH],
|
||||
[
|
||||
dnl Get the script or module directory by querying the Lua interpreter,
|
||||
dnl filtering on the given prefix, and selecting the shallowest path. If no
|
||||
dnl path is found matching the prefix, the result will be an empty string.
|
||||
dnl The third argument determines the type of search, it can be 'script' or
|
||||
dnl 'module'. Supplying 'script' will perform the search with package.path
|
||||
dnl and LUA_PATH, and supplying 'module' will search with package.cpath and
|
||||
dnl LUA_CPATH. This is done for compatibility with Lua 5.0.
|
||||
|
||||
ax_lua_prefixed_path=[`$1 -e '
|
||||
-- get the path based on search type
|
||||
local searchtype = "$3"
|
||||
local paths = ""
|
||||
if searchtype == "script" then
|
||||
paths = (package and package.path) or LUA_PATH
|
||||
elseif searchtype == "module" then
|
||||
paths = (package and package.cpath) or LUA_CPATH
|
||||
end
|
||||
-- search for the prefix
|
||||
local prefix = "'$2'"
|
||||
local minpath = ""
|
||||
local mindepth = 1e9
|
||||
string.gsub(paths, "(@<:@^;@:>@+)",
|
||||
function (path)
|
||||
path = string.gsub(path, "%?.*$", "")
|
||||
path = string.gsub(path, "/@<:@^/@:>@*$", "")
|
||||
if string.find(path, prefix) then
|
||||
local depth = string.len(string.gsub(path, "@<:@^/@:>@", ""))
|
||||
if depth < mindepth then
|
||||
minpath = path
|
||||
mindepth = depth
|
||||
end
|
||||
end
|
||||
end)
|
||||
print(minpath)'`]
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_LUA_HEADERS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_LUA_HEADERS],
|
||||
[
|
||||
dnl Check for LUA_VERSION.
|
||||
AC_MSG_CHECKING([if LUA_VERSION is defined])
|
||||
AS_IF([test "x$LUA_VERSION" != 'x'],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([cannot check Lua headers without knowing LUA_VERSION])
|
||||
])
|
||||
|
||||
dnl Make LUA_INCLUDE a precious variable.
|
||||
AC_ARG_VAR([LUA_INCLUDE], [The Lua includes, e.g. -I/usr/include/lua5.1])
|
||||
|
||||
dnl Some default directories to search.
|
||||
LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'`
|
||||
m4_define_default([_AX_LUA_INCLUDE_LIST],
|
||||
[ /usr/include/lua$LUA_VERSION \
|
||||
/usr/include/lua-$LUA_VERSION \
|
||||
/usr/include/lua/$LUA_VERSION \
|
||||
/usr/include/lua$LUA_SHORT_VERSION \
|
||||
/usr/local/include/lua$LUA_VERSION \
|
||||
/usr/local/include/lua-$LUA_VERSION \
|
||||
/usr/local/include/lua/$LUA_VERSION \
|
||||
/usr/local/include/lua$LUA_SHORT_VERSION \
|
||||
])
|
||||
|
||||
dnl Try to find the headers.
|
||||
_ax_lua_saved_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
|
||||
AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
|
||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
||||
|
||||
dnl Try some other directories if LUA_INCLUDE was not set.
|
||||
AS_IF([test "x$LUA_INCLUDE" = 'x' &&
|
||||
test "x$ac_cv_header_lua_h" != 'xyes'],
|
||||
[ dnl Try some common include paths.
|
||||
for _ax_include_path in _AX_LUA_INCLUDE_LIST; do
|
||||
test ! -d "$_ax_include_path" && continue
|
||||
|
||||
AC_MSG_CHECKING([for Lua headers in])
|
||||
AC_MSG_RESULT([$_ax_include_path])
|
||||
|
||||
AS_UNSET([ac_cv_header_lua_h])
|
||||
AS_UNSET([ac_cv_header_lualib_h])
|
||||
AS_UNSET([ac_cv_header_lauxlib_h])
|
||||
AS_UNSET([ac_cv_header_luaconf_h])
|
||||
|
||||
_ax_lua_saved_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS -I$_ax_include_path"
|
||||
AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
|
||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
||||
|
||||
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
|
||||
[ LUA_INCLUDE="-I$_ax_include_path"
|
||||
break
|
||||
])
|
||||
done
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
|
||||
[ dnl Make a program to print LUA_VERSION defined in the header.
|
||||
dnl TODO It would be really nice if we could do this without compiling a
|
||||
dnl program, then it would work when cross compiling. But I'm not sure how
|
||||
dnl to do this reliably. For now, assume versions match when cross compiling.
|
||||
|
||||
AS_IF([test "x$cross_compiling" != 'xyes'],
|
||||
[ AC_CACHE_CHECK([for Lua header version],
|
||||
[ax_cv_lua_header_version],
|
||||
[ _ax_lua_saved_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
|
||||
AC_RUN_IFELSE(
|
||||
[ AC_LANG_SOURCE([[
|
||||
#include <lua.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
if(argc > 1) printf("%s", LUA_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
]])
|
||||
],
|
||||
[ ax_cv_lua_header_version=`./conftest$EXEEXT p | \
|
||||
$SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"`
|
||||
],
|
||||
[ax_cv_lua_header_version='unknown'])
|
||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
||||
])
|
||||
|
||||
dnl Compare this to the previously found LUA_VERSION.
|
||||
AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION])
|
||||
AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
ax_header_version_match='yes'
|
||||
],
|
||||
[ AC_MSG_RESULT([no])
|
||||
ax_header_version_match='no'
|
||||
])
|
||||
],
|
||||
[ AC_MSG_WARN([cross compiling so assuming header version number matches])
|
||||
ax_header_version_match='yes'
|
||||
])
|
||||
])
|
||||
|
||||
dnl Was LUA_INCLUDE specified?
|
||||
AS_IF([test "x$ax_header_version_match" != 'xyes' &&
|
||||
test "x$LUA_INCLUDE" != 'x'],
|
||||
[AC_MSG_ERROR([cannot find headers for specified LUA_INCLUDE])])
|
||||
|
||||
dnl Test the final result and run user code.
|
||||
AS_IF([test "x$ax_header_version_match" = 'xyes'], [$1],
|
||||
[m4_default([$2], [AC_MSG_ERROR([cannot find Lua includes])])])
|
||||
])
|
||||
|
||||
dnl AX_LUA_HEADERS_VERSION no longer exists, use AX_LUA_HEADERS.
|
||||
AC_DEFUN([AX_LUA_HEADERS_VERSION],
|
||||
[
|
||||
AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS instead]])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_LUA_LIBS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_LUA_LIBS],
|
||||
[
|
||||
dnl TODO Should this macro also check various -L flags?
|
||||
|
||||
dnl Check for LUA_VERSION.
|
||||
AC_MSG_CHECKING([if LUA_VERSION is defined])
|
||||
AS_IF([test "x$LUA_VERSION" != 'x'],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([cannot check Lua libs without knowing LUA_VERSION])
|
||||
])
|
||||
|
||||
dnl Make LUA_LIB a precious variable.
|
||||
AC_ARG_VAR([LUA_LIB], [The Lua library, e.g. -llua5.1])
|
||||
|
||||
AS_IF([test "x$LUA_LIB" != 'x'],
|
||||
[ dnl Check that LUA_LIBS works.
|
||||
_ax_lua_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
AC_SEARCH_LIBS([lua_load], [],
|
||||
[_ax_found_lua_libs='yes'],
|
||||
[_ax_found_lua_libs='no'])
|
||||
LIBS=$_ax_lua_saved_libs
|
||||
|
||||
dnl Check the result.
|
||||
AS_IF([test "x$_ax_found_lua_libs" != 'xyes'],
|
||||
[AC_MSG_ERROR([cannot find libs for specified LUA_LIB])])
|
||||
],
|
||||
[ dnl First search for extra libs.
|
||||
_ax_lua_extra_libs=''
|
||||
|
||||
_ax_lua_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
AC_SEARCH_LIBS([exp], [m])
|
||||
AC_SEARCH_LIBS([dlopen], [dl])
|
||||
LIBS=$_ax_lua_saved_libs
|
||||
|
||||
AS_IF([test "x$ac_cv_search_exp" != 'xno' &&
|
||||
test "x$ac_cv_search_exp" != 'xnone required'],
|
||||
[_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_exp"])
|
||||
|
||||
AS_IF([test "x$ac_cv_search_dlopen" != 'xno' &&
|
||||
test "x$ac_cv_search_dlopen" != 'xnone required'],
|
||||
[_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_dlopen"])
|
||||
|
||||
dnl Try to find the Lua libs.
|
||||
_ax_lua_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
AC_SEARCH_LIBS([lua_load],
|
||||
[ lua$LUA_VERSION \
|
||||
lua$LUA_SHORT_VERSION \
|
||||
lua-$LUA_VERSION \
|
||||
lua-$LUA_SHORT_VERSION \
|
||||
lua \
|
||||
],
|
||||
[_ax_found_lua_libs='yes'],
|
||||
[_ax_found_lua_libs='no'],
|
||||
[$_ax_lua_extra_libs])
|
||||
LIBS=$_ax_lua_saved_libs
|
||||
|
||||
AS_IF([test "x$ac_cv_search_lua_load" != 'xno' &&
|
||||
test "x$ac_cv_search_lua_load" != 'xnone required'],
|
||||
[LUA_LIB="$ac_cv_search_lua_load $_ax_lua_extra_libs"])
|
||||
])
|
||||
|
||||
dnl Test the result and run user code.
|
||||
AS_IF([test "x$_ax_found_lua_libs" = 'xyes'], [$1],
|
||||
[m4_default([$2], [AC_MSG_ERROR([cannot find Lua libs])])])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_LUA_READLINE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_LUA_READLINE],
|
||||
[
|
||||
AX_LIB_READLINE
|
||||
AS_IF([test "x$ac_cv_header_readline_readline_h" != 'x' &&
|
||||
test "x$ac_cv_header_readline_history_h" != 'x'],
|
||||
[ LUA_LIBS_CFLAGS="-DLUA_USE_READLINE $LUA_LIBS_CFLAGS"
|
||||
$1
|
||||
],
|
||||
[$2])
|
||||
])
|
|
@ -0,0 +1,185 @@
|
|||
# Configure paths for GTK+
|
||||
# Owen Taylor 1997-2001
|
||||
|
||||
dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
|
||||
dnl pass to pkg-config
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_GTK_2_0],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from pkg-config
|
||||
dnl
|
||||
AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
|
||||
, enable_gtktest=yes)
|
||||
|
||||
pkg_config_args=gtk+-2.0
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gthread)
|
||||
pkg_config_args="$pkg_config_args gthread-2.0"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
no_gtk=""
|
||||
|
||||
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
PKG_PROG_PKG_CONFIG([0.7])
|
||||
|
||||
min_gtk_version=ifelse([$1], ,2.0.0,$1)
|
||||
AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
## don't try to run the test against uninstalled libtool libs
|
||||
if $PKG_CONFIG --uninstalled $pkg_config_args; then
|
||||
echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
|
||||
enable_gtktest=no
|
||||
fi
|
||||
|
||||
if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
|
||||
:
|
||||
else
|
||||
no_gtk=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$no_gtk" = x ; then
|
||||
GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
|
||||
GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
|
||||
gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_gtktest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$GTK_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
|
||||
dnl checks the results of pkg-config to some extent)
|
||||
dnl
|
||||
rm -f conf.gtktest
|
||||
AC_TRY_RUN([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
fclose (fopen ("conf.gtktest", "w"));
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_gtk_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_gtk_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((gtk_major_version != $gtk_config_major_version) ||
|
||||
(gtk_minor_version != $gtk_config_minor_version) ||
|
||||
(gtk_micro_version != $gtk_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
||||
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf ("*** was found! If pkg-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
|
||||
printf("*** to point to the correct configuration files\n");
|
||||
}
|
||||
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((gtk_major_version > major) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_gtk" = x ; then
|
||||
AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$PKG_CONFIG" = "no" ; then
|
||||
echo "*** A new enough version of pkg-config was not found."
|
||||
echo "*** See http://pkgconfig.sourceforge.net"
|
||||
else
|
||||
if test -f conf.gtktest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GTK+ test program, checking why..."
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
|
||||
echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GTK_CFLAGS=""
|
||||
GTK_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
rm -f conf.gtktest
|
||||
])
|
|
@ -0,0 +1,217 @@
|
|||
# Configure paths for GTK+
|
||||
# Owen Taylor 1997-2001
|
||||
|
||||
dnl AM_PATH_GTK_3_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
|
||||
dnl pass to pkg-config
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_GTK_3_0],
|
||||
[m4_warn([obsolete], [AM_PATH_GTK_3_0 is deprecated, use PKG_CHECK_MODULES([GTK], [gtk+-3.0]) instead])
|
||||
dnl Get the cflags and libraries from pkg-config
|
||||
dnl
|
||||
AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
|
||||
, enable_gtktest=yes)
|
||||
min_gtk_version=ifelse([$1], [], [3.0.0], [$1])
|
||||
|
||||
pkg_config_args="gtk+-3.0 >= $min_gtk_version"
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gthread)
|
||||
pkg_config_args="$pkg_config_args gthread-2.0"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
no_gtk=""
|
||||
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
|
||||
:
|
||||
else
|
||||
echo "*** pkg-config too old; version 0.7 or better required."
|
||||
no_gtk=yes
|
||||
PKG_CONFIG=no
|
||||
fi
|
||||
else
|
||||
no_gtk=yes
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
## don't try to run the test against uninstalled libtool libs
|
||||
if $PKG_CONFIG --uninstalled $pkg_config_args; then
|
||||
echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
|
||||
enable_gtktest=no
|
||||
fi
|
||||
|
||||
if $PKG_CONFIG $pkg_config_args; then
|
||||
:
|
||||
else
|
||||
no_gtk=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$no_gtk" = x ; then
|
||||
GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
|
||||
GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
|
||||
gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_gtktest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$GTK_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
|
||||
dnl checks the results of pkg-config to some extent)
|
||||
dnl
|
||||
rm -f conf.gtktest
|
||||
AC_TRY_RUN([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
unsigned int major, minor, micro;
|
||||
|
||||
fclose (fopen ("conf.gtktest", "w"));
|
||||
|
||||
if (sscanf("$min_gtk_version", "%u.%u.%u", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_gtk_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((gtk_major_version != $gtk_config_major_version) ||
|
||||
(gtk_minor_version != $gtk_config_minor_version) ||
|
||||
(gtk_micro_version != $gtk_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'pkg-config --modversion gtk+-3.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
||||
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf ("*** was found! If pkg-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
|
||||
printf("*** to point to the correct configuration files\n");
|
||||
}
|
||||
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((gtk_major_version > major) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GTK+ (%u.%u.%u) was found.\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf("*** You need a version of GTK+ newer than %u.%u.%u. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_gtk" = x ; then
|
||||
AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$PKG_CONFIG" = "no" ; then
|
||||
echo "*** A new enough version of pkg-config was not found."
|
||||
echo "*** See http://pkgconfig.sourceforge.net"
|
||||
else
|
||||
if test -f conf.gtktest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GTK+ test program, checking why..."
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
|
||||
echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occurred. This usually means GTK+ is incorrectly installed."])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GTK_CFLAGS=""
|
||||
GTK_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
rm -f conf.gtktest
|
||||
])
|
||||
|
||||
dnl GTK_CHECK_BACKEND(BACKEND-NAME [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Tests for BACKEND-NAME in the GTK targets list
|
||||
dnl
|
||||
AC_DEFUN([GTK_CHECK_BACKEND],
|
||||
[m4_warn([obsolete], [GTK_CHECK_BACKEND is deprecated, use PKG_CHECK_MODULES([GTK_X11], [gtk+-x11-3.0]) or similar instead])
|
||||
pkg_config_args=ifelse([$1],,gtk+-3.0, gtk+-$1-3.0)
|
||||
min_gtk_version=ifelse([$2],,3.0.0,$2)
|
||||
pkg_config_args="$pkg_config_args >= $min_gtk_version"
|
||||
|
||||
AC_PATH_PROG(PKG_CONFIG, [pkg-config], [AC_MSG_ERROR([No pkg-config found])])
|
||||
|
||||
if $PKG_CONFIG $pkg_config_args ; then
|
||||
target_found=yes
|
||||
else
|
||||
target_found=no
|
||||
fi
|
||||
|
||||
if test "x$target_found" = "xno"; then
|
||||
ifelse([$4],,[AC_MSG_ERROR([Backend $backend not found.])],[$4])
|
||||
else
|
||||
ifelse([$3],,[:],[$3])
|
||||
fi
|
||||
])
|
|
@ -0,0 +1,185 @@
|
|||
# Configure paths for SDL
|
||||
# Sam Lantinga 9/21/99
|
||||
# stolen from Manish Singh
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
sdl_exec_prefix="$withval", sdl_exec_prefix="")
|
||||
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
|
||||
, enable_sdltest=yes)
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
as_save_PATH="$PATH"
|
||||
if test "x$prefix" != xNONE; then
|
||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||
fi
|
||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
||||
PATH="$as_save_PATH"
|
||||
min_sdl_version=ifelse([$1], ,0.11.0,$1)
|
||||
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_sdltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed SDL is sufficiently new. (Also sanity
|
||||
dnl checks the results of sdl-config to some extent
|
||||
dnl
|
||||
rm -f conf.sdltest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($sdl_major_version > major) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
|
||||
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
|
||||
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
else
|
||||
if test -f conf.sdltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run SDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
rm -f conf.sdltest
|
||||
])
|
|
@ -0,0 +1,37 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
fceux_CPPFLAGS =
|
||||
fceux_LDADD =
|
||||
|
||||
bin_PROGRAMS = fceux
|
||||
fceux_SOURCES = fceu.cpp asm.cpp debug.cpp file.cpp movie.cpp ppu.cpp vsuni.cpp cart.cpp drawing.cpp filter.cpp netplay.cpp sound.cpp wave.cpp cheat.cpp emufile.cpp ines.cpp nsf.cpp state.cpp x6502.cpp conddebug.cpp input.cpp oldmovie.cpp unif.cpp config.cpp fds.cpp palette.cpp video.cpp
|
||||
if LUA
|
||||
TMP_CPPFLAGS = $(lua51_CFLAGS)
|
||||
TMP_LUA = lua-engine.cpp
|
||||
endif
|
||||
if LUA_BUILTIN
|
||||
TMP_LUA = lua-engine.cpp
|
||||
endif
|
||||
|
||||
include lua/Makefile.am.inc
|
||||
|
||||
|
||||
include utils/Makefile.am.inc
|
||||
include boards/Makefile.am.inc
|
||||
include drivers/common/Makefile.am.inc
|
||||
include input/Makefile.am.inc
|
||||
include fir/Makefile.am.inc
|
||||
|
||||
fceux_CPPFLAGS += $(TMP_CPPFLAGS)
|
||||
fceux_SOURCES += $(TMP_LUA)
|
||||
|
||||
#if NATIVEWIN32
|
||||
#include drivers/win/Makefile.am.inc
|
||||
#else
|
||||
include drivers/sdl/Makefile.am.inc
|
||||
#endif
|
||||
# TODO
|
||||
|
||||
# TODO
|
||||
|
||||
fceux_SOURCES += $(fceud_SOURCES)
|
||||
|
|
@ -0,0 +1 @@
|
|||
fceux_SOURCES += boards/01-222.cpp boards/09-034a.cpp boards/103.cpp boards/106.cpp boards/108.cpp boards/112.cpp boards/116.cpp boards/117.cpp boards/120.cpp boards/121.cpp boards/12in1.cpp boards/15.cpp boards/151.cpp boards/156.cpp boards/158B.cpp boards/164.cpp boards/168.cpp boards/170.cpp boards/175.cpp boards/176.cpp boards/177.cpp boards/178.cpp boards/18.cpp boards/183.cpp boards/185.cpp boards/186.cpp boards/187.cpp boards/189.cpp boards/193.cpp boards/199.cpp boards/206.cpp boards/208.cpp boards/222.cpp boards/225.cpp boards/228.cpp boards/230.cpp boards/232.cpp boards/234.cpp boards/235.cpp boards/244.cpp boards/246.cpp boards/252.cpp boards/253.cpp boards/28.cpp boards/32.cpp boards/33.cpp boards/34.cpp boards/36.cpp boards/3d-block.cpp boards/40.cpp boards/41.cpp boards/411120-c.cpp boards/42.cpp boards/43.cpp boards/46.cpp boards/50.cpp boards/51.cpp boards/57.cpp boards/603-5052.cpp boards/62.cpp boards/65.cpp boards/67.cpp boards/68.cpp boards/69.cpp boards/71.cpp boards/72.cpp boards/77.cpp boards/79.cpp boards/80.cpp boards/8157.cpp boards/82.cpp boards/8237.cpp boards/830118C.cpp boards/88.cpp boards/8in1.cpp boards/90.cpp boards/91.cpp boards/96.cpp boards/99.cpp boards/BMW8544.cpp boards/F-15.cpp boards/__dummy_mapper.cpp boards/a9746.cpp boards/ac-08.cpp boards/addrlatch.cpp boards/ax5705.cpp boards/bandai.cpp boards/bb.cpp boards/bmc13in1jy110.cpp boards/bmc42in1r.cpp boards/bmc64in1nr.cpp boards/bmc70in1.cpp boards/bonza.cpp boards/bs-5.cpp boards/cheapocabra.cpp boards/cityfighter.cpp boards/coolboy.cpp boards/dance2000.cpp boards/datalatch.cpp boards/dream.cpp boards/edu2000.cpp boards/eh8813a.cpp boards/emu2413.c boards/et-100.cpp boards/et-4320.cpp boards/famicombox.cpp boards/ffe.cpp boards/fk23c.cpp boards/ghostbusters63in1.cpp boards/gs-2004.cpp boards/gs-2013.cpp boards/h2288.cpp boards/hp898f.cpp boards/inlnsf.cpp boards/karaoke.cpp boards/kof97.cpp boards/ks7010.cpp boards/ks7012.cpp boards/ks7013.cpp boards/ks7016.cpp boards/ks7017.cpp boards/ks7030.cpp boards/ks7031.cpp boards/ks7032.cpp boards/ks7037.cpp boards/ks7057.cpp boards/le05.cpp boards/lh32.cpp boards/lh53.cpp boards/malee.cpp boards/mihunche.cpp boards/mmc1.cpp boards/mmc2and4.cpp boards/mmc3.cpp boards/mmc5.cpp boards/n106.cpp boards/n625092.cpp boards/novel.cpp boards/onebus.cpp boards/pec-586.cpp boards/rt-01.cpp boards/sa-9602b.cpp boards/sachen.cpp boards/sb-2000.cpp boards/sc-127.cpp boards/sheroes.cpp boards/sl1632.cpp boards/subor.cpp boards/super24.cpp boards/supervision.cpp boards/t-227-1.cpp boards/t-262.cpp boards/tengen.cpp boards/tf-1201.cpp boards/transformer.cpp boards/unrom512.cpp boards/vrc1.cpp boards/vrc2and4.cpp boards/vrc3.cpp boards/vrc5.cpp boards/vrc6.cpp boards/vrc7.cpp boards/vrc7p.cpp boards/yoko.cpp
|
|
@ -0,0 +1,24 @@
|
|||
fceux_SOURCES += drivers/sdl/config.cpp drivers/sdl/input.cpp drivers/sdl/sdl-joystick.cpp drivers/sdl/sdl-sound.cpp drivers/sdl/sdl-throttle.cpp drivers/sdl/sdl-video.cpp drivers/sdl/sdl.cpp drivers/sdl/unix-netplay.cpp
|
||||
|
||||
if OPENGL
|
||||
TMP_OGL = drivers/sdl/sdl-opengl.cpp
|
||||
endif
|
||||
|
||||
if GTK2
|
||||
TMP_GTK = drivers/sdl/gui.cpp
|
||||
fceux_CPPFLAGS += @GTK_CFLAGS@
|
||||
fceux_LDADD += @GTK_LIBS@
|
||||
fceux_LDADD += -lX11
|
||||
endif
|
||||
|
||||
if GTK3
|
||||
TMP_GTK = drivers/sdl/gui.cpp
|
||||
fceux_CPPFLAGS += @GTK_CFLAGS@
|
||||
fceux_LDADD += @GTK_LIBS@
|
||||
fceux_LDADD += -lX11
|
||||
endif
|
||||
|
||||
fceux_SOURCES += $(TMP_OGL)
|
||||
fceux_SOURCES += $(TMP_GTK)
|
||||
|
||||
# fceux_SOURCES += drivers/sdl/sdl-netplay.cpp # Doesn't work!
|
|
@ -194,7 +194,7 @@ InitVideo(FCEUGI *gi)
|
|||
// check if we should auto-set x/y resolution
|
||||
|
||||
// check for OpenGL and set the global flags
|
||||
#if OPENGL
|
||||
#ifdef OPENGL
|
||||
if(s_useOpenGL && !s_sponge) {
|
||||
flags = SDL_OPENGL;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
fceux_SOURCES += fir/c44100ntsc.coef fir/c44100ntsc.scm fir/c44100pal.coef fir/c44100pal.scm fir/c48000ntsc.coef fir/c48000ntsc.scm fir/c48000pal.coef fir/c48000pal.scm fir/c96000ntsc.coef fir/c96000ntsc.scm fir/c96000pal.coef fir/c96000pal.scm fir/c44100ntsc.h fir/c44100pal.h fir/c48000ntsc.h fir/c48000pal.h fir/c96000ntsc.h fir/c96000pal.h
|
|
@ -0,0 +1 @@
|
|||
fceux_SOURCES += input/arkanoid.cpp input/bworld.cpp input/cursor.cpp input/fkb.cpp input/ftrainer.cpp input/hypershot.cpp input/mahjong.cpp input/mouse.cpp input/oekakids.cpp input/pec586kb.cpp input/powerpad.cpp input/quiz.cpp input/shadow.cpp input/snesmouse.cpp input/suborkb.cpp input/toprider.cpp input/zapper.cpp
|
|
@ -0,0 +1,4 @@
|
|||
TMP_SOURCES = lua/src/lapi.c lua/src/lauxlib.c lua/src/lbaselib.c lua/src/lcode.c lua/src/ldblib.c lua/src/ldebug.c lua/src/ldo.c lua/src/ldump.c lua/src/lfunc.c lua/src/lgc.c lua/src/linit.c lua/src/liolib.c lua/src/llex.c lua/src/lmathlib.c lua/src/lmem.c lua/src/loadlib.c lua/src/lobject.c lua/src/lopcodes.c lua/src/loslib.c lua/src/lparser.c lua/src/lstate.c lua/src/lstring.c lua/src/lstrlib.c lua/src/ltable.c lua/src/ltablib.c lua/src/ltm.c lua/src/lundump.c lua/src/lvm.c lua/src/lzio.c lua/src/print.c
|
||||
if LUA
|
||||
fceux_SOURCES += $(TMP_SOURCES)
|
||||
endif
|
|
@ -0,0 +1,5 @@
|
|||
fceux_SOURCES += utils/backward.cpp utils/crc32.cpp utils/endian.cpp utils/general.cpp utils/guid.cpp utils/md5.cpp utils/memory.cpp utils/xstring.cpp
|
||||
if ! SYSTEM_MINIZIP
|
||||
ZIP_SOURCES = utils/ioapi.cpp utils/unzip.cpp
|
||||
endif
|
||||
fceux_SOURCES += $(ZIP_SOURCES)
|
Loading…
Reference in New Issue