Asterisk 1.6.1.13 won't build on Mac OSX 10.6

It looks like latest changes prevent Asterisk 1.6.1.13 building under OSX. The problem looks similar to the one solved by Russell Bryant with his change on 2009-03-18. The last few lines of the build process look like:

configure: Package configured for: configure: OS type : darwin configure: Host CPU : x86_64 configure: build-cpu:vendor:os: i386 : apple : darwin10.2.0 : configure: host-cpu:vendor:os: x86_64 : pc : darwin : CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" makeopts make[1]: `makeopts' is up to date. menuselect/menuselect --check-deps menuselect.makeopts menuselect/menuselect --check-deps menuselect.makeopts Generating embedded module rules ... [LD] hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o -> hashtest2 Undefined symbols: "_MAX", referenced from: _ast_internal_poll in poll.o ld: symbol(s) not found collect2: ld returned 1 exit status make[1]: *** [hashtest2] Error 1 make: *** [utils] Error 2

1.6.2.1 has been broken (as far as Mac OSX is concerned), presumably because of the same changes made in MAX. Something in these changes seems to have broken it for us mac users. These are the changes between 1.6.1.12 and .13 that relate to the string MAX:

[code]> lines Define side-effect-safe MIN and MAX macros and remove

#define MAX_SETTINGS (MAX_CONFNUM + MAX_PIN + MAX_PIN + 3)
char parse[MAX_SETTINGS];
char parse[MAX_SETTINGS], *stringp = parse, *confno_tmp;
< #ifndef MAX
< #define MAX(a,b) ((a) > (b) ? (a) : (b))
< #ifndef MAX
< #define MAX(a,b) ((a) > (b) ? (a) : (b))
< #ifndef MAX
< #define MAX(a,b) ((a) > (b) ? (a) : (b))
< #ifndef MAX
< #define MAX(a,b) ((a) > (b) ? (a) : (b))
#undef MAX
#define MAX(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a < __b) ? __b : __a);})
< #ifndef MAX
< #define MAX(a,b) ((a) > (b) ? (a) : (b))
< #ifndef LONG_MAX
< #define LONG_MAX 9223372036854775807L
< cutoff = neg ? (uint64_t)-(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX;
< acc = neg ? LONG_MIN : LONG_MAX;
< snprintf(monitor->filename_base, FILENAME_MAX, “%s/%s”,
snprintf(monitor->filename_base, FILENAME_MAX, “%s%s%s”,
[/code]

Well, I don’t know enough about this stuff to know who did what or who to thank, but I can report that Asterisk 1.6.2.7-rc1 does build successfully on Mac OSX 10.6.3. Whoever you are - thanks!