From 77726e04f896ee121ba048be0c259f9df0d10ca9 Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Fri, 15 Nov 2013 11:47:33 +0900 Subject: [PATCH] Move -Wall -Wno-pointer-sign CFLAGS option specified in Makefile.am to configure.ac. Users can disable those options by giving CFLAGS option explicitly. Also verify the availability of those options. --- Makefile.am | 4 ---- configure.ac | 31 ++++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index dfd36ab..d970c43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,10 +14,6 @@ else lib_LTLIBRARIES = psqlodbca.la endif -if GCC -AM_CFLAGS = -Wall -Wno-pointer-sign -endif - AM_LDFLAGS = -module -no-undefined -avoid-version psqlodbca_la_SOURCES = \ diff --git a/configure.ac b/configure.ac index 3ca0553..14450de 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,34 @@ AM_MAINTAINER_MODE # 0. Options processing +AC_PROG_CC + +AM_CONDITIONAL([GCC], [test -n "$GCC"]) + +if test -n "$GCC" && test "$ac_test_CFLAGS" != set; then + CFLAGS_ADD= + CFLAGS_save="${CFLAGS}" + + AC_MSG_CHECKING(-Wall is a valid compile option) + CFLAGS="${CFLAGS_save} -Wall" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include ]], + [])], + [AC_MSG_RESULT(yes) + CFLAGS_ADD="${CFLAGS_ADD} -Wall"], + [AC_MSG_RESULT(no)]) + CFLAGS=${CFLAGS_save} + + AC_MSG_CHECKING(-Wno-pointer-sign is a valid compile option) + CFLAGS="${CFLAGS_save} -Wno-pointer-sign" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include ]], + [])], + [AC_MSG_RESULT(yes) + CFLAGS_ADD="${CFLAGS_ADD} -Wno-pointer-sign"], + [AC_MSG_RESULT(no)]) + CFLAGS="${CFLAGS_save} ${CFLAGS_ADD}" +fi # # Whether unixODBC driver manager is used @@ -215,9 +243,6 @@ fi # 1. Programs -AC_PROG_CC - -AM_CONDITIONAL([GCC], [test -n "$GCC"]) # 2. Libraries -- 2.39.5