{"id":1056,"date":"2008-03-28T21:49:34","date_gmt":"2008-03-28T11:49:34","guid":{"rendered":"http:\/\/www.flamingspork.com\/blog\/2008\/03\/28\/dear-lazyweb-autoconf-and-define-have_-0\/"},"modified":"2008-03-28T21:49:34","modified_gmt":"2008-03-28T11:49:34","slug":"dear-lazyweb-autoconf-and-define-have_-0","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2008\/03\/28\/dear-lazyweb-autoconf-and-define-have_-0\/","title":{"rendered":"Dear LazyWeb, autoconf and #define HAVE_<foo> 0"},"content":{"rendered":"<p>How do I make an existing project (let&#8217;s say, MySQL) switch from generating a config.h that has #undef HAVE_FOO to one that generates #define HAVE_FOO 0 instead?<\/p>\n<p>Why? Well, here&#8217;s why:<\/p>\n<blockquote><p> Testing for features should be done by including &#8220;config.h&#8221; and using <tt class=\"backtick\">#if HAVE_&lt;feature&gt;<\/tt>.  Use of <tt class=\"backtick\">#if<\/tt> (rather than <tt class=\"backtick\">#ifdef<\/tt>) allows the gcc -Wundef flag to warn users about features which aren&#8217;t defined 1 or 0 in config.h.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>How do I make an existing project (let&#8217;s say, MySQL) switch from generating a config.h that has #undef HAVE_FOO to one that generates #define HAVE_FOO 0 instead? Why? Well, here&#8217;s why: Testing for features should be done by including &#8220;config.h&#8221; &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2008\/03\/28\/dear-lazyweb-autoconf-and-define-have_-0\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-1056","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-h2","jetpack-related-posts":[{"id":411,"url":"https:\/\/www.flamingspork.com\/blog\/2005\/05\/24\/dont-you-just-love-being-compatible\/","url_meta":{"origin":1056,"position":0},"title":"Don&#8217;t you just love being compatible?","author":"Stewart Smith","date":"2005-05-24","format":false,"excerpt":"\/* Force server down. kill all connections and threads and exit *\/ #if defined(OS2) || defined(__NETWARE__) extern \"C\" void kill_server(int sig_ptr) #define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN #elif !defined(__WIN__) static void *kill_server(void *sig_ptr) #define RETURN_FROM_KILL_SERVER DBUG_RETURN(0) #else static void __cdecl kill_server(int sig_ptr) #define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN #endif { DBUG_ENTER(\"kill_server\"); (from sql\/mysqld.cc) There just has\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1777,"url":"https:\/\/www.flamingspork.com\/blog\/2010\/01\/09\/shocked-and-stunned-that-code-exists-and-does-work\/","url_meta":{"origin":1056,"position":1},"title":"Shocked and Stunned (that code exists and does work)","author":"Stewart Smith","date":"2010-01-09","format":false,"excerpt":"#define READ_ALL 1 \/* openfrm: Read all parameters *\/ #define EXTRA_RECORD 8 \/* Reservera plats f|r extra record *\/ \u00ef\u00bb\u00bf\u00ef\u00bb\u00bfand later on.... \u00c2\u00a0\u00c2\u00a0if (prgflag & (READ_ALL+EXTRA_RECORD)) \u00c2\u00a0\u00c2\u00a0 \u00c2\u00a0records++; Feel free to think about that for a second. (I have an urge to add this to questions asked in a job\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":101,"url":"https:\/\/www.flamingspork.com\/blog\/2003\/06\/04\/finally-fixed-it\/","url_meta":{"origin":1056,"position":2},"title":"finally! fixed it!","author":"Stewart Smith","date":"2003-06-04","format":false,"excerpt":"From: Stewart Smith Date: Wed Jun 4, 2003 3:56:09 PM Australia\/Melbourne To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, David Woodhouse , Stewart Smith Subject: [PATCH] fixed: CRC32=y && 8193TOO=m unresolved symbols Linus, please apply - this fixes unresolved symbols when CONFIG_CRC32=y and CONFIG_8139TOO=m (it also appeared on some other ethernet device drivers).\u2026","rel":"","context":"In &quot;linux-kernel&quot;","block_context":{"text":"linux-kernel","link":"https:\/\/www.flamingspork.com\/blog\/category\/linux-kernel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3231,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/03\/03\/unireg-h-is-gone\/","url_meta":{"origin":1056,"position":3},"title":"unireg.h is finally gone","author":"Stewart Smith","date":"2013-03-03","format":false,"excerpt":"I got rid of unireg.cc way back in 2009 as I rewrote all the FRM related code inside Drizzle to instead use a nice protobuf based structure. If you're wondering what was there, I just quote this part of pack_screens() from unireg.cc in MySQL 5.6: start_row=4; end_row=22; cols=80; fields_on_screen=end_row+1-start_row; We\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1067,"url":"https:\/\/www.flamingspork.com\/blog\/2008\/04\/10\/twitter-updates-for-2008-04-10\/","url_meta":{"origin":1056,"position":4},"title":"Twitter Updates for 2008-04-10","author":"Stewart Smith","date":"2008-04-10","format":false,"excerpt":"@cafeugo: i think there's a #define somewhere for the max number of tables in a join... although casually surprised it performs well at ... # Powered by Twitter Tools.","rel":"","context":"In &quot;Twitter&quot;","block_context":{"text":"Twitter","link":"https:\/\/www.flamingspork.com\/blog\/category\/from-twitter\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1376,"url":"https:\/\/www.flamingspork.com\/blog\/2009\/01\/29\/maximum-number-of-columns-hard-limit\/","url_meta":{"origin":1056,"position":5},"title":"maximum number of columns (hard limit)","author":"Stewart Smith","date":"2009-01-29","format":false,"excerpt":"#define MAX_FIELDS 4096 \/* Limit in the .frm file *\/ I should be able to remove this limitation soon. Although if you come anywhere near it, you probably have already lost (and written your own engine).","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/1056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=1056"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=1056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=1056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=1056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}