1dnl# -*- sh -*-
2dnl#
3dnl# $Id: configure.in,v 1.19 2007/08/01 17:45:34 vae Exp $
4dnl#
5dnl# Process this file with autoconf to produce a configure script.
6dnl#
7
8AC_INIT(aterm,1.00.01,as-bugs@afterstep.org,aterm.tar)
9AC_CONFIG_AUX_DIR(autoconf)
10AC_CONFIG_HEADER(config.h:autoconf/config.h.in)
11
12VERSION=$PACKAGE_VERSION
13VERSION_MAJOR="1"
14DATE="01 August 2007"
15LSMDATE="01Aug07"
16
17
18dnl ATERM version
19echo "#define VERSION \"$VERSION\"" > ${srcdir}/src/version.h
20echo "#define DATE \"$DATE\"" >> ${srcdir}/src/version.h
21
22AC_SUBST(VERSION)
23AC_SUBST(DATE)
24AC_SUBST(LSMDATE)
25
26echo "configuring for aterm $VERSION"
27
28MALLOC_TYPE=S
29
30dnl# --------------------------------------------------------------------------
31dnl# CHECKING COMMAND LINE OPTIONS
32dnl# --------------------------------------------------------------------------
33AC_ARG_ENABLE(utmp,  [  --enable-utmp           enable utmp/utmpx support],
34        [if test x$enableval = xyes; then
35                AC_DEFINE(UTMP_SUPPORT,1,[Define if you want to have utmp/utmpx support])
36                utmp_support=yes
37         fi])
38
39AC_ARG_ENABLE(wtmp,  [  --enable-wtmp           enable wtmp support if you have utmp/utmpx support],
40        [if test x$enableval = xyes; then
41                AC_DEFINE(WTMP_SUPPORT,1,[Define if you want to have wtmp support when utmp/utmpx is enabled])
42            wtmp_support=yes
43         fi])
44
45AC_ARG_ENABLE(kanji,  [  --enable-kanji          enable kanji support],
46  [if test x$enableval = xyes; then  AC_DEFINE(KANJI,1,[Define if you want KANJI support]) fi])
47
48AC_ARG_ENABLE(big5,  [  --enable-big5           enable big5 support],
49  [if test x$enableval = xyes; then  AC_DEFINE(ZH,1,[Define if you want chinese support]) fi])
50
51AC_ARG_ENABLE(greek, [  --enable-greek          enable greek keyboard support],
52  [if test x$enableval = xyes; then    AC_DEFINE(GREEK_SUPPORT,1,[Define if you want support for Greek Elot-928 & IBM-437 keyboard]) fi])
53
54AC_ARG_ENABLE(thai,  [  --enable-thai           enable thai support],
55  [if test x$enableval = xyes; then    AC_DEFINE(THAI,1,[Define if you need Thai language support])  fi])
56
57AC_ARG_ENABLE(ttygid,[  --enable-ttygid         enable tty setting to group \"tty\" - use only if
58                          your system uses this type of security],
59  [if test x$enableval = xyes; then  AC_DEFINE(TTY_GID_SUPPORT,1,[Define if you want tty's to be setgid() to the `tty' group]) fi])
60
61AC_ARG_ENABLE(backspace-key,[  --disable-backspace-key disable handling of the backspace key],
62  [if test x$enableval = xno; then AC_DEFINE(NO_BACKSPACE_KEY,1,[Define if you don't want support for the backspace key]) fi])
63
64AC_ARG_ENABLE(delete-key,  [  --disable-delete-key    disable handling of the delete key],
65  [if test x$enableval = xno; then AC_DEFINE(NO_DELETE_KEY,1,[Define if you don't want support for the (non-keypad) delete key]) fi])
66
67AC_ARG_ENABLE(resources,  [  --disable-resources     disable all resource checking],
68  [if test x$enableval = xno; then  AC_DEFINE(NO_RESOURCES,1,[Define if you don't want any resources read]) fi])
69
70AC_ARG_ENABLE(xgetdefault,[  --enable-xgetdefault    enable resources via X instead of our small version],
71  [if test x$enableval = xyes; then AC_DEFINE(USE_XGETDEFAULT,1,[Define if you want to use XGetDefault instead of our internal version which only reads ~/.Xdefaults]) fi])
72
73AC_ARG_ENABLE(memset,  [  --disable-memset        disable memset() function, use your system's instead],
74  [if test x$enableval = xno; then  AC_DEFINE(NO_RMEMSET,1,[Define if you want to use your system's memset()]) fi])
75
76AC_ARG_ENABLE(swapscreen,  [  --disable-swapscreen    disable swap screen support],
77  [if test x$enableval = xno; then  AC_DEFINE(NO_SECONDARY_SCREEN,1,[Disable the secondary screen (Esc(47h) / Esc(47l))]) fi])
78
79AC_ARG_ENABLE(keepscrolling, [  --disable-keepscrolling disable continual scrolling on scrollbar arrow press],
80  [if test x$enableval = xno; then  AC_DEFINE(NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING,1,[Define if you want continual scrolling on when you keep the scrollbar button pressed])  fi])
81
82AC_ARG_ENABLE(mousewheel,  [  --disable-mousewheel    disable scrolling via mouse wheel or buttons 4 & 5],
83  [if test x$enableval = xno; then  AC_DEFINE(NO_MOUSE_WHEEL,1,[Use wheel events (button4 and button5) to scroll])  fi])
84
85AC_ARG_ENABLE(old-selection, [  --enable-old-selection  enable v2.20 (and prior) mouse selection
86                          - this implies old word selection],
87  [if test x$enableval = xyes; then  AC_DEFINE(OLD_SELECTION,1,[Define to use old rxvt (ver 2.20 and before) style selection, not xterm style.]) fi])
88
89AC_ARG_ENABLE(old-wordselect,  [  --enable-old-wordselect enable v2.20 (and prior) mouse selection of words],
90  [if test x$enableval = xyes; then  AC_DEFINE(OLD_WORD_SELECTION,1,[Define to use old word selection (double click) style for you older users])  fi])
91
92AC_ARG_ENABLE(dmalloc,  [  --enable-dmalloc        enable Gray Watson's malloc - for debugging use],
93  [if test x$enableval = xyes;
94   then MALLOC_TYPE=G
95        DEBUG=-DDEBUG_MALLOC
96        DLIB="-L/usr/local/lib -ldmalloc"
97        DINCLUDE=-I/usr/local/include
98        fi])
99
100AC_ARG_ENABLE(dlmalloc,  [  --enable-dlmalloc       enable Doug Lea's malloc - for production use
101                          - enable only one malloc package],
102  [if test x$enableval = xyes; then
103    MALLOC_TYPE=D
104    DEBUG=
105    DLIB="-L/usr/local/lib -ldlmalloc"
106    DINCLUDE=
107  fi])
108
109AC_ARG_WITH(term,[  --with-term=NAME        set the terminal to NAME (default \"xterm\")],
110  [if test x$withval != x;
111      then AC_DEFINE_UNQUOTED(TERMENV,"$withval",[Set TERM to the value given by configure]) term="$withval"
112   fi])
113
114AC_ARG_WITH(terminfo, [  --with-terminfo=PATH    set the path to the terminfo tree to PATH],
115  [if test x$withval != x;
116        then  AC_DEFINE_UNQUOTED(RXVT_TERMINFO,"$withval",[Set TERMINFO value to the value given by configure]) terminfo="$withval"
117   fi])
118
119AC_ARG_WITH(libefence,		[  --with-libefence        compile with libefence to debug buffer overruns [no] ],with_libefence=$withval,with_libefence="")
120AC_ARG_ENABLE(gdb,		[  --enable-gdb            add gdb symbols (-g) (for debugging) [no] ],enable_gdb=$enableval,enable_gdb="no")
121AC_ARG_ENABLE(sigsegv,		[  --enable-sigsegv        enable internal handler of Segmentation Fault (for self-diagnostics) [yes] ],enable_sigsegv=$enableval,enable_sigsegv="yes")
122
123AC_ARG_ENABLE(transparency,     [  --enable-transparency enable transparent background [yes] ],enable_transparency=$enableval,  enable_transparency="yes")
124
125if test "x$enable_transparency" = "xyes";
126        then AC_DEFINE(TRANSPARENT,1,[Define if you want to have a transparent background]) transparent=yes;
127fi
128
129dnl# The following is passed directly to libAfterImage configure :
130
131AC_ARG_WITH(afterimage_config,  [  --with-afterimage-config=DIR  use libAfterImage config script in DIR], afterimage_config="$withval",afterimage_config=NO)
132AC_ARG_WITH(afterstep_config,   [  --with-afterstep-config=DIR   use libAfterStep config script in DIR], afterstep_config="$withval",afterstep_config=NO)
133
134dnl# --------------------------------------------------------------------------
135
136AC_AIX
137
138dnl# --------------------------------------------------------------------------
139
140AC_DEFINE(PROTOTYPES,1,Define if you need function prototypes)
141
142dnl# --------------------------------------------------------------------------
143dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
144dnl#
145if test -z "$CFLAGS"; then
146    if test -z "$CCOPTS"; then
147	CCOPTS='-O'
148dnl>	if test "x$GCC" = xyes; then
149dnl>	    if test x$system = xLinux; then
150dnl>		CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
151dnl>	    fi
152dnl>	fi
153    fi
154    CFLAGS="$CCOPTS"
155fi
156
157dnl# Checks for programs.
158dnl# AC_MAKE_SET
159
160AC_PROG_CC
161AC_PROG_CPP
162export CC
163export GCC
164export prefix
165export exec_prefix
166
167AC_PROG_INSTALL
168
169dnl# now we need to play abot with CFLAGS :
170
171dnl# Remove -g
172if test -n "`echo $CFLAGS' ' | grep '\-g ' 2> /dev/null`" ; then
173  CFLAGS=`echo "$CFLAGS " | sed "s/-g / /"`
174fi
175
176dnl# Add -Wall
177if test "x$GCC" = "xyes"; then
178  if test -z "`echo $CFLAGS | grep '\-Wall' 2> /dev/null`" ; then
179    CFLAGS="$CFLAGS -Wall"
180  fi
181fi
182
183dnl# Add -fPIC for IA64 compilation
184AC_CYGWIN
185if test "x$CYGWIN" = "x" -a "x$GCC" = "xyes" ; then
186  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
187    CFLAGS="$CFLAGS -fPIC"
188  fi
189fi
190
191dnl# Add -g
192if test "x$enable_gdb" = "xyes"; then
193  CFLAGS="$CFLAGS -g -DDEBUG_STRICT"
194  LDFLAGS="$LDFLAGS -g"
195else
196  CFLAGS="$CFLAGS -DNO_DEBUG_OUTPUT"
197fi
198
199dnl# Add -pg
200if test "x$enable_gprof" = "xyes"; then
201  CFLAGS="$CFLAGS -pg"
202  LDFLAGS="$LDFLAGS -pg"
203fi
204
205dnl# Add lots more warnings
206if test "x$enable_warn" = "xyes"; then
207  CFLAGS="$CFLAGS -Wuninitialized -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wconversion -Wcomment -Wcast-align -Winline -Wshadow -Wredundant-decls -Wid-clash-31"
208fi
209
210if test "x$GCC" = "xyes"; then
211   LDFLAGS="$LDFLAGS -rdynamic"
212fi
213
214dnl# done with flags - lets export those for our children to use :
215export CFLAGS
216export LDFLAGS
217
218dnl# install checks :
219AC_PROG_INSTALL
220dnl# if the path to the install program is relative, make it absolute
221currdir=`pwd`
222INSTALL=`echo $INSTALL|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
223INSTALL_PROGRAM=`echo $INSTALL_PROGRAM|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
224INSTALL_DATA=`echo $INSTALL_DATA|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
225INSTALL_LIB=`echo $INSTALL_LIB|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
226
227export INSTALL
228export INSTALL_PROGRAM
229export INSTALL_DATA
230export INSTALL_LIB
231
232AC_PROG_RANLIB
233export RANLIB
234
235AC_PATH_PROG(RM, rm, rm)
236export RM
237AC_PATH_PROG(MV, mv, mv)
238export MV
239AC_PATH_PROG(CP, cp, cp)
240export CP
241AC_PATH_PROG(MKDIR, mkdir, mkdir)
242export MKDIR
243AC_PATH_PROG(PERL, perl, perl)
244export PERL
245AC_PATH_PROG(FIND, find, find)
246export FIND
247AC_PATH_PROG(XARGS, xargs, xargs)
248export XARGS
249AC_PATH_PROG(LDCONFIG, ldconfig, ldconfig, $PATH:/sbin:/usr/local/sbin)
250export LDCONFIG
251AC_PATH_PROG(SED, sed, sed)
252export SED
253
254
255dnl# check for wait is particularly nasty :
256AC_FUNC_WAIT3
257if test "x$ac_cv_func_wait3_rusage" = "xyes"; then
258	DO_HAVE_WAIT3=yes
259	export DO_HAVE_WAIT3
260fi
261
262dnl# Check for X :
263AC_PATH_XTRA
264x_libs="$LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS"
265XEXTENTIONS_LIBS=
266AC_CHECK_LIB(X11, XOpenDisplay, [x_libs="-lX11 $x_libs"],,$x_libs)
267AC_CHECK_LIB(Xext, XShapeCombineMask, [XEXTENTIONS_LIBS="-lXext";AC_DEFINE(SHAPE,1,[Define if you want Shaped Extension support])],,$x_libs)
268
269PATH_XTRA_CHECKED=yes
270export PATH_XTRA_CHECKED
271export x_includes
272export X_CFLAGS
273export X_LIBS
274export X_EXTRA_LIBS
275export X_PRE_LIBS
276export CPP
277export have_x
278
279dnl# DONE WITH COMMON STUFF
280dnl# #############################################################
281dnl# first configuringlibraries :
282
283have_afterbase=no
284have_afterimage=no
285have_afterstep=no
286
287LIBAFTERIMAGE_CFLAGS=
288LIBAFTERSTEP_CFLAGS=
289AFTERIMAGE_LIBS=
290AFTERSTEP_LIB=
291
292
293dnl# if needed - check for external libAfterImage and libAfterBase :
294AC_MSG_CHECKING(if distributed as part of AfterStep)
295if test -d ../../libAfterBase && -d ../../libAfterImage && -d ../../libAfterStep ; then
296	LIBAFTERIMAGE_CFLAGS=
297	LIBAFTERSTEP_CFLAGS=-I../../..
298	AFTERIMAGE_LIBS=-L../../../libAfterImage -L../../../libAfterBase -lAfterImage -lAfterBase `../../libAfterImage/afterimage-config --libs --external-only`
299	AFTERSTEP_LIB=-L../../../libAfterStep -lAfterStep
300	have_afterbase=yes
301	have_afterimage=yes
302	have_afterstep=yes
303	AC_MSG_RESULT(yes)
304else
305	AC_MSG_RESULT(no)
306	AC_MSG_CHECKING(installed libAfterImage)
307	if test "$afterimage_config" = "NO" ; then
308		if afterimage-config --version > /dev/null 2>&1 ; then
309			afterimage_config=afterimage-config
310		else
311			if test -x /usr/local/bin/afterimage-config; then
312				afterimage_config=/usr/local/bin/afterimage-config
313			fi
314		fi
315	else
316	    afterimage_config=$afterimage_config/afterimage-config
317	fi
318	if $afterimage_config --version > /dev/null 2>&1 ; then
319		LIBAFTERIMAGE_CFLAGS=`$afterimage_config --cflags`
320		AFTERIMAGE_LIBS=`$afterimage_config --libs`
321		have_afterbase=`$afterimage_config --have-afterbase`
322		if test "x$AFTERIMAGE_LIBS" != "x"; then
323			have_afterimage=yes
324		fi
325	fi
326
327	if test "x$have_afterimage" = "xyes"; then
328		AC_MSG_RESULT($AFTERIMAGE_LIBS)
329		AC_MSG_CHECKING(libAfterStep)
330		if test "$afterstep_config" = "NO" ; then
331			if afterstep-config --version > /dev/null 2>&1 ; then
332				afterstep_config=afterstep-config
333			else
334				if test -x /usr/local/bin/afterstep-config; then
335					afterstep_config=/usr/local/bin/afterstep-config
336				fi
337			fi
338		else
339		    afterstep_config=$afterstep_config/afterstep-config
340		fi
341		if test "$afterstep_config" != "NO" ; then
342			if $afterstep_config --version >/dev/null 2>&1 ; then
343				LIBAFTERSTEP_CFLAGS=`$afterstep_config --cflags`
344				AFTERSTEP_LIBS=`$afterstep_config --libs`
345				have_afterbase=yes
346				if test "x$AFTERSTEP_LIBS" != "x"; then
347					have_afterstep=yes
348				fi
349			fi
350		fi
351		if test "x$have_afterstep" = "xyes"; then
352			AC_MSG_RESULT($AFTERSTEP_LIBS)
353		else
354	    	    if test "$afterstep_config" != "NO" ; then
355		   AC_MSG_RESULT(afterstep-config not found in $afterstep_config)
356		    else
357			AC_MSG_RESULT(afterstep-config not found)
358		    fi
359		fi
360	else
361		if test "$afterstep_config" != "NO" ; then
362			AC_MSG_RESULT(afterimage-config not found in $afterimage_config - no AfterStep integration available.)
363		else
364			AC_MSG_RESULT(afterimage-config not found - no AfterStep integration available.)
365		fi
366		AC_MSG_RESULT(AfterStep integration, and background image from file will not be available.)
367		AC_MSG_RESULT(To enable background image support you will need to download and install)
368		AC_MSG_RESULT(libAfterImage from ftp://ftp.afterstep.org/stable/libAfterImage/ and then re-run this script.)
369	fi
370
371fi
372
373
374if test "x$have_afterbase" = "xyes"; then
375        AC_DEFINE(HAVE_AFTERBASE,1,[Defined if AfterBase library is available])
376fi
377
378if test "x$have_afterimage" = "xyes"; then
379        AC_DEFINE(HAVE_AFTERIMAGE,1,[Defined if AfterImage library is available])
380	AC_DEFINE(BACKGROUND_IMAGE,1,[Defined if we can have background images])
381fi
382
383if test "x$have_afterstep" = "xyes"; then
384        AC_DEFINE(HAVE_AFTERSTEP,1,[Defined if AfterStep library is available, and MyStyles could be used to define background image])
385fi
386
387if test "x$LIBAFTERIMAGE_CFLAGS" = "x$LIBAFTERSTEP_CFLAGS"; then
388        LIBAFTERIMAGE_CFLAGS=
389fi
390
391AC_SUBST(LIBAFTERIMAGE_CFLAGS)
392AC_SUBST(LIBAFTERSTEP_CFLAGS)
393AC_SUBST(AFTERIMAGE_LIBS)
394AC_SUBST(AFTERSTEP_LIBS)
395
396dnl> end new Check for image libraries NNNNNNNNNNNNNNNNNNNNNNNNNN
397
398dnl# system hacks
399AC_ISC_POSIX
400
401dnl# --------------------------------------------------------------------------
402dnl# CHECKING FOR HEADER FILES
403dnl# --------------------------------------------------------------------------
404AC_HEADER_SYS_WAIT
405AC_CHECK_HEADERS( \
406	assert.h \
407	fcntl.h \
408	grp.h \
409	libc.h \
410	lastlog.h \
411	stdarg.h \
412	stdlib.h \
413	string.h \
414	termios.h \
415	unistd.h \
416	utmpx.h \
417	sys/byteorder.h \
418	sys/ioctl.h \
419	sys/select.h \
420	sys/sockio.h \
421	sys/time.h \
422)
423
424AC_HEADER_TIME
425
426AC_CHECK_FUNCS(getpt)
427
428AC_C_CONST
429AC_C_INLINE
430
431dnl> AC_HEADER_STDC	 dnl# skip this test, Sun always fails anyhow.
432
433dnl# --------------------------------------------------------------------------
434dnl# CHECKING FOR MISSING TYPEDEFS
435dnl# --------------------------------------------------------------------------
436dnl# Missing typedefs and replacements
437AC_TYPE_MODE_T
438dnl> AC_CHECK_TYPE(umode_t, int)
439dnl> AC_CHECK_TYPE(off_t, long)
440AC_TYPE_PID_T
441AC_TYPE_UID_T
442
443AC_CHECK_SIZEOF(char, 1)
444AC_CHECK_SIZEOF(short, 2)
445AC_CHECK_SIZEOF(int, 4)
446AC_CHECK_SIZEOF(long, 4)
447AC_CHECK_SIZEOF(int *, 4)
448dnl# ugly
449if test "$cross_compiling" = yes; then
450    echo "configure: warning: Define SIZEOF_* values in config.h manually"
451fi
452dnl# we could probably pull this info from Xmd.h
453dnl# and these tests are ugly: depending on specials
454if test $ac_cv_sizeof_char -ge 2; then
455  RINT16T=char
456  AC_DEFINE(RINT16T,  char,[Defines 16 bit wide type])
457  AC_DEFINE(RUINT16T, unsigned char,[Defines unsigned 16 bit wide type])
458else
459  if test $ac_cv_sizeof_short -ge 2; then
460    RINT16T=short
461    AC_DEFINE(RINT16T,  short,[Defines 16 bit wide type])
462    AC_DEFINE(RUINT16T, unsigned short,[Defines unsigned 16 bit wide type])
463  else
464    if test $ac_cv_sizeof_int -ge 2; then
465      RINT16T=int
466      AC_DEFINE(RINT16T,  int,[Defines 16 bit wide type])
467      AC_DEFINE(RUINT16T, unsigned int,[Defines unsigned 16 bit wide type])
468    else	dnl What a fantastic system ?
469      RINT16T=long
470      AC_DEFINE(RINT16T,  long,[Defines 16 bit wide type])
471      AC_DEFINE(RUINT16T, unsigned long,[Defines unsigned 16 bit wide type])
472    fi
473  fi
474fi
475if test $ac_cv_sizeof_char -ge 4; then
476  RINT32T=char
477  AC_DEFINE(RINT32T,  char,[Defines 32 bit wide type])
478  AC_DEFINE(RUINT32T, unsigned char,[Defines unsigned 32 bit wide type])
479else
480  if test $ac_cv_sizeof_short -ge 4; then
481    RINT32T=short
482    AC_DEFINE(RINT32T,  short,[Defines 32 bit wide type])
483    AC_DEFINE(RUINT32T, unsigned short,[Defines unsigned 32 bit wide type])
484  else
485    if test $ac_cv_sizeof_int -ge 4; then
486      RINT32T=int
487      AC_DEFINE(RINT32T,  int,[Defines 32 bit wide type])
488      AC_DEFINE(RUINT32T, unsigned int,[Defines unsigned 32 bit wide type])
489    else	dnl What a fantastic system ?
490      RINT32T=long
491      AC_DEFINE(RINT32T,  long,[Defines 32 bit wide type])
492      AC_DEFINE(RUINT32T, unsigned long,[Defines unsigned 32 bit wide type])
493    fi
494  fi
495fi
496if test $ac_cv_sizeof_char -eq $ac_cv_sizeof_int_p; then
497  RINTPT=char
498  AC_DEFINE(RINTPT,  char,[obscure data type])
499  AC_DEFINE(RUINTPT, unsigned char,[obscure data type])
500else
501  if test $ac_cv_sizeof_short -eq $ac_cv_sizeof_int_p; then
502    RINTPT=short
503    AC_DEFINE(RINTPT,  short,[obscure data type])
504    AC_DEFINE(RUINTPT, unsigned short,[obscure data type])
505  else
506    if test $ac_cv_sizeof_int -eq $ac_cv_sizeof_int_p; then
507      RINTPT=int
508      AC_DEFINE(RINTPT,  int,[obscure data type])
509      AC_DEFINE(RUINTPT, unsigned int,[obscure data type])
510    else	dnl what next? long long? quad?
511      RINTPT=long
512      AC_DEFINE(RINTPT,  long,[obscure data type])
513      AC_DEFINE(RUINTPT, unsigned long,[obscure data type])
514    fi
515  fi
516fi
517
518dnl# --------------------------------------------------------------------------
519dnl# CHECKING FOR LIBRARY FUNCTIONS
520dnl# --------------------------------------------------------------------------
521AC_TYPE_SIGNAL
522dnl> AC_FUNC_VPRINTF
523AC_CHECK_FUNCS( \
524	atexit \
525	unsetenv \
526	setutent \
527	seteuid \
528)
529
530dnl# check for host field in utmp structure
531
532AC_CACHE_CHECK(for host in utmp struct, rxvt_cv_struct_utmp_host,
533[AC_TRY_COMPILE([#include <sys/types.h>
534#ifdef HAVE_UTMPX_H
535#include <utmpx.h>
536#else
537#include <utmp.h>
538#endif], [
539#ifdef HAVE_UTMPX_H
540struct utmpx ut;
541#else
542struct utmp ut;
543#endif
544ut.ut_host;],
545  rxvt_cv_struct_utmp_host=yes, rxvt_cv_struct_utmp_host=no)])
546if test "$rxvt_cv_struct_utmp_host" = yes; then
547  AC_DEFINE(HAVE_UTMP_HOST,1,[Define if struct utmp/utmpx contains ut_host])
548fi
549
550dnl# find utmp
551if test "$ac_cv_header_utmpx_h" = yes; then
552  AC_CACHE_CHECK(where utmp is located, rxvt_cv_path_utmp,
553  [for utmp_file in   dnl
554    /var/run/utmp /var/adm/utmpx /etc/utmpx;
555  do
556    if test -f "$utmp_file" ; then
557      rxvt_cv_path_utmp=$utmp_file
558      break
559    fi
560  done
561  ])
562  AC_DEFINE(_GNU_SOURCE,1,[GNU source])
563else
564  AC_CACHE_CHECK(where utmp is located, rxvt_cv_path_utmp,
565  [for utmp_file in   dnl
566    /var/run/utmp /var/adm/utmp /etc/utmp /usr/etc/utmp /usr/adm/utmp;
567  do
568    if test -f "$utmp_file" ; then
569      rxvt_cv_path_utmp=$utmp_file
570      break
571    fi
572  done
573  ])
574fi
575if test "${rxvt_cv_path_utmp+set}" = set; then
576  AC_DEFINE_UNQUOTED(RXVT_UTMP_FILE, "$rxvt_cv_path_utmp",[Define location of utmp/utmpx])
577fi
578
579dnl# find wtmp
580AC_CACHE_CHECK(where wtmp is located, rxvt_cv_path_wtmp,
581[for wtmp_file in   dnl
582  /var/log/wtmp /var/adm/wtmp /etc/wtmp /usr/etc/wtmp /usr/adm/wtmp;
583do
584  if test -f "$wtmp_file" ; then
585    rxvt_cv_path_wtmp=$wtmp_file
586    break
587  fi
588done
589])
590if test "${rxvt_cv_path_wtmp+set}" = set; then
591  AC_DEFINE_UNQUOTED(RXVT_WTMP_FILE, "$rxvt_cv_path_wtmp",[Define location of wtmp/wtmpx])
592fi
593
594dnl# find ttys/ttytab
595AC_CACHE_CHECK(where ttys/ttytab is located, rxvt_cv_path_ttytab,
596[for ttys_file in   dnl
597  /etc/ttys /etc/ttytab;
598do
599  if test -f "$ttys_file" ; then
600    rxvt_cv_path_ttytab=$ttys_file
601    break
602  fi
603done
604])
605if test "${rxvt_cv_path_ttytab+set}" = set; then
606  AC_DEFINE_UNQUOTED(TTYTAB_FILENAME, "$rxvt_cv_path_ttytab",[Define location of ttys/ttytab])
607fi
608
609dnl# this is a really hack test for some basic Xlocale stuff
610SAVETHELIBS=$LIBS
611LIBS="$LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11"
612CFLAGS="$CFLAGS $X_CFLAGS"
613AC_CACHE_CHECK(for working Xlocale, rxvt_cv_func_xlocale,
614[AC_TRY_RUN(
615[#define X_LOCALE 1
616#include <X11/Xlocale.h>
617#include <X11/Xlib.h>
618main() {
619char *p;
620if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
621exit (XSupportsLocale() ? 0 : 1);
622else
623exit (1);}
624],rxvt_cv_func_xlocale=yes, rxvt_cv_func_xlocale=no,
625AC_MSG_WARN([Define NO_XLOCALE in config.h manually]))])
626
627if test "${rxvt_cv_func_xlocale}" = no; then
628  AC_DEFINE(NO_XLOCALE,1,[Define if Xlocale support doesn't work])
629fi
630LIBS=$SAVETHELIBS
631
632AC_CACHE_CHECK(for working setlocale, rxvt_cv_func_xsetlocale,
633[AC_TRY_LINK([#define X_LOCALE 1
634#include <X11/Xlocale.h>],
635  [setlocale(LC_CTYPE, "");],
636  rxvt_cv_func_xsetlocale=yes, rxvt_cv_func_xsetlocale=no)])
637if test "${rxvt_cv_func_xsetlocale}" = no; then
638  AC_DEFINE(NO_XSETLOCALE)
639fi
640
641AC_CACHE_CHECK(for working plain setlocale, rxvt_cv_func_setlocale,
642  [AC_TRY_LINK([#include <locale.h>],
643  [setlocale(LC_CTYPE, "");],
644  rxvt_cv_func_setlocale=yes, rxvt_cv_func_setlocale=no)])
645if test x${rxvt_cv_func_setlocale} = xno; then
646  AC_DEFINE(NO_SETLOCALE,1,[Define is setlocale (defined to Xsetlocale) doesn't work])
647fi
648
649dnl> AC_CHECK_FUNCS(gettimeofday putenv select socket)
650
651CFLAGS=${CFLAGS--O}
652LDFLAGS=${LDFLAGS--O}
653
654CPPFLAGS="$CPPFLAGS"
655AC_SUBST(DEBUG)
656AC_SUBST(DLIB)
657AC_SUBST(DINCLUDE)
658AC_SUBST(CFLAGS)
659AC_SUBST(CPPFLAGS)
660AC_SUBST(LDFLAGS)
661AC_SUBST(X_LIBS)
662AC_SUBST(XEXTENTIONS_LIBS)
663AC_SUBST(LIBS)
664
665dnl# common parts of the Makefile
666MCOMMON=./autoconf/Make.common
667AC_SUBST_FILE(MCOMMON)
668
669AC_OUTPUT(autoconf/Make.common \
670Makefile \
671doc/Makefile \
672src/Makefile \
673src/graphics/Makefile \
674scripts/random_colors
675)
676
677chmod 755 scripts/random_colors
678
679echo "Configuration:
680
681  Aterm version:              ${VERSION} : ${DATE}
682  Source code location:       ${srcdir}
683  Install path:               ${prefix}/bin
684  Compiler:                   ${CC}
685  Compiler flags:             ${CFLAGS}"
686
687echo "
688  Background image support :"
689        echo "    AfterImage library:                 ${AFTERIMAGE_LIB}"
690        echo "    supporting image format libraries:  ${AFTERIMAGE_LIBS}"
691        if test "${have_afterstep}" = yes; then
692                echo   "       with AfterStep MyStyles support available"
693        else
694                echo   "       without AfterStep MyStyles support"
695        fi
696        echo
697
698
699if test "${enable_transparency}" = yes; then
700echo "  Transparency :		enabled"
701else
702echo "  Transparency :		disabled"
703fi
704
705
706if test "$MALLOC_TYPE" = S; then
707  echo "  malloc support:             system default"
708fi
709if test "$MALLOC_TYPE" = G; then
710  echo "  malloc support:             Gray Watson's dmalloc"
711fi
712if test "$MALLOC_TYPE" = D; then
713  echo "  malloc support:             Doug Lea's malloc"
714fi
715echo "
716The following are set in config.h
717"
718if test "${utmp_support}" != yes; then
719  echo "  utmp support:               disabled
720"
721else
722  echo "  utmp support:               enabled
723  utmp file:                  ${rxvt_cv_path_utmp}
724  wtmp file:                  ${rxvt_cv_path_wtmp}
725  ttys/ttytab file:           ${rxvt_cv_path_ttytab}
726"
727fi
728if test "x${term}" != x; then
729  echo "  set TERM to:                ${term}
730"
731fi
732if test "x${terminfo}" != x; then
733  echo "  set TERMINFO to:            ${terminfo}
734"
735fi
736echo "  Type of 16bit:               ${RINT16T}
737          32bit:               ${RINT32T}
738          pointer:             (same as) ${RINTPT}
739"
740echo "  *** Please check src/feature.h for further options ***
741"
742