File: pluginsupport.m4

package info (click to toggle)
ircii-pana 1%3A1.1-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 14,100 kB
  • ctags: 14,592
  • sloc: ansic: 130,478; sql: 6,041; makefile: 4,322; cpp: 1,270; tcl: 1,230; sh: 638; java: 151
file content (162 lines) | stat: -rw-r--r-- 4,372 bytes parent folder | download | duplicates (3)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
dnl AC_CHECK_PLUGIN_SUPPORT
dnl Copyright (c) David Walluck 2000
dnl All rights reserved.

AC_DEFUN(AC_CHECK_PLUGIN_SUPPORT,
[ if test x"$plugins" != x"0"; then
    AC_CHECK_HEADER(dlfcn.h)
    AC_CACHE_CHECK(for system version, ac_cv_system_version,
    [ if test -f "/usr/lib/NextStep/software_version"; then
        system=NEXTSTEP-"`$AWK '/3/,/3/' /usr/lib/NextStep/software_version`"
      else
        system="`uname -s`-`uname -r`"
        if test -z "$system"; then
            AC_MSG_RESULT(unknown \(can't find uname command\))
            system="unknown"
        else
          if test -r "/etc/.relid" -a x"`uname -n`" = x"`uname -s`"; then
            system="MP-RAS-`$AWK '{print $3}' /etc/.relid'`"
          fi
        fi
      fi
      ac_cv_system_version="$system"
    ])
    dnl I really wish I could ditch all of this in favor of libtool
    case "$ac_cv_system_version" in
      AIX*)
        SHLIB_LD="ld -shared"
        ;;
      BSD/OS-2* | BSD/OS-3*)
        SHLIB_LD="ld -r"
        ;;
      BSD/OS-4*)
        SHLIB_LD="$CC -shared"
        ;;
      HP-UX-*9* | HP-UX-*10* | HP-UX-*11*)
        SHLIB_CFLAGS="+Z"
        SHLIB_LD="ld"
        SHLIB_SUFFIX=".sl"
        ;;
      IRIX*32*)
        SHLIB_LD="ld -shared -32"
        ;;
      IRIX*64*)
        SHLIB_LD="ld -shared -64"
        ;;
      Linux*)
        SHLIB_CFLAGS="-fPIC"
        ;;
      MP-RAS-02*)
        SHLIB_CFLAGS="-KPIC"
        SHLIB_LD="$CC -G"
        ;;
      MP-RAS-*)
        SHLIB_CFLAGS="-KPIC"
        SHLIB_LD="$CC -G"
        LDFLAGS="$LDFLAGS -Wl,-Bexport"
        ;;
      NetBSD*)
        if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
            SHLIB_LD="ld -Bshareable"
        else
            SHLIB_LD="ld -shared"
        fi
        ;;
      FreeBSD-1*)
        dnl It sucks that I to have to do this.
        AC_MSG_ERROR(sorry, no plugins on $ac_cv_system_version)
        ;;
      FreeBSD-2.2*)
        SHLIB_LD="ld -Bshareable"
        ;;
      FreeBSD-2*)
        SHLIB_LD="ld -Bshareable"
        ;;
      FreeBSD*)
        SHLIB_LD="$CC -shared"
        ;;
      OpenBSD*)
        SHLIB_LD="$CC -shared"
        ;;
      BSDI*)
        SHLIB_LD="$CC -shared"
        ;;
      NEXTSTEP*)
        SHLIB_LD="$CC -nostdlib -r"
        ;;
      OSF1-1.0 | OSF1-1.1 | OSF1-1.2)
        SHLIB_LD="ld -R -export \$(PLUGIN_NAME)"
        ;;
      OSF1-1*)
        SHLIB_CFLAGS="-fpic"
        SHLIB_LD="ld -shared"
        ;;
      OSF1-V*)
        SHLIB_LD="ld -shared -expect_unresolved \*"
        ;;
      OSF3* | OSF4*)
        SHLIB_LD="ld -shared -expect_unresolved \*"
        ;;
      SCO_SV-3.2*)
        SHLIB_CFLAGS="-Kpic -belf"
        SHLIB_LD="ld -G"
        LDFLAGS="ldFLAGS -belf -Wl,-Bexport"
        ;;
      SINIX*5.4*)
        SHLIB_CFLAGS="-K PIC"
        SHLIB_LD="$CC -G"
        ;;
      Solaris*)
        if test x"$GCC" = x"yes"; then
          SHLIB_LD="ld -shared"
        else
          SHLIB_CFLAGS="-KPIC"
          SHLIB_LD="$CC -shared"
        fi
        ;;
      SunOS-4*)
        if test x"$GCC" = x"yes"; then
          SHLIB_LD="ld -shared"
        else
          SHLIB_CFLAGS="-PIC"
          SHLIB_LD="$CC"
        fi
        ;;
      SunOS-5*)
        if test x"$GCC" = x"yes"; then
          SHLIB_LD="ld -shared"
        else
          SHLIB_CFLAGS="-KPIC"
          SHLIB_LD="$CC"
        fi
        ;;
      UNIX_SV* | SYSTEM_V* | DYNIX/ptx*)
        SHLIB_CFLAGS="-KPIC"
        SHLIB_LD="$CC -G"
        hold_ldflags="$LDFLAGS"
        AC_TRY_LINK(, , [
        LDFLAGS="-Wl,-Bexport"
        AC_MSG_RESULT(yes)
        ], [
        AC_MSG_RESULT(no)
        LD_FLAGS="$hold_ldflags"
        ])
        ;;
      CYGWIN*)
        SHLIB_SUFFIX=".dll"
        SHLIB_LD="dllwrap --export-all --output-def \$(PLUGIN_NAME).def --implib lib\$(PLUGIN_NAME).a --driver-name \$(CC)"
        ;;
      OS/2*)
        SHLIB_SUFFIX=".dll"
        SHLIB_LD="$CC -Zdll -Zcrtdll -Zmt"
        ;;
      *)
        AC_MSG_WARN(couldn't determine plugin flags for your operatins system: $ac_cv_system_version. Check to see that "dll/Makefile" is correct and that you can actually build plugins.)
        SHLIB_CFLAGS="-fPIC"
        SHLIB_LD="$CC -shared"
        SHLIB_SUFFIX=".so"
        ;;
    esac
  else
    AC_MSG_RESULT(not building with plugin support - you will not be able to use plugins)
  fi ])