Add version detection to unify master and cvs branches