\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{externaltikz}%
[22/02/2009 (rev. 2) Externalize TikZ environments to PDFs.]
\RequirePackage{ifthen,xkeyval}
\newif\ifDraft
\newcommand{\filename}{default}
\DeclareOptionX{draft}{\Drafttrue}
\DeclareOptionX{final}{\Draftfalse}
\DeclareOptionX{filename}[\jobname]{\renewcommand{\filename}{#1}}
\DeclareOptionX*{PackageWarning{externaltikz}{Unknown Option '\CurrentOption' will be ignored.}}
\ExecuteOptionsX{draft,filename}
\ProcessOptionsX\relax
Unfortunatelly the xkeyval manual doesn't say that you can't use \DeclareOption and \DeclareOptionX at the same time without running into problem! (LaTeX will halt saying that it can't process a given option and \Declare*{} has to be used.)