mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Scons: nls support (nls=yes, gettext=include/system/auto), merge some autoconf
tests, fix CCFLAGS arg for mingw, version-suffix support, reduce unnecessary rebuild git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13892 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5b83287abe
commit
2496781ffb
@ -84,6 +84,72 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
|
||||
Alias('boost', iostreams)
|
||||
|
||||
|
||||
if env['INCLUDED_GETTEXT'] or 'intl' in targets:
|
||||
#
|
||||
# intl
|
||||
#
|
||||
print "Processing files in intl"
|
||||
|
||||
env.BuildDir('$BUILDDIR/intl', '$TOP_SRC_DIR/intl', duplicate = 0)
|
||||
|
||||
intlenv = env.Copy()
|
||||
# we need the original C compiler for these files
|
||||
intlenv['CC'] = intlenv['C_COMPILER']
|
||||
intlenv['CPPPATH'] += ['intl']
|
||||
|
||||
intlenv.Append(CCFLAGS = [
|
||||
r'-DLOCALEDIR=\"' + env['LOCALE_DIR'] + r'\"',
|
||||
r'-DLOCALE_ALIAS_PATH=\"' + env['LOCALE_DIR'] + r'\"',
|
||||
r'-DLIBDIR=\"' + env['TOP_SRC_DIR'] + r'/lib\"',
|
||||
'-DIN_LIBINTL',
|
||||
'-DENABLE_RELOCATABLE=1',
|
||||
'-DIN_LIBRARY',
|
||||
r'-DINSTALLDIR=\"' + env['PREFIX'] + r'/lib\"',
|
||||
'-DNO_XMALLOC',
|
||||
'-Dset_relocation_prefix=libintl_set_relocation_prefix',
|
||||
'-Drelocate=libintl_relocate',
|
||||
'-DDEPENDS_ON_LIBICONV=1',
|
||||
'-DHAVE_CONFIG_H'
|
||||
]
|
||||
)
|
||||
|
||||
# libgnuintl.h.in => libintl.h
|
||||
env.substFile('$TOP_SRC_DIR/intl/libintl.h', '$TOP_SRC_DIR/intl/libgnuintl.h.in')
|
||||
env.Command('$TOP_SRC_DIR/intl/libgnuintl.h', '$TOP_SRC_DIR/intl/libintl.h',
|
||||
[Copy('$TARGET', '$SOURCE')])
|
||||
|
||||
intl = intlenv.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/intl',
|
||||
LIBS = ['c'],
|
||||
source = ["$BUILDDIR/intl/%s" % x for x in Split('''
|
||||
bindtextdom.c
|
||||
dcgettext.c
|
||||
dgettext.c
|
||||
gettext.c
|
||||
finddomain.c
|
||||
loadmsgcat.c
|
||||
localealias.c
|
||||
textdomain.c
|
||||
l10nflist.c
|
||||
explodename.c
|
||||
dcigettext.c
|
||||
dcngettext.c
|
||||
dngettext.c
|
||||
ngettext.c
|
||||
plural.c
|
||||
plural-exp.c
|
||||
localcharset.c
|
||||
relocatable.c
|
||||
localename.c
|
||||
log.c
|
||||
printf.c
|
||||
osdep.c
|
||||
os2compat.c
|
||||
intl-compat.c
|
||||
''')]
|
||||
)
|
||||
Alias('intl', intl)
|
||||
|
||||
#
|
||||
# Now, src code under src/
|
||||
#
|
||||
@ -414,6 +480,7 @@ if frontend == 'qt3':
|
||||
qt3env = env.Copy()
|
||||
# disable auto scan to speed up non build time
|
||||
qt3env['QT_AUTOSCAN'] = 0
|
||||
qt3env['QT_MOCHPREFIX'] = ''
|
||||
|
||||
# load qt3 tools
|
||||
qt3env.Tool('qt')
|
||||
@ -560,9 +627,8 @@ if frontend == 'qt3':
|
||||
''')]
|
||||
|
||||
# manually moc and uic files for better performance
|
||||
# (stop autoscan, 13:20s->12:50s :-)
|
||||
qt3_moced_files = [qt3env.Moc(x.replace('.C', '.h')) for x in qt3_moc_files]
|
||||
|
||||
qt3_moced_files = [qt3env.Moc(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt3_moc_files]
|
||||
|
||||
qt3_uiced_files = [qt3env.Uic('$BUILDDIR/common/frontends/qt3/ui/'+x) for x in qt3_ui_files]
|
||||
qt3_uiced_cc_files = []
|
||||
for x in qt3_uiced_files:
|
||||
@ -883,8 +949,6 @@ elif frontend == 'qt4':
|
||||
#
|
||||
qt4_moced_files = [qt4env.Moc4(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt4_moc_files]
|
||||
|
||||
# if the moced files are included in the .C file
|
||||
# the Flatten(...) part will not be needed
|
||||
qt4 = qt4env.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/qt4',
|
||||
LIBS = qt4env['QT_LIB'],
|
||||
@ -904,7 +968,8 @@ if 'client' in targets or 'install' in targets or 'all' in targets:
|
||||
if env['HAVE_FCNTL']:
|
||||
client = env.Program(
|
||||
target = '$BUILDDIR/common/client/lyxclient',
|
||||
LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'],
|
||||
LIBS = ['supports'] + env['INTL_LIB'] + env['SYSTEM_LIBS'] +
|
||||
env['SOCKET_LIBS'] + env['BOOST_LIBRARIES'],
|
||||
source = ["$BUILDDIR/common/client/%s" % x for x in Split('''
|
||||
boost.C
|
||||
client.C
|
||||
@ -931,16 +996,10 @@ if 'tex2lyx' in targets or 'install' in targets or 'all' in targets:
|
||||
tex2lyx_env.Prepend(CPPPATH = ['$BUILDDIR/common/tex2lyx'])
|
||||
tex2lyx_env.AppendUnique(LIBPATH = ['#$LOCALLIBPATH'])
|
||||
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/FloatList.C', '$TOP_SRC_DIR/src/FloatList.C')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/Floating.C', '$TOP_SRC_DIR/src/Floating.C')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/counters.C', '$TOP_SRC_DIR/src/counters.C')
|
||||
# for some reason I do not know, I have to copy the header files as well.
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlayout.h', '$TOP_SRC_DIR/src/lyxlayout.h')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlayout.C', '$TOP_SRC_DIR/src/lyxlayout.C')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxtextclass.h', '$TOP_SRC_DIR/src/lyxtextclass.h')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxtextclass.C', '$TOP_SRC_DIR/src/lyxtextclass.C')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlex.C', '$TOP_SRC_DIR/src/lyxlex.C')
|
||||
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlex_pimpl.C', '$TOP_SRC_DIR/src/lyxlex_pimpl.C')
|
||||
for file in ['FloatList.C', 'Floating.C', 'counters.C', 'lyxlayout.h', 'lyxlayout.C',
|
||||
'lyxtextclass.h', 'lyxtextclass.C', 'lyxlex.C', 'lyxlex_pimpl.C']:
|
||||
env.Command('$BUILDDIR/common/tex2lyx/'+file, '$TOP_SRC_DIR/src/'+file,
|
||||
[Copy('$TARGET', '$SOURCE')])
|
||||
|
||||
tex2lyx = tex2lyx_env.Program(
|
||||
target = '$BUILDDIR/common/tex2lyx/tex2lyx',
|
||||
@ -1133,6 +1192,7 @@ if build_lyx or 'lyx' in targets:
|
||||
] +
|
||||
env['BOOST_LIBRARIES'] +
|
||||
env['EXTRA_LIBS'] +
|
||||
env['INTL_LIB'] +
|
||||
env['SOCKET_LIBS'] +
|
||||
env['SYSTEM_LIBS']
|
||||
)
|
||||
@ -1199,13 +1259,13 @@ if 'install' in targets:
|
||||
# others: $PREFIX/share/locale
|
||||
locale_dir = env['LOCALE_DIR']
|
||||
# do not install these files
|
||||
execlude_list = ['Makefile.am', 'Makefile.in', 'Makefile',
|
||||
exclude_list = ['Makefile.am', 'Makefile.in', 'Makefile',
|
||||
'lyx2lyx_version.py', 'lyx2lyx_version.py.in']
|
||||
|
||||
def install(dest, src):
|
||||
''' recusive installation of src to dest '''
|
||||
# separate file and directory
|
||||
files = filter(lambda x: os.path.isfile(x) and not os.path.split(x)[1] in execlude_list, src)
|
||||
files = filter(lambda x: os.path.isfile(x) and not os.path.split(x)[1] in exclude_list, src)
|
||||
dirs = filter(os.path.isdir, src)
|
||||
# install file
|
||||
env.Install(dest, files)
|
||||
@ -1217,8 +1277,35 @@ if 'install' in targets:
|
||||
return ins_dir
|
||||
#
|
||||
# executables (some of them may be none)
|
||||
env.Install(env['BIN_DIR'], filter(lambda x: x != None, [lyx, tex2lyx, client]))
|
||||
Alias('install', env['BIN_DIR'])
|
||||
#
|
||||
if env['ADD_SUFFIX_TO_EXECUTABLES']:
|
||||
program_suffix = env['PROGRAM_SUFFIX']
|
||||
else:
|
||||
program_suffix = ''
|
||||
#
|
||||
# install lyx
|
||||
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx%s' % program_suffix)
|
||||
target = os.path.join(env['BIN_DIR'], target_name)
|
||||
env.InstallAs(target, lyx)
|
||||
Alias('install', target)
|
||||
# install lyx as lyx-qt3
|
||||
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s%s' % (frontend, program_suffix))
|
||||
target = os.path.join(env['BIN_DIR'], target_name)
|
||||
env.InstallAs(target, lyx)
|
||||
Alias('install', target)
|
||||
#
|
||||
# install tex2lyx
|
||||
target_name = os.path.split(str(tex2lyx[0]))[1].replace('tex2lyx', 'tex2lyx%s' % program_suffix)
|
||||
target = os.path.join(env['BIN_DIR'], target_name)
|
||||
env.InstallAs(target, tex2lyx)
|
||||
Alias('install', target)
|
||||
#
|
||||
# install lyxclient, may not exist
|
||||
if client != None:
|
||||
target_name = os.path.split(str(client[0]))[1].replace('client', 'client%s' % program_suffix)
|
||||
target = os.path.join(env['BIN_DIR'], target_name)
|
||||
env.InstallAs(target, client)
|
||||
Alias('install', target)
|
||||
#
|
||||
# share/lyx
|
||||
dirs = install(env['SHARE_DIR'],
|
||||
@ -1240,10 +1327,10 @@ if 'install' in targets:
|
||||
Alias('install', [os.path.join(env['MAN_DIR'], x) for
|
||||
x in ['lyx.1', 'tex2lyx.1', 'lyxclient.1']])
|
||||
# locale files?
|
||||
# ru.gmo ==> ru/LC_MESSAGES/lyx.mo
|
||||
# ru.gmo ==> ru/LC_MESSAGES/lyxSUFFIX.mo
|
||||
for gmo in gmo_files:
|
||||
lan = os.path.split(str(gmo))[1].split('.')[0]
|
||||
dest_file = os.path.join(env['LOCALE_DIR'], lan, 'LC_MESSAGES', 'lyx.mo')
|
||||
dest_file = os.path.join(env['LOCALE_DIR'], lan, 'LC_MESSAGES', 'lyx' + env['PROGRAM_SUFFIX'] + '.mo')
|
||||
env.InstallAs(dest_file, gmo)
|
||||
Alias('install', dest_file)
|
||||
|
||||
|
@ -133,6 +133,7 @@ if os.name == 'nt':
|
||||
# If not specified, boost tries to figure out by itself, but it may fail.
|
||||
boost_posix = False
|
||||
packaging_method = 'windows'
|
||||
add_suffix_to_executables = False
|
||||
default_prefix = 'c:/program files/lyx'
|
||||
share_dir = 'Resources'
|
||||
man_dir = 'Resources/man/man1'
|
||||
@ -147,6 +148,7 @@ elif os.name == 'posix' and sys.platform != 'cygwin':
|
||||
default_with_x = True
|
||||
boost_posix = True
|
||||
packaging_method = 'posix'
|
||||
add_suffix_to_executables = True
|
||||
default_prefix = '/usr/local/'
|
||||
share_dir = 'share/lyx'
|
||||
man_dir = 'man/man1'
|
||||
@ -161,6 +163,7 @@ elif os.name == 'posix' and sys.platform == 'cygwin':
|
||||
default_with_x = True
|
||||
boost_posix = True
|
||||
packaging_method = 'posix'
|
||||
add_suffix_to_executables = True
|
||||
default_prefix = '/usr/local/'
|
||||
share_dir = 'share/lyx'
|
||||
man_dir = 'man/man1'
|
||||
@ -175,6 +178,7 @@ elif os.name == 'darwin':
|
||||
default_with_x = False
|
||||
boost_posix = True
|
||||
packaging_method = 'mac'
|
||||
add_suffix_to_executables = True
|
||||
# FIXME: where to install?
|
||||
default_prefix = '/usr/local/'
|
||||
share_dir = 'Resources'
|
||||
@ -190,6 +194,7 @@ else: # unsupported system
|
||||
default_with_x = True
|
||||
boost_posix = False
|
||||
packaging_method = 'posix'
|
||||
add_suffix_to_executables = True
|
||||
default_prefix = '/usr/local/'
|
||||
share_dir = 'share/lyx'
|
||||
man_dir = 'man/man1'
|
||||
@ -243,16 +248,14 @@ opts.AddOptions(
|
||||
BoolOption('warnings', 'Use warnings', True),
|
||||
# enable glib, (config.h has _GLIBCXX_CONCEPT_CHECKS)
|
||||
BoolOption('concept_checks', 'Enable concept checks', True),
|
||||
# FIXME: I do not know what is nls
|
||||
BoolOption('nls', '(NA) Whether or not use native language support', False),
|
||||
#
|
||||
BoolOption('nls', 'Whether or not use native language support', True),
|
||||
# FIXME: not implemented
|
||||
BoolOption('profile', '(NA) Whether or not enable profiling', False),
|
||||
# FIXME: not implemented
|
||||
BoolOption('std_debug', '(NA) Whether or not turn on stdlib debug', False),
|
||||
# using x11?
|
||||
BoolOption('X11', 'Use x11 windows system', default_with_x),
|
||||
# FIXME: not implemented
|
||||
BoolOption('libintl', '(NA) Use libintl library', False),
|
||||
#
|
||||
PathOption('qt_dir', 'Path to qt directory', None),
|
||||
#
|
||||
@ -275,8 +278,6 @@ opts.AddOptions(
|
||||
('version_suffix', 'install lyx as lyx-suffix', ''),
|
||||
#
|
||||
PathOption('exec_prefix', 'install architecture-independent executable files in PREFIX', None),
|
||||
# FIXME: not implemented
|
||||
PathOption('intl_prefix', '(NA) Path to intl library', None),
|
||||
# log file
|
||||
('logfile', 'save commands (not outputs) to logfile', default_log_file),
|
||||
# Path to aikasurus
|
||||
@ -334,10 +335,25 @@ if env.has_key('exec_prefix'):
|
||||
env['BIN_DIR'] = env['exec_prefix']
|
||||
else:
|
||||
env['BIN_DIR'] = os.path.join(env['PREFIX'], 'bin')
|
||||
env['SHARE_DIR'] = os.path.join(env['PREFIX'], share_dir)
|
||||
# program suffix
|
||||
if env.has_key('version_suffix'):
|
||||
env['PROGRAM_SUFFIX'] = env['version_suffix']
|
||||
else:
|
||||
env['PROGRAM_SUFFIX'] = ''
|
||||
env['ADD_SUFFIX_TO_EXECUTABLES'] = add_suffix_to_executables
|
||||
env['SHARE_DIR'] = os.path.join(env['PREFIX'], share_dir + env['PROGRAM_SUFFIX'])
|
||||
env['MAN_DIR'] = os.path.join(env['PREFIX'], man_dir)
|
||||
env['LOCALE_DIR'] = os.path.join(env['PREFIX'], locale_dir)
|
||||
|
||||
#
|
||||
# this is a bit out of place (after auto-configration) but
|
||||
# it is required to do the tests. Since Tool('mingw') will
|
||||
# reset CCFLAGS etc, this should be before getEnvVariable
|
||||
if platform_name == 'win32':
|
||||
env.Tool('mingw')
|
||||
env.AppendUnique(CPPPATH = ['#c:/MinGW/include'])
|
||||
|
||||
|
||||
# speed up source file processing
|
||||
#env['CPPSUFFIXES'] = ['.C', '.cc', '.cpp']
|
||||
#env['CXXSUFFIX'] = ['.C']
|
||||
@ -426,12 +442,6 @@ if env.has_key('extra_lib_path1') and env['extra_lib_path1']:
|
||||
if env.has_key('aikasurus_path') and env['aikasurus_path']:
|
||||
env.AppendUnique(LIBPATH = [env['aikasurus_path']])
|
||||
|
||||
#
|
||||
# this is a bit out of place (after auto-configration)
|
||||
# but it is required to do the tests.
|
||||
if platform_name == 'win32':
|
||||
env.AppendUnique(CPPPATH = ['#c:/MinGW/include'])
|
||||
env.Tool('mingw')
|
||||
|
||||
# under windows, scons is confused by .C/.c and uses gcc instead of
|
||||
# g++. I am forcing the use of g++ here. This is expected to change
|
||||
@ -440,6 +450,8 @@ if platform_name == 'win32':
|
||||
# Note that this step has to be after env.Tool('mingw') step
|
||||
# since env.Tool('mingw') will set env['CC'] etc.
|
||||
#
|
||||
# save the old c compiler
|
||||
env['C_COMPILER'] = env['CC']
|
||||
if env.has_key('CXX') and env['CXX']:
|
||||
env['CC'] = env['CXX']
|
||||
env['LINK'] = env['CXX']
|
||||
@ -456,13 +468,10 @@ conf = Configure(env,
|
||||
custom_tests = {
|
||||
'CheckPkgConfig' : utils.checkPkgConfig,
|
||||
'CheckPackage' : utils.checkPackage,
|
||||
'CheckPutenv' : utils.checkPutenv,
|
||||
'CheckIstreambufIterator' : utils.checkIstreambufIterator,
|
||||
'CheckMkdirOneArg' : utils.checkMkdirOneArg,
|
||||
'CheckStdCount' : utils.checkStdCount,
|
||||
'CheckSelectArgType' : utils.checkSelectArgType,
|
||||
'CheckBoostLibraries' : utils.checkBoostLibraries,
|
||||
'CheckMsgFmt' : utils.checkMsgFmt,
|
||||
'CheckCommand' : utils.checkCommand,
|
||||
}
|
||||
)
|
||||
|
||||
@ -570,10 +579,44 @@ else:
|
||||
env['BOOST_LIBRARIES'] = env_cache['BOOST_LIBRARIES']
|
||||
env['INCLUDED_BOOST'] = env_cache['INCLUDED_BOOST']
|
||||
|
||||
|
||||
if not env.has_key('nls') or env['nls']:
|
||||
env['ENABLE_NLS'] = True
|
||||
|
||||
if not fast_start:
|
||||
if not env['ENABLE_NLS']:
|
||||
env['INTL_LIB'] = []
|
||||
env['INCLUDED_GETTEXT'] = False
|
||||
else:
|
||||
# check gettext libraries
|
||||
gettext_opt = ARGUMENTS.get('gettext', default_gettext_opt)
|
||||
# check for system gettext
|
||||
succ = False
|
||||
if gettext_opt in ['auto', 'system']:
|
||||
if conf.CheckLib('intl'):
|
||||
env['INCLUDED_GETTEXT'] = False
|
||||
succ = True
|
||||
else: # no found
|
||||
if gettext_opt == 'system':
|
||||
print "Can not find system gettext library"
|
||||
print "Please supply a path through extra_lib_path and try again."
|
||||
print "Or use gettext=included to use included gettext libraries."
|
||||
Exit(2)
|
||||
# now, auto and succ = false, or gettext=included
|
||||
if not succ:
|
||||
# we do not need to set LIBPATH now.
|
||||
env['INCLUDED_GETTEXT'] = True
|
||||
env['INTL_LIB'] = ['intl']
|
||||
env_cache['INCLUDED_GETTEXT'] = env['INCLUDED_GETTEXT']
|
||||
env_cache['INTL_LIB'] = env['INTL_LIB']
|
||||
else:
|
||||
env['INTL_LIB'] = env_cache['INTL_LIB']
|
||||
env['INCLUDED_GETTEXT'] = env_cache['INCLUDED_GETTEXT']
|
||||
|
||||
#
|
||||
# check for msgfmt command
|
||||
if not fast_start:
|
||||
env['MSGFMT'] = conf.CheckMsgFmt()
|
||||
env['MSGFMT'] = conf.CheckCommand('msgfmt')
|
||||
env_cache['MSGFMT'] = env['MSGFMT']
|
||||
else:
|
||||
env['MSGFMT'] = env_cache['MSGFMT']
|
||||
@ -621,6 +664,7 @@ if not fast_start:
|
||||
('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'),
|
||||
('sys/socket.h', 'HAVE_SYS_SOCKET_H', 'c'),
|
||||
('unistd.h', 'HAVE_UNISTD_H', 'c'),
|
||||
('inttypes.h', 'HAVE_INTTYPES_H', 'c'),
|
||||
('utime.h', 'HAVE_UTIME_H', 'c'),
|
||||
('istream', 'HAVE_ISTREAM', 'cxx'),
|
||||
('ostream', 'HAVE_OSTREAM', 'cxx'),
|
||||
@ -646,47 +690,93 @@ if not fast_start:
|
||||
# HAVE__GETPID
|
||||
# HAVE_MKDIR
|
||||
# HAVE__MKDIR
|
||||
# HAVE_PUTENV
|
||||
# HAVE_MKTEMP
|
||||
# HAVE_MKSTEMP
|
||||
# HAVE_STRERROR
|
||||
# HAVE_FCNTL
|
||||
# HAVE_STD_COUNT
|
||||
|
||||
# Check functions
|
||||
functions = [
|
||||
('open', 'HAVE_OPEN'),
|
||||
('close', 'HAVE_CLOSE'),
|
||||
('popen', 'HAVE_POPEN'),
|
||||
('pclose', 'HAVE_PCLOSE'),
|
||||
('_open', 'HAVE__OPEN'),
|
||||
('_close', 'HAVE__CLOSE'),
|
||||
('_popen', 'HAVE__POPEN'),
|
||||
('_pclose', 'HAVE__PCLOSE'),
|
||||
('getpid', 'HAVE_GETPID'),
|
||||
('_getpid', 'HAVE__GETPID'),
|
||||
('mkdir', 'HAVE_MKDIR'),
|
||||
('_mkdir', 'HAVE__MKDIR'),
|
||||
('mktemp', 'HAVE_MKTEMP'),
|
||||
('mkstemp', 'HAVE_MKSTEMP'),
|
||||
('strerror', 'HAVE_STRERROR'),
|
||||
('open', 'HAVE_OPEN', None),
|
||||
('close', 'HAVE_CLOSE', None),
|
||||
('popen', 'HAVE_POPEN', None),
|
||||
('pclose', 'HAVE_PCLOSE', None),
|
||||
('_open', 'HAVE__OPEN', None),
|
||||
('_close', 'HAVE__CLOSE', None),
|
||||
('_popen', 'HAVE__POPEN', None),
|
||||
('_pclose', 'HAVE__PCLOSE', None),
|
||||
('getpid', 'HAVE_GETPID', None),
|
||||
('_getpid', 'HAVE__GETPID', None),
|
||||
('mkdir', 'HAVE_MKDIR', None),
|
||||
('_mkdir', 'HAVE__MKDIR', None),
|
||||
('putenv', 'HAVE_PUTENV', None),
|
||||
('mktemp', 'HAVE_MKTEMP', None),
|
||||
('mkstemp', 'HAVE_MKSTEMP', None),
|
||||
('strerror', 'HAVE_STRERROR', None),
|
||||
('count', 'HAVE_STD_COUNT', '''
|
||||
#include <algorithm>
|
||||
int count()
|
||||
{
|
||||
char a[] = "hello";
|
||||
return std::count(a, a+5, 'l');
|
||||
}
|
||||
''')
|
||||
]
|
||||
|
||||
# HAVE_ASPRINTF
|
||||
# HAVE_WPRINTF
|
||||
# HAVE_SNPRINTF
|
||||
# HAVE_POSIX_PRINTF
|
||||
# HAVE_FCNTL
|
||||
|
||||
for func in functions:
|
||||
if conf.CheckFunc(func[0]):
|
||||
if conf.CheckFunc(func[0], header=func[2]):
|
||||
utils.addToConfig('#define %s 1' % func[1], TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef %s */' % func[1], TOP_SRC_DIR)
|
||||
|
||||
if conf.CheckFunc('fcntl'):
|
||||
utils.addToConfig('#define HAVE_FCNTL 1', TOP_SRC_DIR)
|
||||
env['HAVE_FCNTL'] = True
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_FCNTL */', TOP_SRC_DIR)
|
||||
env['HAVE_FCNTL'] = False
|
||||
env_functions = [
|
||||
('asprintf', 'HAVE_ASPRINTF'),
|
||||
('wprintf', 'HAVE_WPRINTF'),
|
||||
('snprintf', 'HAVE_SNPRINTF'),
|
||||
('printf', 'HAVE_POSIX_PRINTF'),
|
||||
('fcntl', 'HAVE_FCNTL')
|
||||
]
|
||||
|
||||
for func in env_functions:
|
||||
if conf.CheckFunc(func[0]):
|
||||
utils.addToConfig('#define %s 1' % func[1], TOP_SRC_DIR)
|
||||
env[func[1]] = 1
|
||||
else:
|
||||
utils.addToConfig('/* #undef %s */' % func[1], TOP_SRC_DIR)
|
||||
env[func[1]] = 0
|
||||
|
||||
# HAVE_INTMAX_T
|
||||
# HAVE_INTTYPES_H_WITH_UINTMAX
|
||||
# HAVE_DECL_ISTREAMBUF_ITERATOR
|
||||
if conf.CheckType('intmax_t', includes='#include <stdint.h>') or \
|
||||
conf.CheckType('intmax_t', includes='#include <inttypes.h>'):
|
||||
utils.addToConfig('#define HAVE_INTMAX_T 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_INTMAX_T */', TOP_SRC_DIR)
|
||||
|
||||
if conf.CheckType('uintmax_t', includes='#include <inttypes.h>'):
|
||||
utils.addToConfig('#define HAVE_INTTYPES_H_WITH_UINTMAX 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_INTTYPES_H_WITH_UINTMAX */', TOP_SRC_DIR)
|
||||
|
||||
if conf.CheckType('std::istreambuf_iterator<std::istream>',
|
||||
includes='#include <streambuf>\n#include <istream>'):
|
||||
utils.addToConfig('#define HAVE_DECL_ISTREAMBUF_ITERATOR 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_DECL_ISTREAMBUF_ITERATOR */', TOP_SRC_DIR)
|
||||
|
||||
|
||||
# PACKAGE
|
||||
# PACKAGE_VERSION
|
||||
# DEVEL_VERSION
|
||||
utils.addToConfig('#define PACKAGE "%s"' % PACKAGE, TOP_SRC_DIR)
|
||||
utils.addToConfig('#define PACKAGE "%s%s"' % (PACKAGE, env['PROGRAM_SUFFIX']), TOP_SRC_DIR)
|
||||
utils.addToConfig('#define PACKAGE_VERSION "%s"' % PACKAGE_VERSION, TOP_SRC_DIR)
|
||||
if DEVEL_VERSION:
|
||||
utils.addToConfig('#define DEVEL_VERSION 1', TOP_SRC_DIR)
|
||||
@ -783,30 +873,12 @@ if not fast_start:
|
||||
else:
|
||||
utils.addToConfig('/* #undef BOOST_POSIX */', TOP_SRC_DIR)
|
||||
|
||||
# HAVE_PUTENV
|
||||
if conf.CheckPutenv():
|
||||
utils.addToConfig('#define HAVE_PUTENV 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_PUTENV */', TOP_SRC_DIR)
|
||||
|
||||
# HAVE_DECL_ISTREAMBUF_ITERATOR
|
||||
if conf.CheckIstreambufIterator():
|
||||
utils.addToConfig('#define HAVE_DECL_ISTREAMBUF_ITERATOR 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_DECL_ISTREAMBUF_ITERATOR */', TOP_SRC_DIR)
|
||||
|
||||
# MKDIR_TAKES_ONE_ARG
|
||||
if conf.CheckMkdirOneArg():
|
||||
utils.addToConfig('#define MKDIR_TAKES_ONE_ARG 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef MKDIR_TAKES_ONE_ARG */', TOP_SRC_DIR)
|
||||
|
||||
# HAVE_STD_COUNT
|
||||
if conf.CheckStdCount():
|
||||
utils.addToConfig('#define HAVE_STD_COUNT 1', TOP_SRC_DIR)
|
||||
else:
|
||||
utils.addToConfig('/* #undef HAVE_STD_COUNT */', TOP_SRC_DIR)
|
||||
|
||||
# SELECT_TYPE_ARG1
|
||||
# SELECT_TYPE_ARG234
|
||||
# SELECT_TYPE_ARG5
|
||||
@ -826,6 +898,10 @@ if not fast_start:
|
||||
env_cache['USE_ASPELL'] = env['USE_ASPELL']
|
||||
env_cache['USE_PSPELL'] = env['USE_PSPELL']
|
||||
env_cache['USE_ISPELL'] = env['USE_ISPELL']
|
||||
env_cache['HAVE_ASPRINTF'] = env['HAVE_ASPRINTF']
|
||||
env_cache['HAVE_WPRINTF'] = env['HAVE_WPRINTF']
|
||||
env_cache['HAVE_SNPRINTF'] = env['HAVE_SNPRINTF']
|
||||
env_cache['HAVE_POSIX_PRINTF'] = env['HAVE_POSIX_PRINTF']
|
||||
env_cache['HAVE_FCNTL'] = env['HAVE_FCNTL']
|
||||
|
||||
else:
|
||||
@ -840,6 +916,10 @@ else:
|
||||
env['USE_ASPELL'] = env_cache['USE_ASPELL']
|
||||
env['USE_PSPELL'] = env_cache['USE_PSPELL']
|
||||
env['USE_ISPELL'] = env_cache['USE_ISPELL']
|
||||
env['HAVE_ASPRINTF'] = env_cache['HAVE_ASPRINTF']
|
||||
env['HAVE_WPRINTF'] = env_cache['HAVE_WPRINTF']
|
||||
env['HAVE_SNPRINTF'] = env_cache['HAVE_SNPRINTF']
|
||||
env['HAVE_POSIX_PRINTF'] = env_cache['HAVE_POSIX_PRINTF']
|
||||
env['HAVE_FCNTL'] = env_cache['HAVE_FCNTL']
|
||||
|
||||
#
|
||||
@ -905,8 +985,6 @@ else:
|
||||
#
|
||||
# install customized builders
|
||||
env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
|
||||
# FIXME: there must be a better way.
|
||||
env['BUILDERS']['fileCopy'] = Builder(action = utils.env_filecopy)
|
||||
|
||||
#
|
||||
# A Link script for cygwin see
|
||||
@ -929,11 +1007,6 @@ env['LYX_DIR'] = env['SHARE_DIR']
|
||||
# LYX_ABS_INSTALLED_LOCALEDIR
|
||||
env['LOCALEDIR'] = env['LOCALE_DIR']
|
||||
env['TOP_SRCDIR'] = env['TOP_SRC_DIR']
|
||||
# program suffix
|
||||
if env.has_key('version_suffix'):
|
||||
env['PROGRAM_SUFFIX'] = env['version_suffix']
|
||||
else:
|
||||
env['PROGRAM_SUFFIX'] = ''
|
||||
# needed by src/version.C.in => src/version.C
|
||||
env['PACKAGE_VERSION'] = PACKAGE_VERSION
|
||||
# fill in the version info
|
||||
|
@ -13,8 +13,10 @@
|
||||
#
|
||||
|
||||
import os, sys, re, shutil, glob
|
||||
from SCons.Util import WhereIs
|
||||
|
||||
config_h = os.path.join('src', 'config.h')
|
||||
config_content = ''
|
||||
|
||||
def writeToFile(filename, lines, append = False):
|
||||
" utility function: write or append lines to filename "
|
||||
@ -26,14 +28,6 @@ def writeToFile(filename, lines, append = False):
|
||||
file.close()
|
||||
|
||||
|
||||
def addToConfig(lines, top_src_dir):
|
||||
''' utility function: shortcut for appending lines to outfile
|
||||
add newline at the end of lines.
|
||||
'''
|
||||
if lines.strip() != '':
|
||||
writeToFile(os.path.join(top_src_dir, config_h), lines + '\n\n', append = True)
|
||||
|
||||
|
||||
def printEnvironment(env, keys=[]):
|
||||
''' used to check profile settings '''
|
||||
dict = env.Dictionary()
|
||||
@ -72,11 +66,6 @@ def env_subst(target, source, env):
|
||||
#os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
|
||||
|
||||
|
||||
def env_filecopy(target, source, env):
|
||||
''' target can be a directory '''
|
||||
shutil.copy(str(source[0]), str(target[0]))
|
||||
|
||||
|
||||
#
|
||||
# autoconf tests
|
||||
#
|
||||
@ -99,8 +88,8 @@ def checkPackage(conf, pkg):
|
||||
|
||||
def startConfigH(top_src_dir):
|
||||
''' Write the first part of config.h '''
|
||||
writeToFile(os.path.join(top_src_dir, config_h),
|
||||
'''/* src/config.h. Generated by scon. */
|
||||
global config_content
|
||||
config_content = '''/* src/config.h. Generated by scon. */
|
||||
|
||||
/* -*- C++ -*- */
|
||||
/*
|
||||
@ -116,13 +105,23 @@ def startConfigH(top_src_dir):
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
''')
|
||||
'''
|
||||
|
||||
|
||||
def addToConfig(lines, top_src_dir):
|
||||
''' utility function: shortcut for appending lines to outfile
|
||||
add newline at the end of lines.
|
||||
'''
|
||||
global config_content
|
||||
if lines.strip() != '':
|
||||
config_content += lines + '\n\n'
|
||||
|
||||
|
||||
def endConfigH(top_src_dir):
|
||||
''' Write the last part of config.h '''
|
||||
writeToFile(os.path.join(top_src_dir, config_h), '''
|
||||
/************************************************************
|
||||
global config_content
|
||||
writeToFile(os.path.join(top_src_dir, config_h), config_content +
|
||||
'''/************************************************************
|
||||
** You should not need to change anything beyond this point */
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
@ -167,40 +166,7 @@ int mkstemp(char*);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
''', append=True)
|
||||
|
||||
|
||||
#HAVE_PUTENV
|
||||
def checkPutenv(conf):
|
||||
check_putenv_source = """
|
||||
#include <stdlib.h>
|
||||
int main()
|
||||
{
|
||||
putenv("");
|
||||
return(0);
|
||||
}
|
||||
"""
|
||||
conf.Message('Checking for putenv... ')
|
||||
ret = conf.TryLink(check_putenv_source, '.c')
|
||||
conf.Result(ret)
|
||||
return ret
|
||||
|
||||
|
||||
#HAVE_DECL_ISTREAMBUF_ITERATOR
|
||||
def checkIstreambufIterator(conf):
|
||||
check_istreambuf_iterator_source = """
|
||||
#include <streambuf>
|
||||
#include <istream>
|
||||
int main()
|
||||
{
|
||||
std::istreambuf_iterator<std::istream> iter;
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
conf.Message('Checking for iostreambuf::iterator... ')
|
||||
ret = conf.TryLink(check_istreambuf_iterator_source, '.cpp')
|
||||
conf.Result(ret)
|
||||
return ret
|
||||
''')
|
||||
|
||||
|
||||
#MKDIR_TAKES_ONE_ARG
|
||||
@ -222,28 +188,6 @@ int main()
|
||||
return ret
|
||||
|
||||
|
||||
#HAVE_STD_COUNT
|
||||
def checkStdCount(conf):
|
||||
check_std_count_source = """
|
||||
#include <algorithm>
|
||||
using std::count;
|
||||
int countChar(char * b, char * e, char const c)
|
||||
{
|
||||
return count(b, e, c);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
char a[] = "hello";
|
||||
int i = countChar(a, a + 5, 'l');
|
||||
}
|
||||
"""
|
||||
conf.Message('Checking for std::count... ')
|
||||
ret = conf.TryLink(check_std_count_source, '.cpp')
|
||||
conf.Result(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# SELECT_TYPE_ARG1
|
||||
# SELECT_TYPE_ARG234
|
||||
# SELECT_TYPE_ARG5
|
||||
@ -294,15 +238,14 @@ def checkBoostLibraries(conf, lib, pathes):
|
||||
return ('','')
|
||||
|
||||
|
||||
def checkMsgFmt(conf):
|
||||
''' check the existence of command msgfmt '''
|
||||
conf.Message('Checking for gettext command msgfmt...')
|
||||
res = conf.TryAction('msgfmt --help')
|
||||
conf.Result(res[0])
|
||||
if res[0]:
|
||||
return 'msgfmt'
|
||||
else:
|
||||
return None
|
||||
def checkCommand(conf, cmd):
|
||||
''' check the existence of a command
|
||||
return full path to the command, or none
|
||||
'''
|
||||
conf.Message('Checking for command %s...' % cmd)
|
||||
res = WhereIs(cmd)
|
||||
conf.Result(res is not None)
|
||||
return res
|
||||
|
||||
|
||||
def installCygwinLDScript(path):
|
||||
|
Loading…
Reference in New Issue
Block a user