root/src/jlog/configure.in

Revision cc981f5c55100675865b6960135d70148d8585af, 5.5 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

pull in jlog @ 52

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