Skip to content

Commit 3c60ae5

Browse files
cxx-undefGabriel Dos Reis
authored and
Gabriel Dos Reis
committed
asprintf.c: Include config.h.
* asprintf.c: Include config.h. * basename.c: Likewise. * fdmatch.c: Likewise. * hex.c: Likewise. * lbasename.c: Likewise. * spaces.c: Likewise. * xatexit.c:Likewise. * configure.ac: Do check declarations for basename, ffs, asprintf and vasprintf for real. * configure: Regenerate. From-SVN: r98218
1 parent 1a5293c commit 3c60ae5

11 files changed

+320
-0
lines changed

libiberty/ChangeLog

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2005-04-13 Gabriel Dos Reis <[email protected]>
2+
3+
* asprintf.c: Include config.h.
4+
* basename.c: Likewise.
5+
* fdmatch.c: Likewise.
6+
* hex.c: Likewise.
7+
* lbasename.c: Likewise.
8+
* spaces.c: Likewise.
9+
* xatexit.c:Likewise.
10+
* configure.ac: Do check declarations for basename, ffs, asprintf
11+
and vasprintf for real.
12+
* configure: Regenerate.
13+
114
2005-04-13 Gabriel Dos Reis <[email protected]>
215

316
* argv.c (dupargv): Allocate space of argv[argc], not

libiberty/argv.c

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Boston, MA 02111-1307, USA. */
2222
/* Create and destroy argument vectors. An argument vector is simply an
2323
array of string pointers, terminated by a NULL pointer. */
2424

25+
#ifdef HAVE_CONFIG_H
26+
#include "config.h"
27+
#endif
2528
#include "ansidecl.h"
2629
#include "libiberty.h"
2730

libiberty/asprintf.c

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ License along with libiberty; see the file COPYING.LIB. If
1919
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
2020
Boston, MA 02111-1307, USA. */
2121

22+
#ifdef HAVE_CONFIG_H
23+
#include "config.h"
24+
#endif
2225
#include "ansidecl.h"
2326
#include "libiberty.h"
2427

libiberty/basename.c

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Behavior is undefined if the pathname ends in a directory separator.
1212
1313
*/
1414

15+
#ifdef HAVE_CONFIG_H
16+
#include "config.h"
17+
#endif
1518
#include "ansidecl.h"
1619
#include "libiberty.h"
1720
#include "safe-ctype.h"

libiberty/configure

