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
|
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
|
+
+
+
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
fi
FOUND=1
break
fi
done
])
dnl Usage:
dnl DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found)
dnl
AC_DEFUN(DC_GET_SHOBJFLAGS, [
AC_DEFUN(DC_TEST_SHOBJFLAGS, [
AC_SUBST(SHOBJFLAGS)
AC_SUBST(SHOBJLDFLAGS)
AC_MSG_CHECKING(how to create shared objects)
OLD_LDFLAGS="$LDFLAGS"
SHOBJFLAGS=""
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic -fPIC"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -fPIC"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic -fPIC"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -fPIC"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff"
AC_TRY_LINK([#include <stdio.h>
LDFLAGS="$OLD_LDFLAGS $1 $2"
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$LDFLAGS -shared -rdynamic -fPIC"
AC_TRY_LINK([#include <stdio.h>
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -shared -fPIC"
AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [
fi
if test -z "$SHOBJFLAGS"; then
LDFLAGS="$OLD_LDFLAGS -shared"
AC_TRY_LINK([#include <stdio.h>
LDFLAGS="$OLD_LDFLAGS"
$3
])
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
fi
LDFLAGS="$OLD_LDFLAGS"
])
AC_DEFUN(DC_GET_SHOBJFLAGS, [
AC_MSG_CHECKING(how to create shared objects)
DC_TEST_SHOBJFLAGS([-shared -fPIC], [-rdynamic], [
DC_TEST_SHOBJFLAGS([-shared -fPIC], [], [
DC_TEST_SHOBJFLAGS([-shared -fPIC], [-rdynamic -Wl,-G,-z,textoff], [
DC_TEST_SHOBJFLAGS([-shared -fPIC], [-Wl,-G,-z,textoff], [
AC_MSG_ERROR(cant)
])
])
])
])
AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)
])
|