mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
Scons: link to libiconv if available
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14061 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
85dc2d3ebd
commit
f85e2778f3
@ -546,9 +546,12 @@ conf = Configure(env,
|
|||||||
'CheckBoostLibraries' : utils.checkBoostLibraries,
|
'CheckBoostLibraries' : utils.checkBoostLibraries,
|
||||||
'CheckCommand' : utils.checkCommand,
|
'CheckCommand' : utils.checkCommand,
|
||||||
'CheckCXXGlobalCstd' : utils.checkCXXGlobalCstd,
|
'CheckCXXGlobalCstd' : utils.checkCXXGlobalCstd,
|
||||||
|
'CheckLC_MESSAGES' : utils.checkLC_MESSAGES,
|
||||||
|
'CheckIconvConst' : utils.checkIconvConst,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# pkg-config? (if not, we use hard-coded options)
|
# pkg-config? (if not, we use hard-coded options)
|
||||||
if not fast_start:
|
if not fast_start:
|
||||||
if conf.CheckPkgConfig('0.15.0'):
|
if conf.CheckPkgConfig('0.15.0'):
|
||||||
@ -689,10 +692,6 @@ if not fast_start:
|
|||||||
# we do not need to set LIBPATH now.
|
# we do not need to set LIBPATH now.
|
||||||
env['INCLUDED_GETTEXT'] = True
|
env['INCLUDED_GETTEXT'] = True
|
||||||
env['INTL_LIBS'] = ['included_intl']
|
env['INTL_LIBS'] = ['included_intl']
|
||||||
if platform_name == 'win32' and not use_vc:
|
|
||||||
# for functions AddFontResouceA, RemoveFontResourceA
|
|
||||||
# if use_vc, gdi32 will be added anyway later
|
|
||||||
env['INTL_LIBS'].append('gdi32')
|
|
||||||
env_cache['INCLUDED_GETTEXT'] = env['INCLUDED_GETTEXT']
|
env_cache['INCLUDED_GETTEXT'] = env['INCLUDED_GETTEXT']
|
||||||
env_cache['INTL_LIBS'] = env['INTL_LIBS']
|
env_cache['INTL_LIBS'] = env['INTL_LIBS']
|
||||||
else:
|
else:
|
||||||
@ -873,12 +872,6 @@ int count()
|
|||||||
('wcslen', 'HAVE_WCSLEN', None)
|
('wcslen', 'HAVE_WCSLEN', None)
|
||||||
]
|
]
|
||||||
|
|
||||||
# HAVE_ASPRINTF
|
|
||||||
# HAVE_WPRINTF
|
|
||||||
# HAVE_SNPRINTF
|
|
||||||
# HAVE_POSIX_PRINTF
|
|
||||||
# HAVE_FCNTL
|
|
||||||
|
|
||||||
for func in functions:
|
for func in functions:
|
||||||
utils.addToConfig("/* Define to 1 if you have the `%s' function. */" % func[0], newline=1)
|
utils.addToConfig("/* Define to 1 if you have the `%s' function. */" % func[0], newline=1)
|
||||||
if conf.CheckFunc(func[0], header=func[2]):
|
if conf.CheckFunc(func[0], header=func[2]):
|
||||||
@ -886,6 +879,13 @@ int count()
|
|||||||
else:
|
else:
|
||||||
utils.addToConfig('/* #undef %s */' % func[1])
|
utils.addToConfig('/* #undef %s */' % func[1])
|
||||||
|
|
||||||
|
|
||||||
|
# HAVE_ASPRINTF
|
||||||
|
# HAVE_WPRINTF
|
||||||
|
# HAVE_SNPRINTF
|
||||||
|
# HAVE_POSIX_PRINTF
|
||||||
|
# HAVE_FCNTL
|
||||||
|
|
||||||
env_functions = [
|
env_functions = [
|
||||||
('asprintf', 'HAVE_ASPRINTF'),
|
('asprintf', 'HAVE_ASPRINTF'),
|
||||||
('wprintf', 'HAVE_WPRINTF'),
|
('wprintf', 'HAVE_WPRINTF'),
|
||||||
@ -919,7 +919,7 @@ int count()
|
|||||||
# HAVE_WINT_T
|
# HAVE_WINT_T
|
||||||
# HAVE_INTTYPES_H_WITH_UINTMAX
|
# HAVE_INTTYPES_H_WITH_UINTMAX
|
||||||
# HAVE_STDINT_H_WITH_UINTMAX
|
# HAVE_STDINT_H_WITH_UINTMAX
|
||||||
|
|
||||||
types = [
|
types = [
|
||||||
('intmax_t', 'HAVE_INTMAX_T', None),
|
('intmax_t', 'HAVE_INTMAX_T', None),
|
||||||
('long double', 'HAVE_LONG_DOUBLE', None),
|
('long double', 'HAVE_LONG_DOUBLE', None),
|
||||||
@ -942,13 +942,43 @@ int count()
|
|||||||
# FIXME: #include <windows.h> is the right way?
|
# FIXME: #include <windows.h> is the right way?
|
||||||
if not conf.CheckType('pid_t', includes='#include <sys/types.h>'):
|
if not conf.CheckType('pid_t', includes='#include <sys/types.h>'):
|
||||||
utils.addToConfig('#define pid_t int')
|
utils.addToConfig('#define pid_t int')
|
||||||
|
|
||||||
# determine the use of std::tolower or tolower
|
# determine the use of std::tolower or tolower
|
||||||
if conf.CheckCXXGlobalCstd():
|
if conf.CheckCXXGlobalCstd():
|
||||||
utils.addToConfig('#define CXX_GLOBAL_CSTD 1')
|
utils.addToConfig('#define CXX_GLOBAL_CSTD 1')
|
||||||
else:
|
else:
|
||||||
utils.addToConfig('/* #undef CXX_GLOBAL_CSTD */')
|
utils.addToConfig('/* #undef CXX_GLOBAL_CSTD */')
|
||||||
|
|
||||||
|
# HAVE_LIBGDI32
|
||||||
|
# HAVE_ICONV
|
||||||
|
# HAVE_LIBC
|
||||||
|
libs = [
|
||||||
|
('gdi32', 'HAVE_LIBGDI32'),
|
||||||
|
('iconv', 'HAVE_ICONV'),
|
||||||
|
('c', 'HAVE_LIBC')
|
||||||
|
]
|
||||||
|
for lib in libs:
|
||||||
|
if conf.CheckLib(lib[0]):
|
||||||
|
utils.addToConfig('#define %s 1' % lib[1])
|
||||||
|
env[lib[1]] = True
|
||||||
|
env_cache[lib[1]] = env[lib[1]]
|
||||||
|
else:
|
||||||
|
utils.addToConfig('/* #undef %s */' % lib[1])
|
||||||
|
env[lib[1]] = False
|
||||||
|
env_cache[lib[1]] = env[lib[1]]
|
||||||
|
|
||||||
|
# HAVE_LC_MESSAGES
|
||||||
|
if conf.CheckLC_MESSAGES():
|
||||||
|
utils.addToConfig('#define HAVE_LC_MESSAGES 1')
|
||||||
|
else:
|
||||||
|
utils.addToConfig('/* #undef HAVE_LC_MESSAGES */')
|
||||||
|
|
||||||
|
# ICONV_CONST
|
||||||
|
if conf.CheckIconvConst():
|
||||||
|
utils.addToConfig('#define ICONV_CONST')
|
||||||
|
else:
|
||||||
|
utils.addToConfig('/* #undef ICONV_CONST */')
|
||||||
|
|
||||||
# PACKAGE
|
# PACKAGE
|
||||||
# PACKAGE_VERSION
|
# PACKAGE_VERSION
|
||||||
# DEVEL_VERSION
|
# DEVEL_VERSION
|
||||||
@ -1102,6 +1132,9 @@ else:
|
|||||||
env['HAVE_SNPRINTF'] = env_cache['HAVE_SNPRINTF']
|
env['HAVE_SNPRINTF'] = env_cache['HAVE_SNPRINTF']
|
||||||
env['HAVE_POSIX_PRINTF'] = env_cache['HAVE_POSIX_PRINTF']
|
env['HAVE_POSIX_PRINTF'] = env_cache['HAVE_POSIX_PRINTF']
|
||||||
env['HAVE_FCNTL'] = env_cache['HAVE_FCNTL']
|
env['HAVE_FCNTL'] = env_cache['HAVE_FCNTL']
|
||||||
|
env['HAVE_ICONV'] = env_cache['HAVE_ICONV']
|
||||||
|
env['HAVE_LIBGDI32'] = env_cache['HAVE_LIBGDI32']
|
||||||
|
env['HAVE_LIBC'] = env_cache['HAVE_LIBC']
|
||||||
|
|
||||||
#
|
#
|
||||||
# Finish auto-configuration
|
# Finish auto-configuration
|
||||||
@ -1142,12 +1175,17 @@ if platform_name in ['win32', 'cygwin']:
|
|||||||
# the final link step needs stdc++ to succeed under mingw
|
# the final link step needs stdc++ to succeed under mingw
|
||||||
# FIXME: shouldn't g++ automatically link to stdc++?
|
# FIXME: shouldn't g++ automatically link to stdc++?
|
||||||
if use_vc:
|
if use_vc:
|
||||||
env['SYSTEM_LIBS'] = ['shlwapi', 'gdi32', 'shell32', 'advapi32', 'zdll']
|
env['SYSTEM_LIBS'] = ['shlwapi', 'shell32', 'advapi32', 'zdll']
|
||||||
else:
|
else:
|
||||||
env['SYSTEM_LIBS'] = ['shlwapi', 'stdc++', 'z']
|
env['SYSTEM_LIBS'] = ['shlwapi', 'stdc++', 'z']
|
||||||
else:
|
else:
|
||||||
env['SYSTEM_LIBS'] = ['z']
|
env['SYSTEM_LIBS'] = ['z']
|
||||||
|
|
||||||
|
if env['HAVE_ICONV']:
|
||||||
|
env['SYSTEM_LIBS'].append('iconv')
|
||||||
|
if env['HAVE_LIBGDI32']:
|
||||||
|
env['SYSTEM_LIBS'].append('gdi32')
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build parameters CPPPATH etc
|
# Build parameters CPPPATH etc
|
||||||
#
|
#
|
||||||
@ -1157,12 +1195,18 @@ else:
|
|||||||
env['CPPPATH'].remove(env['QT_INC_PATH'])
|
env['CPPPATH'].remove(env['QT_INC_PATH'])
|
||||||
env['CPPPATH'] += ['$TOP_SRC_DIR/boost', '$TOP_SRC_DIR/src']
|
env['CPPPATH'] += ['$TOP_SRC_DIR/boost', '$TOP_SRC_DIR/src']
|
||||||
|
|
||||||
# TODO: add (more) appropriate compiling options (-DNDEBUG etc)
|
# add appropriate compiling options (-DNDEBUG etc)
|
||||||
# for debug/release mode
|
# for debug/release mode
|
||||||
if ARGUMENTS.get('mode', default_build_mode) == 'debug':
|
if ARGUMENTS.get('mode', default_build_mode) == 'debug':
|
||||||
env.AppendUnique(CCFLAGS = [])
|
if use_vc:
|
||||||
|
env.AppendUnique(CCFLAGS = [])
|
||||||
|
else:
|
||||||
|
env.AppendUnique(CCFLAGS = ['-Wall', '-g'])
|
||||||
else:
|
else:
|
||||||
env.AppendUnique(CCFLAGS = [])
|
if use_vc:
|
||||||
|
env.AppendUnique(CCFLAGS = ['/O2'])
|
||||||
|
else:
|
||||||
|
env.AppendUnique(CCFLAGS = ['-Wall', '-O2'])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Customized builders
|
# Customized builders
|
||||||
|
@ -281,6 +281,48 @@ def checkCommand(conf, cmd):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def checkLC_MESSAGES(conf):
|
||||||
|
''' check the definition of LC_MESSAGES '''
|
||||||
|
check_LC_MESSAGES = '''
|
||||||
|
#include <locale.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return LC_MESSAGES;
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
conf.Message('Check for LC_MESSAGES in locale.h... ')
|
||||||
|
ret = conf.TryLink(check_LC_MESSAGES, '.c')
|
||||||
|
conf.Result(ret)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME: not quite sure about this part.
|
||||||
|
def checkIconvConst(conf):
|
||||||
|
''' check the declaration of iconv '''
|
||||||
|
check_iconv_const = '''
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <iconv.h>
|
||||||
|
extern
|
||||||
|
#ifdef __cplusplus
|
||||||
|
"C"
|
||||||
|
#endif
|
||||||
|
#if defined(__STDC__) || defined(__cplusplus)
|
||||||
|
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||||
|
#else
|
||||||
|
size_t iconv();
|
||||||
|
#endif
|
||||||
|
extern size_t iconv(iconv_t cd, const char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
conf.Message('Check if the declaration of iconv needs const... ')
|
||||||
|
ret = conf.TryLink(check_iconv_const, '.c')
|
||||||
|
conf.Result(ret)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def installCygwinLDScript(path):
|
def installCygwinLDScript(path):
|
||||||
''' Install i386pe.x-no-rdata '''
|
''' Install i386pe.x-no-rdata '''
|
||||||
ld_script = os.path.join(path, 'i386pe.x-no-rdata')
|
ld_script = os.path.join(path, 'i386pe.x-no-rdata')
|
||||||
|
Loading…
Reference in New Issue
Block a user