--datadir=DIR directory to install shared data files
--mandir=DIR directory to install manual pages
- --disable-dependency-tracking speed up one-time builds
- --enable-link-sh decrease the number of direct dependencies
+ --disable-dependency-tracking speed up one-time builds (maybe)
+ --disable-special-linking do not use direct dependency minimizer
+ --enable-profile compile in gprof profiling instructions
Program options:
- --enable-debug include debugging symbols and code paths
- --enable-double-precision use doubles instead of floats
- --enable-profile compile in gprof profiling instructions
- --enable-clock_gettime use clock_gettime() for timing
- --enable-threads use threads for concurrency
- --enable-hotloading watch assets for automatic reloading
+ --enable-clock_gettime use a very accurate timing function
+ --enable-debug compile in assertion checks and other debug helps
+ --enable-double-precision use larger floating-point numbers
+ --enable-hotload automatically reload modified game assets
+ --enable-threads use threads for concurrency where appropriate
--with-gtk use the gtk2 toolkit (overrides --with-qt4)
--with-qt4 use the qt4 gui toolkit
-- Setup a temporary file to collect error messages.
--
-error_log = "config.log"
-os.remove(error_log)
+config_log = "config.log"
+os.remove(config_log)
--
--
-- Return true if a file exists, false otherwise.
-function file_exists(file)
- return os.execute("test -f "..file) == 0
+function file_exists(path)
+ return os.execute(string.format("test -f %q", path)) == 0
end
-- Print an error message and exit with an error.
function die(...)
- for _,value in ipairs(arg) do
+ for i,value in ipairs(arg) do
print("fatal: "..tostring(value))
end
- if file_exists(error_log) then
+ if file_exists(config_log) then
print()
print("Look through the file `config.log' for more information:\n")
- os.execute("tail "..error_log)
+ os.execute("tail "..config_log)
end
os.exit(1)
end
-- Execute a command and return its output or nil if the command failed to
-- run.
function backtick_run(command)
- local fd = io.popen(command.." 2>>"..error_log)
+ os.execute("echo '# "..command.."' >>"..config_log)
+ local fd = io.popen(command.." 2>>"..config_log)
if fd then
local stdout = fd:read("*l")
fd:close()
-- Try to execute a command and return true if the command finished
-- successfully (with an exit code of zero).
function try_run(command)
- return os.execute(command.." >/dev/null 2>>"..error_log) == 0
+ os.execute("echo '# "..command.."' >>"..config_log)
+ return os.execute(command.." >/dev/null 2>>"..config_log) == 0
end
-- Remove the whitespace surrounding a string.
-- code zero) given some arguments. Returns nil if none were successful.
function find_command(commands, args)
if not args then args = "" end
- for _,command in ipairs(commands) do
+ for i,command in ipairs(commands) do
if try_run(command.." "..args) then return command end
end
return nil
print("warning: unknown or incomplete argument "..arg)
end
- for _,arg in ipairs(arg) do
+ for i,arg in ipairs(arg) do
parse_arg(arg)
end
define("mandir", datarootdir.."/man")
define("docdir", datarootdir.."/doc/"..tarname)
- if not features["dependency-tracking"] then
+ if features["dependency-tracking"] == nil then
features["dependency-tracking"] = true
end
+ if features["special-linking"] == nil then
+ features["special-linking"] = true
+ end
+
define("config", {})
define("define", {})
define("export", {})
end
-- Check for CXX.
-tmpname = os.tmpname()..".c"
+tmpname = os.tmpname()..".cpp"
tmpfile, err = io.open(tmpname, "w")
if tmpfile then
tmpfile:write([[
config.NDEBUG = true
end
-if get_feature("extra-warnings") then
- add_cflag("-Wextra -Wno-unused-parameter")
+config.ENABLE_CLOCK_GETTIME = get_feature("clock_gettime")
+config.ENABLE_DOUBLE_PRECISION = get_feature("double-precision")
+config.ENABLE_HOTLOADING = get_feature("hotload")
+config.ENABLE_THREADS = get_feature("threads")
+if get_feature("profile") then
+ config.ENABLE_PROFILING = true
+ add_cflag("-pg")
+ LDFLAGS = LDFLAGS .. "-pg"
end
-config.USE_CLOCK_GETTIME = get_feature("clock_gettime")
-config.USE_DOUBLE_PRECISION = get_feature("double-precision")
-config.USE_HOTLOADING = get_feature("hotloading")
-config.USE_THREADS = get_feature("threads")
-config.PROFILING_ENABLED = get_feature("profile") and add_cflag("-pg")
-
-if get_feature("link-sh") then
- -- TODO
-end
-
-if get_package("gtk") then
- -- TODO
-end
-
-if get_package("qt4") then
- -- TODO
-end
+if get_package("gtk") then config.WITH_GTK = true end
+if get_package("qt4") then config.WITH_QT4 = true end
--
define.mandir = mandir
define.EXEEXT = exe_extension
define.DEP_TRACKING = get_feature("dependency-tracking")
+define.DEP_MINIMIZING = get_feature("special-linking")
export.datadir = datadir -- Used in doc/yoink.6.in.
export.PACKAGE_BUGREPORT = contact -- Used in doc/yoink.6.in.