X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=configure.in;h=e113860ef74ec6a7d352ab45eb1c69a25157a85c;hb=56a805299de35d8924969138aef4d0f1580daa6d;hp=b64c489470fa46538ff20552185fd6735463d4ae;hpb=853814d952958385f5d212d167dff4edd3802f3f;p=mmh diff --git a/configure.in b/configure.in index b64c489..e113860 100644 --- a/configure.in +++ b/configure.in @@ -221,14 +221,29 @@ fi AC_PROG_CC +AC_CACHE_CHECK(whether compiler supports -Wno-pointer-sign, nmh_cv_has_noptrsign, +[nmh_saved_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Wno-pointer-sign" + AC_TRY_COMPILE([],[],nmh_cv_has_noptrsign=yes,nmh_cv_has_noptrsign=no) + CFLAGS="$nmh_saved_cflags"]) + dnl if the user hasn't specified CFLAGS, then dnl if compiler is gcc, then dnl use -O2 and some warning flags dnl else use -O +dnl We use -Wall; if the compiler supports it we also use -Wno-pointer-sign, +dnl because gcc 4 now produces a lot of new warnings which are probably mostly +dnl spurious and which in any case we don't want to deal with now. +if test "$nmh_cv_has_noptrsign" = "yes"; then + nmh_gcc_warnflags="-Wall -Wno-pointer-sign" +else + nmh_gcc_warnflags="-Wall" +fi + if test -n "$auto_cflags"; then if test x"$enable_debug" = x"yes"; then if test -n "$GCC"; then - test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g" + test -z "$CFLAGS" && CFLAGS="$nmh_gcc_warnflags -g" || CFLAGS="$CFLAGS $nmh_gcc_warnflags -g" else test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g" fi @@ -244,7 +259,7 @@ if test -n "$auto_cflags"; then esac fi if test -n "$GCC"; then - test -z "$CFLAGS" && CFLAGS="-Wall -O2" || CFLAGS="$CFLAGS -Wall -O2" + test -z "$CFLAGS" && CFLAGS="$nmh_gcc_warnflags -O2" || CFLAGS="$CFLAGS $nmh_gcc_warnflags -O2" else test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O" fi @@ -429,6 +444,25 @@ AC_SUBST(MAIL_SPOOL_GRP)dnl dnl ------------------ dnl CHECK HEADER FILES dnl ------------------ + +dnl On glibc we need to define at least the '_XOPEN_SOURCE' level of features, +dnl or wchar.h doesn't declare a prototype for wcwidth(). But if we only define +dnl that level then db.h won't compile. So we define _GNU_SOURCE which turns +dnl on everything. Perhaps other OSes need some feature switch set to get wcwidth() +dnl declared; if so they should have an entry added to this case statement. +dnl NB that we must define this on the compiler command line, not in config.h, +dnl because it must be set before any system header is included and there's no +dnl portable way to make sure that files generated by lex include config.h +dnl before system header files. + +case "$target_os" in + linux*) + # Like DEFS, but doesn't get stomped on by configure when using config.h: + OURDEFS="$OURDEFS -D_GNU_SOURCE" + ;; +esac +AC_SUBST(OURDEFS) + AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_TIME @@ -969,6 +1003,7 @@ target os : ${target} compiler : ${CC} compiler flags : ${CFLAGS} linker flags : ${LDFLAGS} +definitions : ${OURDEFS} source code location : ${srcdir} binary install path : ${nmhbin2} libary install path : ${nmhlib2}