Implemented a custom check for gettext's libintl.

This commit is contained in:
Sergey Popov 2008-11-14 12:10:49 +00:00
parent 0448a9f9a5
commit 13a9d22cc3
2 changed files with 42 additions and 6 deletions

View file

@ -205,21 +205,17 @@ def Warning(message):
return False
from metasconf import init_metasconf
configure_args = dict(custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig"]), config_h = "config.h",
configure_args = dict(custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext"]), config_h = "config.h",
log_file="build/config.log", conf_dir="build/sconf_temp")
if env["prereqs"]:
conf = env.Configure(**configure_args)
if env["gettextdir"]:
env.AppendUnique(CPPPATH = [os.path.join(env["gettextdir"], "include")],
LIBPATH = [os.path.join(env["gettextdir"], "lib")],
LIBS = ["intl"])
have_server_prereqs = \
conf.CheckCPlusPlus(gcc_version = "3.3") and \
conf.CheckGettextLibintl() and \
conf.CheckBoost("iostreams", require_version = "1.33.0") and \
conf.CheckBoostIostreamsGZip() and \
conf.CheckBoost("smart_ptr", header_only = True) and \
conf.CheckCHeader("libintl.h", "<>") and \
conf.CheckSDL(require_version = '1.2.7') and \
conf.CheckSDL('SDL_net') or Die("Base prerequisites are not met.")

View file

@ -3,6 +3,7 @@ from os.path import join
import os
from SCons.Builder import Builder
from SCons.Util import WhereIs
from config_check_utils import find_include
def exists():
return True
@ -56,3 +57,42 @@ def generate(env):
action = "$PO4A_TRANSLATE -f $PO4A_FORMAT -L $PO4A_CHARSET -m ${SOURCES[0]} -p ${SOURCES[1]} -l $TARGET"
)
env["BUILDERS"]["Po4aTranslate"] = po4a_translate
def CheckGettextLibintl(context):
env = context.env
backup = env.Clone().Dictionary()
context.Message("Checking for Gettext's libintl... ")
test_program = """
#include <libintl.h>
int main()
{
textdomain("test");
char* text = gettext("foo");
}
\n"""
if not env.get("gettextdir") and context.TryLink(test_program, ".c"):
context.Result("libc built-in")
return True
prefixes = [env["prefix"]]
if env.get("gettextdir"):
prefixes = [env["gettextdir"]] + prefixes
includes = find_include(prefixes, "libintl.h", "", not env["host"])
if includes:
env.AppendUnique(
CPPPATH = [join(includes[0][0], "include")],
LIBPATH = [join(includes[0][0], "lib")]
)
env.AppendUnique(LIBS = ["intl"])
if context.TryLink("/* exteral libintl*/\n" + test_program, ".c"):
context.Result("external")
return True
context.Result("no")
env.Replace(**backup)
return False
config_checks = { "CheckGettextLibintl" : CheckGettextLibintl }