1dnl# -*- sh -*-
2dnl# Process this file with autoconf to produce a configure script.
3dnl#
4dnl#Copyright (c) 1998 Michal Vitecek <fuf@fuf.sh.cvut.cz>
5dnl#Copyright (c) 1998 Sasha Vasko <sasha at aftercode.net>
6dnl#Copyright (c) 1998 Juergen Sawinski <Juergen.Sawinski@urz.uni-heidelberg.de>
7dnl#Copyright (c) 1997 1998 Guylhem AZNAR <guylhem@oeil.qc.ca>
8
9AC_INIT(libAfterBase/astypes.h)
10AC_CONFIG_AUX_DIR(autoconf)
11
12version="0.91"
13app_version="1.9.31"
14libafterstep_version="0.91"
15libafterstep_version_major="0"
16libafterstep_name="LIBAFTERSTEP"
17libafterstep_file_name="libAfterStep"
18libafterconf_version="0.90"
19libafterconf_version_major="0"
20libafterconf_name="LIBAFTERCONF"
21libafterconf_file_name="libAfterConf"
22
23dnl# Setup command-line options
24
25dnl# we need the standard prefixes defined early
26test "x$prefix" = xNONE && prefix=$ac_default_prefix
27test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
28eval "bindir=$bindir"
29eval "datadir=$datadir"
30eval "mandir=$mandir"
31eval "libdir=$libdir"
32eval "includedir=$includedir"
33
34dnl# The following is passed directly to libAfterImage configure :
35AC_ARG_WITH(xpm,	    [  --with-xpm               support XPM image format [yes]])
36AC_ARG_WITH(builtin_xpm,    [  --with-builtin-xpm       use builtin XPM parsing/handling instead of libXpm [yes]])
37AC_ARG_WITH(xpm_includes,   [  --with-xpm-includes=DIR  use libXpm includes in DIR( when builtin XPM handling is disabled )], xpm_includes="$withval", xpm_includes=NO)
38AC_ARG_WITH(jpeg,		    [  --with-jpeg              support JPEG image format [yes]])
39AC_ARG_WITH(jpeg_includes,  [  --with-jpeg-includes=DIR use JPEG includes in DIR], jpeg_includes="$withval", jpeg_includes=NO)
40AC_ARG_WITH(png,		    [  --with-png               support PNG image format [yes]])
41AC_ARG_WITH(png_includes,   [  --with-png-includes=DIR  use PNG includes in DIR], png_includes="$withval", png_includes=NO)
42AC_ARG_WITH(ungif,		    [  --with-ungif             support GIF image format using libungif [yes]])
43AC_ARG_WITH(gif,		    [  --with-gif               support GIF image format using libgif   [no]])
44AC_ARG_WITH(gif_includes,   [  --with-gif-includes=DIR  use GIF includes in DIR], gif_includes="$withval", gif_includes=NO)
45AC_ARG_WITH(tiff,		    [  --with-tiff              support TIFF image format [yes]])
46AC_ARG_WITH(tiff_includes,  [  --with-tiff-includes=DIR use TIFF includes in DIR], tiff_includes="$withval", tiff_includes=NO)
47
48AC_ARG_WITH(tff,		    [  --with-ttf               support True Type Fonts via FreeType library [yes]])
49AC_ARG_WITH(tff_includes,   [  --with-ttf-includes=DIR  use FreeType includes in DIR], ttf_includes="$withval", ttf_includes=NO)
50
51AC_ARG_WITH(afterbase_includes,  [  --with-afterbase-includes=DIR  use libAfterBase includes in DIR], afterbase_includes="$withval", afterbase_includes=NO)
52AC_ARG_WITH(afterimage_includes, [  --with-afterimage-includes=DIR  use libAfterImage includes in DIR], afterimage_includes="$withval", afterimage_includes=NO)
53AC_ARG_WITH(afterbase_lib,       [  --with-afterbase-lib=DIR  use libAfterBase library located in DIR], afterbase_lib="$withval", afterbase_lib=NO)
54AC_ARG_WITH(afterimage_lib,      [  --with-afterimage-lib=DIR  use libAfterImage library located in DIR], afterimage_lib="$withval", afterimage_lib=NO)
55
56dnl# compile-time switches
57AC_ARG_ENABLE(i18n,		[  --enable-i18n           support I18N [no] ],enable_i18n=$enableval,enable_i18n="no")
58AC_ARG_ENABLE(xlocale,		[  --enable-xlocale        using X_LOCALE [no] ],enable_xlocale=$enableval,enable_xlocale="no")
59AC_ARG_WITH(locale,		[  --with-locale=LOCALE    locale name you want to use ],with_locale=$withval,with_locale="")
60
61AC_ARG_ENABLE(staticlibs,       [  --enable-staticlibs     enable linking to libraries statically [yes] ],enable_staticlibs=$enableval,enable_staticlibs="yes")
62AC_ARG_ENABLE(sharedlibs,       [  --enable-sharedlibs     enable linking to libraries dynamically [no] ],enable_sharedlibs=$enableval,enable_sharedlibs="no")
63
64AC_ARG_WITH(libefence,		[  --with-libefence        compile with libefence to debug buffer overruns [no] ],with_libefence=$withval,with_libefence="")
65AC_ARG_ENABLE(gdb,		[  --enable-gdb            add gdb symbols (-g) (for debugging) [no] ],enable_gdb=$enableval,enable_gdb="no")
66AC_ARG_ENABLE(sigsegv,		[  --enable-sigsegv        enable internal handler of Segmentation Fault (for self-diagnostics) [yes] ],enable_sigsegv=$enableval,enable_sigsegv="yes")
67AC_ARG_ENABLE(warn,		[  --enable-warn           turn on more compiler warnings (for debugging) [no] ],enable_warn=$enableval,enable_warn="no")
68AC_ARG_ENABLE(gprof,		[  --enable-gprof          add gprof symbols (-pg) (for debugging) [no] ],enable_gprof=$enableval,enable_gprof="no")
69AC_ARG_ENABLE(audit,		[  --enable-audit          memory usage audit (for debugging) [no] ],enable_audit=$enableval,enable_audit="no")
70AC_ARG_ENABLE(trace,		[  --enable-trace          some function calls tracing (see include/trace.h) (for debugging) [no] ],enable_trace=$enableval,enable_trace="no")
71AC_ARG_ENABLE(trace-x,		[  --enable-trace-x        trace X calls (runtime option) (for debugging) [no] ],enable_trace_x=$enableval,enable_trace_x="no")
72AC_ARG_ENABLE(mmx_optimization,
73							[  --enable-mmx-optimization  enable utilization of MMX instruction set to speed up imaging operations [yes] ],enable_mmx_optimization=$enableval,enable_mmx_optimization="yes")
74
75dnl# Comman stuff : compiler tools, proggies, etc.
76
77AC_PROG_CC
78export CC
79export GCC
80dnl# now we need to play abot with CFLAGS :
81
82dnl# Remove -g
83if test -n "`echo $CFLAGS' ' | grep '\-g ' 2> /dev/null`" ; then
84  CFLAGS=`echo "$CFLAGS " | sed "s/-g / /"`
85fi
86
87dnl# Add -Wall
88if test "x$GCC" = "xyes"; then
89  if test -z "`echo $CFLAGS | grep '\-Wall' 2> /dev/null`" ; then
90    CFLAGS="$CFLAGS -Wall"
91  fi
92fi
93
94dnl# Add -fPIC for IA64 compilation
95AC_CYGWIN
96if test "x$CYGWIN" = "x" -a "x$GCC" = "xyes" ; then
97  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
98    CFLAGS="$CFLAGS -fPIC"
99  fi
100fi
101
102dnl# Add -g
103if test "x$enable_gdb" = "xyes"; then
104  CFLAGS="$CFLAGS -g"
105  LDFLAGS="$LDFLAGS -g"
106fi
107
108dnl# Add -pg
109if test "x$enable_gprof" = "xyes"; then
110  CFLAGS="$CFLAGS -pg"
111  LDFLAGS="$LDFLAGS -pg"
112fi
113
114dnl# Add lots more warnings
115if test "x$enable_warn" = "xyes"; then
116  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"
117fi
118
119if test "x$GCC" = "xyes"; then
120   LDFLAGS="$LDFLAGS -rdynamic"
121fi
122
123dnl# done with flags - lets export those for our children to use :
124export CFLAGS
125export LDFLAGS
126
127dnl# install checks :
128AC_PROG_INSTALL
129dnl# if the path to the install program is relative, make it absolute
130currdir=`pwd`
131INSTALL=`echo $INSTALL|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
132INSTALL_PROGRAM=`echo $INSTALL_PROGRAM|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
133INSTALL_DATA=`echo $INSTALL_DATA|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
134INSTALL_LIB=`echo $INSTALL_LIB|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
135
136export INSTALL
137export INSTALL_PROGRAM
138export INSTALL_DATA
139export INSTALL_LIB
140
141AC_PROG_RANLIB
142export RANLIB
143
144AC_PATH_PROG(RM, rm, rm)
145export RM
146AC_PATH_PROG(MV, mv, mv)
147export MV
148AC_PATH_PROG(CP, cp, cp)
149export CP
150AC_PATH_PROG(MKDIR, mkdir, mkdir)
151export MKDIR
152AC_PATH_PROG(PERL, perl, perl)
153export PERL
154AC_PATH_PROG(FIND, find, find)
155export FIND
156AC_PATH_PROG(XARGS, xargs, xargs)
157export XARGS
158AC_PATH_PROG(LDCONFIG, ldconfig, ldconfig, $PATH:/sbin:/usr/local/sbin)
159export LDCONFIG
160
161dnl# Checks for optional programs
162AC_PROG_LEX
163export LEX
164export LEXLIB
165AC_PROG_YACC
166export YACC
167
168dnl# check for wait is particularly nasty :
169AC_FUNC_WAIT3
170if test "x$ac_cv_func_wait3_rusage" = "xyes"; then
171	DO_HAVE_WAIT3=yes
172	export DO_HAVE_WAIT3
173fi
174
175dnl# Check for X :
176AC_PATH_XTRA
177x_libs="$LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS"
178AC_CHECK_LIB(X11, XOpenDisplay, [x_libs="-lX11 $x_libs"],,$x_libs)
179
180PATH_XTRA_CHECKED=yes
181export PATH_XTRA_CHECKED
182export x_includes
183export X_CFLAGS
184export X_LIBS
185export X_EXTRA_LIBS
186export X_PRE_LIBS
187export CPP
188export have_x
189
190dnl# DONE WITH COMMON STUFF
191dnl# #############################################################
192dnl# first configuringlibraries :
193
194FROM_AFTERSTEP_CONFIGURE=yes
195export FROM_AFTERSTEP_CONFIGURE
196
197if test -d libAfterBase; then
198  AC_CHECKING(libAfterBase)
199  cd libAfterBase ; \
200  ./configure --with-x-includes=$x_includes \
201   --with-x=$with_x \
202   --enable-audit=$enable_audit \
203   --enable-trace=$enable_trace \
204   --enable-staticlibs=$enable_staticlibs \
205   --enable-sharedlibs=$enable_sharedlibs \
206   --enable-trace-x=$enable_trace_x ; \
207  cd ../ ;
208  afterbase_includes=".. -I../.." ;
209  afterbase_lib=
210fi
211
212if test -d libAfterBase; then
213  AC_CHECKING(libAfterImage)
214  cd libAfterImage ; \
215  ./configure --with-x-includes=$x_includes \
216   --with-x=$with_x \
217   --with-xpm=$with_xpm   --with-builtin-xpm=$with_builtin_xpm  --with-xpm-includes=$xpm_includes \
218   --with-jpeg=$with_jpeg --with-jpeg-includes=$jpeg_includes \
219   --with-png=$with_png   --with-png-includes=$png_includes \
220   --with-gif-includes=$gif_includes \
221   --with-tiff=$with_tiff --with-tiff-includes=$tiff_includes \
222   --with-ttf=$with_ttf   --with-ttf-includes=$ttf_includes \
223   --enable-audit=$enable_audit \
224   --enable-trace=$enable_trace \
225   --enable-staticlibs=$enable_staticlibs \
226   --enable-sharedlibs=$enable_sharedlibs \
227   --enable-mmx-optimization=$enable_mmx_optimization \
228   --with-ungif=$with_ungif --with-gif=$with_gif; \
229   cd ../
230  afterimage_includes=".. -I../.."
231  afterimage_lib=
232fi
233
234MAKEFILEDEFINES=./autoconf/Makefile.defines
235
236AC_SUBST_FILE(MAKEFILEDEFINES)
237
238AC_OUTPUT(\
239autoconf/Makefile.defines \
240Makefile.libs \
241)
242
243$MV Makefile.libs Makefile
244
245echo "
246
247
248AfterStep LIbraries are now hopefully configured:
249Just run : make ; make install
250"
251