1dnl# -*- sh -*-
2dnl# Process this file with autoconf to produce a configure script.
3dnl#
4dnl#Copyright (c) 1998 Juergen Sawinski <Juergen.Sawinski@urz.uni-heidelberg.de>
5dnl#Copyright (c) 1997 1998 Guylhem AZNAR <guylhem@oeil.qc.ca>
6
7AC_INIT(Makefile.in)
8AC_CONFIG_AUX_DIR(autoconf)
9AC_CONFIG_HEADER(config.h:autoconf/config.h.in)
10
11version="asmem-1.12"
12
13dnl# Setup command-line options
14
15dnl# we need the standard prefixes defined early
16test "x$prefix" = xNONE && prefix=$ac_default_prefix
17test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
18eval "bindir=$bindir"
19eval "datadir=$datadir"
20eval "mandir=$mandir"
21
22dnl# directories
23AC_ARG_WITH(gnustep_dir,	[  --with-gnustep-dir=DIR  GNUstep directory [~/GNUstep] ],with_gnustep_dir=$withval, with_gnustep_dir="~/GNUstep")
24AC_ARG_WITH(gnustep_lib,	[  --with-gnustep-lib=DIR  GNUstep/Library directory [~/GNUstep/Library] ],with_gnustep_lib=$withval, with_gnustep_lib="~/GNUstep/Library")
25AC_ARG_WITH(afterdir,		[  --with-afterdir=DIR     user AfterStep dir [~/GNUstep/Library/AfterStep] ],with_afterdir=$withval, with_afterdir="~/GNUstep/Library/AfterStep")
26AC_ARG_ENABLE(shaping, 		[  --enable-shaping        support shaped windows [yes] ],enable_shaping=$enableval,enable_shaping="yes")
27AC_ARG_ENABLE(jpeg,  		[  --enable-jpeg           support JPEG image format [yes] ],enable_jpeg=$enableval,enable_jpeg="yes")
28AC_ARG_ENABLE(uvm,            [  --enable-uvm            support the BSD kvm/uvm system to get memory stats on BSD systems [yes] ], enable_uvm=$enableval,enable_uvm="yes")
29
30dnl# Check for compiler tools
31
32AC_PROG_CC
33AC_PROG_INSTALL
34AC_PROG_RANLIB
35AC_PATH_PROG(RM, rm, rm)
36AC_PATH_PROG(MV, mv, mv)
37AC_PATH_PROG(CP, cp, cp)
38AC_PATH_PROG(MKDIR, mkdir, mkdir)
39AC_PATH_PROG(STRIP, strip, strip)
40
41dnl# Remove -g
42
43if test -n '`echo "$CFLAGS " | grep "\-g " 2> /dev/null`' ; then
44  CFLAGS=`echo "$CFLAGS " | sed "s/-g //"`
45fi
46
47dnl# Add -Wall
48
49if test "x$GCC" = "xyes"; then
50  if test -z '`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`' ; then
51    CFLAGS="$CFLAGS -Wall"
52  fi
53fi
54
55dnl# Check for headers
56
57AC_PATH_XTRA
58AC_CHECK_HEADERS(sys/wait.h sys/time.h)
59AC_CHECK_HEADERS(sys/statvfs.h sys/vfs.h sys/mount.h ustat.h)
60AC_CHECK_HEADERS(machine/soundcard.h linux/soundcard.h linux/radio.h)
61dnl# check for uvm for *BSD.
62AC_CHECK_HEADERS(uvm/uvm_extern.h)
63AC_CONFIG_HEADER(config.h)
64dnl# check for vm for FreeBSD.
65AC_CHECK_HEADERS(kvm.h sys/vmmeter.h)
66
67dnl# Check for X
68
69saved_cflags="$CFLAGS"
70saved_ldflags="$LDFLAGS"
71
72CFLAGS="$CFLAGS $X_CFLAGS"
73LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
74
75x_libs="$X_EXTRA_LIBS $X_PRE_LIBS"
76AC_CHECK_LIB(X11, XOpenDisplay, [x_libs="-lX11 $x_libs"],,$x_libs)
77
78dnl# Check for XPM library
79
80VT_FIND_LIBXPM
81HAVEXPM="NOXPM"
82if test "x$have_xpm" = "xyes"; then
83  HAVEXPM="XPM"
84  x_libs="$x_libs $XPM_LIBS"
85fi
86for x in $X_CFLAGS; do
87  XPM_CFLAGS=`echo " $XPM_CFLAGS " | sed "s@ $x @ @"`
88done
89
90dnl# Check for X shaped window extension
91
92HAVESHAPE="NOSHAPE"
93if test "x$enable_shaping" = "xyes"; then
94  AC_CHECK_LIB(Xext, XShapeCombineMask, [x_libs="$x_libs -lXext" HAVESHAPE="SHAPE"],,$x_libs)
95fi
96
97CFLAGS="$saved_cflags"
98LDFLAGS="$saved_ldflags"
99
100dnl# Check for libjpeg
101
102HAVEJPEG="NOJPEG"
103if test "x$enable_jpeg" = "xyes"; then
104  AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [JPEG_LIB="-ljpeg" HAVEJPEG="JPEG"],,)
105fi
106
107dnl# Check for uvm (*BSD systems)
108
109HAVEUVM="NOUVM"
110if test "x$enable_uvm" = "xyes"; then
111  AC_CHECK_LIB(kvm, kvm_open, [UVM_LIB="-lkvm" HAVEUVM="UVM"], ,)
112fi
113
114dnl# Check for kvm FreeBSD
115INSTALL_MODE="-m 755"
116AC_CHECK_LIB(kvm, kvm_open, [KVM_LIB="-lkvm" INSTALL_MODE="-m 02755 -g kmem"], ,)
117
118
119dnl# Variable strings declaration
120
121AC_SUBST(version)
122AC_SUBST(with_locale)
123AC_SUBST(HAVEXPM)
124AC_SUBST(HAVESHAPE)
125AC_SUBST(HAVEJPEG)
126AC_SUBST(XPM_LIBS)
127AC_SUBST(x_libs)
128AC_SUBST(x_includes)
129AC_SUBST(XEXT_LIB)
130AC_SUBST(JPEG_LIB)
131AC_SUBST(UVM_LIB)
132AC_SUBST(KVM_LIB)
133AC_SUBST(INSTALL_MODE)
134AC_SUBST(with_gnustep_dir)
135AC_SUBST(with_gnustep_lib)
136AC_SUBST(with_afterdir)
137
138dnl# Write results
139
140AC_CONFIG_HEADER(config.h)
141
142dnl# Common parts of the Makefile
143MAKEFILEDEFINES=./autoconf/Makefile.defines
144MAKEFILECOMMON=./autoconf/Makefile.common
145MAKEFILECOMMONLIB=./autoconf/Makefile.common.lib
146
147AC_SUBST_FILE(MAKEFILEDEFINES)
148AC_SUBST_FILE(MAKEFILECOMMON)
149AC_SUBST_FILE(MAKEFILECOMMONLIB)
150
151AC_OUTPUT(\
152autoconf/Makefile.defines \
153autoconf/Makefile.common \
154autoconf/Makefile.common.lib \
155Makefile
156)
157
158echo "
159
160
161AfterStep applet $version is now hopefully configured, just run :
162make ; make install
163"
164