gdbver.pp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {
  2. $Id$
  3. Program to detect the version of libgdb that will be
  4. used for linking
  5. }
  6. program find_gdb_version;
  7. {$Linklib gdb}
  8. uses
  9. strings;
  10. const
  11. {$ifdef unix}
  12. ver_name = 'version';
  13. {$else not unix}
  14. ver_name = '_version';
  15. {$endif}
  16. var
  17. v5_version : array[0..0] of char;external name ver_name;
  18. v4_version : pchar;external name ver_name;
  19. version : pchar;
  20. version_number : longint;
  21. only_ver : boolean;
  22. begin
  23. only_ver:=(Paramcount>0) and (ParamStr(1)='-n');
  24. getmem(version,5);
  25. strlcopy(version,@v5_version,4);
  26. if (version[0] in ['4','5','6','7','8','9']) and (version[1]='.') then
  27. begin
  28. if not only_ver then
  29. Writeln('GDB version is ',pchar(@v5_version));
  30. version_number:=ord(version[0])-ord('0');
  31. end
  32. else if (version[0]='2') and (version[1]='0') and
  33. (version[2] in ['0'..'9']) and (version[3] in ['0'..'9']) then
  34. begin
  35. { CVS version from 2000 to 2099,
  36. assume version 5.01 PM }
  37. version_number:=501;
  38. end
  39. else
  40. begin
  41. if not only_ver then
  42. Writeln('GDB version is ',v4_version);
  43. version_number:=ord(v4_version[0])-ord('0');
  44. end;
  45. freemem(version,5);
  46. if only_ver then
  47. Write(version_number);
  48. Halt(version_number);
  49. end.
  50. {
  51. $Log$
  52. Revision 1.3 2001-09-11 10:22:09 pierre
  53. * Hack to allow to recognize CVS version as 5.01
  54. Revision 1.2 2001/04/08 11:44:01 peter
  55. * new file
  56. }