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:
slamm%netscape.com 1999-02-12 00:56:35 +00:00
Родитель c98e5697ee
Коммит d16ea70a40
1 изменённых файлов: 48 добавлений и 24 удалений

Просмотреть файл

@ -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,27 +409,44 @@ 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)
fi
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,14 +1082,20 @@ fi
# (Do not add AC_DEFINE calls after this line.)
if test "$USE_CPP_INCLUDE_FLAG"; then
CONFIG_DEFS_H=config-defs.h
AC_MSG_RESULT("creating $CONFIG_DEFS_H")
cat > $CONFIG_DEFS_H <<\EOF
# 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.
* Do not edit.
*/
EOF
cat confdefs.h >> $CONFIG_DEFS_H
cat confdefs.h >> $CONFIG_DEFS_H
fi
CONFIG_DEFS_H='$(DEPTH)/'$CONFIG_DEFS_H
AC_SUBST(CONFIG_DEFS_H)
fi