Removed strict converting/checking of symbol characters to '?'.
[mdsms.git] / configure.in
1 # $Id$
2 #
3 # $Log$
4 # Revision 1.3  1999/07/14 01:02:51  short
5 # Version bumped to 1.2.
6 #
7 # Revision 1.2  1999/06/03 11:48:18  short
8 # Version bumped to 1.1.
9 #
10 # Revision 1.1.1.1  1999/05/26 13:06:26  short
11 # First alpha release.
12 #
13
14 dnl Process this file with autoconf to produce a configure script.
15 AC_INIT(mdsms.c)
16 AM_INIT_AUTOMAKE(mdsms, 1.2)
17 AM_CONFIG_HEADER(config.h)
18 AM_MAINTAINER_MODE
19
20 dnl Configuration switches.
21
22 AC_MSG_CHECKING([whether debugging is requested])
23 AC_ARG_ENABLE(debug,
24 [  --enable-debug          enable debugging output to stderr],
25     enable_debug=$enableval, enable_debug=no)
26 AC_MSG_RESULT($enable_debug)
27
28 AC_MSG_CHECKING([whether included getopt is requested])
29 AC_ARG_WITH(included-getopt,
30 [  --with-included-getopt  use included getopt(3)],
31      with_getopt=$withval, with_getopt=no)
32 AC_MSG_RESULT($with_getopt)
33
34 AC_MSG_CHECKING([for user-specified lock directory])
35 AC_ARG_WITH(lock-directory,
36 [  --with-lock-directory   override default search for modem lock directory],
37      with_lock_directory=$withval, with_lock_directory=)
38 AC_MSG_RESULT($with_lock_directory)
39
40 dnl Checks for programs.
41 AC_PROG_CC
42 if test "$USE_MAINTAINER_MODE" = yes;then
43   if test "$GCC" = yes;then
44                 CFLAGS="-Wall -ansi -pedantic -ggdb"
45                 LDFLAGS="$LDFLAGS -lefence"
46                 fi
47 else
48         LDFLAGS="-s"
49   AC_DEFINE(NDEBUG)
50         fi
51
52 AC_PROG_CPP
53
54 dnl Checks for pathnames.
55
56 AC_MSG_CHECKING([for modem lock directory])
57 dirx=""
58 if test "$with_lock_directory" = no;then
59   AC_MSG_RESULT([user disabled])
60 else
61   if test yes = "$with_lock_directory" \
62            -o  -z   "$with_lock_directory";then
63     for dira in /usr /var         ;do
64                 for dirb in /spool ""         ;do
65                 for dirc in /uucp /locks /lock;do
66                   dir="${dira}${dirb}${dirc}"
67                   if test -d "$dir";then dirx="$dir";fi
68                         done;done;done
69     if test -z "$dirx";then
70             AC_MSG_RESULT([none found, disabled])
71     else
72                   AC_MSG_RESULT([$dirx])
73     fi
74   else
75     dirx="$with_lock_directory"
76                 if test -d "$dirx";then AC_MSG_RESULT([$dirx])
77                 else AC_MSG_RESULT([warning - directory doesn't exist: $dirx])
78                 fi
79         fi
80 fi
81 if test -z "$dirx";then AC_DEFINE(DEF_LOCKFILE,[""])
82 else AC_DEFINE_UNQUOTED(DEF_LOCKFILE,"${dirx}/LCK..%s")
83 fi
84
85 dnl Checks for libraries.
86
87 dnl Checks for header files.
88 AC_HEADER_STDC
89
90 dnl Checks for typedefs, structures, and compiler characteristics.
91
92 AC_C_CONST
93 AC_C_INLINE
94
95 dnl Checks for library functions.
96
97 if test "$with_getopt" = no;then
98         AC_CHECK_FUNCS(getopt_long)
99         fi
100
101 if test "$enable_debug" = yes;then
102         AC_DEFINE(DEBUG)
103         fi
104
105 AC_MSG_CHECKING(whether to use included getopt)
106 if test "$with_getopt" = yes -o "$ac_cv_func_getopt_long" != yes ;then
107         LIBOBJS="$LIBOBJS getopt1.o getopt.o"
108            AC_MSG_RESULT(yes)
109 else AC_MSG_RESULT(no)
110 fi
111
112 AC_CHECK_FUNC(MAX, AC_DEFINE(HAVE_MAX) ,
113         AC_CHECK_FUNC(max, AC_DEFINE(MAX, max) AC_DEFINE(HAVE_MAX))
114         )
115
116 AC_CHECK_FUNC(MIN, AC_DEFINE(HAVE_MIN) ,
117         AC_CHECK_FUNC(min, AC_DEFINE(MIN, min) AC_DEFINE(HAVE_MIN))
118         )
119
120 AC_MSG_CHECKING([for LINE_MAX])
121 AC_TRY_COMPILE([#include <limits.h>], [LINE_MAX;],
122         AC_DEFINE(HAVE_LINE_MAX)  AC_MSG_RESULT(yes),
123         AC_DEFINE(LINE_MAX, 4096) AC_MSG_RESULT(no))
124
125 AC_MSG_CHECKING([for CBAUD])
126 AC_TRY_COMPILE([#include <termios.h>], [CBAUD;],
127         AC_DEFINE(HAVE_CBAUD) AC_MSG_RESULT(yes),
128         AC_DEFINE(CBAUD, 0)   AC_MSG_RESULT(no))
129
130 AC_MSG_CHECKING([for CBAUDEX])
131 AC_TRY_COMPILE([#include <termios.h>], [CBAUDEX;],
132         AC_DEFINE(HAVE_CBAUDEX) AC_MSG_RESULT(yes),
133         AC_DEFINE(CBAUDEX, 0)   AC_MSG_RESULT(no))
134
135 AC_MSG_CHECKING([for unused attribute])
136 uns=true
137 for un in __unused__ unused;do
138   if $uns;then
139                 unx="__attribute__ (($un))"
140                 AC_TRY_COMPILE([#include <stddef.h>],[char untest $unx;],
141                 AC_DEFINE_UNQUOTED(ATTR_UNUSED, $unx)
142                 AC_MSG_RESULT($un)
143                 uns=false)
144                 fi
145         done
146 if $uns;then AC_DEFINE(ATTR_UNUSED,) AC_MSG_RESULT(no);fi
147
148 AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF))
149 AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
150
151 AC_TYPE_SIGNAL
152 AC_TYPE_PID_T
153
154 AC_REPLACE_FUNCS(strdup)
155 dnl AC_MSG_CHECKING([for strdup])
156 dnl AC_TRY_COMPILE([#include <string.h>], [strdup("");],
157 dnl     AC_DEFINE(HAVE_STRDUP)  AC_MSG_RESULT(yes),
158 dnl     LIBOBJS="$LIBOBJS strdup.o" AC_MSG_RESULT(no))
159
160 AC_MSG_CHECKING([for working %m in printf])
161 AC_TRY_RUN([int main() { char s[100];
162         sprintf(s,"%m");
163         return(!(strcmp(s,"m") && strcmp(s,"%m")));
164         }],AC_DEFINE(PRINTF_WORKS_PM) AC_MSG_RESULT(yes),AC_MSG_RESULT(no),AC_MSG_RESULT(avoiding))
165
166 # Final output.
167
168 AC_SUBST(LIBOBJS)
169
170 AC_OUTPUT(Makefile)