1dnl
2dnl Configuration script for LessTif
3dnl $Id: configure.in,v 1.425 2009/05/27 13:45:21 paulgevers Exp $
4dnl
5dnl Copyright (C) 1995 Free Software Foundation, Inc.
6dnl Copyright � 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 LessTif Development Team
7dnl
8
9dnl
10dnl EDIT THESE FOR A NEW RELEASE (automated by a script).
11dnl
12define([LESSTIF_MAJOR_VERSION], [0])
13define([LESSTIF_MINOR_VERSION], [95])
14define([LESSTIF_PICO_VERSION], [2])
15define([LESSTIF_LAST_MAJOR_VERSION], [0])
16define([LESSTIF_LAST_MINOR_VERSION], [95])
17define([LESSTIF_LAST_PICO_VERSION], [0])
18
19dnl
20dnl First some auto*-related stuff
21dnl The AC_INIT line is just here so we can detect whether a sensible source
22dnl distribution is present.
23dnl
24dnl Yuck, the auto* people have changed their mind *again*.
25dnl
26
27AC_INIT(lesstif, LESSTIF_MAJOR_VERSION.LESSTIF_MINOR_VERSION.LESSTIF_PICO_VERSION)
28AC_CONFIG_SRCDIR([lib/Xm-2.1/Vendor.c])
29AC_CONFIG_AUX_DIR(.)
30AC_PREREQ(2.59)
31AM_INIT_AUTOMAKE
32LIBTOOL_VERSION=0:LESSTIF_MINOR_VERSION:0
33
34dnl
35dnl This is here to pass the variables on.
36dnl
37AH_TEMPLATE([MAJOR_VERSION], [The major version number of this release])
38AH_TEMPLATE([MINOR_VERSION], [The minor version number of this release])
39AH_TEMPLATE([PICO_VERSION], [The pico version number of this release])
40AC_DEFINE([MAJOR_VERSION], LESSTIF_MAJOR_VERSION, [The major version number of this release])
41AC_DEFINE([MINOR_VERSION], LESSTIF_MINOR_VERSION, [The minor version number of this release])
42AC_DEFINE([PICO_VERSION], LESSTIF_PICO_VERSION, [The pico version number of this release])
43AH_TEMPLATE([LAST_MAJOR_VERSION], [The major version number of the previous release])
44AH_TEMPLATE([LAST_MINOR_VERSION], [The minor version number of the previous release])
45AH_TEMPLATE([LAST_PICO_VERSION], [The pico version number of the previous release])
46AC_DEFINE([LAST_MAJOR_VERSION], LESSTIF_LAST_MAJOR_VERSION, [The major version number of the previous release])
47AC_DEFINE([LAST_MINOR_VERSION], LESSTIF_LAST_MINOR_VERSION, [The minor version number of the previous release])
48AC_DEFINE([LAST_PICO_VERSION], LESSTIF_LAST_PICO_VERSION, [The pico version number of the previous release])
49
50dnl For cross-compiling?!
51dnl This macro also hides all kinds of stuff we'd otherwise have to add in the
52dnl right order (whichever that may be) ourselves.
53dnl
54AC_CANONICAL_HOST
55
56dnl
57dnl Make some maintainer-specific stuff optional
58dnl
59AM_MAINTAINER_MODE
60
61dnl
62dnl Override a default in libtool. We do NOT want to build static libs. They're BAD.
63dnl
64AC_DISABLE_STATIC
65
66AM_CONFIG_HEADER(include/LTconfig.h)
67
68dnl
69dnl This used to be in acconfig.h
70dnl
71AH_TEMPLATE([LESSTIF_VERBOSE], [Whether to ask LessTif to be verbose])
72AH_TEMPLATE([NONSTANDARD_CONVERTERS], [Whether to include nonstandard converters])
73AH_TEMPLATE([LESSTIF_PRODUCTION], [Build a production version of the library])
74AH_TEMPLATE([SCROLLBAR_VERBOSE], [Configure LessTif ScrollBar to be verbose])
75AH_TEMPLATE([LESSTIF_EDITRES], [Enable support for EditRes])
76AH_TEMPLATE([USE_XDND], [Define if you want XDND (the Drag and Drop compatible with GTK, GNOME, ...)])
77AH_TEMPLATE([XTHREADS], [Define if libXt was compiled with -DXTHREADS])
78AH_TEMPLATE([HAVE_LIB_XP], [Define if libXp is available])
79AH_TEMPLATE([HAVE_GETHOSTNAME], [Define if gethostname() is available (may be in non-standard libs])
80
81AC_MSG_CHECKING(where to store autoconf macro files)
82ACLOCALDIR=`aclocal --print-ac-dir`
83AM_CONDITIONAL(Aclocal, test x$ACLOCALDIR != x )
84AC_MSG_RESULT($ACLOCALDIR)
85
86AC_CONFIG_SUBDIRS(test)
87
88dnl
89dnl	Building a version is triggered by use of the --enable-build flags.
90dnl	Check below for the current default values.
91dnl
92AC_MSG_RESULT([Building a Motif 2.1-compatible version])
93Build12="no"
94Build20="no"
95Build21="yes"
96
97dnl
98dnl Figure out what to compile/link against
99dnl	2.1 is deliberately first.
100dnl
101version_suffix="-2.1"
102lib_version_suffix="-2.1"
103xmVERSION="2"
104xmREVISION="1"
105xmVer="2.1"
106AM_CONDITIONAL(Version_1_2, false)
107AM_CONDITIONAL(Version_2_0, false)
108AM_CONDITIONAL(Version_2_1, true)
109
110dnl
111dnl Conditionally compile editres support
112dnl	The default is yes.
113dnl
114AC_MSG_CHECKING(whether to support EditRes)
115AC_ARG_WITH(editres, [  --with-editres          enable support for EditRes])
116if test -z "$with_editres"; then
117  use_editres=yes
118else
119  use_editres=$with_editres
120fi
121AC_MSG_RESULT($use_editres)
122
123if test x$use_editres = xyes
124then
125	AC_DEFINE(LESSTIF_EDITRES)
126elif test x$use_editres = xset
127then
128	AC_DEFINE(LESSTIF_EDITRES)
129fi
130
131dnl
132dnl Do you want XDND (the Drag and Drop compatible with GTK, GNOME, ...) ?
133dnl
134dnl Since it's in development, not enabled by default (yet).
135dnl
136AC_ARG_WITH(xdnd, [  --with-xdnd             enable support for XDND (GNOME compatible)])
137if test -z "$with_xdnd"; then
138  use_xdnd=no
139else
140  use_xdnd=$with_xdnd
141fi
142
143if test x$use_xdnd = xyes
144then
145	AC_DEFINE(USE_XDND)
146elif test x$use_xdnd = xset
147then
148	AC_DEFINE(USE_XDND)
149fi
150AM_CONDITIONAL(UseXDND, test x$use_xdnd = xyes)
151
152dnl
153dnl Whether to include nonstandard converters
154dnl
155AC_ARG_ENABLE(nonstandard-conversions,
156[  --enable-nonstandard-conversions
157                          include nonstandard conversions])
158
159if test "x$enable_nonstandard_conversions" != "xno" ; then
160	AC_DEFINE(NONSTANDARD_CONVERTERS)
161fi
162
163dnl
164dnl Build a production version of the library
165dnl This will compile out XdbDebug statements
166dnl (the libraries itself remain binary compatible, you can
167dnl  link against a debug version, run with a production version
168dnl  and vice versa!)
169dnl
170AC_ARG_ENABLE(production,
171[  --enable-production     build a production version])
172
173if test "x$enable_production" = "xyes" ; then
174	AC_DEFINE(LESSTIF_PRODUCTION)
175fi
176
177dnl
178dnl Whether to ask LessTif to be verbose
179dnl Verbose means more messages may come out of LessTif than out of Motif.
180dnl
181dnl DON'T DO THIS IN PRODUCTION.
182dnl
183AC_ARG_ENABLE(verbose,
184[  --enable-verbose        configure LessTif to be verbose (default)])
185
186if test "x$enable_verbose" != "xno" ; then
187	if test "x$enable_production" != "xyes" ; then
188		AC_DEFINE(LESSTIF_VERBOSE)
189	fi
190fi
191
192AC_ARG_ENABLE(scrollbar-verbose,
193[  --enable-scrollbar-verbose
194                          configure LessTif ScrollBar to be verbose (default is no)])
195
196if test "x$enable_scrollbar_verbose" = "xyes" ; then
197	if test "x$enable_production" != "xyes" ; then
198		AC_DEFINE(SCROLLBAR_VERBOSE)
199	fi
200fi
201
202dnl
203dnl Some generic stuff about the compiler and system library
204dnl
205lt_cs_test_CFLAGS=${CFLAGS+set}
206AC_PROG_CC
207
208dnl
209dnl Whether to compile with -g for debugging
210dnl
211AC_MSG_CHECKING(compiler flags)
212AC_ARG_ENABLE(debug,
213[  --enable-debug          build LessTif with debugging options (-g)(default)])
214dnl Don't touch compiler flags, if debugging was not explicitly specified.
215dnl Use environment variables, compiler defaults, etc.
216if test "x$enable_debug" = "xyes" ; then
217	if test "x$CC" = "xgcc" ; then
218		if test "$lt_cs_test_CFLAGS" = "set" ; then
219			if [ echo "$CFLAGS" | grep -v -e "\-g" > /dev/null ] ; then
220				if test $ac_cv_prog_cc_g = yes ; then
221					CFLAGS="$CFLAGS -g"
222				fi
223			fi
224		else
225			warn_flags=-Wall
226			if echo $CFLAGS | grep -e "\-g" > /dev/null ; then
227				CFLAGS=-g
228			else
229				CFLAGS=
230			fi
231		fi
232	else
233		if test "$lt_cs_test_CFLAGS" = "set" ; then
234			if [ echo "$CFLAGS" | grep -v -e "\-g" > /dev/null ] ; then
235	 			if test $ac_cv_prog_cc_g = yes ; then
236					CFLAGS="$CFLAGS -g"
237				fi
238			fi
239		else
240			warn_flags=
241			if test $ac_cv_prog_cc_g = yes ; then
242				CFLAGS=-g
243			else
244				CFLAGS=
245			fi
246		fi
247	fi
248fi
249AC_MSG_RESULT("$CFLAGS $warn_flags")
250
251AC_AIX
252AM_PROG_CC_STDC
253AC_EXEEXT
254AC_OBJEXT
255AM_PROG_LIBTOOL
256
257dnl Use an external malloc debugging library
258LT_WITH_DMALLOC
259LT_WITH_DBMALLOC
260
261dnl
262dnl Some checks for required tools
263dnl
264
265dnl Required for internal static libraries we build
266AC_CHECK_PROG(AR, ar, ar, ar)
267
268dnl 'cp' should always be available!?
269AC_CHECK_PROG(cp, cp, cp, cp)
270
271dnl 'rm' should always be available!?
272AC_CHECK_PROG(RM, rm, rm, rm)
273
274
275AC_PROG_MAKE_SET
276AC_PROG_INSTALL
277AC_PROG_LN_S
278
279dnl Some tools we use for code-generation
280AC_PROG_YACC
281AM_PROG_LEX
282
283dnl Check for exuberant ctags
284AC_HAVE_EXCTAGS
285
286dnl auto* checks for ANSI C89 stuff
287AC_HEADER_STDC
288AC_C_CONST
289
290dnl auto* checks for C99 stuff
291AC_C_INLINE
292
293dnl Ok, now let's assume the system is ANSI C89 conforming and
294dnl do not check for those standard funcs/headers again!
295
296AC_CHECK_HEADERS(fcntl.h         libgen.h       pwd.h)
297AC_CHECK_HEADERS(sys/select.h    sys/stat.h     sys/systeminfo.h)
298AC_CHECK_HEADERS(sys/time.h      sys/types.h    sys/wait.h)
299AC_CHECK_HEADERS(unistd.h)
300AC_CHECK_HEADERS(wchar.h         wctype.h)
301AC_CHECK_HEADERS(limits.h stdint.h)
302AC_HEADER_STAT
303
304dnl These checks in fact look for several headers (see autoconf docs)
305AC_HEADER_DIRENT
306AC_HEADER_TIME
307
308dnl Various other stuff. Most should be available on a 'typical' un*x system.
309dnl Most/all should be specified in SUS V2, some are in
310dnl Posix.1 (IEEE Std 1003.1: 1990)
311AC_CHECK_FUNCS(access  basename  close  dirname  _exit  execl  execvp  fork)
312AC_CHECK_FUNCS(getcwd  getdtablesize  getitimer  getopt)
313AC_CHECK_FUNCS(getpid  getpwnam  getpwuid  getrlimit  getuid)
314AC_CHECK_FUNCS(open  pipe  putenv)
315AC_CHECK_FUNCS(setenv  setitimer  sigaction  signal  sleep  snprintf)
316AC_CHECK_FUNCS(stat  strcasecmp  strdup  strncasecmp  sysconf)
317AC_CHECK_FUNCS(uname  usleep  vfprintf  vsnprintf  wait3  waitpid  write)
318AC_CHECK_FUNCS(strlcat)
319
320dnl select() is used in libXm and mwm
321AC_CHECK_FUNCS(select)
322AC_FUNC_SELECT_ARGTYPES
323
324dnl
325dnl This one is only needed for one obscure debugging function.
326dnl
327AC_CHECK_FUNCS(backtrace)
328
329dnl
330dnl Check integer sizes
331dnl
332dnl The constants are only used when cross compiling; if I understand the
333dnl documentation well enough, those get substituted for the target.  The
334dnl values given are the most common values, but may need customization if
335dnl someone is desparate enough to _want_ to cross compile to a 64 bit
336dnl machine from a 32 bit machine, for example.
337AC_CHECK_SIZEOF(short, 2)
338AC_CHECK_SIZEOF(int, 4)
339AC_CHECK_SIZEOF(long, 4)
340AC_CHECK_SIZEOF(long long, 8)
341
342dnl X11 path stuff
343AC_PATH_X
344AC_PATH_XTRA
345
346dnl Not only do we have to figure out whether we have a gethostname(),
347dnl some systems hide it in -lnsl so we have to figure out to link
348dnl it in when appropriate.
349LT_HAVE_GETHOSTNAME
350
351dnl
352dnl Set the CFLAGS variable to the location of the found X-header files
353dnl This is necessary for the tests below to work.
354dnl Don't lose original contents of CFLAGS though.
355dnl
356lt_cs_save_CFLAGS="$CFLAGS"
357if test "x$x_includes" != "x" ; then
358  CFLAGS="$CFLAGS -I$x_includes"
359fi
360
361XTversion=""
362AC_XT_VERSION6
363
364if test "x$XTversion" = "x" ; then
365  AC_XT_VERSION5
366  if test "x$XTversion" = "x"; then
367    AC_MSG_ERROR([The development package of the X Window System is required to compile LessTif,
368		  must be at least X11r5])
369  else
370    AC_MSG_RESULT(revision 5)
371    Editres=V5
372  fi
373else
374  AC_MSG_RESULT(revision 6)
375  Editres=V6
376fi
377
378dnl Pick up the result of previous check for other purposes
379AM_CONDITIONAL(XIsR6, test x$Editres = xV6 )
380
381dnl Check for libXp (X11 Printing extensions)
382LT_HAVE_LIBXP
383
384dnl
385dnl Whether to link -lXp
386dnl
387AC_MSG_CHECKING(whether to link -lXp)
388if test $lt_cv_libxp = yes;
389then
390  XPLIB="-lXp -lXext"
391  AC_MSG_RESULT(yes)
392else
393  XPLIB=""
394  AC_MSG_RESULT(no)
395fi
396AC_SUBST(XPLIB)
397
398dnl
399dnl Build libDtPrint (in lib/Dt) only if we have libXp and we're building a 2.1 version.
400dnl
401AM_CONDITIONAL(BuildLibDtPrint, test "$LT_HAVELIBXP" = "1" -a "$Build21" = "yes")
402
403AC_PATH_MOTIF
404if test -n "$motif_includes"; then
405  if test "x$motif_includes" != "xNONE"; then
406    MOTIF_CFLAGS="-I$motif_includes"
407  fi
408fi
409AC_SUBST(MOTIF_CFLAGS)
410if test -n "$motif_libraries"; then
411  if test "x$motif_libraries" != "xNONE"; then
412    MOTIF_LIBS="-L$motif_libraries"
413  fi
414fi
415AC_SUBST(MOTIF_LIBS)
416
417dnl Our own check for XTHREADS
418LT_LIB_XTHREADS
419
420dnl Adjust some standard variables
421
422if test "x$warn_flags" = x; then
423	CFLAGS="$lt_cs_save_CFLAGS"
424else
425	CFLAGS="$lt_cs_save_CFLAGS $warn_flags"
426fi
427GPROF_FLAGS="-pg"
428GPROF_CFLAGS=""
429EXTRACFLAGS=""
430extralibs=""
431run_libraries=""
432
433case ${with_static} in
434  yes) static_prefix=;;
435  no)  static_prefix="#";;
436esac
437
438dnl
439dnl Look for a tool to convert HTML into ASCII
440dnl
441LT_HTML2TXT
442
443dnl
444dnl check for man2html
445dnl
446dnl Hmm, a standard man2html may not be the right tool ...
447LT_HAVE_MAN2HTML
448
449AC_MSG_CHECKING(whether to build the tests)
450BuildTest=""
451BuildTestDir=""
452
453AC_ARG_ENABLE(build-tests,
454[  --enable-build-tests    build test tree],
455test "$enable_build_tests" = "yes" && BuildTests="yes" && BuildTestDir="test"
456test "$enable_build_tests" = "no" && BuildTests="no" && BuildTestsDir="")
457
458if test -z "$BuildTests" ; then
459AC_CACHE_VAL(lt_cv_buildtests, [ lt_cv_buildtests="no" ])	dnl Here's the default
460BuildTests=$lt_cv_buildtests
461else
462lt_cv_buildTests=$BuildTests
463fi
464test "$BuildTests" = "yes" && BuildTestDir="test"
465
466AC_MSG_RESULT($BuildTests)
467
468dnl
469dnl Experimental ! Keith Packard's Xft
470dnl
471AC_FIND_XFT
472
473dnl
474dnl Now ensure that all required variables get substituted!
475dnl
476
477dnl AC_SUBST(libdir)
478AC_SUBST(bindir)
479
480dnl We might have a bit too much redundant data here, but who cares ...
481dnl AC_SUBST(version)
482AC_SUBST(version_suffix)
483AC_SUBST(lib_version_suffix)
484
485AC_SUBST(xmVERSION)
486AC_SUBST(xmREVISION)
487AC_SUBST(xmVer)
488
489AC_SUBST(Build12)
490AC_SUBST(Build20)
491AC_SUBST(Build21)
492
493AC_SUBST(BuildTestDir)
494
495AC_SUBST(CFLAGS)
496AC_SUBST(x_lib_path)
497AC_SUBST(x_libraries)
498AC_SUBST(x_inc_path)
499AC_SUBST(x_includes)
500AC_SUBST(motif_libraries)
501AC_SUBST(motif_includes)
502AC_SUBST(Editres)
503AC_SUBST(extralibs)
504AC_SUBST(subdirs)
505AC_SUBST(LIBTOOL_VERSION)
506AC_SUBST(AS)
507AC_SUBST(DLLTOOL)
508AC_SUBST(OBJDUMP)
509AC_SUBST(MAJOR_VERSION, LESSTIF_MAJOR_VERSION)
510AC_SUBST(MINOR_VERSION, LESSTIF_MINOR_VERSION)
511AC_SUBST(PICO_VERSION, LESSTIF_PICO_VERSION)
512AC_SUBST(LAST_MAJOR_VERSION, LESSTIF_LAST_MAJOR_VERSION)
513AC_SUBST(LAST_MINOR_VERSION, LESSTIF_LAST_MINOR_VERSION)
514AC_SUBST(LAST_PICO_VERSION, LESSTIF_LAST_PICO_VERSION)
515AC_SUBST(ACLOCALDIR)
516
517dnl
518dnl This need 'splain'in Lucy!!!
519dnl The new autoconf will be setting a default cache_file=/dev/null.
520dnl To avoid all of the problems associated with parseing the long list
521dnl of possibilities from the --enable-build-* and --enable-default-*
522dnl args our sub-configures need to know the result of these options.
523dnl We used to rely on the cache_file being shared, now we don't have a
524dnl cache file. So instead, let's explicitly export the vars that we
525dnl need to make an inteligent decision.
526dnl
527
528export lt_cv_default12 lt_cv_default20 lt_cv_default21
529
530dnl
531dnl Which output files do we generate ?
532dnl
533
534AC_CONFIG_FILES([\
535Makefile \
536autopackage/default.apspec \
537autopackage/Makefile \
538scripts/Makefile \
539scripts/autoconf/Makefile \
540scripts/FreeBSD/Makefile \
541scripts/RedHat/Makefile \
542scripts/RedHat/lesstif.spec \
543scripts/Slackware/Makefile \
544scripts/Slackware/disklesstif1 \
545scripts/Slackware/doinst.sh \
546scripts/OS2/Makefile \
547scripts/motif-config \
548include/Makefile \
549include/Motif-2.1/Makefile \
550include/Motif-2.1/Mrm/Makefile \
551include/Motif-2.1/Xm/Makefile \
552include/Motif-2.1/uil/Makefile \
553include/Motif-2.1/XmI/Makefile \
554lib/Makefile \
555lib/config/Makefile \
556lib/config/Imake.tmpl \
557lib/config/LessTif.tmpl \
558lib/config/mxmkmf \
559lib/Xm-2.1/Makefile \
560lib/Mrm-2.1/Makefile \
561lib/Uil-2.1/Makefile \
562lib/Dt/Makefile \
563clients/Makefile \
564clients/Motif-2.1/Makefile \
565clients/Motif-2.1/mwm/Makefile \
566clients/Motif-2.1/uil/Makefile \
567clients/Motif-2.1/xmbind/Makefile \
568doc/Makefile \
569doc/www.lesstif.org/Makefile \
570doc/www.lesstif.org/images/Makefile \
571doc/lessdox/Makefile \
572doc/lessdox/clients/Makefile \
573doc/lessdox/widgets/Makefile \
574doc/lessdox/functions/Makefile])
575AC_OUTPUT
576
577dnl
578dnl The End.
579dnl
580