mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-19 18:00:23 +08:00
autoconf: use librarized autoconf setup
I have been setting up a cross-project librarized autoconf setup; use it for NASM as well. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
3c0b924c9d
commit
b0121dc312
4
.gitignore
vendored
4
.gitignore
vendored
@ -107,3 +107,7 @@ TAGS
|
||||
/x86/regs.h
|
||||
/x86/regvals.c
|
||||
/patches/
|
||||
/autoconf/aclocal.m4
|
||||
/autoconf/compile
|
||||
/autoconf/config.*
|
||||
/autoconf/install-sh
|
||||
|
@ -30,6 +30,7 @@ INTERNAL_CFLAGS = -I$(srcdir) -I$(objdir) \
|
||||
-I$(srcdir)/output -I$(objdir)/output
|
||||
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
||||
LDFLAGS = @LDFLAGS@
|
||||
ALL_LDFLAGS = $(ALL_CFLAGS) $(LDFLAGS)
|
||||
LIBS = @LIBS@
|
||||
|
||||
AR = @AR@
|
||||
@ -476,7 +477,7 @@ travis: nasm$(X)
|
||||
#
|
||||
# Rules to run autoreconf if necessary
|
||||
#
|
||||
configure: configure.ac aclocal.m4
|
||||
configure: configure.ac autoconf/aclocal.m4
|
||||
autoreconf
|
||||
|
||||
config.status: configure
|
||||
|
202
aclocal.m4
vendored
202
aclocal.m4
vendored
@ -1,202 +0,0 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_SYM(prefix, string)
|
||||
dnl
|
||||
dnl Convert a (semi-) arbitrary string to a CPP symbol
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_SYM,
|
||||
[[$1]m4_bpatsubsts(m4_toupper([$2]),[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]+],[_],[^._?\(.*\)_.$],[[\1]])])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ADD_CFLAGS(flag [,actual_flag])
|
||||
dnl
|
||||
dnl Attempt to add the given option to CFLAGS, if it doesn't break
|
||||
dnl compilation. If the option to be tested is different than the
|
||||
dnl option that should actually be added, add the option to be
|
||||
dnl actually added as a second argument.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_ADD_CFLAGS,
|
||||
[AC_MSG_CHECKING([if $CC accepts $1])
|
||||
pa_add_cflags__old_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
AC_TRY_LINK(AC_INCLUDES_DEFAULT,
|
||||
[printf("Hello, World!\n");],
|
||||
[AC_MSG_RESULT([yes])
|
||||
CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])"
|
||||
AC_DEFINE(PA_SYM([CFLAG_],[$1]), 1,
|
||||
[Define to 1 if compiled with the `$1' compiler flag])],
|
||||
[AC_MSG_RESULT([no])
|
||||
CFLAGS="$pa_add_cflags__old_cflags"])])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ADD_CLDFLAGS(flag [,actual_flag])
|
||||
dnl
|
||||
dnl Attempt to add the given option to CFLAGS and LDFLAGS,
|
||||
dnl if it doesn't break compilation
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_ADD_CLDFLAGS,
|
||||
[AC_MSG_CHECKING([if $CC accepts $1])
|
||||
pa_add_cldflags__old_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
pa_add_cldflags__old_ldflags="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $1"
|
||||
AC_TRY_LINK(AC_INCLUDES_DEFAULT,
|
||||
[printf("Hello, World!\n");],
|
||||
[AC_MSG_RESULT([yes])
|
||||
CFLAGS="$pa_add_cldflags__old_cflags ifelse([$2],[],[$1],[$2])"
|
||||
LDFLAGS="$pa_add_cldflags__old_ldflags ifelse([$2],[],[$1],[$2])"
|
||||
AC_DEFINE(PA_SYM([CFLAG_],[$1]), 1,
|
||||
[Define to 1 if compiled with the `$1' compiler flag])],
|
||||
[AC_MSG_RESULT([no])
|
||||
CFLAGS="$pa_add_cldflags__old_cflags"
|
||||
LDFLAGS="$pa_add_cldflags__old_ldflags"])])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_HAVE_FUNC(func_name)
|
||||
dnl
|
||||
dnl Look for a function with the specified arguments which could be
|
||||
dnl a builtin/intrinsic function.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_HAVE_FUNC,
|
||||
[AC_MSG_CHECKING([for $1])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
int main(int argc, char *argv[]) {
|
||||
(void)$1$2;
|
||||
return 0;
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(AS_TR_CPP([HAVE_$1]), 1,
|
||||
[Define to 1 if you have the `$1' intrinsic function.])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_LIBEXT
|
||||
dnl
|
||||
dnl Guess the library extension based on the object extension
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_LIBEXT,
|
||||
[AC_MSG_CHECKING([for suffix of library files])
|
||||
if test x"$LIBEXT" = x; then
|
||||
case "$OBJEXT" in
|
||||
obj )
|
||||
LIBEXT=lib
|
||||
;;
|
||||
*)
|
||||
LIBEXT=a
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([$LIBEXT])
|
||||
AC_SUBST([LIBEXT])])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_FUNC_ATTRIBUTE(attribute_name)
|
||||
dnl
|
||||
dnl See if this compiler supports the equivalent of a specific gcc
|
||||
dnl attribute on a function, using the __attribute__(()) syntax.
|
||||
dnl All arguments except the attribute name are optional.
|
||||
dnl PA_FUNC_ATTRIBUTE(attribute, attribute_opts, return_type,
|
||||
dnl prototype_args, call_args)
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_FUNC_ATTRIBUTE,
|
||||
[AC_MSG_CHECKING([if $CC supports the $1 function attribute])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
extern ifelse([$3],[],[void *],[$3]) __attribute__(($1$2))
|
||||
bar(ifelse([$4],[],[int],[$4]));
|
||||
ifelse([$3],[],[void *],[$3]) foo(void);
|
||||
ifelse([$3],[],[void *],[$3]) foo(void)
|
||||
{
|
||||
ifelse([$3],[void],[],[return])
|
||||
bar(ifelse([$5],[],[1],[$5]));
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(PA_SYM([HAVE_FUNC_ATTRIBUTE_],[$1]), 1,
|
||||
[Define to 1 if your compiler supports __attribute__(($1)) on functions])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_FUNC_ATTRIBUTE_ERROR
|
||||
dnl
|
||||
dnl See if this compiler supports __attribute__((error("foo")))
|
||||
dnl The generic version of this doesn't work as it makes the compiler
|
||||
dnl throw an error by design.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_FUNC_ATTRIBUTE_ERROR,
|
||||
[AC_MSG_CHECKING([if $CC supports the error function attribute])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
extern void __attribute__((error("message"))) barf(void);
|
||||
void foo(void);
|
||||
void foo(void)
|
||||
{
|
||||
if (0)
|
||||
barf();
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_ERROR], 1,
|
||||
[Define to 1 if your compiler supports __attribute__((error)) on functions])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ARG_ENABLED(option, helptext [,enabled_action [,disabled_action]])
|
||||
dnl PA_ARG_DISABLED(option, helptext [,disabled_action [,enabled_action]])
|
||||
dnl
|
||||
dnl Simpler-to-use versions of AC_ARG_ENABLED, that include the
|
||||
dnl test for $enableval and the AS_HELP_STRING definition
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_ARG_ENABLED,
|
||||
[AC_ARG_ENABLE([$1], [AS_HELP_STRING([--enable-$1],[$2])], [], [enableval=no])
|
||||
AS_IF([test x"$enableval" != xno], [$3], [$4])
|
||||
])
|
||||
|
||||
AC_DEFUN(PA_ARG_DISABLED,
|
||||
[AC_ARG_ENABLE([$1],[AS_HELP_STRING([--disable-$1],[$2])], [], [enableval=yes])
|
||||
AS_IF([test x"$enableval" = xno], [$3], [$4])
|
||||
])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ADD_HEADERS(headers...)
|
||||
dnl
|
||||
dnl Call AC_CHECK_HEADERS(), and add to ac_includes_default if found
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(_PA_ADD_HEADER,
|
||||
[AC_CHECK_HEADERS([$1],[ac_includes_default="$ac_includes_default
|
||||
#include <$1>"
|
||||
])])
|
||||
|
||||
AC_DEFUN(PA_ADD_HEADERS,
|
||||
[m4_map_args_w([$1],[_PA_ADD_HEADER(],[)])])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_CHECK_BAD_STDC_INLINE
|
||||
dnl
|
||||
dnl Some versions of gcc seem to apply -Wmissing-prototypes to C99
|
||||
dnl inline functions, which means we need to use GNU inline syntax
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN(PA_CHECK_BAD_STDC_INLINE,
|
||||
[AC_MSG_CHECKING([if $CC supports C99 external inlines])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
|
||||
/* Don't mistake GNU inlines for c99 */
|
||||
#ifdef __GNUC_GNU_INLINE__
|
||||
# error "Using gnu inline standard"
|
||||
#endif
|
||||
|
||||
inline int foo(int x)
|
||||
{
|
||||
return x+1;
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_STDC_INLINE, 1,
|
||||
[Define to 1 if your compiler supports C99 extern inline])],
|
||||
[AC_MSG_RESULT([no])
|
||||
PA_ADD_CFLAGS([-fgnu89-inline])])])
|
348
autoconf/aux/compile
Executable file
348
autoconf/aux/compile
Executable file
@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1476
autoconf/aux/config.guess
vendored
Executable file
1476
autoconf/aux/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1833
autoconf/aux/config.sub
vendored
Executable file
1833
autoconf/aux/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
518
autoconf/aux/install-sh
Executable file
518
autoconf/aux/install-sh
Executable file
@ -0,0 +1,518 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
10
autoconf/gitignore
Normal file
10
autoconf/gitignore
Normal file
@ -0,0 +1,10 @@
|
||||
/autoconf/aclocal.m4
|
||||
/autoconf/compile
|
||||
/autoconf/config.*
|
||||
/autoconf/install-sh
|
||||
/config/config.h
|
||||
/config/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/configure
|
||||
/Makefile
|
9
autoconf/m4/pa_add_cflags.m4
Normal file
9
autoconf/m4/pa_add_cflags.m4
Normal file
@ -0,0 +1,9 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ADD_CFLAGS(variable, flag [,actual_flag])
|
||||
dnl
|
||||
dnl Attempt to add the given option to xFLAGS, if it doesn't break
|
||||
dnl compilation. If the option to be tested is different than the
|
||||
dnl option that should actually be added, add the option to be
|
||||
dnl actually added as a second argument.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_ADD_CFLAGS], [PA_ADD_FLAGS(CFLAGS, [$1], [$2])])
|
20
autoconf/m4/pa_add_flags.m4
Normal file
20
autoconf/m4/pa_add_flags.m4
Normal file
@ -0,0 +1,20 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ADD_FLAGS(variable, flag [,actual_flag])
|
||||
dnl
|
||||
dnl Attempt to add the given option to CPPFLAGS, if it doesn't break
|
||||
dnl compilation. If the option to be tested is different than the
|
||||
dnl option that should actually be added, add the option to be
|
||||
dnl actually added as a second argument.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_ADD_FLAGS],
|
||||
[AC_MSG_CHECKING([if $CC accepts $2])
|
||||
pa_add_flags__old_flags="$$1"
|
||||
$1="$$1 $2"
|
||||
AC_TRY_LINK(AC_INCLUDES_DEFAULT,
|
||||
[printf("Hello, World!\n");],
|
||||
[AC_MSG_RESULT([yes])
|
||||
$1="$pa_add_flags__old_flags ifelse([$3],[],[$2],[$3])"
|
||||
AC_DEFINE(PA_SYM([$1_],[$2]), 1,
|
||||
[Define to 1 if compiled with the `$2' compiler flag])],
|
||||
[AC_MSG_RESULT([no])
|
||||
$1="$pa_add_flags__old_flags"])])
|
12
autoconf/m4/pa_add_headers.m4
Normal file
12
autoconf/m4/pa_add_headers.m4
Normal file
@ -0,0 +1,12 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ADD_HEADERS(headers...)
|
||||
dnl
|
||||
dnl Call AC_CHECK_HEADERS(), and add to ac_includes_default if found
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([_PA_ADD_HEADER],
|
||||
[AC_CHECK_HEADERS([$1],[ac_includes_default="$ac_includes_default
|
||||
#include <$1>"
|
||||
])])
|
||||
|
||||
AC_DEFUN([PA_ADD_HEADERS],
|
||||
[m4_map_args_w([$1],[_PA_ADD_HEADER(],[)])])
|
19
autoconf/m4/pa_arg_bool.m4
Normal file
19
autoconf/m4/pa_arg_bool.m4
Normal file
@ -0,0 +1,19 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ARG_BOOL(option,helptext,default,enabled_action,disabled_action)
|
||||
dnl
|
||||
dnl The last three arguments are optional; default can be yes or no.
|
||||
dnl
|
||||
dnl Simpler-to-use versions of AC_ARG_ENABLED, that include the
|
||||
dnl test for $enableval and the AS_HELP_STRING definition. This is only
|
||||
dnl to be used for boolean options.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_ARG_BOOL],
|
||||
[m4_pushdef([pa_default],m4_default(m4_normalize([$3]),[no]))
|
||||
m4_pushdef([pa_option],m4_case(pa_default,[yes],[disable],[enable]))
|
||||
AC_ARG_ENABLE([$1],
|
||||
[AS_HELP_STRING([--]m4_defn([pa_option])[-$1],[$2])],
|
||||
[pa_arg_bool_enableval="$enableval"],
|
||||
[pa_arg_bool_enableval="]m4_defn([pa_default])["])
|
||||
m4_popdef([pa_option], [pa_default])
|
||||
AS_IF([test x"$pa_arg_bool_enableval" != xno], [$4], [$5])
|
||||
])
|
4
autoconf/m4/pa_arg_disabled.m4
Normal file
4
autoconf/m4/pa_arg_disabled.m4
Normal file
@ -0,0 +1,4 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ARG_DISABLED(option,helptext,disabled_action,enabled_action)
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_ARG_DISABLED],[PA_ARG_BOOL([$1],[$2],yes,[$4],[$3])])
|
4
autoconf/m4/pa_arg_enabled.m4
Normal file
4
autoconf/m4/pa_arg_enabled.m4
Normal file
@ -0,0 +1,4 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_ARG_ENABLED(option,helptext,enabled_action,disabled_action)
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_ARG_ENABLED],[PA_ARG_BOOL([$1],[$2],no,[$3],[$4])])
|
26
autoconf/m4/pa_check_bad_stdc_inline.m4
Normal file
26
autoconf/m4/pa_check_bad_stdc_inline.m4
Normal file
@ -0,0 +1,26 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_CHECK_BAD_STDC_INLINE
|
||||
dnl
|
||||
dnl Some versions of gcc seem to apply -Wmissing-prototypes to C99
|
||||
dnl inline functions, which means we need to use GNU inline syntax
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_CHECK_BAD_STDC_INLINE],
|
||||
[AC_MSG_CHECKING([if $CC supports C99 external inlines])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
|
||||
/* Don't mistake GNU inlines for c99 */
|
||||
#ifdef __GNUC_GNU_INLINE__
|
||||
# error "Using gnu inline standard"
|
||||
#endif
|
||||
|
||||
inline int foo(int x)
|
||||
{
|
||||
return x+1;
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_STDC_INLINE], 1,
|
||||
[Define to 1 if your compiler supports C99 extern inline])],
|
||||
[AC_MSG_RESULT([no])
|
||||
PA_ADD_CFLAGS([-fgnu89-inline])])])
|
27
autoconf/m4/pa_func_attribute.m4
Normal file
27
autoconf/m4/pa_func_attribute.m4
Normal file
@ -0,0 +1,27 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_FUNC_ATTRIBUTE(attribute_name)
|
||||
dnl
|
||||
dnl See if this compiler supports the equivalent of a specific gcc
|
||||
dnl attribute on a function, using the __attribute__(()) syntax.
|
||||
dnl All arguments except the attribute name are optional.
|
||||
dnl PA_FUNC_ATTRIBUTE(attribute, attribute_opts, return_type,
|
||||
dnl prototype_args, call_args)
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_FUNC_ATTRIBUTE],
|
||||
[AC_MSG_CHECKING([if $CC supports the $1 function attribute])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
extern ifelse([$3],[],[void *],[$3]) __attribute__(($1$2))
|
||||
bar(ifelse([$4],[],[int],[$4]));
|
||||
ifelse([$3],[],[void *],[$3]) foo(void);
|
||||
ifelse([$3],[],[void *],[$3]) foo(void)
|
||||
{
|
||||
ifelse([$3],[void],[],[return])
|
||||
bar(ifelse([$5],[],[1],[$5]));
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(PA_SYM([HAVE_FUNC_ATTRIBUTE_],[$1]), 1,
|
||||
[Define to 1 if your compiler supports __attribute__(($1)) on functions])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])
|
24
autoconf/m4/pa_func_attribute_error.m4
Normal file
24
autoconf/m4/pa_func_attribute_error.m4
Normal file
@ -0,0 +1,24 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_FUNC_ATTRIBUTE_ERROR
|
||||
dnl
|
||||
dnl See if this compiler supports __attribute__((error("foo")))
|
||||
dnl The generic version of this doesn't work as it makes the compiler
|
||||
dnl throw an error by design.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_FUNC_ATTRIBUTE_ERROR],
|
||||
[AC_MSG_CHECKING([if $CC supports the error function attribute])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
extern void __attribute__((error("message"))) barf(void);
|
||||
void foo(void);
|
||||
void foo(void)
|
||||
{
|
||||
if (0)
|
||||
barf();
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_ERROR], 1,
|
||||
[Define to 1 if your compiler supports __attribute__((error)) on functions])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])
|
20
autoconf/m4/pa_have_func.m4
Normal file
20
autoconf/m4/pa_have_func.m4
Normal file
@ -0,0 +1,20 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_HAVE_FUNC(func_name)
|
||||
dnl
|
||||
dnl Look for a function with the specified arguments which could be
|
||||
dnl a builtin/intrinsic function.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_HAVE_FUNC],
|
||||
[AC_MSG_CHECKING([for $1])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
AC_INCLUDES_DEFAULT
|
||||
int main(void) {
|
||||
(void)$1$2;
|
||||
return 0;
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(AS_TR_CPP([HAVE_$1]), 1,
|
||||
[Define to 1 if you have the `$1' intrinsic function.])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])
|
19
autoconf/m4/pa_libext.m4
Normal file
19
autoconf/m4/pa_libext.m4
Normal file
@ -0,0 +1,19 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_LIBEXT
|
||||
dnl
|
||||
dnl Guess the library extension based on the object extension
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_LIBEXT],
|
||||
[AC_MSG_CHECKING([for suffix of library files])
|
||||
if test x"$LIBEXT" = x; then
|
||||
case "$OBJEXT" in
|
||||
obj)
|
||||
LIBEXT=lib
|
||||
;;
|
||||
*)
|
||||
LIBEXT=a
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([$LIBEXT])
|
||||
AC_SUBST([LIBEXT])])
|
7
autoconf/m4/pa_sym.m4
Normal file
7
autoconf/m4/pa_sym.m4
Normal file
@ -0,0 +1,7 @@
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl PA_SYM(prefix, string)
|
||||
dnl
|
||||
dnl Convert a (semi-) arbitrary string to a CPP symbol
|
||||
dnl --------------------------------------------------------------------------
|
||||
AC_DEFUN([PA_SYM],
|
||||
[m4_normalize([$1])m4_bpatsubsts(m4_toupper([$2]),[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]+],[_],[^._?\(.*\)_.$],[[\1]])])
|
22
autogen.sh
22
autogen.sh
@ -1,8 +1,20 @@
|
||||
#!/bin/sh -xe
|
||||
#
|
||||
# Simple script to run the appropriate autotools from a repository.
|
||||
# Run this script to regenerate autoconf files
|
||||
#
|
||||
autoreconf
|
||||
rm -rf autom4te.cache config.log config.status
|
||||
rm -f Makefile rdoff/Makefile doc/Makefile
|
||||
rm -f config.h.in config.h config/config.h
|
||||
mkdir -p autoconf autoconf/aux config
|
||||
autolib="`automake --print-libdir`"
|
||||
for prg in install-sh compile config.guess config.sub; do
|
||||
cp -f "$autolib"/"$prg" autoconf/aux
|
||||
done
|
||||
rm -f autoconf/aclocal.m4
|
||||
mkdir -p autoconf/m4.old autoconf/m4
|
||||
mv -f autoconf/m4/*.m4 autoconf/m4.old/ 2>/dev/null || true
|
||||
ACLOCAL_PATH="${ACLOCAL_PATH}${ACLOCAL_PATH:+:}`pwd`/autoconf/m4.old"
|
||||
export ACLOCAL_PATH
|
||||
aclocal --install --output=autoconf/aclocal.m4 -I autoconf/m4
|
||||
test -f autoconf/aclocal.m4
|
||||
rm -rf autoconf/m4.old
|
||||
autoheader -B autoconf
|
||||
autoconf -B autoconf
|
||||
rm -rf autom4te.cache config.log config.status config/config.h Makefile
|
||||
|
14
configure.ac
14
configure.ac
@ -235,9 +235,9 @@ dnl
|
||||
PA_ARG_DISABLED([sections],
|
||||
[don't try to compile with function/data section support],
|
||||
[],
|
||||
[PA_ADD_CLDFLAGS([-ffunction-sections])
|
||||
PA_ADD_CLDFLAGS([-fdata-sections])
|
||||
PA_ADD_CLDFLAGS([-Wl,--gc-sections])],
|
||||
[PA_ADD_CFLAGS([-ffunction-sections])
|
||||
PA_ADD_CFLAGS([-fdata-sections])
|
||||
PA_ADD_LDFLAGS([-Wl,--gc-sections])]
|
||||
)
|
||||
|
||||
dnl
|
||||
@ -245,7 +245,7 @@ dnl support LTO
|
||||
dnl
|
||||
PA_ARG_ENABLED([lto],
|
||||
[compile with gcc-style link time optimization],
|
||||
[PA_ADD_CLDFLAGS([-flto])
|
||||
[PA_ADD_CFLAGS([-flto])
|
||||
dnl Note: we use _PROG rather than _TOOL since we are prepending the full
|
||||
dnl CC name which ought to already contain the host triplet if needed
|
||||
ccbase=`echo "$CC" | awk '{ print $1; }'`
|
||||
@ -260,14 +260,14 @@ dnl
|
||||
PA_ARG_ENABLED([sanitizer],
|
||||
[compile with sanitizers enabled],
|
||||
[PA_ADD_CFLAGS([-fno-omit-frame-pointer])
|
||||
PA_ADD_CLDFLAGS([-fsanitize=address])
|
||||
PA_ADD_CLDFLAGS([-fsanitize=undefined])])
|
||||
PA_ADD_CFLAGS([-fsanitize=address])
|
||||
PA_ADD_CFLAGS([-fsanitize=undefined])])
|
||||
|
||||
dnl
|
||||
dnl Don't make symbols visible, there is no point and it just
|
||||
dnl makes the code slower.
|
||||
dnl
|
||||
PA_ADD_CLDFLAGS([-fvisibility=hidden])
|
||||
PA_ADD_CFLAGS([-fvisibility=hidden])
|
||||
|
||||
dnl If we have gcc, add appropriate code cleanliness options
|
||||
PA_ADD_CFLAGS([-W])
|
||||
|
Loading…
x
Reference in New Issue
Block a user