1
2# Initialize Autoconf
3AC_PREREQ([2.60])
4AC_INIT([libXaw], [1.0.16],
5        [https://gitlab.freedesktop.org/xorg/lib/libxaw/-/issues], [libXaw])
6AC_CONFIG_SRCDIR([Makefile.am])
7AC_CONFIG_HEADERS([config.h])
8AC_CONFIG_MACRO_DIRS([m4])
9
10# Initialize Automake
11AM_INIT_AUTOMAKE([foreign dist-xz])
12
13# Initialize libtool
14LT_INIT
15
16# Require xorg-macros minimum of 1.12 for DocBook external references
17m4_ifndef([XORG_MACROS_VERSION],
18          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
19XORG_MACROS_VERSION(1.12)
20XORG_DEFAULT_OPTIONS
21XORG_ENABLE_SPECS
22XORG_WITH_XMLTO(0.0.22)
23XORG_WITH_FOP
24XORG_WITH_XSLTPROC
25XORG_CHECK_SGML_DOCTOOLS(1.8)
26
27# Some compilers do not support per target -c and -o flags
28AM_PROG_CC_C_O
29
30# Checks for programs.
31AC_PROG_AWK
32
33# Need to call this explicitly since the first call to PKG_CHECK_MODULES
34# is in an if statement, and later calls would break if it's skipped.
35PKG_PROG_PKG_CONFIG
36
37#
38# fix libtool to set SONAME to libXaw.so.$major
39#
40AC_CONFIG_COMMANDS([libtool_hack], [
41	cp -f libtool libtool_
42	test -z "$SED" && SED=sed
43	$SED '1,/^soname_spec/{
44/^soname_spec/i\
45# X.Org hack to match monolithic Xaw SONAME\
46xorglibxawname="libXaw"
47/^soname_spec/s/libname/xorglibxawname/
48}' libtool_ > libtool
49	rm -f libtool_
50])
51
52# OSX/Win32 rules are different.
53platform_win32=no
54platform_darwin=no
55LIBEXT=so
56case $host_os in
57    cygwin*|mingw*)
58	LIBEXT=dll.a
59	platform_win32=yes
60	;;
61    darwin*)
62	LIBEXT=dylib
63	platform_darwin=yes
64	;;
65esac
66AC_SUBST(LIBEXT)
67AM_CONDITIONAL(PLATFORM_WIN32, test "x$platform_win32" = "xyes")
68AM_CONDITIONAL(PLATFORM_DARWIN, test "x$platform_darwin" = "xyes")
69
70# Whether to build Xaw6
71
72AC_ARG_ENABLE(xaw6, AS_HELP_STRING([--disable-xaw6],
73				[Disable building of libXaw.so.6]),
74			[build_v6=$enableval], [build_v6=yes])
75
76if test "x$build_v6" = xyes; then
77   PKG_CHECK_MODULES(XAW6, xproto x11 xext xextproto xt xmu)
78fi
79
80
81# Whether to build Xaw7
82
83AC_ARG_ENABLE(xaw7, AS_HELP_STRING([--disable-xaw7],
84				[Disable building of libXaw.so.7]),
85			[build_v7=$enableval], [build_v7=yes])
86
87if test "x$build_v7" = xyes; then
88   PKG_CHECK_MODULES(XAW7, xproto x11 xext xextproto xt xmu xpm)
89fi
90
91
92AM_CONDITIONAL(BUILD_XAW6, [test x$build_v6 = xyes])
93AM_CONDITIONAL(BUILD_XAW7, [test x$build_v7 = xyes])
94
95# Checks for header files.
96AC_CHECK_HEADERS([wctype.h wchar.h widec.h])
97
98# Checks for functions
99AC_CHECK_FUNCS([iswalnum getpagesize])
100
101# Link with winsock if mingw target
102case $host_os in
103	*mingw*)
104		AC_CHECK_LIB([ws2_32],[main])
105	;;
106	*)
107	;;
108esac
109
110AC_MSG_CHECKING(if C const-support is wanted)
111AC_ARG_ENABLE(const, AS_HELP_STRING([--disable-const], [Disable const-support]),
112	USE_CONST="$enableval", USE_CONST="yes")
113AC_MSG_RESULT($USE_CONST)
114if test "x$USE_CONST" = "xyes" ; then
115	AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.])
116fi
117
118# --enable-unit-tests
119XORG_ENABLE_UNIT_TESTS(no)
120XORG_MEMORY_CHECK_FLAGS
121if test "x$enable_unit_tests" != "xno" ; then
122	AC_CHECK_FUNCS([malloc_usable_size])
123	AC_CHECK_HEADERS([malloc.h])
124fi
125
126AC_CONFIG_FILES([Makefile
127		examples/Makefile
128		include/Makefile
129		man/Makefile
130		specs/Makefile
131		specs/libXaw.ent
132		src/Makefile])
133
134if test "x$build_v6" = xyes; then
135   AC_CONFIG_FILES(xaw6.pc)
136fi
137
138if test "x$build_v7" = xyes; then
139   AC_CONFIG_FILES(xaw7.pc)
140fi
141
142AC_OUTPUT
143