+282
Original file line numberDiff line numberDiff line change
@@ -6915,6 +6915,288 @@ _ACEOF
69156915
fi
69166916
done
69176917
6918+
echo "$as_me:$LINENO: checking whether basename is declared" >&5
6919+
echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6
6920+
if test "${ac_cv_have_decl_basename+set}" = set; then
6921+
echo $ECHO_N "(cached) $ECHO_C" >&6
6922+
else
6923+
cat >conftest.$ac_ext <<_ACEOF
6924+
/* confdefs.h. */
6925+
_ACEOF
6926+
cat confdefs.h >>conftest.$ac_ext
6927+
cat >>conftest.$ac_ext <<_ACEOF
6928+
/* end confdefs.h. */
6929+
$ac_includes_default
6930+
int
6931+
main ()
6932+
{
6933+
#ifndef basename
6934+
char *p = (char *) basename;
6935+
#endif
6936+
6937+
;
6938+
return 0;
6939+
}
6940+
_ACEOF
6941+
rm -f conftest.$ac_objext
6942+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6943+
(eval $ac_compile) 2>conftest.er1
6944+
ac_status=$?
6945+
grep -v '^ *+' conftest.er1 >conftest.err
6946+
rm -f conftest.er1
6947+
cat conftest.err >&5
6948+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
6949+
(exit $ac_status); } &&
6950+
{ ac_try='test -z "$ac_c_werror_flag"
6951+
|| test ! -s conftest.err'
6952+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6953+
(eval $ac_try) 2>&5
6954+
ac_status=$?
6955+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
6956+
(exit $ac_status); }; } &&
6957+
{ ac_try='test -s conftest.$ac_objext'
6958+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6959+
(eval $ac_try) 2>&5
6960+
ac_status=$?
6961+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
6962+
(exit $ac_status); }; }; then
6963+
ac_cv_have_decl_basename=yes
6964+
else
6965+
echo "$as_me: failed program was:" >&5
6966+
sed 's/^/| /' conftest.$ac_ext >&5
6967+
6968+
ac_cv_have_decl_basename=no
6969+
fi
6970+
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6971+
fi
6972+
echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5
6973+
echo "${ECHO_T}$ac_cv_have_decl_basename" >&6
6974+
if test $ac_cv_have_decl_basename = yes; then
6975+
6976+
cat >>confdefs.h <<_ACEOF
6977+
#define HAVE_DECL_BASENAME 1
6978+
_ACEOF
6979+
6980+
6981+
else
6982+
cat >>confdefs.h <<_ACEOF
6983+
#define HAVE_DECL_BASENAME 0
6984+
_ACEOF
6985+
6986+
6987+
fi
6988+
echo "$as_me:$LINENO: checking whether ffs is declared" >&5
6989+
echo $ECHO_N "checking whether ffs is declared... $ECHO_C" >&6
6990+
if test "${ac_cv_have_decl_ffs+set}" = set; then
6991+
echo $ECHO_N "(cached) $ECHO_C" >&6
6992+
else
6993+
cat >conftest.$ac_ext <<_ACEOF
6994+
/* confdefs.h. */
6995+
_ACEOF
6996+
cat confdefs.h >>conftest.$ac_ext
6997+
cat >>conftest.$ac_ext <<_ACEOF
6998+
/* end confdefs.h. */
6999+
$ac_includes_default
7000+
int
7001+
main ()
7002+
{
7003+
#ifndef ffs
7004+
char *p = (char *) ffs;
7005+
#endif
7006+
7007+
;
7008+
return 0;
7009+
}
7010+
_ACEOF
7011+
rm -f conftest.$ac_objext
7012+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7013+
(eval $ac_compile) 2>conftest.er1
7014+
ac_status=$?
7015+
grep -v '^ *+' conftest.er1 >conftest.err
7016+
rm -f conftest.er1
7017+
cat conftest.err >&5
7018+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7019+
(exit $ac_status); } &&
7020+
{ ac_try='test -z "$ac_c_werror_flag"
7021+
|| test ! -s conftest.err'
7022+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7023+
(eval $ac_try) 2>&5
7024+
ac_status=$?
7025+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7026+
(exit $ac_status); }; } &&
7027+
{ ac_try='test -s conftest.$ac_objext'
7028+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7029+
(eval $ac_try) 2>&5
7030+
ac_status=$?
7031+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7032+
(exit $ac_status); }; }; then
7033+
ac_cv_have_decl_ffs=yes
7034+
else
7035+
echo "$as_me: failed program was:" >&5
7036+
sed 's/^/| /' conftest.$ac_ext >&5
7037+
7038+
ac_cv_have_decl_ffs=no
7039+
fi
7040+
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7041+
fi
7042+
echo "$as_me:$LINENO: result: $ac_cv_have_decl_ffs" >&5
7043+
echo "${ECHO_T}$ac_cv_have_decl_ffs" >&6
7044+
if test $ac_cv_have_decl_ffs = yes; then
7045+
7046+
cat >>confdefs.h <<_ACEOF
7047+
#define HAVE_DECL_FFS 1
7048+
_ACEOF
7049+
7050+
7051+
else
7052+
cat >>confdefs.h <<_ACEOF
7053+
#define HAVE_DECL_FFS 0
7054+
_ACEOF
7055+
7056+
7057+
fi
7058+
echo "$as_me:$LINENO: checking whether asprintf is declared" >&5
7059+
echo $ECHO_N "checking whether asprintf is declared... $ECHO_C" >&6
7060+
if test "${ac_cv_have_decl_asprintf+set}" = set; then
7061+
echo $ECHO_N "(cached) $ECHO_C" >&6
7062+
else
7063+
cat >conftest.$ac_ext <<_ACEOF
7064+
/* confdefs.h. */
7065+
_ACEOF
7066+
cat confdefs.h >>conftest.$ac_ext
7067+
cat >>conftest.$ac_ext <<_ACEOF
7068+
/* end confdefs.h. */
7069+
$ac_includes_default
7070+
int
7071+
main ()
7072+
{
7073+
#ifndef asprintf
7074+
char *p = (char *) asprintf;
7075+
#endif
7076+
7077+
;
7078+
return 0;
7079+
}
7080+
_ACEOF
7081+
rm -f conftest.$ac_objext
7082+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7083+
(eval $ac_compile) 2>conftest.er1
7084+
ac_status=$?
7085+
grep -v '^ *+' conftest.er1 >conftest.err
7086+
rm -f conftest.er1
7087+
cat conftest.err >&5
7088+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7089+
(exit $ac_status); } &&
7090+
{ ac_try='test -z "$ac_c_werror_flag"
7091+
|| test ! -s conftest.err'
7092+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7093+
(eval $ac_try) 2>&5
7094+
ac_status=$?
7095+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7096+
(exit $ac_status); }; } &&
7097+
{ ac_try='test -s conftest.$ac_objext'
7098+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7099+
(eval $ac_try) 2>&5
7100+
ac_status=$?
7101+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7102+
(exit $ac_status); }; }; then
7103+
ac_cv_have_decl_asprintf=yes
7104+
else
7105+
echo "$as_me: failed program was:" >&5
7106+
sed 's/^/| /' conftest.$ac_ext >&5
7107+
7108+
ac_cv_have_decl_asprintf=no
7109+
fi
7110+
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7111+
fi
7112+
echo "$as_me:$LINENO: result: $ac_cv_have_decl_asprintf" >&5
7113+
echo "${ECHO_T}$ac_cv_have_decl_asprintf" >&6
7114+
if test $ac_cv_have_decl_asprintf = yes; then
7115+
7116+
cat >>confdefs.h <<_ACEOF
7117+
#define HAVE_DECL_ASPRINTF 1
7118+
_ACEOF
7119+
7120+
7121+
else
7122+
cat >>confdefs.h <<_ACEOF
7123+
#define HAVE_DECL_ASPRINTF 0
7124+
_ACEOF
7125+
7126+
7127+
fi
7128+
echo "$as_me:$LINENO: checking whether vasprintf is declared" >&5
7129+
echo $ECHO_N "checking whether vasprintf is declared... $ECHO_C" >&6
7130+
if test "${ac_cv_have_decl_vasprintf+set}" = set; then
7131+
echo $ECHO_N "(cached) $ECHO_C" >&6
7132+
else
7133+
cat >conftest.$ac_ext <<_ACEOF
7134+
/* confdefs.h. */
7135+
_ACEOF
7136+
cat confdefs.h >>conftest.$ac_ext
7137+
cat >>conftest.$ac_ext <<_ACEOF
7138+
/* end confdefs.h. */
7139+
$ac_includes_default
7140+
int
7141+
main ()
7142+
{
7143+
#ifndef vasprintf
7144+
char *p = (char *) vasprintf;
7145+
#endif
7146+
7147+
;
7148+
return 0;
7149+
}
7150+
_ACEOF
7151+
rm -f conftest.$ac_objext
7152+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7153+
(eval $ac_compile) 2>conftest.er1
7154+
ac_status=$?
7155+
grep -v '^ *+' conftest.er1 >conftest.err
7156+
rm -f conftest.er1
7157+
cat conftest.err >&5
7158+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7159+
(exit $ac_status); } &&
7160+
{ ac_try='test -z "$ac_c_werror_flag"
7161+
|| test ! -s conftest.err'
7162+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7163+
(eval $ac_try) 2>&5
7164+
ac_status=$?
7165+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7166+
(exit $ac_status); }; } &&
7167+
{ ac_try='test -s conftest.$ac_objext'
7168+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7169+
(eval $ac_try) 2>&5
7170+
ac_status=$?
7171+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7172+
(exit $ac_status); }; }; then
7173+
ac_cv_have_decl_vasprintf=yes
7174+
else
7175+
echo "$as_me: failed program was:" >&5
7176+
sed 's/^/| /' conftest.$ac_ext >&5
7177+
7178+
ac_cv_have_decl_vasprintf=no
7179+
fi
7180+
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7181+
fi
7182+
echo "$as_me:$LINENO: result: $ac_cv_have_decl_vasprintf" >&5
7183+
echo "${ECHO_T}$ac_cv_have_decl_vasprintf" >&6
7184+
if test $ac_cv_have_decl_vasprintf = yes; then
7185+
7186+
cat >>confdefs.h <<_ACEOF
7187+
#define HAVE_DECL_VASPRINTF 1
7188+
_ACEOF
7189+
7190+
7191+
else
7192+
cat >>confdefs.h <<_ACEOF
7193+
#define HAVE_DECL_VASPRINTF 0
7194+
_ACEOF
7195+
7196+
7197+
fi
7198+
7199+
69187200
echo "$as_me:$LINENO: checking whether canonicalize_file_name must be declared" >&5
69197201
echo $ECHO_N "checking whether canonicalize_file_name must be declared... $ECHO_C" >&6
69207202
if test "${libiberty_cv_decl_needed_canonicalize_file_name+set}" = set; then

