PDU receive mode implemented, untested yet.
[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.0)
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 -ggdb"
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 termios.h time.h unistd.h)
114
115 AC_CHECK_FUNC(MAX, AC_DEFINE(HAVE_MAX) ,
116         AC_CHECK_FUNC(max, AC_DEFINE(MAX, max) AC_DEFINE(HAVE_MAX))
117         )
118
119 AC_CHECK_FUNC(MIN, AC_DEFINE(HAVE_MIN) ,
120         AC_CHECK_FUNC(min, AC_DEFINE(MIN, min) AC_DEFINE(HAVE_MIN))
121         )
122
123 AC_MSG_CHECKING([for LINE_MAX])
124 AC_TRY_COMPILE([
125 #ifdef HAVE_LIMITS_H
126 #include <limits.h>
127 #endif], [LINE_MAX;],
128         AC_DEFINE(HAVE_LINE_MAX)  AC_MSG_RESULT(yes),
129         AC_DEFINE(LINE_MAX, 4096) AC_MSG_RESULT(no))
130
131 AC_MSG_CHECKING([for CBAUD])
132 AC_TRY_COMPILE([
133 #ifdef HAVE_TERMIOS_H
134 #include <termios.h>
135 #endif], [CBAUD;],
136         AC_DEFINE(HAVE_CBAUD) AC_MSG_RESULT(yes),
137         AC_DEFINE(CBAUD, 0)   AC_MSG_RESULT(no))
138
139 AC_MSG_CHECKING([for CBAUDEX])
140 AC_TRY_COMPILE([
141 #ifdef HAVE_TERMIOS_H
142 #include <termios.h>
143 #endif], [CBAUDEX;],
144         AC_DEFINE(HAVE_CBAUDEX) AC_MSG_RESULT(yes),
145         AC_DEFINE(CBAUDEX, 0)   AC_MSG_RESULT(no))
146
147 AC_MSG_CHECKING([for FD_SETSIZE])
148 AC_TRY_COMPILE([
149 #ifdef HAVE_SYS_TIME_H
150 #include <sys/time.h>
151 #endif
152 #ifdef HAVE_SYS_TYPES_H
153 #include <sys/types.h>
154 #endif
155 #ifdef HAVE_UNISTD_H
156 #include <unistd.h>
157 #endif], [FD_SETSIZE;],
158         AC_DEFINE(HAVE_FD_SETSIZE) AC_MSG_RESULT(yes),
159                                    AC_MSG_RESULT(no))
160
161 AC_MSG_CHECKING([for unused attribute])
162 uns=true
163 for un in __unused__ unused;do
164   if $uns;then
165                 unx="__attribute__ (($un))"
166                 AC_TRY_COMPILE([
167 #ifdef HAVE_STDDEF_H
168 #include <stddef.h>
169 #endif],[char untest $unx;],
170                 AC_DEFINE_UNQUOTED(ATTR_UNUSED, $unx)
171                 AC_MSG_RESULT($un)
172                 uns=false)
173                 fi
174         done
175 if $uns;then AC_DEFINE(ATTR_UNUSED,) AC_MSG_RESULT(no);fi
176
177 AC_MSG_CHECKING([for printf style attribute])
178 AC_TRY_COMPILE([
179 #ifdef HAVE_STDDEF_H
180 #include <stddef.h>
181 #endif
182 void testf(char *fmt,...) __attribute__((format(printf,1,2)));
183 void testf(char *fmt,...) {}], [testf("%d",1);],
184         AC_DEFINE(HAVE_PRINTFORMAT) AC_MSG_RESULT(yes),
185                                     AC_MSG_RESULT(no)
186         )
187
188 AC_MSG_CHECKING([for offsetof macro])
189 AC_TRY_COMPILE([
190 #ifdef HAVE_STDDEF_H
191 #include <stddef.h>
192 #endif
193 struct x { int a; };], [return(offsetof(struct x,a));],
194         AC_DEFINE(HAVE_OFFSETOF) AC_MSG_RESULT(yes),
195                                  AC_MSG_RESULT(no)
196         )
197
198 AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF))
199 AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
200
201 dnl FIXME: select(3) missing here but what to do anyway
202 AC_CHECK_FUNCS(siginterrupt strerror strchr strrchr memmove atexit strcasecmp poll)
203
204 AC_TYPE_SIGNAL
205 AC_TYPE_PID_T
206
207 dnl FIXME: mktime(3) missing here
208 AC_REPLACE_FUNCS(strdup usleep)
209
210 GCC_NEED_DECLARATION(gethostname,[
211 #ifdef HAVE_UNISTD_H
212 #include <unistd.h>
213 #endif])
214 GCC_NEED_DECLARATION(kill,[
215 #ifdef HAVE_SYS_TYPES_H
216 #include <sys/types.h>
217 #endif
218 #ifdef HAVE_SIGNAL_H
219 #include <signal.h>
220 #endif])
221 GCC_NEED_DECLARATION(snprintf,[
222 #ifdef HAVE_STDIO_H
223 #include <stdio.h>
224 #endif])
225 GCC_NEED_DECLARATION(vsnprintf,[
226 #ifdef HAVE_STDIO_H
227 #include <stdio.h>
228 #endif
229 #ifdef HAVE_STDARG_H
230 #include <stdarg.h>
231 #endif])
232 GCC_NEED_DECLARATION(strdup,[
233 #ifdef HAVE_STRING_H
234 #include <string.h>
235 #endif])
236 GCC_NEED_DECLARATION(usleep,[
237 #ifdef HAVE_UNISTD_H
238 #include <unistd.h>
239 #endif])
240 GCC_NEED_DECLARATION(strcasecmp,[
241 #ifdef HAVE_STRING_H
242 #include <string.h>
243 #endif])
244 GCC_NEED_DECLARATION(siginterrupt,[
245 #ifdef HAVE_SIGNAL_H
246 #include <signal.h>
247 #endif])
248 GCC_NEED_DECLARATION(popen,[
249 #ifdef HAVE_STDIO_H
250 #include <stdio.h>
251 #endif])
252 GCC_NEED_DECLARATION(pclose,[
253 #ifdef HAVE_STDIO_H
254 #include <stdio.h>
255 #endif])
256
257 # Final output.
258
259 if test "$ACLOCAL" = "aclocal";then
260   ACLOCAL="$ACLOCAL -I ."
261 fi
262
263 AC_SUBST(LIBOBJS)
264
265 AC_OUTPUT([Makefile
266 mdsms.spec
267 po/Makefile.in
268 intl/Makefile],[sed -e "/POTFILES =/r po/POTFILES" -e "s/ ChangeLog / /" po/Makefile.in > po/Makefile])