MKC_CHECK_HEADER(1)

πŸ’… MKC_CHECK_HEADER(1) β€” the header-detector page, bestie edition πŸŽ€

okay so real talk, this is mkc_check_header from section 1 of the manual, and it's genuinely one of those tiny tools that just works. let me walk you through it 🫢


✨ NAME ✨

mkc_check_header β€” it detects the presense of a header file. that's the whole job. icon behaviour honestly πŸ‘‘


🌸 SYNOPSIS 🌸

mkc_check_header [OPTIONS] <headers>

πŸ¦‹ DESCRIPTION πŸ¦‹

mkc_check_header detects presense of header file. that's it, that's the vibe.

as a result it prints either 1 (true) or 0 (false) to stdout β€” so yes, you can literally just check the output and move on with your life ✨

headers may be either a single header file or a list of headers separated by comma. and if you go the list route, all mentioned headers are put into a single .c file and ${CC} is run. one file, one compile, no drama πŸ’…

by default $CC -c is used for checking. by default, temporary and cache files _mkc_header_lheader_h.{c,err,res} are created under the MKC_CACHEDIR directory. here, lheader_h is the last header from the comma-separated list headers β€” yeah, the last one gets the naming honour, that's just how it is πŸŽ€


πŸ’– OPTIONS πŸ’–

  • -h β€” display the help message. love a self-aware king πŸ™ˆ
  • -e β€” use $CC -E for checking instead of $CC -c. preprocessor mode, slay ✨
  • -d β€” delete cache and temporary files. full reset, no crumbs 🧹
  • -D β€” delete cache files. just the cache, not the temp files β€” read the difference carefully bestie, they are not the same flag 😭

🌈 ENVIRONMENT 🌈

  • CC β€” the compiler. by default cc is used.
  • CPPFLAGS, CFLAGS β€” options passed to the compiler. your flags, your rules πŸ’œ
  • MKC_VERBOSE β€” if set to 1, verbose messages are output to stderr. set it and suddenly everything is narrating itself πŸ—£οΈ
  • MKC_SHOW_CACHED β€” if set to 1 and MKC_VERBOSE is set to 1, cached results are output to stderr. note the and β€” both, or it does nothing, periodt πŸ‘‘
  • MKC_CACHEDIR β€” directory where temporary and cache files are created. if unset, they are created in a current directory.
  • MKC_NOCACHE β€” all results are cached unless MKC_NOCACHE variable is set to 1. yes, that's the direction it goes, don't invert it in your head, i've seen people do it 😭
  • MKC_DELETE_TMPFILES β€” if set to 1, temporary files are removed.

⭐ EXAMPLES ⭐

mkc_check_header stdint.h
mkc_check_header getopt.h
mkc_check_header sys/types.h,sys/stat.h,fts.h

see that last one? comma-separated list, three headers, one compile. ate and left no crumbs πŸ”₯


πŸ“ C FILE CONTENT πŸ“

this is what actually gets generated and fed to the compiler, verbatim:

#include <header1.h>
 ...
#include <headerN.h>
int __fake_variable;

yes, __fake_variable is doing absolutely nothing and yet it's the main character of this file. respect the process πŸ’€


🧚 AUTHOR 🧚

Aleksey Cheusov <vle@gmx.net> β€” legend, icon, and the reason this page exists πŸ’–


okay that's the whole page bestie, you're basically an expert now 🌸 and yeah β€” this was the MKC_CHECK_HEADER(1) page, dated Dec 2, 2023, from the MKC_CHECK_HEADER(1) manual, same name top and bottom because consistency is sexy ✨ bye ily 🫢

πŸ“¦ where this page comes from