\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usepackage{hyperref}

\IfFileExists{pgfplots.sty}{%
	\usepackage{pgfplots}
}{}%

\IfFileExists{tikzlibraryexternal.code.tex}{%
	\usetikzlibrary{external}
}{%
	\message{TEST IS RUNNING IN COMPATIBILITY MODE}%
	% a test to check for pgf 2.00 compatibility, to check whether the
	% external library copy shipped with pgfplots works:
	\usepgfplotslibrary{external}
}%

\pgfkeys{/pgf/images/include external/.code={\href{file:#1}{\pgfimage{#1}}}}
