From: Steve Reinhardt Date: Wed, 31 Aug 2005 03:34:36 +0000 (-0400) Subject: Fix to work with older versions of mysql_config that don't support --include. X-Git-Tag: m5_1.1~36 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87dfb4050e1136a3bc90762a50b84ada0ada1ced;p=gem5.git Fix to work with older versions of mysql_config that don't support --include. Also add mysql version check. --HG-- extra : convert_revision : 36b6174ed1c64e8c5516f6adee71f27e068ceca2 --- diff --git a/build/SConstruct b/build/SConstruct index c091f4795..f30014154 100644 --- a/build/SConstruct +++ b/build/SConstruct @@ -196,10 +196,30 @@ if not have_fenv: print "Warning: Header file not found." print " This host has no IEEE FP rounding mode control." -# Check for mysql +# Check for mysql. mysql_config = WhereIs('mysql_config') have_mysql = mysql_config != None +# Check MySQL version. +if have_mysql: + mysql_vers = os.popen(mysql_config + ' --version').read() + mv = [int(v) for v in mysql_vers.split('.')] + # This version check is probably overly conservative, but it deals + # with the versions we have installed. + if mv[0] < 3 or (mv[0] == 3 and mv[1] < 23) or (mv[0] == 4 and mv[1] < 1): + print "Warning: MySQL v3.23 or v4.1 or newer required." + have_mysql = False + +# Set up mysql_config commands. +if have_mysql: + mysql_config_include = mysql_config + ' --include' + if os.system(mysql_config_include + ' > /dev/null') != 0: + # older mysql_config versions don't support --include, use + # --cflags instead + mysql_config_include = mysql_config + ' --cflags' + # This seems to work in all versions + mysql_config_libs = mysql_config + ' --libs' + env = conf.Finish() # The source operand is a Value node containing the value of the option. @@ -283,8 +303,8 @@ for build_dir in build_dirs: env['USE_MYSQL'] = False else: print "Compiling in", build_dir, "with MySQL support." - env.ParseConfig(mysql_config + ' --libs') - env.ParseConfig(mysql_config + ' --include') + env.ParseConfig(mysql_config_libs) + env.ParseConfig(mysql_config_include) # The m5/SConscript file sets up the build rules in 'env' according # to the configured options.