root/configure.in

Revision f469f75923a109d91ace6f58902e18516ecddfb1, 5.7 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 1 year ago)

first draft of JNI wrappers around jlog

  • Property mode set to 100755
Line 
1 dnl vim:ts=2:sw=2:et:
2 AC_INIT(jlog.c)
3 AC_CONFIG_HEADER(jlog_config.h)
4
5 AC_PROG_CC
6 AC_C_INLINE
7 AC_CANONICAL_HOST
8 AC_C_BIGENDIAN
9 AC_PROG_CPP
10 AC_PROG_RANLIB
11 AC_PROG_INSTALL
12 AC_PROG_LN_S
13 AC_PATH_PROG(AR, ar)
14 AC_PATH_PROGS(PERL, perl)
15 AC_PATH_PROGS(JAVAC, javac)
16 AC_PATH_PROGS(JAR, jar)
17 AC_SUBST(PERL)
18
19 # Checks for data types
20 AC_CHECK_SIZEOF(char, 1)
21 AC_CHECK_SIZEOF(short int, 2)
22 AC_CHECK_SIZEOF(int, 4)
23 AC_CHECK_SIZEOF(long int, 4)
24 AC_CHECK_SIZEOF(long long int, 8)
25 AC_CHECK_SIZEOF(void *, 1)
26
27 AC_CHECK_LIB(rt, sem_init, , )
28 AC_CHECK_LIB(posix4, sem_wait, , )
29
30 AC_MSG_CHECKING([whether sem_init works])
31 AC_TRY_RUN(
32         [
33 #include <semaphore.h>
34 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
35         ],
36         [AC_MSG_RESULT(yes)],
37         [
38                 AC_MSG_RESULT(no)
39                 AC_DEFINE(BROKEN_SEM_INIT)
40                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
41         ]
42 )
43
44 AC_CHECK_LIB(rt, sem_init, , )
45 AC_FUNC_STRFTIME
46
47 # Checks for header files.
48 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
49                  sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
50                  ctype.h unistd.h time.h sys/stat.h sys/time.h unistd.h sys/mman.h jni.h)
51
52 JAVA_BITS=java-bits
53 if test "x$ac_cv_header_jni_h" != "xyes" ; then
54         JAVA_BITS=
55         AC_MSG_WARN([Not building java bits due to jni.h absence (set CPPFLAGS?)])
56 fi
57 AC_SUBST(JAVA_BITS)
58
59 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
60         AC_TRY_COMPILE(
61                 [ #include <sys/types.h> ],
62                 [ u_int a; a = 1;],
63                 [ ac_cv_have_u_int="yes" ],
64                 [ ac_cv_have_u_int="no" ]
65         )
66 ])
67
68 if test "x$ac_cv_have_u_int" = "xyes" ; then
69         AC_DEFINE(HAVE_U_INT)
70         have_u_int=1
71 fi
72
73 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
74         AC_TRY_COMPILE(
75                 [ #include <sys/types.h> ],
76                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
77                 [ ac_cv_have_intxx_t="yes" ],
78                 [ ac_cv_have_intxx_t="no" ]
79         )
80 ])
81 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
82         AC_DEFINE(HAVE_INTXX_T)
83         have_intxx_t=1
84 fi
85        
86 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
87         AC_TRY_COMPILE(
88                 [ #include <sys/types.h> ],
89                 [ int64_t a; a = 1;],
90                 [ ac_cv_have_int64_t="yes" ],
91                 [ ac_cv_have_int64_t="no" ]
92         )
93 ])
94 if test "x$ac_cv_have_int64_t" = "xyes" ; then
95         AC_DEFINE(HAVE_INT64_T)
96         have_int64_t=1
97 fi
98        
99 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
100         AC_TRY_COMPILE(
101                 [ #include <sys/types.h> ],
102                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
103                 [ ac_cv_have_u_intxx_t="yes" ],
104                 [ ac_cv_have_u_intxx_t="no" ]
105         )
106 ])
107 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
108         AC_DEFINE(HAVE_U_INTXX_T)
109         have_u_intxx_t=1
110 fi
111
112 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
113         AC_TRY_COMPILE(
114                 [ #include <sys/types.h> ],
115                 [ u_int64_t a; a = 1;],
116                 [ ac_cv_have_u_int64_t="yes" ],
117                 [ ac_cv_have_u_int64_t="no" ]
118         )
119 ])
120 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
121         AC_DEFINE(HAVE_U_INT64_T)
122         have_u_int64_t=1
123 fi
124
125 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
126            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
127 then
128         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
129         AC_TRY_COMPILE(
130                 [
131 #include <sys/bitypes.h>
132                 ],
133                 [
134                         int8_t a; int16_t b; int32_t c;
135                         u_int8_t e; u_int16_t f; u_int32_t g;
136                         a = b = c = e = f = g = 1;
137                 ],
138                 [
139                         AC_DEFINE(HAVE_U_INTXX_T)
140                         AC_DEFINE(HAVE_INTXX_T)
141                         AC_MSG_RESULT(yes)
142                 ],
143                 [AC_MSG_RESULT(no)]
144         )
145 fi
146
147 if test -z "$have_u_intxx_t" ; then
148         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
149                 AC_TRY_COMPILE(
150                         [
151 #include <sys/types.h>
152                         ],
153                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
154                         [ ac_cv_have_uintxx_t="yes" ],
155                         [ ac_cv_have_uintxx_t="no" ]
156                 )
157         ])
158         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
159                 AC_DEFINE(HAVE_UINTXX_T)
160         fi
161 fi
162
163 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
164         AC_TRY_COMPILE(
165                 [
166 #include <sys/types.h>
167 #include <sys/socket.h>
168                 ],
169                 [socklen_t foo; foo = 1235;],
170                 [ ac_cv_have_socklen_t="yes" ],
171                 [ ac_cv_have_socklen_t="no" ]
172         )
173 ])
174 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
175         AC_DEFINE(HAVE_SOCKLEN_T)
176 fi
177
178 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
179         AC_TRY_COMPILE(
180                 [
181 #include <sys/types.h>
182                 ],
183                 [ size_t foo; foo = 1235; ],
184                 [ ac_cv_have_size_t="yes" ],
185                 [ ac_cv_have_size_t="no" ]
186         )
187 ])
188 if test "x$ac_cv_have_size_t" = "xyes" ; then
189         AC_DEFINE(HAVE_SIZE_T)
190 fi
191
192 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
193         AC_TRY_COMPILE(
194                 [
195 #include <sys/types.h>
196                 ],
197                 [ ssize_t foo; foo = 1235; ],
198                 [ ac_cv_have_ssize_t="yes" ],
199                 [ ac_cv_have_ssize_t="no" ]
200         )
201 ])
202 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
203         AC_DEFINE(HAVE_SSIZE_T)
204 fi
205
206 docdir="docs"
207 mansubdir="man"
208 AC_SUBST(docdir)
209 AC_SUBST(mansubdir)
210
211 AC_CHECK_LIB(pthread, pthread_create)
212
213 case $host in
214   *-*-solaris*)
215     RLDFLAG="-R"
216     ;;
217   *)
218     RLDFLAG="-Wl,--rpath="
219     ;;
220 esac
221 AC_SUBST(RLDFLAG)
222
223 DOTSO=so
224 case $host in
225   *solaris*)
226     if test "x$ac_compiler_gnu" = "xyes" ; then
227        # GCC
228        SHCFLAGS="$SHCFLAGS -fPIC -pthreads"
229        CFLAGS="$CFLAGS -pthreads"
230        SHLD="$CC -shared"
231     else
232        # Sun C compiler
233        SHCFLAGS="$SHCFLAGS -KPIC -mt"
234        CFLAGS="$CFLAGS -mt"
235        LIBS="-mt $LIBS"
236        SHLD="$CC -G"
237     fi
238     ;;
239   *linux*)
240     case `uname -m` in
241       *x86_64*)
242         SHCFLAGS="$SHCFLAGS -fPIC"
243         ;;
244     esac
245     SHCFLAGS="$SHCFLAGS -shared"
246     SHLD="$CC -shared -rdynamic"
247     ;;
248   *darwin*)
249     RLDFLAG="-R"
250     DOTSO=dylib
251     SHCFLAGS="$CFLAGS"
252     SHLD="$CC -dynamiclib -single_module -undefined dynamic_lookup -install_name \$(libdir)/\$@"
253     ;;
254   *freebsd*)
255     SHCFLAGS="$CFLAGS -fPIC -pthread"
256     SHLD="$CC -shared -rdynamic"
257     ;;
258   *)
259     AC_MSG_ERROR(need to handle this case)
260     exit 1
261     ;;
262 esac
263 AC_SUBST(DOTSO)
264 AC_SUBST(SHLD)
265 AC_SUBST(SHCFLAGS)
266 AC_SUBST(LDFLAGS)
267
268 AC_OUTPUT([
269 Makefile
270 perl/Makefile.PL
271 ])
Note: See TracBrowser for help on using the browser.