root/configure.in

Revision 38548991ed56b69bc705cb445b413da0d5c5755a, 4.7 kB (checked in by Wez Furlong <wez.furlong@messagesystems.com>, 6 years ago)

Use clean-IP getopt implementation.
Fixup build for jlog tools

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