Hello.
I have a problem with compiling openldap suite on AIX. I feel it has certainly trivial solution, but I'm not so skilled in C development, so I can't solve it.

After compiling, all binaries have hardcoded library dependencies:

# cd /home/horakmar/src/openldap-2.3.4
# servers/slapd/slapd
Could not load program servers/slapd/slapd:
        Dependent module ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r-2.3.so.0) could not be loaded.
Could not load module ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r-2.3.so.0).
System error: No such file or directory

# ldd servers/slapd/slapd
servers/slapd/slapd needs:
         /lib/libs.a( shr.o)
         /lib/libpthreads.a(shr_comm.o)
         /lib/libpthreads.a(shr_xpg5.o)
         /home/qshorakmar/src/openldap-2.3.4/libraries/liblber/.libs/liblber.a(liblber-2.3.so.0)
Cannot find ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r- 2.3.so.0)
         /opt/freeware/lib/libcrypto.a(libcrypto.so.0.9.7)
         /unix
         /lib/libcrypt.a(shr.o)
         /lib/libc.a(shr.o)
         /lib/libc.a(shr_64.o)
         /lib/libcrypt.a(shr_64.o)


# dump -H servers/slapd/slapd

servers/slapd/slapd:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000183       0x0000226b       0x00000119      

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000007       0x0001c16c       0x0000130c       0x0001c285      

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER             
0      /opt/freware/lib:/usr/lib:/lib                                        
1                                    libs.a              shr.o              
2                                    libpthreads.a       shr_comm.o         
3                                    libpthreads.a       shr_xpg5.o         
4      /home/qshorakmar/src/openldap- 2.3.4/libraries/liblber/.libs liblber.a           liblber-2.3.so.0   
5      ../../libraries/libldap_r/.libs libldap_r.a         libldap_r-2.3.so.0 
6                                    libcrypto.a         libcrypto.so.0.9.7  

Client tools (e.g. ldapsearch) suffer from the same problem.
When I install libraries into desired directories, program works. But dependency on directory in which it's being run is very unpleasant.
Please do you have any idea, how to get rid of those:
../../libraries/libldap_r/.libs libldap_r.a
/home/qshorakmar/src/openldap-2.3.4/libraries/liblber/.libs liblber.a
?

Thank you in advance,
Martin Horak