libiberty/configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ if test -z "${setobjs}"; then
518518
[AC_MSG_RESULT([no])])
519519

520520
AC_CHECK_FUNCS($checkfuncs)
521+
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf])
521522
libiberty_NEED_DECLARATION(canonicalize_file_name)
522523
fi
523524

libiberty/fdmatch.c

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ BUGS
4141
4242
*/
4343

44+
#ifdef HAVE_CONFIG_H
45+
#include "config.h"
46+
#endif
4447
#include "ansidecl.h"
4548
#include "libiberty.h"
4649
#include <sys/types.h>

libiberty/hex.c

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1818
Boston, MA 02111-1307, USA. */
1919

2020
#include <stdio.h> /* for EOF */
21+
#ifdef HAVE_CONFIG_H
22+
#include "config.h"
23+
#endif
2124
#include "libiberty.h"
2225
#include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
2326

libiberty/lbasename.c

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ and a path ending in @code{/} returns the empty string after it.
3737
3838
*/
3939

40+
#ifdef HAVE_CONFIG_H
41+
#include "config.h"
42+
#endif
4043
#include "ansidecl.h"
4144
#include "libiberty.h"
4245
#include "safe-ctype.h"

libiberty/spaces.c

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ valid until at least the next call.
2929
3030
*/
3131

32+
#ifdef HAVE_CONFIG_H
33+
#include "config.h"
34+
#endif
3235
#include "ansidecl.h"
3336
#include "libiberty.h"
3437

libiberty/xatexit.c

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ failure. If you use @code{xatexit} to register functions, you must use
2222
/* Adapted from newlib/libc/stdlib/{,at}exit.[ch].
2323
If you use xatexit, you must call xexit instead of exit. */
2424

25+
#ifdef HAVE_CONFIG_H
26+
#include "config.h"
27+
#endif
2528
#include "ansidecl.h"
2629
#include "libiberty.h"
2730

0 commit comments

Comments
 (0)