1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

add auto creation of config.h

This commit is contained in:
Stefan Lankes 2016-11-30 00:11:58 +01:00 committed by Daniel Krebs
parent cadacc24ae
commit a289acf440
4 changed files with 331 additions and 116 deletions

313
configure vendored
View file

@ -582,8 +582,9 @@ PACKAGE_TARNAME='HermitCore'
PACKAGE_VERSION='0.1'
PACKAGE_STRING='HermitCore 0.1'
PACKAGE_BUGREPORT='slankes@eonerc.rwth-aachen.de'
PACKAGE_URL='http://rwth-os.github.io/HermitCore/'
PACKAGE_URL='http://www.hermitcore.org'
ac_unique_file="kernel/main.c"
ac_subst_vars='LTLIBOBJS
LIBOBJS
ARCH_OPT
@ -631,6 +632,10 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_mtune
with_max_cores
with_max_tasks
with_kernel_stack_size
with_default_stack_size
'
ac_precious_vars='build_alias
host_alias
@ -1244,9 +1249,15 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-mtune=ARCH enable tuning for a specific architecture
--with-max-cores=N specify the maximum number of cores
--with-max-tasks=N specify the maximum number of running tasks
--with-kernel-stack-size=SIZE
specify the size of the kernel stack
--with-default-stack-size=SIZE
specify the default stack size
Report bugs to <slankes@eonerc.rwth-aachen.de>.
HermitCore home page: <http://rwth-os.github.io/HermitCore/>.
HermitCore home page: <http://www.hermitcore.org>.
_ACEOF
ac_status=$?
fi
@ -1717,6 +1728,9 @@ fi
done
ac_config_headers="$ac_config_headers include/hermit/config.h"
# Checks for programs.
# Checks for libraries.
@ -1727,6 +1741,29 @@ done
# Checks for library functions.
# define eduOS specific constants
$as_echo "#define HAVE_ARCH_MEMSET 1" >>confdefs.h
$as_echo "#define HAVE_ARCH_MEMCPY 1" >>confdefs.h
$as_echo "#define HAVE_ARCH_STRLEN 1" >>confdefs.h
$as_echo "#define HAVE_ARCH_STRCPY 1" >>confdefs.h
$as_echo "#define HAVE_ARCH_STRNCPY 1" >>confdefs.h
$as_echo "#define MAX_ISLE 8" >>confdefs.h
$as_echo "#define MAX_FNAME 128" >>confdefs.h
CROSSDIR=`pwd`/usr/x86/bin
@ -1742,6 +1779,79 @@ fi
# Check whether --with-max-cores was given.
if test "${with_max_cores+set}" = set; then :
withval=$with_max_cores;
fi
if test "x$with_max_cores" != x; then
cat >>confdefs.h <<_ACEOF
#define MAX_CORES $with_max_tasks
_ACEOF
else
$as_echo "#define MAX_CORES 512" >>confdefs.h
fi
# Check whether --with-max-tasks was given.
if test "${with_max_tasks+set}" = set; then :
withval=$with_max_tasks;
fi
if test "x$with_max_tasks" != x; then
cat >>confdefs.h <<_ACEOF
#define MAX_TASKS $with_max_tasks
_ACEOF
else
$as_echo "#define MAX_TASKS (MAX_CORES*2+2)" >>confdefs.h
fi
# Check whether --with-kernel-stack-size was given.
if test "${with_kernel_stack_size+set}" = set; then :
withval=$with_kernel_stack_size;
fi
if test "x$with_kernel_stack_size" != x; then
cat >>confdefs.h <<_ACEOF
#define KERNEL_STACK_SIZE $with_stack_size
_ACEOF
else
$as_echo "#define KERNEL_STACK_SIZE 8192" >>confdefs.h
fi
# Check whether --with-default-stack-size was given.
if test "${with_default_stack_size+set}" = set; then :
withval=$with_default_stack_size;
fi
if test "x$with_default_stack_size" != x; then
cat >>confdefs.h <<_ACEOF
#define DEFAULT_STACK_SIZE $with_default_stack_size
_ACEOF
else
$as_echo "#define DEFAULT_STACK_SIZE 262144" >>confdefs.h
fi
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
@ -1834,43 +1944,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
ac_script='
:mline
/\\$/{
N
s,\\\n,,
b mline
}
t clear
:clear
s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
t quote
s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
t quote
b any
:quote
s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
s/\[/\\&/g
s/\]/\\&/g
s/\$/$$/g
H
:any
${
g
s/^\n//
s/\n/ /g
p
}
'
DEFS=`sed -n "$ac_script" confdefs.h`
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
@ -2304,11 +2378,15 @@ case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
_ACEOF
@ -2329,12 +2407,17 @@ Usage: $0 [OPTION]... [TAG]...
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Report bugs to <slankes@eonerc.rwth-aachen.de>.
HermitCore home page: <http://rwth-os.github.io/HermitCore/>."
HermitCore home page: <http://www.hermitcore.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@ -2394,7 +2477,18 @@ do
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h | --help | --hel | -h )
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
@ -2450,6 +2544,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"include/hermit/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/hermit/config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@ -2463,6 +2558,7 @@ done
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
@ -2650,8 +2746,116 @@ fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
eval set X " :F $CONFIG_FILES "
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' <confdefs.h | sed '
s/'"$ac_delim"'/"\\\
"/g' >>$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
shift
for ac_tag
do
@ -2859,7 +3063,30 @@ which seems to be undefined. Please make sure it is defined" >&2;}
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
esac

