It happens for both cases.
I compiled PHP myself with the following config line-
./configure --prefix=/usr/local/php-5.2.0 --exec-prefix=/usr/local/php-5.2.0 --with-config-file-path=/usr/local/php-5.2.0/lib --with-exec-dir=/usr/local/php-5.2.0/bin --with-pear=/usr/local/php-5.2.0/lib/php --with-apxs2=/usr/local/httpd-2.0.59/bin/apxs --with-libxml-dir=/usr/local/libxml2 --with-mysql=/usr/share/mysql-max-5.0.24a-linux-i686/ --with-zlib --with-gd=/usr/share/gd-2.0.33/ --enable-bcmath --with-ldap=/usr/local/openldap-2.2.26/ --with-oci8=instantclient,/usr/local/instantclient_10_2 --with-xsl=/usr/local/libxslt --with-mcrypt=/usr/local/libmcrypt --with-curl=/usr/local/curl
MySQL portion from phpinfo() ->
mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.0.21
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I/usr/share/mysql-max-5.0.24a-linux-i686//include
MYSQL_LIBS -L/usr/share/mysql-max-5.0.24a-linux-i686//lib -lmysqlclient