2 # Usage: windres-options [--escape] PACKAGE_VERSION
3 # Outputs a set of command-line options for 'windres', containing definitions
4 # for the preprocessor variables
5 # PACKAGE_VERSION_STRING
6 # PACKAGE_VERSION_MAJOR
7 # PACKAGE_VERSION_MINOR
8 # PACKAGE_VERSION_SUBMINOR
11 if test "$1" = "--escape"; then
15 version
="$1" # something like 2.0 or 2.17 or 2.17.3 or 2.17.3-pre3
17 sed_extract_major
='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
22 sed_extract_minor
='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
27 sed_extract_subminor
='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;}
34 echo "-DPACKAGE_VERSION_STRING=\"${version}\""
35 echo "-DPACKAGE_VERSION_MAJOR="`echo "${version}" | sed -n -e "$sed_extract_major"`
36 echo "-DPACKAGE_VERSION_MINOR="`echo "${version}" | sed -n -e "$sed_extract_minor"`
37 echo "-DPACKAGE_VERSION_SUBMINOR="`echo "${version}" | sed -n -e "$sed_extract_subminor"`
40 if test -n "$escape"; then
41 sed -e 's,\(["\\]\),\\\1,g'