1
dnl as-ac-expand.m4 0.2.0
2
dnl autostars m4 macro for expanding directories using configure's prefix
3
dnl thomas@apestaart.org
5
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
7
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
8
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
10
AC_DEFUN([AS_AC_EXPAND],
15
dnl first expand prefix and exec_prefix if necessary
17
exec_prefix_save=$exec_prefix
19
dnl if no prefix given, then use /usr/local, the default prefix
20
if test "x$prefix" = "xNONE"; then
21
prefix="$ac_default_prefix"
23
dnl if no exec_prefix given, then use prefix
24
if test "x$exec_prefix" = "xNONE"; then
29
dnl loop until it doesn't change anymore
31
new_full_var="`eval echo $full_var`"
32
if test "x$new_full_var" = "x$full_var"; then break; fi
33
full_var=$new_full_var
37
full_var=$new_full_var
38
AC_SUBST([$1], "$full_var")
40
dnl restore prefix and exec_prefix
42
exec_prefix=$exec_prefix_save
45
dnl EXTRA_COMPILE_WARNINGS
46
dnl Turn on many useful compiler warnings
47
dnl For now, only works on GCC
48
AC_DEFUN([EXTRA_COMPILE_WARNINGS],[
49
dnl ******************************
50
dnl More compiler warnings
51
dnl ******************************
53
AC_ARG_ENABLE(compile-warnings,
54
AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
55
[Turn on compiler warnings]),,
56
[enable_compile_warnings="m4_default([$1],[yes])"])
59
if test "x$GCC" != xyes; then
60
enable_compile_warnings=no
64
realsave_CFLAGS="$CFLAGS"
66
case "$enable_compile_warnings" in
74
warning_flags="-Wall -Wmissing-prototypes"
77
warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
78
CFLAGS="$warning_flags $CFLAGS"
79
for option in -Wno-sign-compare; do
81
CFLAGS="$CFLAGS $option"
82
AC_MSG_CHECKING([whether gcc understands $option])
83
AC_TRY_COMPILE([], [],
87
AC_MSG_RESULT($has_option)
88
if test $has_option = yes; then
89
warning_flags="$warning_flags $option"
95
if test "$enable_compile_warnings" = "error" ; then
96
warning_flags="$warning_flags -Werror"
100
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
103
CFLAGS="$realsave_CFLAGS"
104
AC_MSG_CHECKING(what warning flags to pass to the C compiler)
105
AC_MSG_RESULT($warning_flags)
108
AC_HELP_STRING([--enable-iso-c],
109
[Try to warn if code is not ISO C ]),,
112
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
114
if test "x$enable_iso_c" != "xno"; then
115
if test "x$GCC" = "xyes"; then
117
*[\ \ ]-ansi[\ \ ]*) ;;
118
*) complCFLAGS="$complCFLAGS -ansi" ;;
121
*[\ \ ]-pedantic[\ \ ]*) ;;
122
*) complCFLAGS="$complCFLAGS -pedantic" ;;
126
AC_MSG_RESULT($complCFLAGS)
128
WARN_CFLAGS="$warning_flags $complCFLAGS"
129
AC_SUBST(WARN_CFLAGS)