- # add AC_ARG_ENABLE option
- out = ''
- state = 'copy'
- for line in configure_ac.split('\n')[:-1]:
- if state == 'copy':
- if line == "# Hardware support '--enable' options.":
- state = 'acarg'
- elif state == 'acarg':
- m = re.match('AC_ARG_ENABLE\(([^,]+)', line)
- if m:
- drv_short = m.group(1)
- if drv_short.lower() > names['short']:
- out += tmpl(TMPL_AUTOCONF_AC_ARG_ENABLE)
- state = 'done'
- if line == '# Checks for libraries.':
- # new one at the end
- out += tmpl(TMPL_AUTOCONF_AC_ARG_ENABLE)
- state = 'done'
- out += line + '\n'
- if state != 'done':
- raise Exception('AC_ARG_ENABLE markers not found in configure.ac')
- configure_ac = out
-
- # add driver Makefile to AC_CONFIG_FILES
- out = ''
- state = 'copy'
- for line in configure_ac.split('\n')[:-1]:
- if state == 'copy':
- if line.find("AC_CONFIG_FILES([Makefile") > -1:
- state = 'acconf'
- elif state == 'acconf':
- m = re.match('\t\t hardware/([^/]+)/Makefile', line)
- if m:
- drv_short = m.group(1)
- if drv_short.lower() > names['short']:
- out += tmpl(TMPL_AUTOCONF_AC_CONFIG_FILES)
- state = 'done'
- else:
- # new one at the end
- out += tmpl(TMPL_AUTOCONF_AC_CONFIG_FILES)
- state = 'done'
- out += line + '\n'
- if state != 'done':
- raise Exception('AC_CONFIG_FILES marker not found in configure.ac')
- configure_ac = out
-
- # add summary line