not sure whether your question is meaningful at all in case your understanding of 'phoneme' is compatible with mine. in my book, 'phoneme' is 'an abstract class of 'sounds' that results from an analysis of spoken language which attempts to produce as few sound classes as practical and feasible'; instead of 'sounds' i like to use 'phonotypes', which in turn denotes 'universally distinguishable and practically occurring types of phonetically minimal utterances'. whew. that's not even close to being complete, but the upshot is:
we cannot say how many sounds there are in human language, the problem being the same as in the question 'how long is the British coastline'? it has a definite length when you walk around it with finite strides, but it becomes arbitrarily long if you make your strides shorter and shorter. all you can do is to impose a somewhat artificial limit, and this is exactly what phonotypes are for: you discard some precision, and end up basically with the famous and well-known IPA table of human speech sounds.
Yuen-Ren Chao, in 1934, wrote a famous piece entitled "The Non-Uniqueness of Phonemic Solutions", which is a must-read for anyone doing phonology. i will give an example (using Pinyin here instead of IPA): in Chinese, 'sa' and 'sha' are distinct sibilants (apical and retroflex). they do not occur before 'i' and 'ü', but there are 'xi' and 'xü' (with palatalized sibilants). one might conclude that there are at least three sibilants /s, sh, x/ in Mandarin, or that [x] is an allophone of /s/, or else an allophone of /sh/, or else that it is a neutralization of both /s, sh/ before /i, ü/. but it's worse since /h/ does not occur before /i, ü/, either, so maybe [x] is the neutralization of /s, sh, h/? it goes on like that with the vowels: you have 'lou' and 'luo', 'lei' and 'lie', but no *'loi, lio, leu, lue', so maybe [e] and [o] are really one phoneme?—i can tell you that a closer inspection of the entire system of Mandarin Chinese syllable finals makes such an analysis very compelling.
the above lead me to surmising that maybe what you really want is counting phonotypes across languages, and maybe which phonotypes often get lumped together to form phonemes. but even that will depend very much on the person(s) doing the analysis for a given language.
does German 'have' the phoneme /x/ (as in 'ach, Bach, Suche')? it regularly changes to [ç] after a front vowel, so [x, ç] get normally lumped together under one roof (which is intuitively correct for a native speaker). but what do you label that phoneme? label it /x/ or /ç/ or anything else, and your count of phonemes will by necessity omit the important fact that German speakers sometimes utter [x] and sometimes [ç]. Chinese speakers utter a sound very close to German [x] when saying things like 'hu, han, huanghe', but 'is' their /x/ 'the same' as German /x/? it doesn't seem to make sense—both systems do have commonalities, but (1) German [x] does not normally occur initially in a syllable, where Chinese [x] only occurs in initial position, and (2) German [x] is closely related to [ç], while Chinese [x] has a (much more complicated) relationship to an alveo-palatal sibilant.
it does not seem to make much sense. counting phonemes across languages is little more than counting letters.