configure.ac revision e1e1713c
1dnl Process this file with autoconf to create configure.
2
3AC_PREREQ([2.57])
4
5AC_INIT([libXaw],
6	1.0.7,
7	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
8	libXaw)
9
10AM_INIT_AUTOMAKE([dist-bzip2])
11
12AM_CONFIG_HEADER(config.h)
13
14# Require xorg-macros: XORG_WITH_LINT, XORG_DEFAULT_OPTIONS
15m4_ifndef([XORG_MACROS_VERSION],
16	  [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
17XORG_MACROS_VERSION(1.3)
18
19# Check for progs
20AC_PROG_CC
21AC_PROG_LIBTOOL
22AC_PROG_AWK
23AC_PROG_SED
24
25AC_PATH_PROGS([GROFF], [groff], [none], [$PATH:/usr/gnu/bin])
26
27AC_MSG_CHECKING([whether to build documentation])
28AC_ARG_ENABLE(docs, AC_HELP_STRING([--enable-docs],
29				   [Enable building of Xaw documentation]),
30	      [build_docs="${enableval}"], [build_docs="auto"])
31
32if test "x${build_docs}" = xauto; then
33    if test "x${GROFF}" = xnone ; then
34	build_docs=no
35    else
36	build_docs=yes
37    fi
38fi
39AC_MSG_RESULT([${build_docs}])
40if test "x${build_docs}" = xyes && test "x${GROFF}" = xnone ; then
41    AC_MSG_ERROR([can't build documentation without groff])
42fi
43
44AM_CONDITIONAL(BUILD_DOCS, [test x$build_docs = xyes])
45
46# Need to call this explicitly since the first call to PKG_CHECK_MODULES
47# is in an if statement, and later calls would break if it's skipped.
48PKG_PROG_PKG_CONFIG
49
50XORG_DEFAULT_OPTIONS
51
52#
53# fix libtool to set SONAME to libXaw.so.$major
54#
55AC_CONFIG_COMMANDS([libtool_hack], [
56	cp -f libtool libtool_
57	test -z "$SED" && SED=sed
58	$SED '1,/^soname_spec/{
59/^soname_spec/i\
60# X.Org hack to match monolithic Xaw SONAME\
61xorglibxawname="libXaw"
62/^soname_spec/s/libname/xorglibxawname/
63}' libtool_ > libtool
64	rm -f libtool_
65])
66
67# OSX/Win32 rules are different.
68platform_win32=no
69platform_darwin=no
70LIBEXT=so
71case $host_os in
72    cygwin*|mingw*)
73	platform_win32=yes
74	;;
75    darwin*)
76	LIBEXT=dylib
77	platform_darwin=yes
78	;;
79esac
80AC_SUBST(LIBEXT)
81AM_CONDITIONAL(PLATFORM_WIN32, test "x$platform_win32" = "xyes")
82AM_CONDITIONAL(PLATFORM_DARWIN, test "x$platform_darwin" = "xyes")
83
84# Whether to build Xaw6
85
86AC_ARG_ENABLE(xaw6, AC_HELP_STRING([--disable-xaw6],
87				[Disable building of libXaw.so.6]),
88			[build_v6=$enableval], [build_v6=yes])
89
90if test "x$build_v6" = xyes; then
91   PKG_CHECK_MODULES(XAW6, xproto x11 xext xextproto xt xmu)
92   AC_SUBST(XAW6_CFLAGS)
93   AC_SUBST(XAW6_LIBS)
94fi
95
96
97# Whether to build Xaw7
98
99AC_ARG_ENABLE(xaw7, AC_HELP_STRING([--disable-xaw7],
100				[Disable building of libXaw.so.7]),
101			[build_v7=$enableval], [build_v7=yes])
102
103if test "x$build_v7" = xyes; then
104   PKG_CHECK_MODULES(XAW7, xproto x11 xext xextproto xt xmu xpm)
105   AC_SUBST(XAW7_CFLAGS)
106   AC_SUBST(XAW7_LIBS)
107fi
108
109
110AM_CONDITIONAL(BUILD_XAW6, [test x$build_v6 = xyes])
111AM_CONDITIONAL(BUILD_XAW7, [test x$build_v7 = xyes])
112
113# Checks for header files.
114AC_HEADER_STDC
115AC_CHECK_HEADER(wctype.h,
116       	AC_DEFINE([HAS_WCTYPE_H],1,
117			[Define to 1 if you have the <wctype.h> header file.]))
118AC_CHECK_HEADER(wchar.h,
119       	AC_DEFINE([HAS_WCHAR_H],1,
120			[Define to 1 if you have the <wchar.h> header file.]))
121AC_CHECK_HEADER(widec.h, [],
122       	AC_DEFINE([NO_WIDEC_H],1,
123			[Define to 1 if you DO NOT have the <widec.h> header file.]))
124
125# Checks for functions
126AC_CHECK_FUNCS([iswalnum])
127
128AC_OUTPUT([Makefile
129	  include/Makefile
130	  man/Makefile
131	  spec/Makefile
132	  src/Makefile])
133
134if test "x$build_v6" = xyes; then
135   AC_OUTPUT(xaw6.pc)
136fi
137
138if test "x$build_v7" = xyes; then
139   AC_OUTPUT(xaw7.pc)
140fi
141