wow! awk-hack alert!

Luke Kenneth Casson Leighton lkcl at
Mon May 11 15:20:41 GMT 1998

never done any awk before in me _life_, guv.  puts #ifdef USE_LDAP around
the ldap.c files.

useful technique we might want to employ for other compile-time options: i
know it's certainly a pain to have to do something awkward like 

- create a separate Makefile just for a single compile-time option: what
happens when you get several such options?  urk.

- create a separate header file (in this case for function prototypes in
ldap.c) e.g as already exists for the ubiqx code.

- create dummy structs (in this case when #ifndef USE_LDAP) to satisfy the
compiler for when a compile-time option is not used.

chris, as the author of the ubiqx modules (some of which will be
compile-time selected), what do you (specifically but not exclusively)


  use_ldap_define = 0;
  print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */"
  print ""

  if (FILENAME!=current_file) {
    if (use_ldap_define)
      print "#endif /* USE_LDAP */"
      use_ldap_define = 0;
    print ""
    print "/*The following definitions come from ",FILENAME," */"
    print ""
    if (current_file=="ldap.c") {
      print "#ifdef USE_LDAP"
      use_ldap_define = 1;
  if (inheader) {
    if (match($0,"[)][ \t]*$")) {
      inheader = 0;
      printf "%s;\n",$0;
    } else {
      printf "%s\n",$0;

More information about the samba-technical mailing list