From: Oliver Kiddle Date: Tue, 11 Oct 2016 14:20:52 +0000 (-0400) Subject: For the autoconf/automake stuff to replace getline, the following X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/f9df238ce8b1a1ee5d6acae3e5661cbc0ed2f625?ds=inline For the autoconf/automake stuff to replace getline, the following patch seems to work. The final change on configure.ac is to cope with cc -V output having slightly changed in the most recent version of the compiler. --- diff --git a/Makefile.am b/Makefile.am index 91b53efe..2cd95a05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -504,7 +504,7 @@ test_fakesmtp_SOURCES = test/fakesmtp.c test/server.c test_fakesmtp_LDADD = $(POSTLINK) test_fakehttp_SOURCES = test/fakehttp.c test/server.c -test_fakehttp_LDADD = $(POSTLINK) +test_fakehttp_LDADD = $(LDADD) $(POSTLINK) test_getcwidth_SOURCES = test/getcwidth.c test_getcwidth_LDADD = $(POSTLINK) @@ -632,6 +632,8 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/arglist.c \ config/config.c config/version.c \ thirdparty/jsmn/jsmn.c +sbr_libmh_a_LIBADD = $(LIBOBJS) + ## ## Because these files use the definitions in the libmh rule below, ## they need to be rebuilt if the Makefile changes. diff --git a/configure.ac b/configure.ac index b87dd644..4ed79bbc 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,10 @@ dnl CHECK FUNCTIONS dnl --------------- AC_CHECK_FUNCS([wcwidth mbtowc getutxent arc4random mkstemps]) +dnl Use custom getline for platforms that don't have it. +AC_CONFIG_LIBOBJ_DIR([sbr]) +AC_REPLACE_FUNCS([getline]) + dnl ----------------------- dnl CHECK MULTIBYTE SUPPORT dnl ----------------------- @@ -135,7 +139,7 @@ if test "$GCC" != yes; then dnl better to use an autoconf test, except -v will probably succeed dnl with many other compilers but have different meaning. AS_CASE([`${CC} -V 2>&1`], - [cc:\ Sun\ C*], [CFLAGS=\ + [cc:*\ Sun\ C*], [CFLAGS=\ "${CFLAGS:+$CFLAGS }-v -errtags=yes -erroff=E_STATEMENT_NOT_REACHED"]) fi