The comment atop config_data still mentions $option, but after the patch that's no longer a name used in the function. (I have to admit that using @_ in the body of the function was a little bit confusing to me at first. Did you do that in order to allow multiple options to be passed?)
Also: if you give an option to pg_config, the output is not prefixed with the variable name. So you don't need to strip the "SHAREDIR =" bit: there isn't any. This is true even if you give multiple options: schmee: master 0$ pg_config --sharedir --includedir /home/alvherre/Code/pgsql-install/REL9_6_STABLE/share /home/alvherre/Code/pgsql-install/REL9_6_STABLE/include