function tklib=gettklib()
	if MSDOS then 
		tklib='tk84.dll'
	else
		// In the binary version libtk8.4.so has been copied in
		// the SCI/bin directory and scilab script add SCI/bin
		// to the LD_LIBRARY_PATH (or SHLIB_PATH).
		// So, If libtk8.4.so (or .sl) exists in SCI/bin ... it's ok
		
		if fileinfo('SCI/bin/@GETLIBTK@') <> [] then
			tklib='@GETLIBTK@';
			return;
		end
		
		execstr('link(''@GETLIBTK@'')', 'errcatch')
		if ans == 0 then
			tklib='@GETLIBTK@'
		else
			execstr('link(''@GETLIBTK@.0'')', 'errcatch')
			if ans == 0 then
				tklib='@GETLIBTK@.0'
			else
				mprintf('Warning: Error loading @GETLIBTK@ :""'+lasterror()+'""')
			end
		end
	end
endfunction
