17a84e134Smrg 2f353fbadSmrg# Initialize Autoconf 3994689c1SmrgAC_PREREQ([2.60]) 4efbcb2bfSmrgAC_INIT([libXaw], [1.0.16], 55b16253fSmrg [https://gitlab.freedesktop.org/xorg/lib/libxaw/-/issues], [libXaw]) 6f353fbadSmrgAC_CONFIG_SRCDIR([Makefile.am]) 7f353fbadSmrgAC_CONFIG_HEADERS([config.h]) 85b16253fSmrgAC_CONFIG_MACRO_DIRS([m4]) 97a84e134Smrg 10f353fbadSmrg# Initialize Automake 115b16253fSmrgAM_INIT_AUTOMAKE([foreign dist-xz]) 127a84e134Smrg 13421c997bSmrg# Initialize libtool 145b16253fSmrgLT_INIT 15421c997bSmrg 16421c997bSmrg# Require xorg-macros minimum of 1.12 for DocBook external references 17e1e1713cSmrgm4_ifndef([XORG_MACROS_VERSION], 18421c997bSmrg [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])]) 19421c997bSmrgXORG_MACROS_VERSION(1.12) 20f353fbadSmrgXORG_DEFAULT_OPTIONS 21f353fbadSmrgXORG_ENABLE_SPECS 22421c997bSmrgXORG_WITH_XMLTO(0.0.22) 23f353fbadSmrgXORG_WITH_FOP 24421c997bSmrgXORG_WITH_XSLTPROC 25421c997bSmrgXORG_CHECK_SGML_DOCTOOLS(1.8) 26775e7de9Smrg 27421c997bSmrg# Some compilers do not support per target -c and -o flags 28994689c1SmrgAM_PROG_CC_C_O 297a84e134Smrg 30421c997bSmrg# Checks for programs. 31421c997bSmrgAC_PROG_AWK 32421c997bSmrg 337a84e134Smrg# Need to call this explicitly since the first call to PKG_CHECK_MODULES 347a84e134Smrg# is in an if statement, and later calls would break if it's skipped. 357a84e134SmrgPKG_PROG_PKG_CONFIG 367a84e134Smrg 377a84e134Smrg# 387a84e134Smrg# fix libtool to set SONAME to libXaw.so.$major 397a84e134Smrg# 40ab902922SmrgAC_CONFIG_COMMANDS([libtool_hack], [ 41ab902922Smrg cp -f libtool libtool_ 42ab902922Smrg test -z "$SED" && SED=sed 43ab902922Smrg $SED '1,/^soname_spec/{ 44ab902922Smrg/^soname_spec/i\ 45ab902922Smrg# X.Org hack to match monolithic Xaw SONAME\ 467a84e134Smrgxorglibxawname="libXaw" 477a84e134Smrg/^soname_spec/s/libname/xorglibxawname/ 48ab902922Smrg}' libtool_ > libtool 49ab902922Smrg rm -f libtool_ 50ab902922Smrg]) 517a84e134Smrg 52775e7de9Smrg# OSX/Win32 rules are different. 53775e7de9Smrgplatform_win32=no 54775e7de9Smrgplatform_darwin=no 55775e7de9SmrgLIBEXT=so 567a84e134Smrgcase $host_os in 577a84e134Smrg cygwin*|mingw*) 58994689c1Smrg LIBEXT=dll.a 597a84e134Smrg platform_win32=yes 607a84e134Smrg ;; 61775e7de9Smrg darwin*) 62775e7de9Smrg LIBEXT=dylib 63775e7de9Smrg platform_darwin=yes 647a84e134Smrg ;; 657a84e134Smrgesac 66775e7de9SmrgAC_SUBST(LIBEXT) 677a84e134SmrgAM_CONDITIONAL(PLATFORM_WIN32, test "x$platform_win32" = "xyes") 68775e7de9SmrgAM_CONDITIONAL(PLATFORM_DARWIN, test "x$platform_darwin" = "xyes") 697a84e134Smrg 707a84e134Smrg# Whether to build Xaw6 717a84e134Smrg 72421c997bSmrgAC_ARG_ENABLE(xaw6, AS_HELP_STRING([--disable-xaw6], 737a84e134Smrg [Disable building of libXaw.so.6]), 747a84e134Smrg [build_v6=$enableval], [build_v6=yes]) 757a84e134Smrg 767a84e134Smrgif test "x$build_v6" = xyes; then 777a84e134Smrg PKG_CHECK_MODULES(XAW6, xproto x11 xext xextproto xt xmu) 787a84e134Smrgfi 797a84e134Smrg 807a84e134Smrg 817a84e134Smrg# Whether to build Xaw7 827a84e134Smrg 83421c997bSmrgAC_ARG_ENABLE(xaw7, AS_HELP_STRING([--disable-xaw7], 847a84e134Smrg [Disable building of libXaw.so.7]), 857a84e134Smrg [build_v7=$enableval], [build_v7=yes]) 867a84e134Smrg 877a84e134Smrgif test "x$build_v7" = xyes; then 887a84e134Smrg PKG_CHECK_MODULES(XAW7, xproto x11 xext xextproto xt xmu xpm) 897a84e134Smrgfi 907a84e134Smrg 917a84e134Smrg 927a84e134SmrgAM_CONDITIONAL(BUILD_XAW6, [test x$build_v6 = xyes]) 937a84e134SmrgAM_CONDITIONAL(BUILD_XAW7, [test x$build_v7 = xyes]) 947a84e134Smrg 957a84e134Smrg# Checks for header files. 96f353fbadSmrgAC_CHECK_HEADERS([wctype.h wchar.h widec.h]) 977a84e134Smrg 987a84e134Smrg# Checks for functions 99f353fbadSmrgAC_CHECK_FUNCS([iswalnum getpagesize]) 1007a84e134Smrg 101c889a3bfSmrg# Link with winsock if mingw target 102c889a3bfSmrgcase $host_os in 103c889a3bfSmrg *mingw*) 104c889a3bfSmrg AC_CHECK_LIB([ws2_32],[main]) 105c889a3bfSmrg ;; 106c889a3bfSmrg *) 107c889a3bfSmrg ;; 108c889a3bfSmrgesac 109c889a3bfSmrg 1105ec34c4cSmrgAC_MSG_CHECKING(if C const-support is wanted) 1115ec34c4cSmrgAC_ARG_ENABLE(const, AS_HELP_STRING([--disable-const], [Disable const-support]), 1125ec34c4cSmrg USE_CONST="$enableval", USE_CONST="yes") 1135ec34c4cSmrgAC_MSG_RESULT($USE_CONST) 1145ec34c4cSmrgif test "x$USE_CONST" = "xyes" ; then 1155ec34c4cSmrg AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.]) 1165ec34c4cSmrgfi 1175ec34c4cSmrg 118efbcb2bfSmrg# --enable-unit-tests 119efbcb2bfSmrgXORG_ENABLE_UNIT_TESTS(no) 120efbcb2bfSmrgXORG_MEMORY_CHECK_FLAGS 121efbcb2bfSmrgif test "x$enable_unit_tests" != "xno" ; then 122efbcb2bfSmrg AC_CHECK_FUNCS([malloc_usable_size]) 123efbcb2bfSmrg AC_CHECK_HEADERS([malloc.h]) 124efbcb2bfSmrgfi 125efbcb2bfSmrg 126f353fbadSmrgAC_CONFIG_FILES([Makefile 127efbcb2bfSmrg examples/Makefile 128f353fbadSmrg include/Makefile 129f353fbadSmrg man/Makefile 130f353fbadSmrg specs/Makefile 1315ec34c4cSmrg specs/libXaw.ent 132f353fbadSmrg src/Makefile]) 1337a84e134Smrg 1347a84e134Smrgif test "x$build_v6" = xyes; then 135f353fbadSmrg AC_CONFIG_FILES(xaw6.pc) 1367a84e134Smrgfi 1377a84e134Smrg 1387a84e134Smrgif test "x$build_v7" = xyes; then 139f353fbadSmrg AC_CONFIG_FILES(xaw7.pc) 1407a84e134Smrgfi 141f353fbadSmrg 142f353fbadSmrgAC_OUTPUT 143