View file

@ -2,8 +2,10 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.69)
AC_INIT(HermitCore, 0.1, slankes@eonerc.rwth-aachen.de, HermitCore, http://rwth-os.github.io/HermitCore/)
AC_INIT(HermitCore, 0.1, slankes@eonerc.rwth-aachen.de, HermitCore, http://www.hermitcore.org)
AC_CHECK_PROGS(QEMU, qemu-system-x86_64)
AC_CONFIG_SRCDIR(kernel/main.c)
AC_CONFIG_HEADERS(include/hermit/config.h)
# Checks for programs.
@ -15,6 +17,15 @@ AC_CHECK_PROGS(QEMU, qemu-system-x86_64)
# Checks for library functions.
# define eduOS specific constants
AC_DEFINE(HAVE_ARCH_MEMSET, 1, Define to use machine specific version of memset)
AC_DEFINE(HAVE_ARCH_MEMCPY, 1, Define to use machine specific version of memcpy)
AC_DEFINE(HAVE_ARCH_STRLEN, 1, Define to use machine specific version of strlen)
AC_DEFINE(HAVE_ARCH_STRCPY, 1, Define to use machine specific version of strcpy)
AC_DEFINE(HAVE_ARCH_STRNCPY, 1, Define to use machine specific version of strncpy)
AC_DEFINE(MAX_ISLE, 8, Define the maximum number of isles / numa nodes)
AC_DEFINE(MAX_FNAME, 128, Define the maximum length of a file name)
CROSSDIR=`pwd`/usr/x86/bin
AC_SUBST(CROSSDIR)
@ -27,5 +38,34 @@ AC_ARG_WITH([mtune],
[ARCH_OPT=])
AC_SUBST(ARCH_OPT)
AC_ARG_WITH(max-cores, [AS_HELP_STRING([--with-max-cores=N], [specify the maximum number of cores])])
if test "x$with_max_cores" != x; then
AC_DEFINE_UNQUOTED(MAX_CORES, $with_max_tasks, Define the maximum number of cores)
else
AC_DEFINE(MAX_CORES, 512, Define the maximum number of cores)
fi
AC_ARG_WITH(max-tasks, [AS_HELP_STRING([--with-max-tasks=N], [specify the maximum number of running tasks])])
if test "x$with_max_tasks" != x; then
AC_DEFINE_UNQUOTED(MAX_TASKS, $with_max_tasks, Define the maximum number of running tasks)
else
AC_DEFINE(MAX_TASKS, (MAX_CORES*2+2), Define the maximum number of running tasks)
fi
AC_ARG_WITH(kernel-stack-size, [AS_HELP_STRING([--with-kernel-stack-size=SIZE], [specify the size of the kernel stack])])
if test "x$with_kernel_stack_size" != x; then
AC_DEFINE_UNQUOTED(KERNEL_STACK_SIZE, $with_stack_size, Define the size of the kernel stack)
else
AC_DEFINE(KERNEL_STACK_SIZE, 8192, Define the size of the kernel stack)
fi
AC_ARG_WITH(default-stack-size, [AS_HELP_STRING([--with-default-stack-size=SIZE], [specify the default stack size])])
if test "x$with_default_stack_size" != x; then
AC_DEFINE_UNQUOTED(DEFAULT_STACK_SIZE, $with_default_stack_size, Define the default stack size)
else
AC_DEFINE(DEFAULT_STACK_SIZE, 262144, Define the default stack size)
fi
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

View file

@ -1,72 +0,0 @@
/*
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __CONFIG_H__
#define __CONFIG_H__
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_CORES 512
#define MAX_TASKS (MAX_CORES*2+2)
#define MAX_ISLE 8
#define MAX_FNAME 128
#define TIMER_FREQ 100 /* in HZ */
#define CLOCK_TICK_RATE 1193182 /* 8254 chip's internal oscillator frequency */
#define VIDEO_MEM_ADDR 0xB8000 /* the video memory address */
#define CACHE_LINE 64
#define KERNEL_STACK_SIZE (8*1024)
#define DEFAULT_STACK_SIZE (256*1024)
#define HEAP_START (PAGE_2M_FLOOR((size_t)&kernel_end) + 4*PAGE_SIZE)
#define HEAP_SIZE (1ULL << 32)
#define KMSG_SIZE (4*1024)
#define INT_SYSCALL 0x80
#define MAILBOX_SIZE 128
//#define WITH_PCI_IDS
//#define SAVE_FPU
//#define CONFIG_VGA
#define BYTE_ORDER LITTLE_ENDIAN
#define DYNAMIC_TICKS
#define BUILTIN_EXPECT(exp, b) __builtin_expect((exp), (b))
//#define BUILTIN_EXPECT(exp, b) (exp)
#define NORETURN __attribute__((noreturn))
#define HAVE_ARCH_MEMSET
#define HAVE_ARCH_MEMCPY
#define HAVE_ARCH_STRLEN
#define HAVE_ARCH_STRCPY
#define HAVE_ARCH_STRNCPY
#ifdef __cplusplus
}
#endif
#endif

View file

@ -42,6 +42,26 @@
extern "C" {
#endif
#define TIMER_FREQ 100 /* in HZ */
#define CLOCK_TICK_RATE 1193182 /* 8254 chip's internal oscillator frequency */
#define VIDEO_MEM_ADDR 0xB8000 /* the video memory address */
#define CACHE_LINE 64
#define HEAP_START (PAGE_2M_FLOOR((size_t)&kernel_end) + 4*PAGE_SIZE)
#define HEAP_SIZE (1ULL << 32)
#define INT_SYSCALL 0x80
#define MAILBOX_SIZE 128
//#define WITH_PCI_IDS
//#define SAVE_FPU
//#define CONFIG_VGA
#define BYTE_ORDER LITTLE_ENDIAN
#define DYNAMIC_TICKS
#define BUILTIN_EXPECT(exp, b) __builtin_expect((exp), (b))
//#define BUILTIN_EXPECT(exp, b) (exp)
#define NORETURN __attribute__((noreturn))
#define NULL ((void*) 0)
/// represents a task identifier