You probably want to keep your current KDE-3.5.x installation till you feel that KDE-4.x.y meets your needs for actual day to day use of your computer. Yet, you want to be able to change over with a minimum of work when the time comes to make the switch.
The best way to accomplish this is to install the needed support libraries on your system in the usual manner. Convention is that these should be installed in the /usr/local/ directory. By default, Troll Tech installs Qt in: /usr/local/Trolltech/Qt-4/. It is best to install KDE-4.x.y in its own directory so that the directory can be deleted if some large problem occurs. I will be using /usr/local/KDE-4/ but you can call it whatever you want.
We will keep configurations straight by using a separate user account for accessing KDE-4.x.y. This user account will contain your configurations of KDE-4.x.y and will have a script to set the environment variables (.bash_profile if using Linux).
(Till other distro instructions are added, you can probably determine the correct version to install by reading the LFS list of libraries)
Use whatever method you wish to create a new user account. Mine is called: "KDE4". Then edit or create the user specific login script (.bash_profile for Linux). There is a lot that goes into this. Note that this presumes that USER was correctly set by the system login script.
Be sure to get the paths correct for your system!!!
This is in addition to other things that you need in the script which would probably go at the beginning -- this large block of junk is to be added at the end. The XDG directories might need to be modified for your system.
To build, you must be logged on as the new user account (KDE4). You can 'su' for the whole thing or 'su -c' for each install.
Packages need to be installed with the correct prefixes for this to work:
For this to work, you must properly configure D-Bus. The D-Bus services will be installed in "$KDEDIR/share/dbus-1/services". For D-Bus to find them, you must add that path to the: "/etc/dbus-1/session-local.conf" file.
You will have two "startkde" scripts on your system and you will probably need to make changes so that you use the correct one to start the version that you want. Specifically, the KDE desktop from KDM from KDE-3 probably has the full path to the KDE-3 "startkde" script so the different PATH will not make any difference.
I have done this and will write this up soon.