File: SharedLibraryPathInfo.cxx

package info (click to toggle)
vtk7 7.1.1%2Bdfsg2-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 127,396 kB
  • sloc: cpp: 1,539,584; ansic: 124,382; python: 78,038; tcl: 47,013; xml: 8,142; yacc: 5,040; java: 4,439; perl: 3,132; lex: 1,926; sh: 1,500; makefile: 126; objc: 83
file content (147 lines) | stat: -rw-r--r-- 3,804 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
   This program accepts one argument which must be one of the following:

   PATH_SEP    return the path separator for the platform
   PATH_SLASH  return the directory separator
   LDD         return the name of the "ldd" equivalent for the platform
   LDD_FLAGS   return the flags (if any) needed for ldd equivalent
   LDPATH      return the name of the environment variable for shared lib path
*/


/* The path separator for this platform.  */
#if defined(_WIN32) && !defined(__CYGWIN__)
# define CMAKE_SHARED_PATH_SEP ";"
# define CMAKE_SHARED_PATH_SLASH "\\"
#else
# define CMAKE_SHARED_PATH_SEP ":"
# define CMAKE_SHARED_PATH_SLASH "/"
#endif

/* Select the environment variable holding the shared library runtime
   search path for this platform and build configuration.  Also select
   ldd command equivalent.  */

/* Linux */
#if defined(__linux)
# define CMAKE_SHARED_LDD "ldd"
# define CMAKE_SHARED_LDD_FLAGS ""
# define CMAKE_SHARED_LDPATH "LD_LIBRARY_PATH"
# define RETURN_VALUE 0
#endif

/* FreeBSD */
#if defined(__FreeBSD__)
# define CMAKE_SHARED_LDD "ldd"
# define CMAKE_SHARED_LDD_FLAGS ""
# define CMAKE_SHARED_LDPATH "LD_LIBRARY_PATH"
# define RETURN_VALUE 0
#endif

/* OS X */
#if defined(__APPLE__)
# define CMAKE_SHARED_LDD "otool"
# define CMAKE_SHARED_LDD_FLAGS "-L"
# define CMAKE_SHARED_LDPATH "DYLD_LIBRARY_PATH"
# define RETURN_VALUE 0
#endif

/* AIX */
#if defined(_AIX)
# define CMAKE_SHARED_LDD "dump"
# define CMAKE_SHARED_LDD_FLAGS "-H"
# define CMAKE_SHARED_LDPATH "LIBPATH"
# define RETURN_VALUE 0
#endif

/* SUN */
#if defined(__sparc)
# define CMAKE_SHARED_LDD "ldd"
# define CMAKE_SHARED_LDD_FLAGS ""
# include <sys/isa_defs.h>
# if defined(_ILP32)
#  define CMAKE_SHARED_LDPATH "LD_LIBRARY_PATH"
#  define RETURN_VALUE 0
# elif defined(_LP64)
#  define CMAKE_SHARED_LDPATH "LD_LIBRARY_PATH_64"
#  define RETURN_VALUE 64
# endif
#endif

/* HP-UX */
#if defined(__hpux)
# define CMAKE_SHARED_LDD "chatr"
# define CMAKE_SHARED_LDD_FLAGS ""
# if defined(__LP64__)
#  define CMAKE_SHARED_LDPATH "LD_LIBRARY_PATH"
#  define RETURN_VALUE 64
# else
#  define CMAKE_SHARED_LDPATH "SHLIB_PATH"
#  define RETURN_VALUE 0
# endif
#endif

/* Windows */
#if defined(_WIN32)
# if defined(__CYGWIN__)
#  define CMAKE_SHARED_LDD "cygcheck"
#  define CMAKE_SHARED_LDD_FLAGS ""
# endif
# define CMAKE_SHARED_LDPATH "PATH"
# define RETURN_VALUE 0
#endif

/* Guess on this unknown system.  */
#if !defined(CMAKE_SHARED_LDPATH)
# define CMAKE_SHARED_LDD "ldd"
# define CMAKE_SHARED_LDD_FLAGS ""
# define CMAKE_SHARED_LDPATH "LD_LIBRARY_PATH"
#endif

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
  if (argc > 1)
    {
    if (strcmp("LDPATH", argv[1]) == 0)
      {
      fprintf(stdout, "%s\n", CMAKE_SHARED_LDPATH);
      return 0;
      }
    else if (strcmp("PATH_SEP", argv[1]) == 0)
      {
      fprintf(stdout, "%s\n", CMAKE_SHARED_PATH_SEP);
      return 0;
      }
    else if (strcmp("PATH_SLASH", argv[1]) == 0)
      {
      fprintf(stdout, "%s\n", CMAKE_SHARED_PATH_SLASH);
      return 0;
      }
    else if (strcmp("LDD", argv[1]) == 0)
      {
      fprintf(stdout, "%s\n", CMAKE_SHARED_LDD);
      return 0;
      }
    else if (strcmp("LDD_FLAGS", argv[1]) == 0)
      {
      fprintf(stdout, "%s\n", CMAKE_SHARED_LDD_FLAGS);
      return 0;
      }
   }

  fprintf(stdout, "\nusage: %s <item>   where item is one of the following:\n\n",
          argv[0]);
  fprintf(stdout, "  LDPATH      \"%s\"\n", CMAKE_SHARED_LDPATH);
  fprintf(stdout, "  PATH_SEP    \"%s\"\n", CMAKE_SHARED_PATH_SEP);
  fprintf(stdout, "  PATH_SLASH  \"%s\"\n", CMAKE_SHARED_PATH_SLASH);
  fprintf(stdout, "  LDD         \"%s\"\n", CMAKE_SHARED_LDD);
  fprintf(stdout, "  LDD_FLAGS   \"%s\"\n", CMAKE_SHARED_LDD_FLAGS);
  fprintf(stdout, "\n");

  return 1;
}