gdbver.pp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. { This variable should be change with
  17. change in GDB CVS PM }
  18. Current_cvs_version : longint = 502;
  19. var
  20. v5_version : array[0..0] of char;external name ver_name;
  21. v4_version : pchar;external name ver_name;
  22. version : pchar;
  23. version_number : longint;
  24. only_ver : boolean;
  25. begin
  26. only_ver:=(Paramcount>0) and (ParamStr(1)='-n');
  27. getmem(version,5);
  28. strlcopy(version,@v5_version,4);
  29. if (version[0] in ['4','5','6','7','8','9']) and (version[1]='.') then
  30. begin
  31. if not only_ver then
  32. Writeln('GDB version is ',pchar(@v5_version));
  33. version_number:=ord(version[0])-ord('0');
  34. end
  35. else if (version[0]='2') and (version[1]='0') and
  36. (version[2] in ['0'..'9']) and (version[3] in ['0'..'9']) then
  37. begin
  38. { CVS version from 2000 to 2099,
  39. assume current_cvs_version PM }
  40. version_number:=Current_cvs_version;
  41. end
  42. else
  43. begin
  44. if not only_ver then
  45. Writeln('GDB version is ',v4_version);
  46. version_number:=ord(v4_version[0])-ord('0');
  47. end;
  48. freemem(version,5);
  49. if only_ver then
  50. Write(version_number);
  51. Halt(version_number);
  52. end.
  53. {
  54. $Log$
  55. Revision 1.4 2002-01-24 09:14:40 pierre
  56. * adapt to GDB 5.1
  57. Revision 1.3 2001/09/11 10:22:09 pierre
  58. * Hack to allow to recognize CVS version as 5.01
  59. Revision 1.2 2001/04/08 11:44:01 peter
  60. * new file
  61. }