summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-12-12 21:30:48 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-12-12 21:30:48 -0800
commit4217488314883c309cb355d91740451b7f9a01f3 (patch)
tree74e11024e5d4bb01145f45f0bd1ba79d1d75a381 /configure
parent72a18ef042a9845fdf5a6bedd502ba1fd6b2ca68 (diff)
downloadtxr-4217488314883c309cb355d91740451b7f9a01f3.tar.gz
txr-4217488314883c309cb355d91740451b7f9a01f3.tar.bz2
txr-4217488314883c309cb355d91740451b7f9a01f3.zip
Build bugfix: if a config.h header exists in $(top_srcdir),
then that header is used when building in a separate directory, instead of the config.h generated in that directory. To fix this, we move config.h into a config/ subdirectory. The $(top_srcdir)/config is not in the include search path when buiding in a separate build directory. While we are at it, let's move all the configure materials generated by the configure script into config/. * Makefile: include config/config.make at the top. Removing the rule which asserts the existence of configuration based on the presence of config.make. (CFLAGS): Add $(conf_dir) to include search path with -iquote. (notconfigured): New conditionally-defined target for producing the error message when the build system is not configured. (NL, DEP): New variables. ($(OBJS)): Make dependent on config/config.make and config/config.h with help of DEP macro. (opt/lex.yy.o, dbg/lex.yy.o): Express dependency using DEP. (y.tab.h): Split off as a dependent on y.tab.c rather than a co-target in the rule. The rule has a body to handle the situation when y.tab.h is missing for some reason, but y.tab.c already exists (and so won't be re-made, and so y.tab.h won't be remade). * configure: Require GNU Make 3.81 rather than 3.80. (conf_dir): New variable. (config_h, config_make, config_log): New variables. These are used in place of config.h, config.make and config.log. Add conf_dir to config.make variable.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure160
1 files changed, 84 insertions, 76 deletions
diff --git a/configure b/configure
index 38fe9800..62dfb8b4 100755
--- a/configure
+++ b/configure
@@ -121,6 +121,10 @@ have_windows_h=
have_posix_sigs=
need_darwin_c_source=
have_git=
+conf_dir=config
+config_h=$conf_dir/config.h
+config_make=$conf_dir/config.make
+config_log=$conf_dir/config.log
#
# Parse configuration variables
@@ -201,9 +205,9 @@ These variables can also influence what features are present in the
software, and can determine various defaults for those behaviors which are
dynamically configurable when the software is run.
-Configuration variables are recorded in a file called config.make. This is a
-GNU makefile, and consequently uses the GNU make syntax. It is included in the
-main Makefile by an include statement.
+Configuration variables are recorded in a file called $config_make.
+This is a GNU makefile, and consequently uses the GNU make syntax. It is
+included in the main Makefile by an include statement.
The configure script is flexible. It allows variables to be entered in any
of these forms:
@@ -225,7 +229,7 @@ No variables are required. The configure script establishes default values
for any variables which are needed by the build, but which are not specified
on the command line.
-After running $0, check that the config.make contents are sane.
+After running $0, check that the $config_make contents are sane.
The following variables are supported. Note that make variable syntax may
be used in paths. Default values are shown in [square brackets].
@@ -242,7 +246,7 @@ install-prefix [$install_prefix]
Specifies an extra path prefix that will be prepended to all paths during
installation, which allows the software to be installed in a temporary
directory for packaging. This variable becomes the \$(DESTDIR)
- variable in the config.make makefile.
+ variable in the $config_make makefile.
bindir [$bindir]
@@ -262,7 +266,7 @@ mandir [$mandir]
cross [$cross]
Specifies the root of a cross-compiling toolchain.
- This becomes the \$(cross) variable in the config.make makefile, and by
+ This becomes the \$(cross) variable in the $config_make makefile, and by
default will be added as a prefix to all of the toolchain commands.
It should include the trailing slash, unless the \$compiler_prefix
and \$tool_prefix variables take care of this by providing a leading slash.
@@ -285,7 +289,7 @@ cc [$cc]
Specifies the name of the toolchain front-end driver command to use for
compiling C sources to object files, and for linking object files to
- executables. This becomes the CC variable in config.make.
+ executables. This becomes the CC variable in $config_make.
intptr [$intptr]
@@ -462,8 +466,8 @@ make_version=$3
save_ifs=$IFS ; IFS=. ; set -- $make_version ; IFS=$save_ifs
-if [ $1 -lt 3 -o \( $1 -eq 3 -a $2 -lt 80 \) ] ; then
- printf "too old (%s found, 3.80 or newer needed)\n" $make_version
+if [ $1 -lt 3 -o \( $1 -eq 3 -a $2 -lt 81 \) ] ; then
+ printf "too old (%s found, 3.81 or newer needed)\n" $make_version
exit 1
else
printf "yes (%s found)\n" $make_version
@@ -560,7 +564,8 @@ fi
gen_config_make()
{
- cat > config.make <<!
+ mkdir -p $conf_dir
+ cat > $config_make <<!
#
# Make include file automatically generated by $0.
# Changes to this file are lost when the above is re-run.
@@ -613,6 +618,8 @@ compiler_prefix := $compiler_prefix
# prefix for non-compiler toolchain commands
tool_prefix := $tool_prefix
+conf_dir := $conf_dir
+
# do we compile in syslog support?
have_syslog := $have_syslog
@@ -656,7 +663,7 @@ TXR_DBG_OPTS := $txr_dbg_opts
# Before doing some other tests, we need a config.make
#
-printf "Generating config.make ... "
+printf "Generating %s ... " $config_make
gen_config_make
printf "\n"
@@ -664,7 +671,8 @@ printf "\n"
# Start config.h header
#
-cat <<! > config.h
+mkdir -p $conf_dir
+cat <<! > $config_h
/*
* Header file automatically generated by $0.
* Tweaking this file may seem like a good temporary workaround
@@ -791,7 +799,7 @@ int $ident(void);
int main(void) { return 0; }
!
if ! conftest ; then
- printf "#define %s txr_%s\n" $ident $ident >> config.h
+ printf "#define %s txr_%s\n" $ident $ident >> $config_h
have_unistd=y
fi
done
@@ -818,7 +826,7 @@ if conftest EXTRA_FLAGS=-Werror ; then
else
printf "no\n"
lang_flags="$lang_flags -U__STRICT_ANSI__"
- printf "Regenerating config.make ..."
+ printf "Regenerating %s ..." $config_make
gen_config_make
printf "done\n"
fi
@@ -834,7 +842,7 @@ case "$ccname" in
printf "yes\n"
need_darwin_c_source=y
lang_flags="$lang_flags -D_DARWIN_C_SOURCE"
- printf "Regenerating config.make ..."
+ printf "Regenerating %s ..." $config_make
gen_config_make
printf "done\n"
else
@@ -898,7 +906,7 @@ if conftest EXTRA_FLAGS=-Werror ; then
printf "absent\n"
else
printf "present\n"
- cat >> config.h <<!
+ cat >> $config_h <<!
$(for x in isalpha isupper islower isdigit isxdigit isalnum isspace \
ispunct isprint isgraph iscntrl isblank ; do \
printf "#undef %s\n" $x ; done)
@@ -925,8 +933,8 @@ done
if [ -n "$longlong" ] ; then
printf '"%s"\n' "$longlong"
- printf "#define HAVE_LONGLONG_T 1\n" >> config.h
- printf "typedef $longlong longlong_t;\n" >> config.h
+ printf "#define HAVE_LONGLONG_T 1\n" >> $config_h
+ printf "typedef $longlong longlong_t;\n" >> $config_h
else
printf "none\n"
fi
@@ -947,8 +955,8 @@ done
if [ -n "$ulonglong" ] ; then
printf '"%s"\n' "$ulonglong"
- printf "#define HAVE_ULONGLONG_T 1\n" >> config.h
- printf "typedef $ulonglong ulonglong_t;\n" >> config.h
+ printf "#define HAVE_ULONGLONG_T 1\n" >> $config_h
+ printf "typedef $ulonglong ulonglong_t;\n" >> $config_h
else
printf "none\n"
fi
@@ -989,8 +997,8 @@ fi
if [ -n "$superlong" ] ; then
printf '"%s"\n' "$superlong"
- printf "#define HAVE_SUPERLONG_T 1\n" >> config.h
- printf "typedef $superlong superlong_t;\n" >> config.h
+ printf "#define HAVE_SUPERLONG_T 1\n" >> $config_h
+ printf "typedef $superlong superlong_t;\n" >> $config_h
else
printf "none\n"
fi
@@ -1020,8 +1028,8 @@ fi
if [ -n "$usuperlong" ] ; then
printf '"%s"\n' "$usuperlong"
- printf "#define HAVE_USUPERLONG_T 1\n" >> config.h
- printf "typedef $usuperlong usuperlong_t;\n" >> config.h
+ printf "#define HAVE_USUPERLONG_T 1\n" >> $config_h
+ printf "typedef $usuperlong usuperlong_t;\n" >> $config_h
else
printf "none\n"
fi
@@ -1048,7 +1056,7 @@ read_syms()
SIZEOF* )
eval $(printf "%s=%d\n" "$deferred_sym" "$size")
if [ -n "$print_into_config" ] ; then
- printf "#define %s %s\n" "$deferred_sym" "$size" >> config.h
+ printf "#define %s %s\n" "$deferred_sym" "$size" >> $config_h
fi
;;
esac
@@ -1062,7 +1070,7 @@ read_syms()
SIZEOF* )
eval $(printf "%s=%d\n" "$symbol" "$size")
if [ -n "$print_into_config" ] ; then
- printf "#define %s %s\n" "$symbol" "$size" >> config.h
+ printf "#define %s %s\n" "$symbol" "$size" >> $config_h
fi
;;
esac
@@ -1127,23 +1135,23 @@ char DUMMY;
fi
printf '"%s"\n' "$intptr"
-printf "typedef $intptr int_ptr_t;\n" >> config.h
+printf "typedef $intptr int_ptr_t;\n" >> $config_h
if [ -n "$uintptr" ] ; then
- printf "#define HAVE_UINTPTR_T 1\n" >> config.h
- printf "typedef unsigned $intptr uint_ptr_t;\n" >> config.h
+ printf "#define HAVE_UINTPTR_T 1\n" >> $config_h
+ printf "typedef unsigned $intptr uint_ptr_t;\n" >> $config_h
fi
intptr_max_expr="((((convert($intptr, 1) << $((SIZEOF_PTR * 8 - 2))) - 1) << 1) + 1)"
-printf "#define INT_PTR_MAX %s\n" "$intptr_max_expr" >> config.h
-printf "#define INT_PTR_MIN (-INT_PTR_MAX)\n" >> config.h
+printf "#define INT_PTR_MAX %s\n" "$intptr_max_expr" >> $config_h
+printf "#define INT_PTR_MIN (-INT_PTR_MAX)\n" >> $config_h
if [ -n "$longlong" ] && [ $SIZEOF_LONGLONG_T -eq $(( 2 * $SIZEOF_PTR )) ]
then
- printf "#define HAVE_DOUBLE_INTPTR_T 1\n" >> config.h
- printf "typedef longlong_t double_intptr_t;\n" >> config.h
+ printf "#define HAVE_DOUBLE_INTPTR_T 1\n" >> $config_h
+ printf "typedef longlong_t double_intptr_t;\n" >> $config_h
elif [ -n "$superlong" ] && [ $SIZEOF_SUPERLONG_T -eq $(( 2 * $SIZEOF_PTR )) ]
then
- printf "#define HAVE_DOUBLE_INTPTR_T 1\n" >> config.h
- printf "typedef superlong_t double_intptr_t;\n" >> config.h
+ printf "#define HAVE_DOUBLE_INTPTR_T 1\n" >> $config_h
+ printf "typedef superlong_t double_intptr_t;\n" >> $config_h
fi
#if HAVE_LONGLONG_T &&
@@ -1191,7 +1199,7 @@ char DUMMY;
fi
printf "%d\n" "$lit_align"
-printf "#define LIT_ALIGN %d\n" "$lit_align" >> config.h
+printf "#define LIT_ALIGN %d\n" "$lit_align" >> $config_h
#
# Inline functions
@@ -1231,7 +1239,7 @@ $inline int func(void)
fi
printf '"%s"\n' "$inline"
-printf "#define INLINE $inline\n" >> config.h
+printf "#define INLINE $inline\n" >> $config_h
#
# Valgrind
@@ -1262,7 +1270,7 @@ syntax error
fi
printf "okay\n"
- printf "#define HAVE_VALGRIND 1\n" >> config.h
+ printf "#define HAVE_VALGRIND 1\n" >> $config_h
fi
#
@@ -1321,7 +1329,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_SYS_WAIT 1\n" >> config.h
+ printf "#define HAVE_SYS_WAIT 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1344,7 +1352,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_SYS_STAT 1\n" >> config.h
+ printf "#define HAVE_SYS_STAT 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1368,7 +1376,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_ENVIRON 1\n" >> config.h
+ printf "#define HAVE_ENVIRON 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1390,7 +1398,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_GETENVIRONMENTSTRINGS 1\n" >> config.h
+ printf "#define HAVE_GETENVIRONMENTSTRINGS 1\n" >> $config_h
have_windows_h=y
else
printf "no\n"
@@ -1424,7 +1432,7 @@ int main(int argc, char **argv)
if conftest ; then
printf "yes\n"
- printf "#define HAVE_FORK_STUFF 1\n" >> config.h
+ printf "#define HAVE_FORK_STUFF 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1445,7 +1453,7 @@ int main(int argc, char **argv)
if conftest ; then
printf "yes\n"
- printf "#define HAVE_GETPPID 1\n" >> config.h
+ printf "#define HAVE_GETPPID 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1470,7 +1478,7 @@ int main(int argc, char **argv)
if conftest ; then
printf "yes\n"
- printf "#define HAVE_FCNTL_H 1\n" >> config.h
+ printf "#define HAVE_FCNTL_H 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1490,8 +1498,8 @@ for try_field in tm_gmtoff __tm_gmtoff ; do
int x = sizeof ((struct tm *) 0)->$try_field;
!
if conftest_o ; then
- printf "#define HAVE_TM_GMTOFF 1\n" >> config.h
- printf "#define TM_GMTOFF %s\n" $try_field >> config.h
+ printf "#define HAVE_TM_GMTOFF 1\n" >> $config_h
+ printf "#define TM_GMTOFF %s\n" $try_field >> $config_h
break
fi
done
@@ -1502,8 +1510,8 @@ for try_field in tm_zone __tm_zone ; do
int x = sizeof ((struct tm *) 0)->$try_field;
!
if conftest_o ; then
- printf "#define HAVE_TM_ZONE 1\n" >> config.h
- printf "#define TM_ZONE %s\n" $try_field >> config.h
+ printf "#define HAVE_TM_ZONE 1\n" >> $config_h
+ printf "#define TM_ZONE %s\n" $try_field >> $config_h
break
fi
done
@@ -1523,7 +1531,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_TIMEGM 1\n" >> config.h
+ printf "#define HAVE_TIMEGM 1\n" >> $config_h
have_timegm=y
else
printf "no\n"
@@ -1543,7 +1551,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_SETENV 1\n" >> config.h
+ printf "#define HAVE_SETENV 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1560,7 +1568,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_TZSET 1\n" >> config.h
+ printf "#define HAVE_TZSET 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1582,7 +1590,7 @@ int main(int argc, char **argv)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_GMTIME_R 1\n" >> config.h
+ printf "#define HAVE_GMTIME_R 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1602,7 +1610,7 @@ int main(int argc, char **argv)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_POSIX_SLEEP 1\n" >> config.h
+ printf "#define HAVE_POSIX_SLEEP 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1621,7 +1629,7 @@ int main(int argc, char **argv)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_POSIX_USLEEP 1\n" >> config.h
+ printf "#define HAVE_POSIX_USLEEP 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1641,7 +1649,7 @@ int main(int argc, char **argv)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_POSIX_NANOSLEEP 1\n" >> config.h
+ printf "#define HAVE_POSIX_NANOSLEEP 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1660,7 +1668,7 @@ int main(int argc, char **argv)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_DAEMON 1\n" >> config.h
+ printf "#define HAVE_DAEMON 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1679,7 +1687,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_ISATTY 1\n" >> config.h
+ printf "#define HAVE_ISATTY 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1701,7 +1709,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_SYSLOG 1\n" >> config.h
+ printf "#define HAVE_SYSLOG 1\n" >> $config_h
have_syslog=y
else
printf "no\n"
@@ -1727,7 +1735,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_POSIX_SIGS 1\n" >> config.h
+ printf "#define HAVE_POSIX_SIGS 1\n" >> $config_h
have_posix_sigs=y
else
printf "no\n"
@@ -1750,7 +1758,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_SIGALTSTACK 1\n" >> config.h
+ printf "#define HAVE_SIGALTSTACK 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1772,7 +1780,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_ITIMER 1\n" >> config.h
+ printf "#define HAVE_ITIMER 1\n" >> $config_h
have_sys_time=y
else
printf "no\n"
@@ -1793,7 +1801,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_MAKEDEV 1\n" >> config.h
+ printf "#define HAVE_MAKEDEV 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1814,7 +1822,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_SYMLINK 1\n" >> config.h
+ printf "#define HAVE_SYMLINK 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1837,7 +1845,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_MKDIR 1\n" >> config.h
+ printf "#define HAVE_MKDIR 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1859,7 +1867,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_MKNOD 1\n" >> config.h
+ printf "#define HAVE_MKNOD 1\n" >> $config_h
have_unistd=y
else
printf "no\n"
@@ -1881,7 +1889,7 @@ int main(int argc, char **argv)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_WSPAWN 1\n" >> config.h
+ printf "#define HAVE_WSPAWN 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1899,7 +1907,7 @@ int main(void)
!
if conftest ; then
printf "yes\n"
- printf "#define HAVE_LOG2 1\n" >> config.h
+ printf "#define HAVE_LOG2 1\n" >> $config_h
else
printf "no\n"
fi
@@ -1909,15 +1917,15 @@ fi
#
if [ -n "$have_unistd" ] ; then
- printf "#define HAVE_UNISTD_H 1\n" >> config.h
+ printf "#define HAVE_UNISTD_H 1\n" >> $config_h
fi
if [ -n "$have_sys_time" ] ; then
- printf "#define HAVE_SYS_TIME 1\n" >> config.h
+ printf "#define HAVE_SYS_TIME 1\n" >> $config_h
fi
if [ -n "$have_windows_h" ] ; then
- printf "#define HAVE_WINDOWS_H 1\n" >> config.h
+ printf "#define HAVE_WINDOWS_H 1\n" >> $config_h
fi
#
@@ -1926,7 +1934,7 @@ fi
if [ -n "$extra_debugging" ] ; then
printf "Configuring extra debugging, as requested ...\n"
- printf "#define EXTRA_DEBUGGING 1\n" >> config.h
+ printf "#define EXTRA_DEBUGGING 1\n" >> $config_h
fi
#
@@ -2004,21 +2012,21 @@ fi
# Some final blurbs into config.h
#
-[ -n "$debug_support" ] && printf "#define CONFIG_DEBUG_SUPPORT 1\n" >> config.h
-[ -n "$gen_gc" ] && printf "#define CONFIG_GEN_GC 1\n" >> config.h
+[ -n "$debug_support" ] && printf "#define CONFIG_DEBUG_SUPPORT 1\n" >> $config_h
+[ -n "$gen_gc" ] && printf "#define CONFIG_GEN_GC 1\n" >> $config_h
#
# Regenerate config.make
#
-printf "Regenerating config.make ... "
+printf "Regenerating %s ... " $config_make
gen_config_make
printf "done\n"
#
# Save configuration in config.log
#
-cat > config.log <<!
+cat > $config_log <<!
Configured on $(date) using