Only write 'config-defs.h' if it has changed. Add -Wall and -pedantic to CFLAGS if they are supported by $(CC). Clean up test for -include flag.
This commit is contained in:
Родитель
c98e5697ee
Коммит
d16ea70a40
64
configure.in
64
configure.in
|
@ -395,12 +395,13 @@ else
|
|||
fi
|
||||
CC=$_SAVE_CC
|
||||
|
||||
dnl Check for preprocesssor feature: command-line include files
|
||||
AC_MSG_CHECKING($CXX for \"-include <file>\" option)
|
||||
dnl Check cc for -include flag support (command-line include files)
|
||||
dnl Assume that cxx has the feature if cc has it.
|
||||
dnl (We can add another test later if we need to.)
|
||||
AC_MSG_CHECKING($CC for \"-include <file>\" option)
|
||||
_tmp_header="include-test-$$.h"
|
||||
echo "char *booboo;" > $_tmp_header
|
||||
_SAVE_CFLAGS=$CFLAGS ; CFLAGS="$CFLAGS -include $_tmp_header"
|
||||
_SAVE_CC=$CC ; CC=$CXX
|
||||
AC_CACHE_VAL(ac_cv_cxx_include_flag,
|
||||
[AC_TRY_COMPILE([],
|
||||
[booboo = "yogi";],
|
||||
|
@ -408,26 +409,43 @@ AC_CACHE_VAL(ac_cv_cxx_include_flag,
|
|||
[ac_cv_cxx_include_flag=false])])
|
||||
if test $ac_cv_cxx_include_flag = true ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
CC=$_SAVE_CC
|
||||
AC_MSG_CHECKING($CC for \"-include <file>\" option)
|
||||
AC_CACHE_VAL(ac_cv_cc_include_flag,
|
||||
[AC_TRY_COMPILE([],
|
||||
[booboo = "yogi";],
|
||||
[ac_cv_cc_include_flag=true],
|
||||
[ac_cv_cc_include_flag=false])])
|
||||
if test $ac_cv_cc_include_flag = true ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
USE_CPP_INCLUDE_FLAG=1
|
||||
AC_SUBST(USE_CPP_INCLUDE_FLAG)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
rm -r $_tmp_header
|
||||
if test $ac_cv_cc_include_flag = true -a $ac_cv_cxx_include_flag = true; then
|
||||
USE_CPP_INCLUDE_FLAG=1
|
||||
AC_SUBST(USE_CPP_INCLUDE_FLAG)
|
||||
|
||||
dnl Check cc for -Wall flag support (adds compiler warnings)
|
||||
AC_MSG_CHECKING($CC for \"-Wall\" support)
|
||||
_SAVE_CFLAGS=$CFLAGS ; CFLAGS="$CFLAGS -Wall"
|
||||
AC_CACHE_VAL(ac_cv_cc_wall_flag,
|
||||
[AC_TRY_COMPILE([],
|
||||
[int i;],
|
||||
[ac_cv_cc_wall_flag=true],
|
||||
[ac_cv_cc_wall_flag=false])])
|
||||
if test $ac_cv_cc_wall_flag = true ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
dnl Take -Wall back off CFLAGS
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
fi
|
||||
|
||||
dnl Check cc for -pedantic flag support (adds compiler warnings)
|
||||
AC_MSG_CHECKING($CC for \"-pedantic\" support)
|
||||
_SAVE_CFLAGS=$CFLAGS ; CFLAGS="$CFLAGS -pedantic"
|
||||
AC_CACHE_VAL(ac_cv_cc_pedantic_flag,
|
||||
[AC_TRY_COMPILE([],
|
||||
[int i;],
|
||||
[ac_cv_cc_pedantic_flag=true],
|
||||
[ac_cv_cc_pedantic_flag=false])])
|
||||
if test $ac_cv_cc_pedantic_flag = true ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
dnl Take -pedantic back off CFLAGS
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
fi
|
||||
|
||||
# Mozilla specific options
|
||||
|
@ -991,7 +1009,7 @@ AC_CHECK_LIB(plds21, PL_GetEvent, NSPR_LIBS="-lplds21 $NSPR_LIBS",
|
|||
[MISSING_NSPR="$MISSING_NSPR -lplds21"], $NSPR_LIBS)
|
||||
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
CFLAGS="${OPTIMIZE} ${GPROF} ${COMPILER_WARNINGS} ${CFLAGS}"
|
||||
CFLAGS="${OPTIMIZE} ${GPROF} ${CFLAGS}"
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
LIBS=$_SAVE_LIBS
|
||||
|
||||
|
@ -1064,7 +1082,11 @@ fi
|
|||
# (Do not add AC_DEFINE calls after this line.)
|
||||
if test "$USE_CPP_INCLUDE_FLAG"; then
|
||||
CONFIG_DEFS_H=config-defs.h
|
||||
# Only write config-defs.h when something changes (or it doesn't exist)
|
||||
if test ! -f $CONFIG_DEFS_H \
|
||||
|| diff confdefs.h $CONFIG_DEFS_H | grep \# > /dev/null; then
|
||||
AC_MSG_RESULT("creating $CONFIG_DEFS_H")
|
||||
|
||||
cat > $CONFIG_DEFS_H <<\EOF
|
||||
/* List of defines generated by configure. Included with preprocessor flag,
|
||||
* -include, to avoid long list of -D defines on the compile command-line.
|
||||
|
@ -1072,6 +1094,8 @@ if test "$USE_CPP_INCLUDE_FLAG"; then
|
|||
*/
|
||||
EOF
|
||||
cat confdefs.h >> $CONFIG_DEFS_H
|
||||
fi
|
||||
|
||||
CONFIG_DEFS_H='$(DEPTH)/'$CONFIG_DEFS_H
|
||||
AC_SUBST(CONFIG_DEFS_H)
|
||||
fi
|
||||
|
|
Загрузка…
Ссылка в новой задаче