]> git.eshelyaron.com Git - emacs.git/commitdiff
* configure.ac: Include X11/Xlib.h for XOpenDisplay. (Bug#68842)
authorUlrich Müller <ulm@gentoo.org>
Wed, 31 Jan 2024 07:49:36 +0000 (08:49 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 4 Feb 2024 11:01:51 +0000 (12:01 +0100)
Do not merge to master.

(cherry picked from commit 5f3b46c61e23786295e8e532f7eadeee8cd4340b)

configure.ac

index fa8b04ec685460ad98ecab832eb4a5195fd9c58d..4249e663c7b501f45e7f5d913dfadf80186d6f2c 100644 (file)
@@ -3470,6 +3470,39 @@ if test "${HAVE_X11}" = "yes"; then
     export LD_RUN_PATH
   fi
 
+  if test "${opsys}" = "gnu-linux"; then
+    AC_CACHE_CHECK([whether X on GNU/Linux needs -b to link], [emacs_cv_b_link],
+    [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
+     [[XOpenDisplay ("foo");]])],
+     [xgnu_linux_first_failure=no],
+     [xgnu_linux_first_failure=yes])
+    if test "${xgnu_linux_first_failure}" = "yes"; then
+      OLD_CPPFLAGS="$CPPFLAGS"
+      OLD_LIBS="$LIBS"
+      CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
+      LIBS="$LIBS -b i486-linuxaout"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
+       [[XOpenDisplay ("foo");]])],
+       [xgnu_linux_second_failure=no],
+       [xgnu_linux_second_failure=yes])
+      if test "${xgnu_linux_second_failure}" = "yes"; then
+       # If we get the same failure with -b, there is no use adding -b.
+       # So leave it out.  This plays safe.
+        emacs_cv_b_link=no
+      else
+        emacs_cv_b_link=yes
+      fi
+      CPPFLAGS=$OLD_CPPFLAGS
+      LIBS=$OLD_LIBS
+    else
+      emacs_cv_b_link=no
+    fi])
+    if test "x$emacs_cv_b_link" = xyes ; then
+      LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
+      C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
+    fi
+  fi
+
   # Reportedly, some broken Solaris systems have XKBlib.h but are missing
   # header files included from there.
   AC_CACHE_CHECK([for Xkb], [emacs_cv_xkb],