sysdep.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* sysdep.h -- handle host dependencies for the GNU linker
  2. Copyright (C) 1995-2015 Free Software Foundation, Inc.
  3. This file is part of the GNU Binutils.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #ifndef LD_SYSDEP_H
  17. #define LD_SYSDEP_H
  18. #ifdef PACKAGE
  19. #error sysdep.h must be included in lieu of config.h
  20. #endif
  21. #include "config.h"
  22. #include <stdio.h>
  23. #include <sys/types.h>
  24. #include <sys/stat.h>
  25. #include <stdarg.h>
  26. #ifdef STRING_WITH_STRINGS
  27. #include <string.h>
  28. #include <strings.h>
  29. #else
  30. #ifdef HAVE_STRING_H
  31. #include <string.h>
  32. #else
  33. #ifdef HAVE_STRINGS_H
  34. #include <strings.h>
  35. #else
  36. extern char *strchr ();
  37. extern char *strrchr ();
  38. #endif
  39. #endif
  40. #endif
  41. #ifdef HAVE_STDLIB_H
  42. #include <stdlib.h>
  43. #endif
  44. #ifdef HAVE_UNISTD_H
  45. #include <unistd.h>
  46. #endif
  47. #ifdef HAVE_REALPATH
  48. # define REALPATH(a,b) realpath (a, b)
  49. #else
  50. # define REALPATH(a,b) NULL
  51. #endif
  52. #ifdef USE_BINARY_FOPEN
  53. #include "fopen-bin.h"
  54. #else
  55. #include "fopen-same.h"
  56. #endif
  57. #ifdef HAVE_FCNTL_H
  58. #include <fcntl.h>
  59. #else
  60. #ifdef HAVE_SYS_FILE_H
  61. #include <sys/file.h>
  62. #endif
  63. #endif
  64. #ifdef HAVE_DLFCN_H
  65. #include <dlfcn.h>
  66. #endif
  67. #ifndef O_RDONLY
  68. #define O_RDONLY 0
  69. #endif
  70. #ifndef O_WRONLY
  71. #define O_WRONLY 1
  72. #endif
  73. #ifndef O_RDWR
  74. #define O_RDWR 2
  75. #endif
  76. #ifndef O_ACCMODE
  77. #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
  78. #endif
  79. /* Systems that don't already define this, don't need it. */
  80. #ifndef O_BINARY
  81. #define O_BINARY 0
  82. #endif
  83. #ifndef SEEK_SET
  84. #define SEEK_SET 0
  85. #endif
  86. #ifndef SEEK_CUR
  87. #define SEEK_CUR 1
  88. #endif
  89. #ifndef SEEK_END
  90. #define SEEK_END 2
  91. #endif
  92. #if !HAVE_DECL_STRSTR
  93. extern char *strstr ();
  94. #endif
  95. #if !HAVE_DECL_FREE
  96. extern void free ();
  97. #endif
  98. #if !HAVE_DECL_GETENV
  99. extern char *getenv ();
  100. #endif
  101. #if !HAVE_DECL_ENVIRON
  102. extern char **environ;
  103. #endif
  104. #endif /* ! defined (LD_SYSDEP_H) */