Based on my answer at How to link two terms in math mode, use
\ubar{left}{middle}{right}{undertext}
where each term is taken in math mode, including the undertext.
The parameters \rldp, \rlht, \rlwd, and \rlbr can be altered to affect the appearance.
\rldp is the depth of the primary horizontal underbar
\rlht is the height of the vertical struts, both above and below the primary horizontal underbar.
\rlwd is the width (thickness) of the rule
\rlbr is the height of the secondary vertical rules, which gird the actual math terms.
\documentclass{article}
\usepackage{stackengine}
\stackMath
\def\rldp{1.4ex}
\def\rlht{.8ex}
\def\rlwd{.8pt}
\def\rlbr{2pt}
\setstackgap{L}{\rldp}
\def\uvbarR#1{%
\def\stackalignment{r}\def\stacktype{S}\stackunder[-\rlwd]{%
\def\stackalignment{c}\def\stacktype{L}\stackunder{\ubr{#1}}{\rule{\rlwd}{\rlht}}%
}{\setbox0\hbox{$#1$}\rule{.5\wd0}{\rlwd}}%
}
\def\uvbarL#1{%
\def\stackalignment{l}\def\stacktype{S}\stackunder[-\rlwd]{%
\def\stackalignment{c}\def\stacktype{L}\stackunder{\ubr{#1}}{\rule{\rlwd}{\rlht}}%
}{\setbox0\hbox{$#1$}\rule{.5\wd0}{\rlwd}}%
}
\def\uvbar#1#2{%
\def\stacktype{S}\def\stackalignment{c}\def\useanchorwidth{T}\stackunder[0pt]{%
\def\stacktype{L}\setbox0\hbox{${}#1{}$}%
\stackunder[\rldp]{{}#1{}}{\rule{\wd0}{\rlwd}}%
}{\def\stacktype{S}\stackunder[1pt]{\rule{\rlwd}{\rlht}}{\scriptscriptstyle#2}}%
}
\def\ubr#1{\setbox2=\hbox{$#1$}\stackunder[\dimexpr\rldp-\rlht\relax]{#1}{%
\llap{\rule{\rlwd}{\rlbr}}\rule{\wd2}{\rlwd}\rlap{\rule{\rlwd}{\rlbr}}}}
\newcommand\ubar[4]{\uvbarR{#1} \uvbar{#2}{#4} \uvbarL{#3}}
\begin{document}
$\ubar{ax}{+ by +}{cz}{h} =d$
\end{document}

As egreg suggests, thinning out the lines through the use of \rlwd may be desirable. Here it is with \rlwd set to 0.4pt.
