1dnl# $Id: configure.ac 50969 2010-08-10 18:08:44Z kwo $
2
3PATH=$PATH:/usr/bin:/bin:/usr/local/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/ucb/bin
4export PATH
5
6test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
7test "x$ACLOCAL" = "x" && ACLOCAL=aclocal
8test "x$AUTOCONF" = "x" && AUTOCONF=autoconf
9test "x$AUTOHEADER" = "x" && AUTOHEADER=autoheader
10test "x$AUTOMAKE" = "x" && AUTOMAKE=automake
11
12AC_SUBST(LIBTOOLIZE)
13AC_SUBST(ACLOCAL)
14AC_SUBST(AUTOCONF)
15AC_SUBST(AUTOHEADER)
16AC_SUBST(AUTOMAKE)
17
18SAVE_LIBTOOLIZE="$LIBTOOLIZE"
19SAVE_ACLOCAL="$ACLOCAL"
20SAVE_AUTOCONF="$AUTOCONF"
21SAVE_AUTOHEADER="$AUTOHEADER"
22SAVE_AUTOMAKE="$AUTOMAKE"
23
24AC_INIT(src/feature.h)
25AM_INIT_AUTOMAKE(Eterm, 0.9.6)
26
27dnl# Set some basic variables
28DATE="`date '+%d %B %Y'`"
29AC_SUBST(DATE)
30BUILD_DATE="`date`"
31AC_DEFINE_UNQUOTED(BUILD_DATE, "$BUILD_DATE", [The date of the build.])
32AUTHORS="Michael Jennings (mej@eterm.org) "
33AC_SUBST(AUTHORS)
34AC_DEFINE_UNQUOTED(AUTHORS, "$AUTHORS", [Authors])
35
36LIBTOOLIZE="${SAVE_LIBTOOLIZE:-libtoolize}"
37ACLOCAL="${SAVE_ACLOCAL:-aclocal}"
38AUTOCONF="${SAVE_AUTOCONF:-autoconf}"
39AUTOHEADER="${SAVE_AUTOHEADER:-autoheader}"
40AUTOMAKE="${SAVE_AUTOMAKE:-automake}"
41
42AC_MSG_CHECKING(for preferred libtoolize)
43AC_MSG_RESULT($LIBTOOLIZE)
44AC_MSG_CHECKING(for preferred aclocal)
45AC_MSG_RESULT($ACLOCAL)
46AC_MSG_CHECKING(for preferred autoconf)
47AC_MSG_RESULT($AUTOCONF)
48AC_MSG_CHECKING(for preferred autoheader)
49AC_MSG_RESULT($AUTOHEADER)
50AC_MSG_CHECKING(for preferred automake)
51AC_MSG_RESULT($AUTOMAKE)
52
53dnl# Find RCS Ident info from source files
54AC_DEFINE_UNQUOTED(ACTIONS_IDENT, "`grep '$''Id:' $srcdir/src/actions.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [actions.c RCS ID])
55AC_DEFINE_UNQUOTED(BUTTONS_IDENT, "`grep '$''Id:' $srcdir/src/buttons.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [buttons.c RCS ID])
56AC_DEFINE_UNQUOTED(COMMAND_IDENT, "`grep '$''Id:' $srcdir/src/command.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [command.c RCS ID])
57AC_DEFINE_UNQUOTED(DRAW_IDENT, "`grep '$''Id:' $srcdir/src/draw.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [draw.c RCS ID])
58AC_DEFINE_UNQUOTED(E_IDENT, "`grep '$''Id:' $srcdir/src/e.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [e.c RCS ID])
59AC_DEFINE_UNQUOTED(EVENTS_IDENT, "`grep '$''Id:' $srcdir/src/events.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [events.c RCS ID])
60AC_DEFINE_UNQUOTED(FONT_IDENT, "`grep '$''Id:' $srcdir/src/font.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [font.c RCS ID])
61AC_DEFINE_UNQUOTED(GRKELOT_IDENT, "`grep '$''Id:' $srcdir/src/grkelot.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [grkelot.c RCS ID])
62AC_DEFINE_UNQUOTED(MAIN_IDENT, "`grep '$''Id:' $srcdir/src/main.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [main.c RCS ID])
63AC_DEFINE_UNQUOTED(MENUS_IDENT, "`grep '$''Id:' $srcdir/src/menus.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [menus.c RCS ID])
64AC_DEFINE_UNQUOTED(MISC_IDENT, "`grep '$''Id:' $srcdir/src/misc.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [misc.c RCS ID])
65AC_DEFINE_UNQUOTED(OPTIONS_IDENT, "`grep '$''Id:' $srcdir/src/options.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [options.c RCS ID])
66AC_DEFINE_UNQUOTED(PIXMAP_IDENT, "`grep '$''Id:' $srcdir/src/pixmap.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [pixmap.c RCS ID])
67AC_DEFINE_UNQUOTED(SCREEN_IDENT, "`grep '$''Id:' $srcdir/src/screen.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [screen.c RCS ID])
68AC_DEFINE_UNQUOTED(SCROLLBAR_IDENT, "`grep '$''Id:' $srcdir/src/scrollbar.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [scrollbar.c RCS ID])
69AC_DEFINE_UNQUOTED(STARTUP_IDENT, "`grep '$''Id:' $srcdir/src/startup.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [startup.c RCS ID])
70AC_DEFINE_UNQUOTED(SYSTEM_IDENT, "`grep '$''Id:' $srcdir/src/system.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [system.c RCS ID])
71AC_DEFINE_UNQUOTED(TERM_IDENT, "`grep '$''Id:' $srcdir/src/term.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [term.c RCS ID])
72AC_DEFINE_UNQUOTED(TIMER_IDENT, "`grep '$''Id:' $srcdir/src/timer.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [timer.c RCS ID])
73AC_DEFINE_UNQUOTED(UTMP_IDENT, "`grep '$''Id:' $srcdir/src/utmp.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [utmp.c RCS ID])
74AC_DEFINE_UNQUOTED(WINDOWS_IDENT, "`grep '$''Id:' $srcdir/src/windows.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [windows.c RCS ID])
75
76dnl# Check for build/host/target system types
77AC_CANONICAL_HOST
78
79dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
80if test ! -z "${CFLAGS}" -o ! -z "${CCOPTS}"; then
81  CFLAGS_GIVEN=1
82else
83  CFLAGS_GIVEN=0
84fi
85
86if test -z "${CFLAGS}"; then
87    if test -z "${CCOPTS}"; then
88	CCOPTS="-O"
89    fi
90    CFLAGS="$CCOPTS"
91fi
92
93AC_ARG_WITH(cc, [  --with-cc=compiler      force Eterm to build with a particular compiler (like pgcc, egcs, etc.)], [
94            CC=$withval,
95  if test -z "$CC"; then
96    CC=check
97  fi
98])
99
100if test "$CC" = "check"; then
101  dnl# Check for Pentium compiler
102  AC_CHECK_PROG(PGCC, pgcc, pgcc)
103
104  if test ! -z "$PGCC"; then
105    CC=$PGCC
106  else
107    unset CC
108  fi
109fi
110
111AC_PROG_CC
112AC_PROG_CPP
113AM_PROG_AS
114
115dnl# These must be run after AC_PROG_CC but before any other macros that use
116dnl# the C compiler
117AC_AIX
118AC_ISC_POSIX
119AC_MINIX
120
121dnl# At least make the attempt to support CygWin32
122AC_CYGWIN
123AC_ARG_PROGRAM
124
125AM_PROG_LIBTOOL
126AC_PROG_LIBTOOL
127
128dnl# Where are we?
129AC_MSG_CHECKING(for distribution root)
130DIST_ROOT=`pwd`
131AC_SUBST(DIST_ROOT)
132AC_MSG_RESULT($DIST_ROOT)
133
134AC_GCC_TRADITIONAL
135
136dnl # If using gcc, use -O2.  If -g works with it, use that too
137if test "${CFLAGS_GIVEN}" -ne 1; then
138    if test "$GCC" = "yes"; then
139	if test "$ac_cv_prog_cc_g" = "yes"; then
140	    CCOPTS='-g -O2'
141	else
142	    CCOPTS='-O2'
143	fi
144	CFLAGS="$CCOPTS"
145    fi
146fi
147
148AC_PROG_INSTALL
149
150CCASFLAGS="$CCASFLAGS -I.. -I."
151CCAS=$CC
152AC_SUBST(CCASFLAGS)
153AC_SUBST(CCAS)
154
155dnl# Check the sanity of what we've done so far
156AM_SANITY_CHECK
157
158dnl# Most people don't want the developer-only clutter
159AM_MAINTAINER_MODE
160
161dnl# If it's there, what the hell?
162AM_WITH_DMALLOC
163
164dnl# Look for needed programs
165AC_CHECK_PROG(SED, sed, sed, false)
166AC_CHECK_PROG(RM, rm, rm, true)
167AC_CHECK_PROG(CP, cp, cp, false)
168AC_CHECK_PROG(CHMOD, chmod, chmod, true)
169AC_CHECK_PROG(TAR, tar, tar, tar)
170AC_CHECK_PROG(MKDIR, mkdir, mkdir, false)
171AC_CHECK_PROG(CTAGS, ctags, ctags, true)
172AC_CHECK_PROG(AR, ar, ar, false)
173AC_CHECK_PROG(MV, mv, mv, true)
174AC_CHECK_PROG(TIC, tic, tic, true)
175AC_LN_S
176AC_PATH_PROG(PERL, perl, perl)
177AC_PROG_AWK
178export PERL AWK
179
180AC_C_CONST
181AC_C_INLINE
182AC_C_BIGENDIAN
183
184AC_PATH_XTRA
185
186if test ! -z "$X_CFLAGS"; then
187  if test -z "$CPPFLAGS"; then
188    CPPFLAGS="$X_CFLAGS"
189  else
190    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
191  fi
192fi
193if test ! -z "$X_LIBS"; then
194  if test -z "$LDFLAGS"; then
195    LDFLAGS="$X_LIBS"
196  else
197    LDFLAGS="$LDFLAGS $X_LIBS"
198  fi
199fi
200
201dnl# Checks for header files.
202AC_HEADER_SYS_WAIT
203AC_CHECK_HEADERS(fcntl.h termios.h \
204sys/ioctl.h sys/select.h sys/time.h \
205sys/sockio.h sys/byteorder.h malloc.h \
206utmpx.h unistd.h bsd/signal.h regex.h \
207regexp.h stdarg.h X11/X.h X11/Xlib.h \
208X11/Sunkeysym.h X11/Xlocale.h \
209)
210AC_HEADER_TIME
211
212dnl# Missing typedefs and replacements
213AC_TYPE_MODE_T
214AC_CHECK_TYPE(off_t, long)
215AC_TYPE_PID_T
216AC_TYPE_UID_T
217
218dnl# Checks for library functions.
219AC_TYPE_SIGNAL
220AC_CHECK_FUNCS(atexit _exit unsetenv setutent \
221seteuid memmove putenv strsep setresuid setresgid \
222memmem usleep snprintf strcasestr strcasechr \
223strcasepbrk strrev nl_langinfo \
224)
225
226# NOTE:  The following line is NOT NOT NOT NOT NOT a typo!
227# If you are having problems with it, libast.m4 is not installed
228# or aclocal couldn't find it.  Hence the problem is on YOUR end.
229dps_snprintf_oflow()
230
231dnl# Check for math lib.
232AC_CHECK_LIB(m, pow)
233
234dnl# Portability checks for various functions
235AC_SEARCH_LIBS(login, bsd ucb util)
236AC_SEARCH_LIBS(logout, util)
237AC_SEARCH_LIBS(getpwuid, sun)
238
239dnl#
240dnl# Utility stuff
241dnl#
242dnl# Did they want debugging?
243AC_MSG_CHECKING(for debugging level)
244AC_ARG_WITH(debugging, [  --with-debugging[=num]  enable debugging output, num is an integer 0-9], [
245              if test "$withval" = "yes"; then
246                  withval=4
247              else
248                  :
249              fi
250              if test "$withval" != "no"; then
251                  echo "$withval"
252                  AC_DEFINE_UNQUOTED(DEBUG, $withval, [Debugging level to compile in.])
253              else
254                  echo "no debugging"
255                  AC_DEFINE_UNQUOTED(DEBUG, 0, [Debugging level to compile in.])
256              fi], [echo "4"
257                  AC_DEFINE_UNQUOTED(DEBUG, 4, [Debugging level to compile in.])
258])
259
260AC_CHECK_FUNC(posix_openpt,
261              HAVE_POSIX_OPENPT=yes
262             )
263AC_CHECK_FUNC(ptsname,
264              HAVE_PTSNAME=yes
265             )
266AC_CHECK_FUNC(grantpt,
267              HAVE_GRANTPT=yes
268             )
269AC_CHECK_FUNC(unlockpt,
270              HAVE_UNLOCKPT=yes
271             )
272dnl# Check for the appropriate pty mechanism
273AC_MSG_CHECKING(for pty mechanism)
274PTY_MECH=""
275if test ! -z "$HAVE_POSIX_OPENPT" -a ! -z "$HAVE_PTSNAME" -a ! -z "$HAVE_GRANTPT" -a ! -z "$HAVE_UNLOCKPT"; then
276  AC_DEFINE(HAVE_POSIX_OPENPT, , [Define for posix_openpt() support.])
277  PTY_MECH="POSIX $PTY_MECH"
278fi
279if test -c /dev/ptc ; then
280  AC_DEFINE(HAVE_DEV_PTC, , [Define for /dev/ptc support.])
281  PTY_MECH="AIX $PTY_MECH"
282fi
283if test -r /dev/ptmx -a ! -z "$HAVE_PTSNAME" -a ! -z "$HAVE_GRANTPT" -a ! -z "$HAVE_UNLOCKPT"; then
284  AC_DEFINE(HAVE_DEV_PTMX, , [Define for /dev/ptmx support.])
285  PTY_MECH="SVR4 $PTY_MECH"
286fi
287if test -c /dev/ptyp128 ; then
288  AC_DEFINE(HAVE_SCO_PTYS, , [Define for SCO-style pty support.])
289  PTY_MECH="SCO $PTY_MECH"
290fi
291if test "X$PTY_MECH" = "X"; then
292  AC_MSG_RESULT(generic only)
293else
294  AC_MSG_RESULT($PTY_MECH)
295fi
296AC_MSG_CHECKING(for pty group)
297AC_ARG_WITH(pty-group,
298[  --with-pty-group[=gid]  specify the group that should own pty files], [
299            if test "$withval" = "yes"; then
300              PTY_GRP_NAME=`ls -1l /dev/pty* 2>/dev/null | head -n 1 | awk '{print $4}'`
301              if test ! -z "$PTY_GRP_NAME"; then
302                AC_MSG_RESULT($PTY_GRP_NAME)
303                AC_DEFINE_UNQUOTED(PTY_GRP_NAME, "$PTY_GRP_NAME", [Group name for pty ownership.])
304              else
305                AC_MSG_RESULT(unable to determine.  This feature will not be enabled.)
306              fi
307            elif test "$withval" = "no"; then
308              AC_MSG_RESULT(none)
309            else
310              AC_MSG_RESULT($withval)
311              AC_DEFINE_UNQUOTED(PTY_GRP_NAME, "$withval", [Group name for pty ownership.])
312            fi
313            ], [
314            PTY_GRP_NAME=`ls -1l /dev/pty* 2>/dev/null | head -n 1 | awk '{print $4}'`
315            if test ! -z "$PTY_GRP_NAME"; then
316              AC_MSG_RESULT($PTY_GRP_NAME)
317              AC_DEFINE_UNQUOTED(PTY_GRP_NAME, "$PTY_GRP_NAME", [Group name for pty ownership.])
318            else
319              AC_MSG_RESULT(none)
320            fi
321])
322AC_MSG_CHECKING(for saved uids)
323AC_ARG_WITH(saved-uids, [  --with(out)-saved-uids  specify that your OS has (does not have) saved uids, default is to guess], [
324            if test "$withval" = "yes"; then
325                AC_MSG_RESULT(user specified yes)
326                HAVE_SAVED_UIDS=1
327            elif test "$withval" = "no"; then
328                AC_MSG_RESULT(user specified no)
329                HAVE_SAVED_UIDS=0
330            fi
331])
332if test "x$HAVE_SAVED_UIDS" = "x"; then
333    case `uname -s` in
334        Linux | linux | GNU*Linux)  HAVE_SAVED_UIDS=1 ;;
335        HP*UX | hp*ux)              HAVE_SAVED_UIDS=1 ;;
336        AIX | aix)                  HAVE_SAVED_UIDS=1 ;;
337        Solaris | SunOS | [Ss]un)   HAVE_SAVED_UIDS=1 ;;
338        *BSD)                       HAVE_SAVED_UIDS=0 ;;
339    esac
340    if test "x$HAVE_SAVED_UIDS" = "x"; then
341        AC_MSG_RESULT(unknown...assuming no support)
342        HAVE_SAVED_UIDS=0
343    elif test $HAVE_SAVED_UIDS -eq 1; then
344        AC_MSG_RESULT(yes)
345        AC_DEFINE(HAVE_SAVED_UIDS, , [Define if the system supports saved UID and GID.])
346    else
347        AC_MSG_RESULT(no)
348    fi
349fi
350AC_MSG_CHECKING(if strict ICCCM compliance should be enabled)
351AC_ARG_ENABLE(strict-icccm,
352[  --enable-strict-icccm   compile with strict ICCCM compliant WM icon support], [
353              if test "$enableval" = "yes"; then
354                  AC_MSG_RESULT(yes)
355                  AC_DEFINE(STRICT_ICCCM, , [Define if WM cannot handle icon pixmaps.])
356              else
357                  AC_MSG_RESULT(no)
358              fi
359], AC_MSG_RESULT(no))
360
361dnl#
362dnl# X LIBRARIES
363dnl#
364AC_CHECK_LIB(X11, XOpenDisplay, , [
365echo "ERROR:  You need libX11 to build Eterm.  Verify that you have libX11.a or";
366echo "        libX11.so installed and that it is located in the X libraries";
367echo "        directory shown above.  If it is in a different directory, try using";
368echo "        the --x-libraries parameter to configure.";
369             AC_MSG_ERROR([Fatal:  libX11 not found.])])
370AC_CHECK_LIB(Xext, XextAddDisplay, , [
371echo "ERROR:  You need libXext to build Eterm.  Verify that you have libXext.a or";
372echo "        libXext.so installed and that it is located in the X libraries";
373echo "        directory shown above.  If it is in a different directory, try using";
374echo "        the --x-libraries parameter to configure.";
375             AC_MSG_ERROR([Fatal:  libXext not found.])])
376
377AC_CHECK_LIB(Xext, XShapeQueryExtension, AC_DEFINE(HAVE_X_SHAPE_EXT, , [Define if X shaped window extension is available.]))
378
379dnl#
380dnl# FEATURES
381dnl#
382AC_MSG_CHECKING(if Pablo support is wanted)
383AC_ARG_WITH(pablo,
384[  --with-pablo[=DIR]      compile with Pablo I/O Tracing support (using Pablo prefix DIR)], [
385            if test "$withval" != "no"; then
386              AC_MSG_RESULT(yes)
387              if test "$withval" != "yes"; then
388                CPPFLAGS="$CPPFLAGS -I${withval}/include"
389                LDFLAGS="$LDFLAGS -L${withval}/lib"
390              fi
391              AC_CHECK_HEADER(IOTrace.h, [
392                              AC_CHECK_LIB(PabloTraceExt, initIOTrace, [
393                                           AC_DEFINE(IOTRACE, , [Define for Pablo I/O tracing support.])
394                                           LIBS="$LIBS -lPabloTraceExt -lPabloTrace"
395                                           echo "Pablo support enabled.  Headers in ${withval}/include.  Libraries in ${withval}/lib."
396                                           ], [
397                                           echo "*** ERROR:  Pablo support was requested but the Pablo libraries could not be"
398                                           echo "***         found.  Please check config.log for further information."
399                                           echo "***         Pablo support will NOT be included."
400                                           ], -lPabloTrace)
401                              ], [
402                              echo "*** ERROR:  Pablo support was requested but the Pablo header files could not be"
403                              echo "***         found.  Please check the value you passed to --with-pablo."
404                              echo "***         Pablo support will NOT be included."
405                              ])
406            else
407              AC_MSG_RESULT(no)
408            fi], AC_MSG_RESULT(no)
409)
410AC_MSG_CHECKING(for Escreen support)
411AC_ARG_ENABLE(escreen,
412[  --disable-escreen       disable Eterm's built-in screen support], [
413            if test "$enableval" = "yes"; then
414              FOUND_SCREEN=1
415              AC_DEFINE(NS_HAVE_SCREEN, 1, [Define for support of the screen text windowing system.])
416              AC_MSG_RESULT(yes)
417            else
418              AC_MSG_RESULT(no)
419            fi
420          ], [
421            FOUND_SCREEN=1
422            AC_DEFINE(NS_HAVE_SCREEN, 1, [Define for support of the screen text windowing system.])
423            AC_MSG_RESULT(yes)
424          ]
425)
426AC_MSG_CHECKING(for Etwin support)
427AC_ARG_ENABLE(etwin,
428[  --enable-etwin          enable Eterm's built-in twin support], [
429            if test "$enableval" = "yes"; then
430              AC_CHECK_LIB(Tw, Tw_Open, FOUND_LIBTWIN=1, FOUND_LIBTWIN=0, $GRLIBS)
431              if test "$FOUND_LIBTWIN" -ne "1"; then
432                AC_WARN(*** Twin support has been disabled because libTw was not found ***)
433              else
434                AC_DEFINE(NS_HAVE_TWIN, 1, [Define for support of the twin text windowing system.])
435                LIBS="$LIBS -lTw"
436              fi
437            else
438              AC_MSG_RESULT(no)
439            fi], AC_MSG_RESULT(no)
440)
441
442if test ! -z "$FOUND_SCREEN" || test ! -z "$FOUND_LIBTWIN"; then
443    AC_DEFINE(ESCREEN, , [Define for Escreen support.])
444    AC_MSG_CHECKING(for Escreen startup effects)
445    AC_ARG_ENABLE(escreen-fx, [  --enable-escreen-fx     enable Escreen startup effects], [
446            if test "$enableval" = "yes"; then
447                AC_MSG_RESULT(yes)
448                AC_DEFINE(ESCREEN_FX, , [Define to enable Escreen startup effects.])
449            else
450                AC_MSG_RESULT(no)
451            fi
452        ], [
453            AC_MSG_RESULT(no)
454        ]
455    )
456fi
457
458AC_MSG_CHECKING(if profiling macros should be included)
459AC_ARG_ENABLE(profile,
460[  --enable-profile        compile with code profiling macros enabled], [
461            if test "$enableval" = "yes"; then
462              AC_MSG_RESULT(yes)
463              AC_DEFINE(ENABLE_PROFILE, , [Define to enable code profiling macros.])
464            else
465              AC_MSG_RESULT(no)
466            fi], AC_MSG_RESULT(no)
467)
468AC_MSG_CHECKING(for pixmap support)
469AC_ARG_WITH(imlib,
470[  --with-imlib[=DIR]      compile with Imlib support (Imlib residing in DIR/lib) (default)], [
471            if test "$withval" != "no"; then
472              AC_MSG_RESULT(yes)
473              if test "$withval" != "yes"; then
474                CPPFLAGS="$CPPFLAGS -I${withval}/include"
475                LDFLAGS="$LDFLAGS -L${withval}/lib"
476              fi
477              USE_IMLIB=1
478            else
479              AC_MSG_RESULT(no)
480              GRLIBS=""
481              USE_IMLIB=0
482              AC_WARN(*** Pixmap support has been disabled at your request.  This ***)
483              AC_WARN(*** is generally a bad idea since it really doesn't save    ***)
484              AC_WARN(*** much memory.  And the developers almost never test that ***)
485              AC_WARN(*** configuration.  So I'd reconsider if I were you....     ***)
486            fi], [AC_MSG_RESULT(yes)
487                USE_IMLIB=1
488])
489if test $USE_IMLIB -eq 1 ; then
490  AC_CHECK_LIB(dl, dlopen, GRLIBS="-ldl", , $GRLIBS)
491  AC_CHECK_LIB(ttf, TT_Init_FreeType, GRLIBS="-lttf $GRLIBS", , $GRLIBS)
492  AC_CHECK_LIB(Imlib2, imlib_create_image, [
493               GRLIBS="-lImlib2 $GRLIBS"
494               AC_DEFINE(HAVE_LIBIMLIB2, , [Define if Imlib2 is present.])
495               AC_DEFINE(PIXMAP_SUPPORT, , [Define if pixmap support is desired.])
496               AC_DEFINE(BACKING_STORE, , [Define if backing store is desired.])
497              ], [
498               AC_WARN(*** Pixmap support has been disabled because Imlib2 was not found ***)
499               AC_WARN(*** or could not be linked.  Eterm should still work, but it will ***)
500               AC_WARN(*** not be very happy.  Check config.log for more detailed        ***)
501               AC_WARN(*** information on why my attempt to link with Imlib2 failed.     ***)
502              ], $GRLIBS)
503
504fi
505
506AC_MSG_CHECKING(for transparency support)
507AC_ARG_ENABLE(trans,
508[  --enable-trans          compile with transparency support], [
509            if test "$enableval" != "no"; then
510              AC_MSG_RESULT(yes)
511              AC_DEFINE(PIXMAP_OFFSET, , [Define for pseudo-transparency support.])
512            else
513              AC_MSG_RESULT(no)
514            fi], [AC_MSG_RESULT(yes)
515                AC_DEFINE(PIXMAP_OFFSET, , [Define for pseudo-transparency support.])
516])
517
518dnl#
519dnl# MMX support
520dnl#
521AC_MSG_CHECKING(for MMX support)
522HAVE_MMX=""
523AC_ARG_ENABLE(mmx, [  --enable-mmx            enable MMX assembly routines], [
524                  test "x$enableval" = "xyes" && HAVE_MMX="yes"
525              ], [
526                  case $host_cpu in
527                      i*86)
528                          grep mmx /proc/cpuinfo >/dev/null 2>&1 && HAVE_MMX="yes"
529                          ;;
530                  esac
531              ])
532if test "x$HAVE_MMX" = "xyes"; then
533    AC_MSG_RESULT([yes (32-bit)])
534    AC_DEFINE(HAVE_MMX, , [Define for 32-bit MMX support.])
535else
536    AC_MSG_RESULT([no (no MMX detected)])
537fi
538AM_CONDITIONAL(HAVE_MMX, test "x$HAVE_MMX" = "xyes")
539
540dnl#
541dnl# SSE2 support
542dnl#
543AC_MSG_CHECKING(for SSE2 support)
544HAVE_SSE2=""
545AC_ARG_ENABLE(sse2, [  --enable-sse2            enable SSE2 assembly routines], [
546                  test "x$enableval" = "xyes" && HAVE_SSE2="yes"
547              ], [
548                  case $host_cpu in
549                      x86_64)
550                          grep sse2 /proc/cpuinfo >/dev/null 2>&1 && HAVE_SSE2="yes"
551                          ;;
552                  esac
553              ])
554if test "x$HAVE_SSE2" = "xyes"; then
555    AC_MSG_RESULT([yes])
556    AC_DEFINE(HAVE_SSE2, , [Define for 64-bit SSE2 support.])
557else
558    AC_MSG_RESULT([no (no SSE2 detected)])
559fi
560AM_CONDITIONAL(HAVE_SSE2, test "x$HAVE_SSE2" = "xyes")
561
562dnl#
563dnl# LibAST
564dnl#
565LIBAST_MIN=5
566AC_CHECK_PROG(LIBAST_CONFIG, libast-config, libast-config, false)
567if test "$LIBAST_CONFIG" = "false"; then
568    FOUND_LIBAST=0
569else
570    FOUND_LIBAST=`$LIBAST_CONFIG --version | awk -F. '{print $2}'`
571    CPPFLAGS="$CPPFLAGS `$LIBAST_CONFIG --cppflags`"
572    LDFLAGS="$LDFLAGS `$LIBAST_CONFIG --ldflags`"
573    GRLIBS="$GRLIBS `$LIBAST_CONFIG --libs`"
574fi
575AC_CHECK_LIB(ast, libast_set_program_name, , FOUND_LIBAST=0, $GRLIBS)
576
577if test "$FOUND_LIBAST" -lt "$LIBAST_MIN"; then
578  echo "ERROR:  You need LibAST 0.$LIBAST_MIN or higher to build Eterm.  If you already have it,";
579  echo "        you may have it installed in a strange place, or you may need to run";
580  echo "        /sbin/ldconfig.  If you don't have it, I can download it for you.";
581  echo "        Shall I retrieve and build LibAST now (y/n)?";
582  read ANS
583  if test "x$ANS" = "xy" -o "x$ANS" = "xyes" -o "x$ANS" = "xY" -o "x$ANS" = "xYES"; then
584      # Download from CVS server
585      CVSROOT=":pserver:anonymous@cvs.enlightenment.sourceforge.net:/cvsroot/enlightenment"
586      test -f $HOME/.cvspass || touch $HOME/.cvspass
587      grep $CVSROOT $HOME/.cvspass >/dev/null 2>&1 || cvs -d $CVSROOT login
588      cvs -z3 -d $CVSROOT co -d libast eterm/libast
589      (cd libast && ./autogen.sh $ac_configure_args && make install && cd .. && rm -rf libast)
590      if test $? -ne 0; then
591          echo 'ERROR:  Unable to auto-get libast, sorry.' 1>&2
592          exit 1
593      fi
594      FOUND_LIBAST=1
595      AC_CHECK_PROG(LIBAST_CONFIG, libast-config, libast-config, false)
596      test "$LIBAST_CONFIG" = "false" && FOUND_LIBAST=0
597  fi
598fi
599if test "$FOUND_LIBAST" -ge "$LIBAST_MIN"; then
600  if test ! -z "$LIBAST_CONFIG"; then
601    #GRLIBS="-last $GRLIBS"
602    AC_DEFINE(HAVE_LIBAST, , [Define if LibAST is present.])
603    test "$prefix" = "NONE" && prefix="`$LIBAST_CONFIG --prefix`"
604    SUPPORT_FLAGS="`$LIBAST_CONFIG --support`"
605    for i in $SUPPORT_FLAGS ; do
606      case $i in
607        MMX)
608          AC_DEFINE(LIBAST_MMX_SUPPORT, 1, [Defined as 1 if LibAST has MMX support.])
609          ;;
610        X11)
611          AC_DEFINE(LIBAST_X11_SUPPORT, 1, [Defined as 1 if LibAST has X11 support.])
612          ;;
613        Imlib2)
614          AC_DEFINE(LIBAST_IMLIB2_SUPPORT, 1, [Defined as 1 if LibAST has Imlib2 support.])
615          ;;
616      esac
617    done
618  fi
619else
620  AC_MSG_ERROR(Fatal:  libast not found.)
621fi
622
623AC_MSG_CHECKING(for utmp support)
624AC_ARG_ENABLE(utmp,
625[  --enable-utmp           compile with utmp support], [
626            if test "$enableval" != "no"; then
627              AC_MSG_RESULT(yes)
628              UTMP=1
629              AC_DEFINE(UTMP_SUPPORT, , [Define for utmp logging support.])
630            else
631              AC_MSG_RESULT(no)
632              UTMP=0
633            fi], [AC_MSG_RESULT(yes)
634                AC_DEFINE(UTMP_SUPPORT, , [Define for utmp logging support.])
635                UTMP=1
636])
637if test $UTMP -eq 1; then
638  AC_CHECK_LIB(utempter, addToUtmp)
639fi
640AC_MSG_CHECKING(for backspace key configuration)
641AC_ARG_WITH(backspace,
642[  --with-backspace=KEY    force backspace to send KEY (KEY is \"bs\" for ^H, \"del\" for ^?, \"auto\" to check stty)], [
643            if test "$withval" = "bs"; then
644              AC_MSG_RESULT(forcing Backspace to send Ctrl-H)
645              AC_DEFINE(FORCE_BACKSPACE, , [Define to force Backspace to send ^H.])
646            elif test "$withval" = "del"; then
647              AC_MSG_RESULT(forcing Backspace to send Ctrl-?)
648              AC_DEFINE(FORCE_DELETE, , [Define to force Backspace to send ^?.])
649            elif test "$withval" = "detect" -o "$withval" = "auto"; then
650              AC_MSG_RESULT(attempt to auto-detect)
651            else
652              AC_MSG_RESULT(default)
653              AC_DEFINE(FORCE_BACKSPACE, , [Define to force Backspace to send ^H.])
654            fi], [AC_MSG_RESULT(default)
655                AC_DEFINE(FORCE_BACKSPACE, , [Define to force Backspace to send ^H.])
656])
657AC_MSG_CHECKING(for delete key configuration)
658AC_ARG_WITH(delete,
659[  --with-delete=SETTING   force delete to SETTING (\"server\" to use the X server value always,
660                          \"execute\" to send the old default execute escape sequence, \"del\" for ^?,
661                          or a quoted string to use a specific string)], [
662            if test "$withval" = "server"; then
663              AC_MSG_RESULT(X server value)
664              AC_DEFINE(NO_DELETE_KEY, , [Define to use the X server value for Delete.])
665            elif test "$withval" = "no"; then
666              AC_MSG_RESULT(X server value)
667              AC_DEFINE(NO_DELETE_KEY, , [Define to use the X server value for Delete.])
668            elif test "$withval" = "execute"; then
669              AC_MSG_RESULT(send execute sequence)
670            elif test "$withval" = "del"; then
671              AC_MSG_RESULT(send Ctrl-?)
672              AC_DEFINE_UNQUOTED(KS_DELETE, "\177", [Define to force Delete to send ^?.])
673            else
674              AC_MSG_RESULT(forcing Delete to send "$withval")
675              AC_DEFINE_UNQUOTED(KS_DELETE, "$withval", [Define for specific Delete escape sequence.])
676            fi], AC_MSG_RESULT(default)
677)
678XTERM_HOME="\033\133H"
679LINUX_HOME="\033\1331~"
680AC_MSG_CHECKING(for home key configuration)
681AC_ARG_WITH(home,
682[  --with-home=SEQUENCE    specify which sequence to use for the Home key ("xterm", "linux", or "vt102")], [
683            if test "$withval" = "xterm"; then
684              AC_MSG_RESULT(emulate xterm)
685              AC_DEFINE_UNQUOTED(KS_HOME, "$XTERM_HOME", [Emulate xterm for Home key.])
686            elif test "$withval" = "linux"; then
687              AC_MSG_RESULT(emulate linux console/vt220)
688              AC_DEFINE_UNQUOTED(KS_HOME, "$LINUX_HOME", [Emulate Linux console for Home key.])
689            else
690              AC_MSG_RESULT(default vt102)
691            fi], AC_MSG_RESULT(default)
692)
693XTERM_END="\033\133F"
694LINUX_END="\033\1334~"
695AC_MSG_CHECKING(for end key configuration)
696AC_ARG_WITH(end,
697[  --with-end=SEQUENCE     specify which sequence to use for the End key ("xterm", "linux", or "vt102")], [
698            if test "$withval" = "xterm"; then
699              AC_MSG_RESULT(emulate xterm)
700              AC_DEFINE_UNQUOTED(KS_END, "$XTERM_END", [Emulate xterm for End key.])
701            elif test "$withval" = "linux"; then
702              AC_MSG_RESULT(emulate linux console/vt220)
703              AC_DEFINE_UNQUOTED(KS_END, "$LINUX_END", [Emulate Linux console for End key.])
704            else
705              AC_MSG_RESULT(default vt102)
706            fi], AC_MSG_RESULT(default)
707)
708AC_MSG_CHECKING(if mousewheel support should be enabled)
709AC_ARG_WITH(mousewheel,
710[  --without-mousewheel    disable built-in mousewheel support], [
711            if test "$withval" = "no"; then
712              AC_MSG_RESULT(no)
713            else
714              AC_MSG_RESULT(yes)
715              AC_DEFINE(MOUSEWHEEL, , [Define for built-in mousewheel support.])
716            fi], [AC_MSG_RESULT(yes)
717                AC_DEFINE(MOUSEWHEEL, , [Define for built-in mousewheel support.])
718])
719
720AC_MSG_CHECKING(for automatic encoding)
721AC_ARG_ENABLE(auto-encoding,
722[  --enable-auto-encoding  compile with runtime automatic encoding setting],
723             if test "$enableval" = "no"; then
724               AC_MSG_RESULT(no)
725             else
726               AC_MSG_RESULT(yes)
727               AC_DEFINE(AUTO_ENCODING, 1, [Define for automatic character encoding.])
728             fi, AC_MSG_RESULT(yes)
729                 AC_DEFINE(AUTO_ENCODING, 1, [Define for automatic character encoding.])
730)
731
732MULTICHAR_ENCODING=""
733AC_MSG_CHECKING(for multi-charset support)
734AC_ARG_ENABLE(multi-charset,
735[  --enable-multi-charset  compile with multibyte font support], [
736            if test "$enableval" = "no"; then
737              MULTI_CHARSET_TYPE=""
738            elif test "$enableval" = "yes"; then
739              MULTI_CHARSET_TYPE="unicode"
740            else
741              MULTI_CHARSET_TYPE="$enableval"
742            fi], [
743            if (xlsfonts 2>/dev/null | grep 10646 >&5 2>&5); then
744              MULTI_CHARSET_TYPE="unicode"
745            else
746              MULTI_CHARSET_TYPE=""
747            fi
748           ])
749
750if test "x$MULTI_CHARSET_TYPE" != "x"; then
751  if test "$MULTI_CHARSET_TYPE" = "kanji"; then
752    AC_MSG_RESULT(kanji)
753    AC_DEFINE(MULTI_CHARSET, , [Define for multi-byte character set support.])
754    DEF_FONT_IDX=0
755    MULTICHAR_ENCODING="eucj"
756    FONT0="fixed"
757    FONT1="8x16"
758    FONT2="9x18"
759    FONT3="12x24"
760    FONT4="13x26"
761    MFONT0="k14"
762    MFONT1="jiskan16"
763    MFONT2="jiskan18"
764    MFONT3="jiskan24"
765    MFONT4="jiskan26"
766  elif test "$MULTI_CHARSET_TYPE" = "euc-kr" -o "$MULTI_CHARSET_TYPE" = "euckr"; then
767    AC_MSG_RESULT(euckr)
768    AC_DEFINE(MULTI_CHARSET, , [Define for multi-byte character set support.])
769    DEF_FONT_IDX=1
770    MULTICHAR_ENCODING="euckr"
771    FONT0="7x14"
772    FONT1="8x16"
773    FONT2="9x18"
774    FONT3="10x20"
775    FONT4="12x24"
776    MFONT0="-*-gulim-medium-r-normal--14-*-*-*-*-140-ksc5601.1987-0"
777    MFONT1="-*-gulim-medium-r-normal--16-*-*-*-*-160-ksc5601.1987-0"
778    MFONT2="-*-gulim-medium-r-normal--18-*-*-*-*-180-ksc5601.1987-0"
779    MFONT3="-*-gulim-medium-r-normal--20-*-*-*-*-200-ksc5601.1987-0"
780    MFONT4="-*-gulim-medium-r-normal--24-*-*-*-*-240-ksc5601.1987-0"
781  elif test "$MULTI_CHARSET_TYPE" = "unicode" -o "$MULTI_CHARSET_TYPE" = "utf-8" -o "$MULTI_CHARSET_TYPE" = "utf8"; then
782    AC_MSG_RESULT(ISO-10646)
783    AC_DEFINE(MULTI_CHARSET, , [Define for multi-byte character set support.])
784    DEF_FONT_IDX=2
785    MULTICHAR_ENCODING="iso-10646"
786    MFONT0="-misc-fixed-medium-r-normal--7-70-75-75-c-50-iso10646-1"
787    MFONT1="-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso10646-1"
788    MFONT2="-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1"
789    MFONT3="-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1"
790    MFONT4="-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1"
791    FONT0="5x7"
792    FONT1="6x10"
793    FONT2="fixed"
794    FONT3="8x13"
795    FONT4="9x15"
796  elif test "$MULTI_CHARSET_TYPE" = "big5"; then
797    AC_MSG_RESULT(big5)
798    AC_DEFINE(MULTI_CHARSET, , [Define for multi-byte character set support.])
799    DEF_FONT_IDX=0
800    MULTICHAR_ENCODING="big5"
801    FONT0="8x16"
802    FONT1="9x18"
803    FONT2="10x20"
804    FONT3="12x24"
805    FONT4="13x26"
806    MFONT0="-*-ming-medium-r-normal--16-*-*-*-c-*-big5-0"
807    MFONT1="-*-ming-medium-r-normal--18-*-*-*-c-*-big5-0"
808    MFONT2="-*-ming-medium-r-normal--20-*-*-*-c-*-big5-0"
809    MFONT3="-*-ming-medium-r-normal--24-*-*-*-c-*-big5-0"
810    MFONT4="-*-ming-medium-r-normal--26-*-*-*-c-*-big5-0"
811  else
812    MULTI_CHARSET_TYPE=""
813  fi
814fi
815if test "x$MULTI_CHARSET_TYPE" = "x"; then
816  AC_MSG_RESULT(no)
817  DEF_FONT_IDX=2
818  MULTICHAR_ENCODING=none
819  MFONT0=none
820  MFONT1=none
821  MFONT2=none
822  MFONT3=none
823  MFONT4=none
824  FONT0="5x7"
825  FONT1="6x10"
826  FONT2="fixed"
827  FONT3="8x13"
828  FONT4="9x15"
829fi
830
831AC_DEFINE_UNQUOTED(DEF_FONT_IDX, $DEF_FONT_IDX, [Default font index.])
832AC_DEFINE_UNQUOTED(FONT0, "$FONT0", [Font 0])
833AC_DEFINE_UNQUOTED(FONT1, "$FONT1", [Font 1])
834AC_DEFINE_UNQUOTED(FONT2, "$FONT2", [Font 2])
835AC_DEFINE_UNQUOTED(FONT3, "$FONT3", [Font 3])
836AC_DEFINE_UNQUOTED(FONT4, "$FONT4", [Font 4])
837AC_SUBST(DEF_FONT_IDX)
838AC_SUBST(FONT0)
839AC_SUBST(FONT1)
840AC_SUBST(FONT2)
841AC_SUBST(FONT3)
842AC_SUBST(FONT4)
843export FONT0 FONT1 FONT2 FONT3 FONT4 DEF_FONT_IDX
844
845AC_DEFINE_UNQUOTED(MULTICHAR_ENCODING, "$MULTICHAR_ENCODING", [Multi-byte character encoding style.])
846AC_DEFINE_UNQUOTED(MFONT0, "$MFONT0", [Multibyte Font 0])
847AC_DEFINE_UNQUOTED(MFONT1, "$MFONT1", [Multibyte Font 1])
848AC_DEFINE_UNQUOTED(MFONT2, "$MFONT2", [Multibyte Font 2])
849AC_DEFINE_UNQUOTED(MFONT3, "$MFONT3", [Multibyte Font 3])
850AC_DEFINE_UNQUOTED(MFONT4, "$MFONT4", [Multibyte Font 4])
851AC_SUBST(MULTICHAR_ENCODING)
852AC_SUBST(MFONT0)
853AC_SUBST(MFONT1)
854AC_SUBST(MFONT2)
855AC_SUBST(MFONT3)
856AC_SUBST(MFONT4)
857export MFONT0 MFONT1 MFONT2 MFONT3 MFONT4 MULTICHAR_ENCODING
858
859AC_MSG_CHECKING(for XIM support)
860AC_ARG_ENABLE(xim,
861[  --enable-xim            compile with XIM support (default)], [
862            if test "$enableval" = "no"; then
863              AC_MSG_RESULT(no)
864	      XIM="FALSE"
865            else
866              AC_MSG_RESULT(yes)
867	      AC_DEFINE(USE_XIM, , [Define for X Input Method support.])
868	      XIM="TRUE"
869            fi], [AC_MSG_RESULT(yes)
870	        AC_DEFINE(USE_XIM, , [Define for X Input Method support.])
871	        XIM="TRUE"
872])
873
874# check X11R6 for XIM
875if test "$XIM" = "TRUE"; then
876  AC_CHECK_LIB(X11, XRegisterIMInstantiateCallback, AC_DEFINE(USE_X11R6_XIM, , [Define if we have X11R6 XIM.]))
877fi
878
879# Check for XResource extension
880AC_CHECK_HEADER([X11/extensions/XRes.h],
881                [
882                    AC_DEFINE([HAVE_X11_EXTENSIONS_XRES_H], [], [Define if we have X11/extensions/XRes.h])
883                ], [],
884                [
885#ifdef HAVE_X11_X_H
886#  include <X11/X.h>
887#endif
888#ifdef HAVE_X11_XLIB_H
889#  include <X11/Xlib.h>
890#endif
891                ])
892AC_CHECK_LIB(XRes, XResQueryExtension,
893             [
894                 GRLIBS="$GRLIBS -lXRes"
895                 AC_DEFINE(HAVE_XRES_EXT, , [Define if we have the XResource extension.])
896             ])
897
898AC_MSG_CHECKING(for Greek keyboard support)
899AC_ARG_ENABLE(greek,
900[  --enable-greek          compile with support for Greek keyboards], [
901            if test "$enableval" = "yes"; then
902              AC_MSG_RESULT(yes)
903              AC_DEFINE(GREEK_SUPPORT, , [Define for Greek keyboard support.])
904            else
905              AC_MSG_RESULT(no)
906            fi], AC_MSG_RESULT(no)
907)
908
909AC_ARG_WITH(terminfo,
910[  --without-terminfo      do not compile the Eterm terminfo file], [
911            if test "$withval" = "no"; then
912              TIC=true
913            fi
914])
915
916AC_ARG_WITH(theme-update,
917[  --with-theme-update     existing themes will be forceably removed and new ones installed], [
918            if test "$withval" = "yes"; then
919              REMOVE_THEMES=yes
920            else
921              REMOVE_THEMES=no
922            fi], [REMOVE_THEMES=no
923])
924AC_SUBST(REMOVE_THEMES)
925
926dnl# AC_MSG_CHECKING(which threads library to use)
927dnl# AC_ARG_WITH(threads,
928dnl# [  --with-threads[=STYLE]  compile with threads support, STYLE is either "posix" or blank
929dnl#                           (disabled by default)],
930dnl#             case $withval in
931dnl#               [yes | posix )]
932dnl#                 AC_MSG_RESULT(POSIX)
933dnl#                 THREADS_LIB=posix
934dnl#                 ;;
935dnl#               [* )]
936dnl#                 AC_MSG_RESULT(none)
937dnl#                 ;;
938dnl#             esac
939dnl#  , AC_MSG_RESULT(none))
940dnl# if test "$THREADS_LIB" = "posix"; then
941dnl#   AC_CHECK_LIB(pthread, pthread_create, CPPFLAGS="$CPPFLAGS -D_REENTRANT" ; THREADLIBS="-lpthread"
942dnl#                                        AC_DEFINE(USE_POSIX_THREADS)
943dnl#                                        AC_DEFINE(MUTEX_SYNCH)
944dnl#                , , -D_REENTRANT -L/usr/lib -L/lib -L/usr/local/lib)
945dnl# fi
946
947AC_PREFIX(Eterm)
948AC_PREFIX(gcc)
949if test "$prefix" = "NONE"; then
950  prefix=$ac_default_prefix
951fi
952if test "$exec_prefix" = "NONE"; then
953  exec_prefix=$prefix
954fi
955
956dnl Stack Tracing toys
957AC_ARG_ENABLE(stack-trace, [  --disable-stack-trace   disable stack trace on abnormal termination], [
958  if test "$enableval" = "no"; then
959    AC_DEFINE(NO_STACK_TRACE, , [Define to disable stack trace on abnormal termination.])
960    NO_STACK_TRACE=1
961  fi
962])
963
964if test "$NO_STACK_TRACE" != "1"; then
965  AC_PATH_PROG(DBX, dbx, no)
966  if test "$DBX" != "no"; then
967    AC_DEFINE_UNQUOTED(DBX, "$DBX", [Define for dbx support.])
968  fi
969  AC_PATH_PROG(GDB, gdb, no)
970  if test "$GDB" != "no"; then
971    AC_DEFINE_UNQUOTED(GDB, "$GDB", [Define for gdb support.])
972  fi
973  AC_PATH_PROG(PSTACK, pstack, no, $PATH:/usr/proc/bin:/usr/sbin)
974  if test "$PSTACK" != "no"; then
975    AC_DEFINE_UNQUOTED(PSTACK, "$PSTACK", [Define for pstack support.])
976  fi
977  AC_CHECK_LIB(cl, U_STACK_TRACE, LIBS="$LIBS -lcl")
978fi
979
980AC_MSG_CHECKING(for Linux 2.1 or higher)
981OS_NAME=`uname -s`
982if test "$OS_NAME" = "Linux"; then
983  OS_REV=`uname -r`
984  OS_MAJOR=`echo $OS_REV | cut -d. -f1`
985  OS_MINOR=`echo $OS_REV | cut -d. -f2`
986  if test "$OS_MAJOR" -ge "2" -a "$OS_MINOR" -ge "1"; then
987    AC_MSG_RESULT(yes)
988    AC_DEFINE(NEED_LINUX_HACK, , [Define if uid hack needed to open X display.])
989  else
990    AC_MSG_RESULT(no)
991  fi
992else
993  AC_MSG_RESULT(no)
994fi
995
996dnl# Enable/disable name reporting escape sequences
997AC_MSG_CHECKING(if we should enable name reporting escape sequences)
998AC_ARG_ENABLE(name-reporting-escapes, [ --enable-name-reporting-escapes  Specify this to enable title/icon name reporting], [
999              if test "$enableval" = "yes"; then
1000                  AC_MSG_RESULT(yes)
1001                  AC_DEFINE(ENABLE_NAME_REPORTING_ESCAPES, 1, [Defined to enable title/icon name reporting escape sequences.])
1002              else
1003                  AC_MSG_RESULT(no)
1004              fi
1005], [AC_MSG_RESULT(no)])
1006
1007dnl# Enable/disable humor
1008AC_ARG_WITH(sense-of-humor, [  --without-sense-of-humor   Specify this if you have no sense of humor], [
1009            if test "$withval" = "no"; then
1010              HUMOR=none
1011            fi
1012])
1013
1014if test -z "$HUMOR"; then
1015AC_CHECK_LIB(Kenny, life_signs, , [
1016  echo "  Oh my god, they killed Kenny!  You bastards!"
1017  AC_DEFINE(HAVE_HUMOR, 1, [Defined if user has a sense of humor.])
1018])
1019fi
1020
1021CONFIG_SEARCH_PATH=`eval eval eval eval eval echo "${sysconfdir}/$PACKAGE/themes:/etc/$PACKAGE/themes:${datadir}/$PACKAGE/themes"`
1022CONFIG_SEARCH_PATH=`eval eval eval eval eval echo "$CONFIG_SEARCH_PATH:${sysconfdir}/$PACKAGE:/etc/$PACKAGE:${datadir}/$PACKAGE"`
1023AC_DEFINE_UNQUOTED(CONFIG_SEARCH_PATH, "~/.Eterm/themes:~/.Eterm:$CONFIG_SEARCH_PATH", [Config file/theme search path.])
1024# Do replacements on theme files and such.  All variables to be replaced
1025# by this routine MUST be exported before the awk script runs.
1026if test "X$PKGDATADIR" = "X" ; then
1027  PKGDATADIR=`eval eval eval eval echo "$datadir/$PACKAGE"`
1028fi
1029export PKGDATADIR
1030AC_DEFINE_UNQUOTED(PKGDATADIR, "$PKGDATADIR", [Package data directory.])
1031if test "$GDB" != "no"; then
1032  GDB_CMD_FILE="$PKGDATADIR/gdb.scr"
1033  AC_DEFINE_UNQUOTED(GDB_CMD_FILE, "$GDB_CMD_FILE", [gdb command script.])
1034else
1035  GDB_CMD_FILE=""
1036fi
1037AC_SUBST(GDB_CMD_FILE)
1038
1039CPPFLAGS=`eval eval eval eval eval echo "-I$includedir -I$prefix/include $CPPFLAGS"`
1040CPPFLAGS=`echo $CPPFLAGS | tr ' ' '\n' | uniq | grep -v NONE | tr '\n' ' '`
1041CFLAGS=${CFLAGS--O}
1042LDFLAGS=`eval eval eval eval eval echo "-L$libdir -L$prefix/lib ${LDFLAGS--O}"`
1043LDFLAGS=`echo $LDFLAGS | tr ' ' '\n' | uniq | grep -v NONE | tr '\n' ' '`
1044LIBS="$GRLIBS $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
1045
1046AC_SUBST(CC)
1047AC_SUBST(CFLAGS)
1048AC_SUBST(CPPFLAGS)
1049AC_SUBST(LDFLAGS)
1050AC_SUBST(LIBS)
1051AC_SUBST(THREADLIBS)
1052
1053basedir=.
1054
1055AM_CONFIG_HEADER(config.h)
1056
1057AC_OUTPUT([Makefile bg/Makefile doc/Makefile utils/Makefile pix/Makefile
1058          src/Makefile themes/Makefile])
1059
1060# Mega evals to make sure all the relative variables get resolved.
1061BINDIR=`eval eval eval eval echo ${bindir}`
1062export BINDIR bindir prefix exec_prefix datadir PACKAGE
1063
1064# The awk-fu below replaces @VAR@ in theme config files with the corresponding
1065# environment variables, kinda like AC_OUTPUT above.
1066changequote(%&, &%)dnl
1067%&
1068for i in utils/kEsetroot themes/Eterm/theme.cfg themes/auto/theme.cfg themes/Escreen/theme.cfg \
1069         themes/trans/theme.cfg ; do
1070  echo creating $i
1071  $AWK '{if (match($0,/@[A-Za-z0-9_]*@/)) {
1072           i=ENVIRON[substr($0,RSTART+1,RLENGTH-2)];
1073           outp=$0;
1074           gsub(/@[A-Za-z0-9_]*@/,i,outp);
1075           print outp;
1076         } else {
1077           print $0;
1078         }
1079        }' $i.in > $i
1080done
1081&%
1082changequote([, ])dnl
1083
1084dnl If we're not building with Imlib support, don't build Esetroot
1085if test -z "$GRLIBS"; then
1086  sed -e 's/^bin_PROGRAMS.*$//g' $srcdir/doc/Makefile > $srcdir/doc/Makefile.new
1087  mv $srcdir/doc/Makefile.new $srcdir/doc/Makefile
1088fi
1089
1090echo "
1091$PACKAGE $VERSION
1092Configuration:
1093--------------
1094
1095  Source code location:       $srcdir
1096  Host System Type:           $host
1097  Preprocessor:               $CPP $CPPFLAGS
1098  Compiler:                   $CC $CFLAGS
1099  Linker:                     $CC $LDFLAGS $LIBS
1100  Install path:               $prefix
1101
1102  See src/feature.h for further configuration information.
1103
1104  Now type 'make' to build $PACKAGE $VERSION.
1105"
1106