PKG_CHECK_MODULES(XLIB,x11)
AC_SUBST(XLIB_CFLAGS)
AC_SUBST(XLIB_LIBS)
 
I use this in lxdm, maybe this can have some help.
 
 
------------------ Original ------------------
From: "Sergio Cipolla";
Date: 2011年5月10日(星期二) 上午6:32
To: "LXDE list";
Subject: [Lxde-list] Would like help to build latest lxsession.
 
Hi.
Until this latest commit for lxsession
commit 21f44a4aa772ee802c3cffc38d8b83c1c8ab30c6
Author: Julien Lavergne <gilir@ubuntu.com>
Date: Mon May 9 16:29:19 2011 +0200
Link directly to X11
diff --git a/configure.ac b/configure.ac
index 21ef9cb..94c9af9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,10 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.6.0])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

+PKG_CHECK_MODULES(X11, [x11])
+AC_SUBST(X11_CFLAGS)
+AC_SUBST(X11_LIBS)
+
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
diff --git a/lxsession/Makefile.am b/lxsession/Makefile.am
index 3f2bb20..c21795b 100644
I could build lxsession by adding -lX11 to the LDADD line in lxsession-logout/Makefile.am but now the build fails during 'make', regardless if I add -lX11 or $(X11_LIBS) to that line.
Note that I don't know about programming and I almost copy/paste the suggestions I receive, i.e. don't really understand them much.
Anyway, the error here in Debian sid for the unmodified git code is:
$ make
make all-recursive
make[1]: Entrando no diretório `/home/lxde/src/lxsession'
Making all in lxsession
make[2]: Entrando no diretório `/home/lxde/src/lxsession/lxsession'
CC lxsession-lxsession.o
CC lxsession-xdg-autostart.o
CC lxsession-xevent..o
CC lxsession-settings-daemon.o
CC lxsession-xsettings-common.o
CC lxsession-xsettings-manager.o
CC lxsession-xutils.o
CCLD lxsession
make[2]: Saindo do diretório `/home/lxde/src/lxsession/lxsession'
Making all in lxsession-logout
make[2]: Entrando no diretório `/home/lxde/src/lxsession/lxsession-logout'
CC lxsession_logout-dbus-interface.o
CC lxsession_logout-lxsession-logout.o
CCLD lxsession-logout
/usr/bin/ld.bfd.real: lxsession_logout-lxsession-logout.o: undefined reference to symbol 'XInternAtom'
/usr/bin/ld.bfd.real: note: 'XInternAtom' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: ** [lxsession-logout] Erro 1
make[2]: Saindo do diretório `/home/lxde/src/lxsession/lxsession-logout'
make[1]: ** [all-recursive] Erro 1
make[1]: Saindo do diretório `/home/lxde/src/lxsession'
make: ** [all] Erro 2