Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
57772688
Commit
57772688
authored
Feb 03, 2014
by
vysheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #56 from antma/master
remove printf from signal handlers and reduce configure.ac
parents
c0e52584
7a76b66f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
244 additions
and
187 deletions
+244
-187
Makefile.in
Makefile.in
+2
-2
config.h
config.h
+6
-0
config.h.in
config.h.in
+6
-0
configure
configure
+211
-152
configure.ac
configure.ac
+4
-25
main.c
main.c
+15
-8
No files found.
Makefile.in
View file @
57772688
...
...
@@ -6,8 +6,8 @@ CPPFLAGS=@CPPFLAGS@
DEFS
=
@DEFS@
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-Wno-deprecated
-fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
EXTRA_LIBS
=
@EXTRA_LIBS@
LOCAL_LDFLAGS
=
-
lm
-lcrypto
-lz
-lssl
-
rdynamic
-ggdb
${
EXTRA_LIBS
}
EXTRA_LIBS
=
-lssl
@LIBS@
@EXTRA_LIBS@
LOCAL_LDFLAGS
=
-rdynamic
-ggdb
${
EXTRA_LIBS
}
LINK_FLAGS
=
${
LDFLAGS
}
${
LOCAL_LDFLAGS
}
HEADERS
=
${
srcdir
}
/constants.h
${
srcdir
}
/include.h
${
srcdir
}
/interface.h
${
srcdir
}
/LICENSE.h
${
srcdir
}
/loop.h
${
srcdir
}
/mtproto-client.h
${
srcdir
}
/mtproto-common.h
${
srcdir
}
/net.h
${
srcdir
}
/no-preview.h
${
srcdir
}
/queries.h
${
srcdir
}
/structures.h
${
srcdir
}
/telegram.h
${
srcdir
}
/tree.h
${
srcdir
}
/config.h
${
srcdir
}
/binlog.h
${
srcdir
}
/tools.h
${
srcdir
}
/lua-tg.h
...
...
config.h
View file @
57772688
...
...
@@ -13,6 +13,9 @@
/* Define to 1 if you have the `endpwent' function. */
#define HAVE_ENDPWENT 1
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
...
...
@@ -31,6 +34,9 @@
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <luaconf.h> header file. */
#define HAVE_LUACONF_H 1
...
...
config.h.in
View file @
57772688
...
...
@@ -12,6 +12,9 @@
/* Define to 1 if you have the `endpwent' function. */
#undef HAVE_ENDPWENT
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
...
...
@@ -30,6 +33,9 @@
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <luaconf.h> header file. */
#undef HAVE_LUACONF_H
...
...
configure
View file @
57772688
...
...
@@ -1489,73 +1489,6 @@ fi
}
# ac_fn_c_try_link
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func
()
{
as_lineno
=
${
as_lineno
-
"
$1
"
}
as_lineno_stack
=
as_lineno_stack
=
$as_lineno_stack
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for
$2
"
>
&5
$as_echo_n
"checking for
$2
... "
>
&6
;
}
if
eval
\$
{
$3
+:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Define
$2
to an innocuous variant, in case <limits.h> declares
$2
.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define
$2
innocuous_
$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char
$2
(); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef
$2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char
$2
();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_
$2
|| defined __stub___
$2
choke me
#endif
int
main ()
{
return
$2
();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
eval
"
$3
=yes"
else
eval
"
$3
=no"
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
fi
eval
ac_res
=
\$
$3
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_res
"
>
&5
$as_echo
"
$ac_res
"
>
&6
;
}
eval
$as_lineno_stack
;
${
as_lineno_stack
:+:
}
unset
as_lineno
}
# ac_fn_c_check_func
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
...
...
@@ -1806,6 +1739,73 @@ $as_echo "$ac_res" >&6; }
eval
$as_lineno_stack
;
${
as_lineno_stack
:+:
}
unset
as_lineno
}
# ac_fn_c_check_type
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func
()
{
as_lineno
=
${
as_lineno
-
"
$1
"
}
as_lineno_stack
=
as_lineno_stack
=
$as_lineno_stack
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for
$2
"
>
&5
$as_echo_n
"checking for
$2
... "
>
&6
;
}
if
eval
\$
{
$3
+:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Define
$2
to an innocuous variant, in case <limits.h> declares
$2
.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define
$2
innocuous_
$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char
$2
(); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef
$2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char
$2
();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_
$2
|| defined __stub___
$2
choke me
#endif
int
main ()
{
return
$2
();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
eval
"
$3
=yes"
else
eval
"
$3
=no"
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
fi
eval
ac_res
=
\$
$3
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_res
"
>
&5
$as_echo
"
$ac_res
"
>
&6
;
}
eval
$as_lineno_stack
;
${
as_lineno_stack
:+:
}
unset
as_lineno
}
# ac_fn_c_check_func
cat
>
config.log
<<
_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
...
...
@@ -3211,13 +3211,12 @@ _ACEOF
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for
AES_set_encrypt_key in -lcrypto
"
>
&5
$as_echo_n
"checking for
AES_set_encrypt_key in -lcrypto
... "
>
&6
;
}
if
${
ac_cv_
lib_crypto_AES_set_encrypt_key
+
:
}
false
;
then
:
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for
library containing clock_gettime
"
>
&5
$as_echo_n
"checking for
library containing clock_gettime
... "
>
&6
;
}
if
${
ac_cv_
search_clock_gettime
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-lcrypto
$LIBS
"
ac_func_search_save_LIBS
=
$LIBS
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
...
...
@@ -3227,55 +3226,110 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char
AES_set_encrypt_key
();
char
clock_gettime
();
int
main ()
{
return
AES_set_encrypt_key
();
return
clock_gettime
();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_lib_crypto_AES_set_encrypt_key
=
yes
else
ac_cv_lib_crypto_AES_set_encrypt_key
=
no
for
ac_lib
in
''
rt
;
do
if
test
-z
"
$ac_lib
"
;
then
ac_res
=
"none required"
else
ac_res
=
-l
$ac_lib
LIBS
=
"-l
$ac_lib
$ac_func_search_save_LIBS
"
fi
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_search_clock_gettime
=
$ac_res
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
conftest
$ac_exeext
if
${
ac_cv_search_clock_gettime
+
:
}
false
;
then
:
break
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_crypto_AES_set_encrypt_key
"
>
&5
$as_echo
"
$ac_cv_lib_crypto_AES_set_encrypt_key
"
>
&6
;
}
if
test
"x
$ac_cv_lib_crypto_AES_set_encrypt_key
"
=
xyes
;
then
:
cat
>>
confdefs.h
<<
_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS
=
"-lcrypto
$LIBS
"
done
if
${
ac_cv_search_clock_gettime
+
:
}
false
;
then
:
else
ac_cv_search_clock_gettime
=
no
fi
rm
conftest.
$ac_ext
LIBS
=
$ac_func_search_save_LIBS
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_search_clock_gettime
"
>
&5
$as_echo
"
$ac_cv_search_clock_gettime
"
>
&6
;
}
ac_res
=
$ac_cv_search_clock_gettime
if
test
"
$ac_res
"
!=
no
;
then
:
test
"
$ac_res
"
=
"none required"
||
LIBS
=
"
$ac_res
$LIBS
"
fi
EXTRA_LIBS
=
""
BT
=
ac_fn_c_check_func
"
$LINENO
"
"backtrace"
"ac_cv_func_backtrace"
if
test
"x
$ac_cv_func_backtrace
"
=
xyes
;
then
:
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for library containing backtrace"
>
&5
$as_echo_n
"checking for library containing backtrace... "
>
&6
;
}
if
${
ac_cv_search_backtrace
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_func_search_save_LIBS
=
$LIBS
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
BT
=
1
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char backtrace ();
int
main ()
{
return backtrace ();
;
return 0;
}
_ACEOF
for
ac_lib
in
''
execinfo
;
do
if
test
-z
"
$ac_lib
"
;
then
ac_res
=
"none required"
else
ac_res
=
-l
$ac_lib
LIBS
=
"-l
$ac_lib
$ac_func_search_save_LIBS
"
fi
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_search_backtrace
=
$ac_res
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
if
${
ac_cv_search_backtrace
+
:
}
false
;
then
:
break
fi
done
if
${
ac_cv_search_backtrace
+
:
}
false
;
then
:
else
ac_cv_search_backtrace
=
no
fi
rm
conftest.
$ac_ext
LIBS
=
$ac_func_search_save_LIBS
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_search_backtrace
"
>
&5
$as_echo
"
$ac_cv_search_backtrace
"
>
&6
;
}
ac_res
=
$ac_cv_search_backtrace
if
test
"
$ac_res
"
!=
no
;
then
:
test
"
$ac_res
"
=
"none required"
||
LIBS
=
"
$ac_res
$LIBS
"
fi
if
test
"x
$BT
"
=
"x"
;
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for backtrace in -lexecinfo"
>
&5
$as_echo_n
"checking for backtrace in -lexecinfo... "
>
&6
;
}
if
${
ac_cv_lib_execinfo_backtrace
+
:
}
false
;
then
:
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for inflate in -lz"
>
&5
$as_echo_n
"checking for inflate in -lz... "
>
&6
;
}
if
${
ac_cv_lib_z_inflate
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-l
execinfo
$LIBS
"
LIBS
=
"-l
z
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
...
...
@@ -3285,34 +3339,82 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char
backtrac
e ();
char
inflat
e ();
int
main ()
{
return
backtrac
e ();
return
inflat
e ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_lib_
execinfo_backtrac
e
=
yes
ac_cv_lib_
z_inflat
e
=
yes
else
ac_cv_lib_
execinfo_backtrac
e
=
no
ac_cv_lib_
z_inflat
e
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_execinfo_backtrace
"
>
&5
$as_echo
"
$ac_cv_lib_execinfo_backtrace
"
>
&6
;
}
if
test
"x
$ac_cv_lib_execinfo_backtrace
"
=
xyes
;
then
:
EXTRA_LIBS
=
"
${
EXTRA_LIBS
}
-lexecinfo"
;
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_z_inflate
"
>
&5
$as_echo
"
$ac_cv_lib_z_inflate
"
>
&6
;
}
if
test
"x
$ac_cv_lib_z_inflate
"
=
xyes
;
then
:
cat
>>
confdefs.h
<<
_ACEOF
#define HAVE_LIBZ 1
_ACEOF
LIBS
=
"-lz
$LIBS
"
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for AES_set_encrypt_key in -lcrypto"
>
&5
$as_echo_n
"checking for AES_set_encrypt_key in -lcrypto... "
>
&6
;
}
if
${
ac_cv_lib_crypto_AES_set_encrypt_key
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-lcrypto
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char AES_set_encrypt_key ();
int
main ()
{
return AES_set_encrypt_key ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_lib_crypto_AES_set_encrypt_key
=
yes
else
CFLAGS
=
"
${
CFLAGS
}
-DNO_BACKTRACE"
;
ac_cv_lib_crypto_AES_set_encrypt_key
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_crypto_AES_set_encrypt_key
"
>
&5
$as_echo
"
$ac_cv_lib_crypto_AES_set_encrypt_key
"
>
&6
;
}
if
test
"x
$ac_cv_lib_crypto_AES_set_encrypt_key
"
=
xyes
;
then
:
cat
>>
confdefs.h
<<
_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS
=
"-lcrypto
$LIBS
"
fi
EXTRA_LIBS
=
""
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for rl_save_prompt in -lreadline"
>
&5
$as_echo_n
"checking for rl_save_prompt in -lreadline... "
>
&6
;
}
if
${
ac_cv_lib_readline_rl_save_prompt
+
:
}
false
;
then
:
...
...
@@ -3412,49 +3514,6 @@ $as_echo "#define READLINE_EDIT 1" >>confdefs.h
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for clock_gettime in -lrt"
>
&5
$as_echo_n
"checking for clock_gettime in -lrt... "
>
&6
;
}
if
${
ac_cv_lib_rt_clock_gettime
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-lrt
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char clock_gettime ();
int
main ()
{
return clock_gettime ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_lib_rt_clock_gettime
=
yes
else
ac_cv_lib_rt_clock_gettime
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_rt_clock_gettime
"
>
&5
$as_echo
"
$ac_cv_lib_rt_clock_gettime
"
>
&6
;
}
if
test
"x
$ac_cv_lib_rt_clock_gettime
"
=
xyes
;
then
:
EXTRA_LIBS
=
"
${
EXTRA_LIBS
}
-lrt"
;
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for libconfig"
>
&5
$as_echo_n
"checking for libconfig... "
>
&6
;
}
# Check whether --enable-libconfig was given.
...
...
@@ -5301,7 +5360,7 @@ fi
# Checks for header files.
for
ac_header
in
fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h
for
ac_header
in
execinfo.h
fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h
do
:
as_ac_Header
=
`
$as_echo
"ac_cv_header_
$ac_header
"
|
$as_tr_sh
`
ac_fn_c_check_header_mongrel
"
$LINENO
"
"
$ac_header
"
"
$as_ac_Header
"
"
$ac_includes_default
"
...
...
configure.ac
View file @
57772688
...
...
@@ -10,25 +10,12 @@ AC_PROG_CC
# Checks for libraries.
AC_CHECK_LIB([m], [sqrt])
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([backtrace], [execinfo])
AC_CHECK_LIB([z], [inflate])
AC_CHECK_LIB([crypto], [AES_set_encrypt_key])
EXTRA_LIBS=""
BT=
AC_CHECK_FUNC([backtrace],
[
BT=1
],
[
]
)
if test "x$BT" = "x" ; then
AC_CHECK_LIB([execinfo], [backtrace],
[ EXTRA_LIBS="${EXTRA_LIBS} -lexecinfo" ; ],
[ CFLAGS="${CFLAGS} -DNO_BACKTRACE" ; ])
fi
AC_CHECK_LIB([readline], [rl_save_prompt],
[
AC_DEFINE([READLINE_GNU], [1], [Use gnu libreadline])
...
...
@@ -41,14 +28,6 @@ AC_CHECK_LIB([readline], [rl_save_prompt],
]
)
AC_CHECK_LIB([rt], [clock_gettime],
[
[ EXTRA_LIBS="${EXTRA_LIBS} -lrt" ; ]
],
[
]
)
AC_MSG_CHECKING([for libconfig])
AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig],
[
...
...
@@ -100,7 +79,7 @@ AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h])
AC_CHECK_HEADERS([
execinfo.h
fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
...
...
main.c
View file @
57772688
...
...
@@ -38,7 +38,8 @@
#include <sys/stat.h>
#include <time.h>
#include <fcntl.h>
#ifndef NO_BACKTRACE
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <signal.h>
...
...
@@ -420,7 +421,7 @@ void args_parse (int argc, char **argv) {
}
}
#if
ndef NO_BACKTRACE
#if
def HAVE_EXECINFO_H
void
print_backtrace
(
void
)
{
void
*
buffer
[
255
];
const
int
calls
=
backtrace
(
buffer
,
sizeof
(
buffer
)
/
sizeof
(
void
*
));
...
...
@@ -428,21 +429,27 @@ void print_backtrace (void) {
}
#else
void
print_backtrace
(
void
)
{
printf
(
"No libexec. Backtrace disabled
\n
"
);
write
(
1
,
"No libexec. Backtrace disabled
\n
"
,
32
);
}
#endif
void
sig_
handler
(
int
signum
)
{
void
sig_
segv_handler
(
int
signum
__attribute__
((
unused
))
)
{
set_terminal_attributes
();
printf
(
"Signal %d received
\n
"
,
signum
);
write
(
1
,
"SIGSEGV received
\n
"
,
18
);
print_backtrace
();
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
void
sig_abrt_handler
(
int
signum
__attribute__
((
unused
)))
{
set_terminal_attributes
();
write
(
1
,
"SIGABRT received
\n
"
,
18
);
print_backtrace
();
exit
(
EXIT_FAILURE
);
}
int
main
(
int
argc
,
char
**
argv
)
{
signal
(
SIGSEGV
,
sig_handler
);
signal
(
SIGABRT
,
sig_handler
);
signal
(
SIGSEGV
,
sig_
segv_
handler
);
signal
(
SIGABRT
,
sig_
abrt_
handler
);
log_level
=
10
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment