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