\@ifundefined{pdfoutput}%
  {\let\pdfoutput\@undefined
    \ExecuteOptions{dvips}%
    \AtEndOfPackage{%
      \@ifundefined{DeclareGraphicsRule}%
        {\let\DeclareGraphicsRule\@undefined}%
        {\DeclareGraphicsRule{.pz}{eps}{.bb}{}%
         \DeclareGraphicsRule{.eps.Z}{eps}{.eps.bb}{}%
         \DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{}%
         \DeclareGraphicsRule{.ps.gz}{eps}{.ps.bb}{}%
         \DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{}}}%
  }%
  {\ifcase\pdfoutput
      \let\pdfoutput\@undefined
      \ExecuteOptions{dvips}%
      \AtEndOfPackage{%
        \@ifundefined{DeclareGraphicsRule}%
          {\let\DeclareGraphicsRule\@undefined}%
          {\DeclareGraphicsRule{.pz}{eps}{.bb}{}%
           \DeclareGraphicsRule{.eps.Z}{eps}{.eps.bb}{}%
           \DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{}%
           \DeclareGraphicsRule{.ps.gz}{eps}{.ps.bb}{}%
           \DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{}}}%
   \else
      \ExecuteOptions{pdftex}
   \fi}%
