Well, I think it really depends on your personality... how you would react.
Frankly, I usually just kind of laugh weakly a little, politely and with a smile but not like bursting out with laughter. Then, I just change the topic. I don't really like the idea of trying to put someone down or embarrass them, even if their joke was not that funny. But that is just my personality. If I really don't get the joke, then I may ask, "Hmm... what do you mean?..." or "Can you explain that?". But if I know what they meant and it is just a bad joke, I will do what I said above. In fact, I think even bad jokes can sometimes make you smile or giggle and lighten the mood, so I really don't like the idea of being rude, mean or sarcastic back to someone making one, especially if they are my close friend. The only case where I would say, "Do you think that's funny???" or something like that, is if it was an offensive joke (i.e. racist, cruel, inappropriate...etc.). ^^ Oh!! If I know that my friend also knows they were making a bad joke, then I might jokingly say something like, "What are you talking about??? Ahaha." with a smile. Well, this is just the way I like to handle that situation... ^^