New option -w|--waittime as requested by Markus Widauer
[mdsms.git] / configure.in
1 # $Id$
2
3 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(mdsms.c)
5 AM_INIT_AUTOMAKE(mdsms, 1.5.3)
6 AM_CONFIG_HEADER(config.h)
7 AM_MAINTAINER_MODE
8
9 dnl Configuration switches.
10
11 AC_MSG_CHECKING([whether debugging is requested])
12 AC_ARG_ENABLE(debug,
13 [  --enable-debug          enable debugging output to stderr],
14     enable_debug=$enableval, enable_debug=no)
15 AC_MSG_RESULT($enable_debug)
16
17 AC_MSG_CHECKING([whether included getopt is requested])
18 AC_ARG_WITH(included-getopt,
19 [  --with-included-getopt  use included getopt(3)],
20      with_getopt=$withval, with_getopt=no)
21 AC_MSG_RESULT($with_getopt)
22
23 AC_MSG_CHECKING([for user-specified lock directory])
24 AC_ARG_WITH(lock-directory,
25 [  --with-lock-directory   override default search for modem lock directory],
26      with_lock_directory=$withval, with_lock_directory=)
27 AC_MSG_RESULT($with_lock_directory)
28
29 AC_ARG_WITH(efence,
30 [  --without-efence        disable use of Electric Fence in maintainer-mode],
31     efence=$withval, efence=yes)
32
33 dnl Checks for programs.
34 AC_PROG_CC
35 if test "$USE_MAINTAINER_MODE" = yes;then
36         if test "$GCC" = yes;then
37                 CFLAGS="$CFLAGS -Wall -ansi -pedantic -ggdb3"
38                 if test x$efence != xno;then
39                         AC_CHECK_LIB(efence, EF_Exit)
40                 fi
41         fi
42 else
43         LDFLAGS="-s"
44         AC_DEFINE(NDEBUG)
45 fi
46
47 AC_PROG_CPP
48
49 dnl Checks for pathnames.
50
51 ALL_LINGUAS="cs"
52 AM_GNU_GETTEXT
53 AC_CHECK_HEADERS(libintl.h)
54
55 AC_MSG_CHECKING([for modem lock directory])
56 dirx=""
57 if test "$with_lock_directory" = no;then
58   AC_MSG_RESULT([user disabled])
59 else
60   if test yes = "$with_lock_directory" \
61            -o  -z   "$with_lock_directory";then
62     for dira in /usr /var         ;do
63                 for dirb in /spool ""         ;do
64                 for dirc in /uucp /locks /lock;do
65                   dir="${dira}${dirb}${dirc}"
66                   if test -d "$dir";then dirx="$dir";fi
67                         done;done;done
68     if test -z "$dirx";then
69             AC_MSG_RESULT([none found, disabled])
70     else
71                   AC_MSG_RESULT([$dirx])
72     fi
73   else
74     dirx="$with_lock_directory"
75                 if test -d "$dirx";then AC_MSG_RESULT([$dirx])
76                 else AC_MSG_RESULT([warning - directory doesn't exist: $dirx])
77                 fi
78         fi
79 fi
80 if test -z "$dirx";then AC_DEFINE(DEF_LOCKFILE,[""])
81 else AC_DEFINE_UNQUOTED(DEF_LOCKFILE,"${dirx}/LCK..%s")
82 fi
83
84 dnl Checks for libraries.
85
86 dnl Checks for header files.
87 AC_HEADER_STDC
88
89 dnl Checks for typedefs, structures, and compiler characteristics.
90
91 AC_C_CONST
92 AC_C_INLINE
93
94 dnl Checks for library functions.
95
96 if test "$with_getopt" = no;then
97         AC_CHECK_FUNCS(getopt_long)
98         fi
99
100 if test "$enable_debug" = yes;then
101         AC_DEFINE(DEBUG)
102         fi
103
104 AC_MSG_CHECKING(whether to use included getopt)
105 if test "$with_getopt" = yes -o "$ac_cv_func_getopt_long" != yes ;then
106         LIBOBJS="$LIBOBJS getopt1.o getopt.o"
107            AC_MSG_RESULT(yes)
108 else AC_MSG_RESULT(no)
109 fi
110
111 AC_CHECK_HEADERS(assert.h ctype.h errno.h fcntl.h limits.h signal.h stdarg.h)
112 AC_CHECK_HEADERS(stdio.h stdlib.h string.h sys/poll.h sys/stat.h sys/time.h)
113 AC_CHECK_HEADERS(sys/types.h sys/wait.h termios.h time.h unistd.h)
114
115 AC_MSG_CHECKING([for LINE_MAX])
116 AC_TRY_COMPILE([
117 #ifdef HAVE_LIMITS_H
118 #include <limits.h>
119 #endif], [LINE_MAX;],
120         AC_DEFINE(HAVE_LINE_MAX)  AC_MSG_RESULT(yes),
121         AC_DEFINE(LINE_MAX, 4096) AC_MSG_RESULT(no))
122
123 AC_MSG_CHECKING([for CBAUD])
124 AC_TRY_COMPILE([
125 #ifdef HAVE_TERMIOS_H
126 #include <termios.h>
127 #endif], [CBAUD;],
128         AC_DEFINE(HAVE_CBAUD) AC_MSG_RESULT(yes),
129         AC_DEFINE(CBAUD, 0)   AC_MSG_RESULT(no))
130
131 AC_MSG_CHECKING([for CBAUDEX])
132 AC_TRY_COMPILE([
133 #ifdef HAVE_TERMIOS_H
134 #include <termios.h>
135 #endif], [CBAUDEX;],
136         AC_DEFINE(HAVE_CBAUDEX) AC_MSG_RESULT(yes),
137         AC_DEFINE(CBAUDEX, 0)   AC_MSG_RESULT(no))
138
139 AC_MSG_CHECKING([for CRTSCTS])
140 AC_TRY_COMPILE([
141 #ifdef HAVE_TERMIOS_H
142 #include <termios.h>
143 #endif], [CRTSCTS;],
144         AC_DEFINE(HAVE_CRTSCTS) AC_MSG_RESULT(yes),[
145         if test "$USE_MAINTAINER_MODE" = yes ;then
146                 AC_DEFINE(HAVE_CRTSCTS) AC_MSG_RESULT(faked for maintainer)
147                 # from "RedHat: glibc-devel-2.2-5/bits/termios.h"
148                 AC_DEFINE(CRTSCTS, 020000000000)
149         else
150                 AC_DEFINE(CRTSCTS, 0)   AC_MSG_RESULT(no)
151         fi
152         ])
153
154 AC_MSG_CHECKING([for _POSIX_VDISABLE])
155 AC_TRY_COMPILE([
156 #ifdef HAVE_UNISTD_H
157 #include <unistd.h>
158 #endif
159 #ifdef HAVE_TERMIOS_H
160 #include <termios.h>
161 #endif], [_POSIX_VDISABLE;],
162         AC_DEFINE(HAVE__POSIX_VDISABLE)    AC_MSG_RESULT(yes),[
163         AC_DEFINE(_POSIX_VDISABLE, ['\0']) AC_MSG_RESULT(no)
164         ])
165
166 AC_MSG_CHECKING([for FD_SETSIZE])
167 AC_TRY_COMPILE([
168 #ifdef HAVE_SYS_TIME_H
169 #include <sys/time.h>
170 #endif
171 #ifdef HAVE_SYS_TYPES_H
172 #include <sys/types.h>
173 #endif
174 #ifdef HAVE_UNISTD_H
175 #include <unistd.h>
176 #endif], [FD_SETSIZE;],
177         AC_DEFINE(HAVE_FD_SETSIZE) AC_MSG_RESULT(yes),
178                                    AC_MSG_RESULT(no))
179
180 AC_MSG_CHECKING([for unused attribute])
181 uns=true
182 for un in __unused__ unused;do
183   if $uns;then
184                 unx="__attribute__ (($un))"
185                 AC_TRY_COMPILE([
186 #ifdef HAVE_STDDEF_H
187 #include <stddef.h>
188 #endif],[char untest $unx;],
189                 AC_DEFINE_UNQUOTED(ATTR_UNUSED, $unx)
190                 AC_MSG_RESULT($un)
191                 uns=false)
192                 fi
193         done
194 if $uns;then AC_DEFINE(ATTR_UNUSED,) AC_MSG_RESULT(no);fi
195
196 AC_MSG_CHECKING([for printf style attribute])
197 AC_TRY_COMPILE([
198 #ifdef HAVE_STDDEF_H
199 #include <stddef.h>
200 #endif
201 void testf(char *fmt,...) __attribute__((format(printf,1,2)));
202 void testf(char *fmt,...) {}], [testf("%d",1);],
203         AC_DEFINE(HAVE_PRINTFORMAT) AC_MSG_RESULT(yes),
204                                     AC_MSG_RESULT(no)
205         )
206
207 AC_MSG_CHECKING([for offsetof macro])
208 AC_TRY_COMPILE([
209 #ifdef HAVE_STDDEF_H
210 #include <stddef.h>
211 #endif
212 struct x { int a; };], [return(offsetof(struct x,a));],
213         AC_DEFINE(HAVE_OFFSETOF) AC_MSG_RESULT(yes),
214                                  AC_MSG_RESULT(no)
215         )
216
217 AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF))
218 AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
219
220 dnl FIXME: select(3) missing here but what to do anyway
221 AC_CHECK_FUNCS(siginterrupt strerror strchr strrchr memmove atexit strcasecmp poll)
222
223 AC_TYPE_SIGNAL
224 AC_TYPE_PID_T
225
226 dnl FIXME: mktime(3) missing here
227 AC_REPLACE_FUNCS(strdup usleep)
228
229 GCC_NEED_DECLARATION(gethostname,[
230 #ifdef HAVE_UNISTD_H
231 #include <unistd.h>
232 #endif])
233 GCC_NEED_DECLARATION(kill,[
234 #ifdef HAVE_SYS_TYPES_H
235 #include <sys/types.h>
236 #endif
237 #ifdef HAVE_SIGNAL_H
238 #include <signal.h>
239 #endif])
240 GCC_NEED_DECLARATION(snprintf,[
241 #ifdef HAVE_STDIO_H
242 #include <stdio.h>
243 #endif])
244 GCC_NEED_DECLARATION(vsnprintf,[
245 #ifdef HAVE_STDIO_H
246 #include <stdio.h>
247 #endif
248 #ifdef HAVE_STDARG_H
249 #include <stdarg.h>
250 #endif])
251 GCC_NEED_DECLARATION(strdup,[
252 #ifdef HAVE_STRING_H
253 #include <string.h>
254 #endif])
255 GCC_NEED_DECLARATION(usleep,[
256 #ifdef HAVE_UNISTD_H
257 #include <unistd.h>
258 #endif])
259 GCC_NEED_DECLARATION(strcasecmp,[
260 #ifdef HAVE_STRING_H
261 #include <string.h>
262 #endif])
263 GCC_NEED_DECLARATION(siginterrupt,[
264 #ifdef HAVE_SIGNAL_H
265 #include <signal.h>
266 #endif])
267 GCC_NEED_DECLARATION(popen,[
268 #ifdef HAVE_STDIO_H
269 #include <stdio.h>
270 #endif])
271 GCC_NEED_DECLARATION(pclose,[
272 #ifdef HAVE_STDIO_H
273 #include <stdio.h>
274 #endif])
275 GCC_NEED_DECLARATION(gettext,[
276 #ifdef HAVE_LIBINTL_H
277 #include <libintl.h>
278 #endif])
279
280 # Final output.
281
282 if test "$ACLOCAL" = "aclocal";then
283   ACLOCAL="$ACLOCAL -I ."
284 fi
285
286 AC_SUBST(LIBOBJS)
287
288 AC_OUTPUT([Makefile
289 mdsms.spec
290 po/Makefile.in
291 intl/Makefile],[sed -e "/POTFILES =/r po/POTFILES" -e "s/ ChangeLog / /" po/Makefile.in > po/Makefile])