-])
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50
-dnl -----------------
-dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
-dnl character-strings.
-dnl
-dnl It is ambiguous because the specification accommodated the pre-ANSI
-dnl compilers bundled by more than one vendor in lieu of providing a standard C
-dnl compiler other than by costly add-ons. Because of this, the specification
-dnl did not take into account the use of const for telling the compiler that
-dnl string literals would be in readonly memory.
-dnl
-dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
-dnl let the compiler decide how to represent Xt's strings which were #define'd.
-dnl That does not solve the problem of using the block of Xt's strings which
-dnl are compiled into the library (and is less efficient than one might want).
-dnl
-dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
-dnl when compiling the library and compiling using the library, to tell the
-dnl compiler that String is const.
-AC_DEFUN([CF_CONST_X_STRING],
-[
-AC_REQUIRE([AC_PATH_XTRA])
-
-CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
-
-AC_TRY_COMPILE(
-[
-#include <stdlib.h>
-#include <X11/Intrinsic.h>
-],
-[String foo = malloc(1); free((void*)foo)],[
-
-AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
- AC_TRY_COMPILE(
- [
-#undef _CONST_X_STRING
-#define _CONST_X_STRING /* X11R7.8 (perhaps) */
-#undef XTSTRINGDEFINES /* X11R5 and later */
-#include <stdlib.h>
-#include <X11/Intrinsic.h>
- ],[String foo = malloc(1); *foo = 0],[
- cf_cv_const_x_string=no
- ],[
- cf_cv_const_x_string=yes
- ])
-])
-
-CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING])
-
-case "$cf_cv_const_x_string" in
-(no)
- CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
- ;;
-(*)
- CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
- ;;
-esac
-