1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(src/crctab.c)
3AM_INIT_AUTOMAKE(lrzsz, 0.12.20)
4AM_CONFIG_HEADER(config.h)
5
6
7dnl AC_C_CROSS is in AC_PROG_CC since 2.12
8AC_PREREQ(2.12)
9
10PACKAGE_VERSION="$PACKAGE-$VERSION"
11AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
12AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
13AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$PACKAGE_VERSION")
14AC_SUBST(PACKAGE)
15AC_SUBST(VERSION)
16AC_SUBST(PACKAGE_VERSION)
17
18ALL_LINGUAS="de"
19
20AC_SUBST(PACKAGE)
21AC_SUBST(VERSION)
22
23changequote(,)dnl
24case $VERSION in
25	[0-9]*.[0-9]*.[0-9]*) README_ALPHA="README-alpha";;
26	*) README_ALPHA=;;
27esac
28changequote([, ])dnl
29
30
31AC_ARG_ENABLE(timesync,
32	[--disable-timesync   exclude support for timesync protocol],
33	[if test "$enableval" = "no" ; then
34		:
35	  else
36		AC_DEFINE(ENABLE_TIMESYNC)
37	  fi],
38	[AC_DEFINE(ENABLE_TIMESYNC)])
39AC_SUBST(ENABLE_TIMESYNC)
40AC_ARG_ENABLE(pubdir,
41	[--enable-pubdir=/path   include support for a public writeable directory],
42	[if test "$enableval" = "no" ; then
43		:
44	  else
45	    AC_DEFINE_UNQUOTED(PUBDIR,"$enableval")
46	  fi])
47AC_ARG_ENABLE(mkdir,
48	[--disable-mkdir   disable support for creating directories (lrz)],
49	[if test "$enableval" = "no" ; then
50		:
51	  else
52	  	AC_DEFINE(ENABLE_MKDIR)
53	  fi],
54	[AC_DEFINE(ENABLE_MKDIR)])
55AC_ARG_ENABLE(syslog,
56	[--enable-syslog=FACILITY,{force,default,optional} include syslogsupport],
57	[
58	  if test "$enableval" = "no" ; then
59		:
60	  else
61	    case "$enableval" in
62	    *,*)
63			level=`echo $enableval|sed -e 's/^.*,//'`
64			fac=`echo $enableval|sed -e 's/,.*$//'`
65			AC_DEFINE_UNQUOTED(ENABLE_SYSLOG,$fac)
66			;;
67		*)
68			lookup_facility=LOG_UUCP
69			level="$enableval"
70			;;
71		esac
72	  	if test "$level" = "force" ; then
73		  AC_DEFINE(ENABLE_SYSLOG_FORCE)
74	  	else
75	  	  if test "$level" = "optional" ; then
76	  	    :
77	  	  else
78		    AC_DEFINE(ENABLE_SYSLOG_DEFAULT)
79		  fi
80	  	fi
81	  fi],[
82		AC_DEFINE(ENABLE_SYSLOG_DEFAULT)
83		lookup_facility=LOG_UUCP
84	  ])
85
86dnl Checks for programs.
87AC_PROG_CC
88AC_PROG_GCC_TRADITIONAL
89dnl AC_PROG_INSTALL  included in AM_INIT_AUTOMAKE
90dnl AC_PROG_MAKE_SET included in AM_INIT_AUTOMAKE
91AC_PROG_RANLIB
92AC_ISC_POSIX
93AC_AIX
94AC_MINIX
95AM_C_PROTOTYPES
96AC_C_CONST
97AC_C_INLINE
98
99if test `hostname` = tirka.ohse.de -a "$cross_compiling" = no ; then
100    test $prefix = NONE && prefix=/usr
101	if test -z "$CFLAGS" ; then
102	    case "$CC" in
103		*gcc*)
104			CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
105			# -Wnested_externs entfernt wegen dcgettext()
106			CFLAGS="$CFLAGS -Wpointer-arith -Wcast-qual -Wcast-align"
107			CFLAGS="$CFLAGS -Winline -Wwrite-strings -Wshadow -Wmissing-braces"
108			CFLAGS="$CFLAGS -Wcomments -fforce-mem -fforce-addr -O2 -m486 -pipe"
109			CFLAGS="$CFLAGS -malign-loops=2 -malign-jumps=2 -malign-functions=2 -g3"
110			;;
111		esac
112	fi
113fi
114case "$CFLAGS" in
115*-Wstrict-prototypes*)
116	AC_DEFINE(STRICT_PROTOTYPES)
117	;;
118esac
119
120dnl Checks for libraries.
121dnl SCO needs this.
122AC_CHECK_LIB(socket,syslog,,,)
123dnl BeOS needs this
124AC_CHECK_LIB(be,syslog,,,)
125dnl slowlartis needs this
126AC_CHECK_LIB(nsl,gethostbyname,,,)
127
128dnl Checks for header files.
129AC_HEADER_STDC
130AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/times.h)
131LRZSZ_HEADERS_TERM_IO
132AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)
133AC_CHECK_HEADERS(sys/mman.h utime.h syslog.h sys/syslog.h sys/param.h)
134AC_CHECK_HEADERS(sys/select.h strings.h arpa/inet.h)
135
136dnl Checks for typedefs, structures, and compiler characteristics.
137AC_TYPE_SIZE_T
138AC_TYPE_MODE_T
139AC_TYPE_OFF_T
140LRZSZ_TYPE_SPEED_T
141AC_STRUCT_ST_RDEV
142AC_HEADER_TIME
143lrzsz_HEADER_SYS_SELECT
144AC_STRUCT_TM
145LRZSZ_ERRNO_DECL
146
147dnl Checks for library functions.
148if test $cross_compiling = no ; then
149	AC_FUNC_SETVBUF_REVERSED
150fi
151AC_TYPE_SIGNAL
152dnl suggested by autoscan, but not really needed.
153dnl AC_FUNC_UTIME_NULL
154AC_FUNC_MMAP
155AC_FUNC_ALLOCA
156AC_EGREP_HEADER([struct.*utimbuf], utime.h, AC_DEFINE(HAVE_STRUCT_UTIMBUF))
157
158AC_CHECK_FUNCS(gettimeofday settimeofday)
159AC_CHECK_FUNCS(strchr memcpy select vprintf)
160AC_CHECK_FUNCS(times rdchk utime syslog siginterrupt)
161AC_REPLACE_FUNCS(mkdir mktime strerror strstr strdup strtoul strtol strpbrk)
162AC_REPLACE_FUNCS(stpcpy strftime vasprintf)
163
164AC_REPLACE_GNU_GETOPT
165
166dnl for lib/error.c
167AC_DEFINE(HAVE_STRERROR)
168
169
170dnl special tests
171
172dnl this is taken from taylor uucp.
173dnl Check for the SCO buggy ftime; the code can cope with the bug,
174dnl though it would prefer not to, so if we're cross-configuring we
175dnl accept that ftime exists.
176AC_CHECK_FUNC(ftime,
177[AC_MSG_CHECKING(that ftime works correctly)
178AC_CACHE_VAL(lrzsz_cv_sys_ftime_ok,
179[AC_TRY_RUN([
180#include <sys/types.h>
181#include <sys/timeb.h>
182#include <stdio.h>
183main ()
184{
185  struct timeb s, slast;
186  int c = 0;
187  ftime (&slast);
188  while (c < 10)
189    {
190      ftime (&s);
191      if (s.time < slast.time
192      || (s.time == slast.time && s.millitm < slast.millitm)) {
193      fprintf(stderr,"s: %ld, %ld, slast: %ld, %ld\n",
194      	s.time,s.millitm, slast.time,slast.millitm);
195    exit (1);
196	}
197      if (s.time != slast.time)
198    ++c;
199      slast.time = s.time;
200      slast.millitm = s.millitm;
201    }
202  exit (0);
203}
204],
205lrzsz_cv_sys_ftime_ok=yes,
206lrzsz_cv_sys_ftime_ok=no,
207lrzsz_cv_sys_ftime_ok=runtime)])
208case $lrzsz_cv_sys_ftime_ok in
209yes) AC_DEFINE(HAVE_FTIME) AC_MSG_RESULT(yes) ;;
210no)  AC_MSG_RESULT(no)
211	AC_MSG_WARN(ftime seems to be buggy) ;;
212runtime) AC_DEFINE(HAVE_FTIME)
213	AC_MSG_RESULT(will check at run time) ;;
214esac
215])
216
217dnl
218AC_MSG_CHECKING([for timezone variable])
219AC_CACHE_VAL(libquark_cv_var_timezone,[
220AC_TRY_LINK([#include <time.h>],[return(int)(timezone/2);],
221	[libquark_cv_var_timezone=yes],
222	[libquark_cv_var_timezone=no])
223])
224if test $libquark_cv_var_timezone = yes ; then
225	AC_MSG_RESULT(yes)
226	AC_DEFINE(HAVE_TIMEZONE_VAR)
227else
228	AC_MSG_RESULT(no)
229fi
230if test "x$lookup_facility" = x ; then
231	:
232else
233	AC_MSG_CHECKING([for $lookup_facility])
234	AC_CACHE_VAL(lrzsz_cv_lookup_facility,[
235		AC_EGREP_CPP(ihave$lookup_facility, [
236#ifdef HAVE_SYSLOG_H
237#include <syslog.h>
238#else
239#include <sys/syslog.h>
240#endif
241#ifdef $lookup_facility
242ihave$lookup_facility
243#endif
244		], lrzsz_cv_lookup_facility=yes, lrzsz_cv_lookup_facility=no)
245	])
246	if test $lrzsz_cv_lookup_facility = yes ; then
247		AC_MSG_RESULT(yes)
248		AC_DEFINE_UNQUOTED(ENABLE_SYSLOG,$lookup_facility)
249	else
250		AC_DEFINE(ENABLE_SYSLOG,LOG_USER)
251		AC_MSG_RESULT(no)
252	fi
253fi
254
255
256AC_SUBST(CFLAGS)
257AC_SUBST(LDFLAGS)
258AC_SUBST(LIBS)
259
260AM_GNU_GETTEXT
261
262AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME")
263AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
264
265AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile \
266man/Makefile po/Makefile.in src/Makefile debian/rules Specfile systype \
267src/lrzszbug],
268[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile;
269chmod +x debian/rules;
270test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
271