Changeset 2510 for neercs


Ignore:
Timestamp:
Jul 1, 2008, 1:26:57 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Add a --debug flag to the configure step.
Location:
neercs/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/configure.ac

    r2506 r2510  
    2525  export PKG_CONFIG_LIBDIR=/dev/null
    2626fi
     27
     28dnl conditional builds
     29AC_ARG_ENABLE(debug,
     30  [  --enable-debug          build debug versions of neercs (default no)])
    2731
    2832CACA="no"
     
    5357fi
    5458
     59if test "${enable_debug}" = "yes"; then
     60  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
     61fi
    5562
    5663AC_DEFINE(_GNU_SOURCE, 1, [Use GNU extentions])
  • neercs/trunk/src/neercs.h

    r2505 r2510  
    207207int fill_config(struct screen_list *screen_list);
    208208
    209 #if 1
    210 #   define debug(f, z...) fprintf(stderr, f "\n", z)
     209#if defined DEBUG
     210#   include <stdio.h>
     211#   include <stdarg.h>
     212static inline void debug(const char *format, ...)
     213{
     214    int saved_errno = geterrno();
     215    va_list args;
     216    va_start(args, format);
     217    fprintf(stderr, "** neercs debug ** ");
     218    vfprintf(stderr, format, args);
     219    fprintf(stderr, "\n");
     220    va_end(args);
     221    seterrno(saved_errno);
     222}
    211223#else
    212 #   define debug(f, z...) do {} while(0)
     224#   define debug(format, ...) do {} while(0)
    213225#endif
    214226
Note: See TracChangeset for help on using the changeset viewer.