Thanks Wolfgang! I was able to make it work without -lgif in the LDFLAGS. The rpms I extracted did not have libgif.a. This is a very enlightening thread for me: Learnt about CentOS .rpm files for RHEL, rpm2cpio, LDFLAGS vs LD_LIBRARY_PATH. Thanks to everyone for the help :). On Fri, Sep 11, 2015 at 8:36 AM Wolfgang Jenkner wrote: > On Fri, Sep 11 2015, Kaushal Modi wrote: > > > The LDFLAGS did the magic, thank you! > > Actually, > > ./configure ... LDFLAGS=-L/path/to/the/lib64 > CPPFLAGS=-I/path/to/gifincludedir > > should be enough since configure will add -lgif to LIBS anyway (or do > something else to that effect). > > > (I wonder why setting the $LD_LIBRARY_PATH and $PKG_CONFIG_PATH env vars > > did not help.) > > LD_LIBRARY_PATH is used at runtime by the dynamic linker ld.so(8), > whereas LDFLAGS belongs to the GNU buildsystem, see > > (info "(autoconf) Preset Output Variables"). > > PKG_CONFIG_PATH is a search path for *.pc files, which giflib doesn't > install (as Paul already mentioned), see pkg-config(1). > > There are some (completely untested) variations on the theme: > > One could pass > > LDFLAGS="-L/path/to/the/lib64 -Wl,-rpath=/path/to/the/lib64" > > to configure and so avoid changing LD_LIBRARY_PATH. > > Or, if you have the static lib64/libgif.a you could link emacs to it > instead (by simply moving away the lib64/libgif.so* you have in your > home directory before building emacs); in this case, you could even > completely remove the giflib stuff from your home directory after > building emacs. >