197cf2ee2Smrg 26e7d3316Smrg# Initialize Autoconf 36e7d3316SmrgAC_PREREQ([2.60]) 452dc082bSmrgAC_INIT([libXpm], [3.5.17], 574835918Smrg [https://gitlab.freedesktop.org/xorg/lib/libxpm/-/issues/], [libXpm]) 6a966c04fSmrgAC_CONFIG_SRCDIR([Makefile.am]) 76e7d3316SmrgAC_CONFIG_HEADERS([config.h]) 897cf2ee2SmrgAC_CONFIG_MACRO_DIR([m4]) 9a966c04fSmrg 106e7d3316Smrg# Initialize Automake 1119569120SmrgAM_INIT_AUTOMAKE([foreign dist-xz]) 12a966c04fSmrg 136e7d3316Smrg# Initialize libtool 1474835918SmrgLT_INIT 152e2dd055Smrg 161c235774Smrg# Require X.Org macros 1.16 or later for XORG_MEMORY_CHECK_FLAGS 176e7d3316Smrgm4_ifndef([XORG_MACROS_VERSION], 181c235774Smrg [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])]) 191c235774SmrgXORG_MACROS_VERSION(1.16) 202e2dd055SmrgXORG_DEFAULT_OPTIONS 21a966c04fSmrg 226e7d3316Smrg# Checks for library functions 23a966c04fSmrgAC_CHECK_FUNCS([strlcat]) 24edce3322SmrgAC_CHECK_FUNC([fork],[], AC_DEFINE(NO_ZPIPE)) 25a966c04fSmrg 266e7d3316Smrg# Obtain compiler/linker options for dependencies 276e7d3316SmrgPKG_CHECK_MODULES(XPM, xproto x11) 28ac92798bSmrgPKG_CHECK_MODULES(SXPM, [x11 xt xext xextproto xproto >= 7.0.17], 29ac92798bSmrg [build_sxpm=true], [build_sxpm=false]) 306e7d3316SmrgAM_CONDITIONAL(BUILD_SXPM, test x$build_sxpm = xtrue) 316e7d3316Smrg 32a966c04fSmrg# Internationalization & localization support 33a966c04fSmrgAC_SEARCH_LIBS([gettext], [intl], [USE_GETTEXT="yes"], [USE_GETTEXT="no"]) 34a966c04fSmrgAC_MSG_CHECKING([where to install localized messages]) 356e7d3316SmrgAC_ARG_WITH([localedir], AS_HELP_STRING([--with-localedir=<path>], 36a966c04fSmrg [Path to install message files in (default: datadir/locale)]), 37a966c04fSmrg [LOCALEDIR=${withval}], [LOCALEDIR=${datadir}/locale]) 382e2dd055SmrgAX_DEFINE_DIR([LOCALEDIR], [LOCALEDIR], [Location of translated messages]) 39a966c04fSmrgif test "x$LOCALEDIR" = "xno" -o "x$USE_GETTEXT" = "xno" ; then 40a966c04fSmrg AC_MSG_RESULT([nowhere]) 41a966c04fSmrg USE_GETTEXT="no" 42a966c04fSmrgelse 43a966c04fSmrg AC_MSG_RESULT([$LOCALEDIR]) 44a966c04fSmrgfi 45a966c04fSmrg 46a966c04fSmrgif test "x$USE_GETTEXT" = "xyes" ; then 4797cf2ee2Smrg AC_DEFINE([USE_GETTEXT], 1, 48a966c04fSmrg [Define to 1 if you want to use the gettext() function.]) 49a966c04fSmrgfi 50a966c04fSmrgAM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes") 51a966c04fSmrg 521c235774Smrgdnl Helper macro to find absolute path to program and add a #define for it 531c235774SmrgAC_DEFUN([XPM_PATH_PROG],[ 541c235774SmrgAC_PATH_PROG([$1], [$2], []) 5574835918SmrgAS_IF([test "x$$1" = "x"], [$3], 5674835918Smrg [AC_DEFINE_UNQUOTED([$1], ["$$1"], [Path to $2])]) 571c235774Smrg]) dnl End of AC_DEFUN([XPM_PATH_PROG]... 581c235774Smrg 591c235774Smrg# Optional feature: When a filename ending in .Z or .gz is requested, 601c235774Smrg# open a pipe to a newly forked compress/uncompress/gzip command to 611c235774Smrg# handle it. 621c235774SmrgAC_MSG_CHECKING([whether to handle compressed pixmaps]) 631c235774Smrgcase $host_os in 641c235774Smrg *mingw*) zpipe_default="no" ;; 651c235774Smrg *) zpipe_default="yes" ;; 661c235774Smrgesac 671c235774SmrgAC_ARG_ENABLE(open-zfile, 681c235774Smrg AS_HELP_STRING([--enable-open-zfile], 691c235774Smrg [Search for files with .Z & .gz extensions automatically @<:@default=auto@:>@]), 701c235774Smrg [OPEN_ZFILE=$enableval], [OPEN_ZFILE=yes]) 711c235774SmrgAC_MSG_RESULT([$OPEN_ZFILE]) 721c235774SmrgAM_CONDITIONAL(COMPRESSED_PIXMAPS, test "x$OPEN_ZFILE" = "xyes") 731c235774Smrgif test x$OPEN_ZFILE = xno ; then 741c235774Smrg AC_DEFINE(NO_ZPIPE, 1, [Define to 1 to disable decompression via pipes]) 751c235774Smrgelse 7674835918Smrg # gzip is absolutely required for the compressed file handling code 7774835918Smrg XPM_PATH_PROG([XPM_PATH_GZIP], [gzip], 7874835918Smrg [AC_MSG_ERROR([gzip not found, set XPM_PATH_GZIP or use --disable-open-zfile])]) 7974835918Smrg 8074835918Smrg # if compress is not found, we disable writing to .Z files, 8174835918Smrg # but leave the rest of the compression code active 8274835918Smrg XPM_PATH_PROG([XPM_PATH_COMPRESS], [compress], 8374835918Smrg [AC_MSG_WARN([compress not found, disabling writing of .Z files])]) 8474835918Smrg # if uncompress is not found, we use gzip to read .Z files 851c235774Smrg XPM_PATH_PROG([XPM_PATH_UNCOMPRESS], [uncompress]) 8674835918Smrg 871c235774Smrg AC_CHECK_FUNCS([closefrom close_range], [break]) 881c235774Smrgfi 891c235774Smrg 90a966c04fSmrg# Optional feature: When ___.xpm is requested, also look for ___.xpm.Z & .gz 91a966c04fSmrg# Replaces ZFILEDEF = -DSTAT_ZFILE in old Imakefile 921c235774SmrgAC_MSG_CHECKING([whether to search for compressed pixmaps]) 93a966c04fSmrgAC_ARG_ENABLE(stat-zfile, 941c235774Smrg AS_HELP_STRING([--enable-stat-zfile], 951c235774Smrg [Search for files with .Z & .gz extensions automatically @<:@default=auto@:>@]), 961c235774Smrg [STAT_ZFILE=$enableval], [STAT_ZFILE=$OPEN_ZFILE]) 971c235774SmrgAC_MSG_RESULT([$STAT_ZFILE]) 98a966c04fSmrgif test x$STAT_ZFILE = xyes ; then 991c235774Smrg AC_DEFINE(STAT_ZFILE, 1, [Define to 1 to automatically look for files with .Z & .gz extensions]) 100a966c04fSmrgfi 101a966c04fSmrg 1021c235774Smrg# --enable-unit-tests 1031c235774SmrgAC_REQUIRE_AUX_FILE([tap-driver.sh]) 1041c235774SmrgXORG_ENABLE_UNIT_TESTS 1051c235774SmrgXORG_WITH_GLIB([2.46]) 10652dc082bSmrgif test "x$have_glib" = x"yes"; then 10752dc082bSmrg AC_CHECK_FUNCS([g_pattern_spec_match_string]) 10852dc082bSmrgfi 1091c235774SmrgXORG_MEMORY_CHECK_FLAGS 110ac92798bSmrg 1116e7d3316SmrgAC_CONFIG_FILES([Makefile 1126e7d3316Smrg doc/Makefile 1136e7d3316Smrg include/Makefile 11497cf2ee2Smrg man/Makefile 1156e7d3316Smrg src/Makefile 1166e7d3316Smrg sxpm/Makefile 1176e7d3316Smrg cxpm/Makefile 1181c235774Smrg test/Makefile 1196e7d3316Smrg xpm.pc]) 1206e7d3316SmrgAC_OUTPUT 121