configure.ac revision 5ec34c4c
17a84e134Smrg
2f353fbadSmrg# Initialize Autoconf
3994689c1SmrgAC_PREREQ([2.60])
45ec34c4cSmrgAC_INIT([libXaw], [1.0.14],
55ec34c4cSmrg        [https://gitlab.freedesktop.org/xorg/lib/libXaw/issues], [libXaw])
6f353fbadSmrgAC_CONFIG_SRCDIR([Makefile.am])
7f353fbadSmrgAC_CONFIG_HEADERS([config.h])
87a84e134Smrg
9f353fbadSmrg# Initialize Automake
10994689c1SmrgAM_INIT_AUTOMAKE([foreign dist-bzip2])
117a84e134Smrg
12421c997bSmrg# Initialize libtool
13421c997bSmrgAC_PROG_LIBTOOL
14421c997bSmrg
15421c997bSmrg# Require xorg-macros minimum of 1.12 for DocBook external references
16e1e1713cSmrgm4_ifndef([XORG_MACROS_VERSION],
17421c997bSmrg          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
18421c997bSmrgXORG_MACROS_VERSION(1.12)
19f353fbadSmrgXORG_DEFAULT_OPTIONS
20f353fbadSmrgXORG_ENABLE_SPECS
21421c997bSmrgXORG_WITH_XMLTO(0.0.22)
22f353fbadSmrgXORG_WITH_FOP
23421c997bSmrgXORG_WITH_XSLTPROC
24421c997bSmrgXORG_CHECK_SGML_DOCTOOLS(1.8)
25775e7de9Smrg
26421c997bSmrg# Some compilers do not support per target -c and -o flags
27994689c1SmrgAM_PROG_CC_C_O
287a84e134Smrg
29421c997bSmrg# Checks for programs.
30421c997bSmrgAC_PROG_AWK
31421c997bSmrg
327a84e134Smrg# Need to call this explicitly since the first call to PKG_CHECK_MODULES
337a84e134Smrg# is in an if statement, and later calls would break if it's skipped.
347a84e134SmrgPKG_PROG_PKG_CONFIG
357a84e134Smrg
367a84e134Smrg#
377a84e134Smrg# fix libtool to set SONAME to libXaw.so.$major
387a84e134Smrg#
39ab902922SmrgAC_CONFIG_COMMANDS([libtool_hack], [
40ab902922Smrg	cp -f libtool libtool_
41ab902922Smrg	test -z "$SED" && SED=sed
42ab902922Smrg	$SED '1,/^soname_spec/{
43ab902922Smrg/^soname_spec/i\
44ab902922Smrg# X.Org hack to match monolithic Xaw SONAME\
457a84e134Smrgxorglibxawname="libXaw"
467a84e134Smrg/^soname_spec/s/libname/xorglibxawname/
47ab902922Smrg}' libtool_ > libtool
48ab902922Smrg	rm -f libtool_
49ab902922Smrg])
507a84e134Smrg
51775e7de9Smrg# OSX/Win32 rules are different.
52775e7de9Smrgplatform_win32=no
53775e7de9Smrgplatform_darwin=no
54775e7de9SmrgLIBEXT=so
557a84e134Smrgcase $host_os in
567a84e134Smrg    cygwin*|mingw*)
57994689c1Smrg	LIBEXT=dll.a
587a84e134Smrg	platform_win32=yes
597a84e134Smrg	;;
60775e7de9Smrg    darwin*)
61775e7de9Smrg	LIBEXT=dylib
62775e7de9Smrg	platform_darwin=yes
637a84e134Smrg	;;
647a84e134Smrgesac
65775e7de9SmrgAC_SUBST(LIBEXT)
667a84e134SmrgAM_CONDITIONAL(PLATFORM_WIN32, test "x$platform_win32" = "xyes")
67775e7de9SmrgAM_CONDITIONAL(PLATFORM_DARWIN, test "x$platform_darwin" = "xyes")
687a84e134Smrg
697a84e134Smrg# Whether to build Xaw6
707a84e134Smrg
71421c997bSmrgAC_ARG_ENABLE(xaw6, AS_HELP_STRING([--disable-xaw6],
727a84e134Smrg				[Disable building of libXaw.so.6]),
737a84e134Smrg			[build_v6=$enableval], [build_v6=yes])
747a84e134Smrg
757a84e134Smrgif test "x$build_v6" = xyes; then
767a84e134Smrg   PKG_CHECK_MODULES(XAW6, xproto x11 xext xextproto xt xmu)
777a84e134Smrgfi
787a84e134Smrg
797a84e134Smrg
807a84e134Smrg# Whether to build Xaw7
817a84e134Smrg
82421c997bSmrgAC_ARG_ENABLE(xaw7, AS_HELP_STRING([--disable-xaw7],
837a84e134Smrg				[Disable building of libXaw.so.7]),
847a84e134Smrg			[build_v7=$enableval], [build_v7=yes])
857a84e134Smrg
867a84e134Smrgif test "x$build_v7" = xyes; then
877a84e134Smrg   PKG_CHECK_MODULES(XAW7, xproto x11 xext xextproto xt xmu xpm)
887a84e134Smrgfi
897a84e134Smrg
907a84e134Smrg
917a84e134SmrgAM_CONDITIONAL(BUILD_XAW6, [test x$build_v6 = xyes])
927a84e134SmrgAM_CONDITIONAL(BUILD_XAW7, [test x$build_v7 = xyes])
937a84e134Smrg
947a84e134Smrg# Checks for header files.
95f353fbadSmrgAC_CHECK_HEADERS([wctype.h wchar.h widec.h])
967a84e134Smrg
977a84e134Smrg# Checks for functions
98f353fbadSmrgAC_CHECK_FUNCS([iswalnum getpagesize])
997a84e134Smrg
100c889a3bfSmrg# Link with winsock if mingw target
101c889a3bfSmrgcase $host_os in
102c889a3bfSmrg	*mingw*)
103c889a3bfSmrg		AC_CHECK_LIB([ws2_32],[main])
104c889a3bfSmrg	;;
105c889a3bfSmrg	*)
106c889a3bfSmrg	;;
107c889a3bfSmrgesac
108c889a3bfSmrg
1095ec34c4cSmrgAC_MSG_CHECKING(if C const-support is wanted)
1105ec34c4cSmrgAC_ARG_ENABLE(const, AS_HELP_STRING([--disable-const], [Disable const-support]),
1115ec34c4cSmrg	USE_CONST="$enableval", USE_CONST="yes")
1125ec34c4cSmrgAC_MSG_RESULT($USE_CONST)
1135ec34c4cSmrgif test "x$USE_CONST" = "xyes" ; then
1145ec34c4cSmrg	AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.])
1155ec34c4cSmrgfi
1165ec34c4cSmrg
117f353fbadSmrgAC_CONFIG_FILES([Makefile
118f353fbadSmrg		include/Makefile
119f353fbadSmrg		man/Makefile
120f353fbadSmrg		specs/Makefile
1215ec34c4cSmrg		specs/libXaw.ent
122f353fbadSmrg		src/Makefile])
1237a84e134Smrg
1247a84e134Smrgif test "x$build_v6" = xyes; then
125f353fbadSmrg   AC_CONFIG_FILES(xaw6.pc)
1267a84e134Smrgfi
1277a84e134Smrg
1287a84e134Smrgif test "x$build_v7" = xyes; then
129f353fbadSmrg   AC_CONFIG_FILES(xaw7.pc)
1307a84e134Smrgfi
131f353fbadSmrg
132f353fbadSmrgAC_OUTPUT
133