Commit a579964a authored by Thomas Wouters's avatar Thomas Wouters

Move our own getopt() implementation to _PyOS_GetOpt(), and use it

regardless of whether the system getopt() does what we want. This avoids the
hassle with prototypes and externs, and the check to see if the system
getopt() does what we want. Prefix optind, optarg and opterr with _PyOS_ to
avoid name clashes. Add new include file to define the right symbols. Fix
Demo/pyserv/pyserv.c to include getopt.h itself, instead of relying on
Python to provide it.
parent d38784a1
...@@ -19,6 +19,7 @@ can log in on your machine. Use with caution! ...@@ -19,6 +19,7 @@ can log in on your machine. Use with caution!
#include <netinet/in.h> #include <netinet/in.h>
#include <pthread.h> #include <pthread.h>
#include <getopt.h>
/* XXX Umpfh. /* XXX Umpfh.
Python.h defines a typedef destructor, which conflicts with pthread.h. Python.h defines a typedef destructor, which conflicts with pthread.h.
...@@ -32,10 +33,6 @@ extern int Py_VerboseFlag; ...@@ -32,10 +33,6 @@ extern int Py_VerboseFlag;
#define PORT 4000 #define PORT 4000
#endif #endif
extern int optind;
extern char *optarg;
extern int getopt(int, char **, char *);
struct workorder { struct workorder {
int conn; int conn;
struct sockaddr_in addr; struct sockaddr_in addr;
......
#ifndef Py_PYGETOPT_H
#define Py_PYGETOPT_H
#ifdef __cplusplus
extern "C" {
#endif
extern DL_IMPORT(int) _PyOS_opterr;
extern DL_IMPORT(int) _PyOS_optind;
extern DL_IMPORT(char *) _PyOS_optarg;
DL_IMPORT(int) _PyOS_GetOpt(int argc, char **argv, char *optstring);
#ifdef __cplusplus
}
#endif
#endif /* !Py_PYGETOPT_H */
...@@ -17,15 +17,11 @@ ...@@ -17,15 +17,11 @@
#define PYTHONHOMEHELP "<prefix>/python2.0" #define PYTHONHOMEHELP "<prefix>/python2.0"
#endif #endif
#include "pygetopt.h"
#define COPYRIGHT \ #define COPYRIGHT \
"Type \"copyright\", \"credits\" or \"license\" for more information." "Type \"copyright\", \"credits\" or \"license\" for more information."
/* Interface to getopt(): */
extern int optind;
extern char *optarg;
extern int getopt(); /* PROTO((int, char **, char *)); -- not standardized */
/* For Py_GetArgcArgv(); set by main() */ /* For Py_GetArgcArgv(); set by main() */
static char **orig_argv; static char **orig_argv;
static int orig_argc; static int orig_argc;
...@@ -105,16 +101,16 @@ Py_Main(int argc, char **argv) ...@@ -105,16 +101,16 @@ Py_Main(int argc, char **argv)
if ((p = getenv("PYTHONUNBUFFERED")) && *p != '\0') if ((p = getenv("PYTHONUNBUFFERED")) && *p != '\0')
unbuffered = 1; unbuffered = 1;
while ((c = getopt(argc, argv, "c:diOStuUvxXhV")) != EOF) { while ((c = _PyOS_GetOpt(argc, argv, "c:diOStuUvxXhV")) != EOF) {
if (c == 'c') { if (c == 'c') {
/* -c is the last option; following arguments /* -c is the last option; following arguments
that look like options are left for the that look like options are left for the
the command to interpret. */ the command to interpret. */
command = malloc(strlen(optarg) + 2); command = malloc(strlen(_PyOS_optarg) + 2);
if (command == NULL) if (command == NULL)
Py_FatalError( Py_FatalError(
"not enough memory to copy -c argument"); "not enough memory to copy -c argument");
strcpy(command, optarg); strcpy(command, _PyOS_optarg);
strcat(command, "\n"); strcat(command, "\n");
break; break;
} }
...@@ -181,10 +177,10 @@ Py_Main(int argc, char **argv) ...@@ -181,10 +177,10 @@ Py_Main(int argc, char **argv)
exit(0); exit(0);
} }
if (command == NULL && optind < argc && if (command == NULL && _PyOS_optind < argc &&
strcmp(argv[optind], "-") != 0) strcmp(argv[_PyOS_optind], "-") != 0)
{ {
filename = argv[optind]; filename = argv[_PyOS_optind];
if (filename != NULL) { if (filename != NULL) {
if ((fp = fopen(filename, "r")) == NULL) { if ((fp = fopen(filename, "r")) == NULL) {
fprintf(stderr, "%s: can't open file '%s'\n", fprintf(stderr, "%s: can't open file '%s'\n",
...@@ -253,12 +249,12 @@ Py_Main(int argc, char **argv) ...@@ -253,12 +249,12 @@ Py_Main(int argc, char **argv)
if (command != NULL) { if (command != NULL) {
/* Backup optind and force sys.argv[0] = '-c' */ /* Backup _PyOS_optind and force sys.argv[0] = '-c' */
optind--; _PyOS_optind--;
argv[optind] = "-c"; argv[_PyOS_optind] = "-c";
} }
PySys_SetArgv(argc-optind, argv+optind); PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind);
if ((inspect || (command == NULL && filename == NULL)) && if ((inspect || (command == NULL && filename == NULL)) &&
isatty(fileno(stdin))) { isatty(fileno(stdin))) {
......
...@@ -46,7 +46,7 @@ AROBJS= \ ...@@ -46,7 +46,7 @@ AROBJS= \
marshal.o modsupport.o mystrtoul.o \ marshal.o modsupport.o mystrtoul.o \
pyfpe.o pystate.o pythonrun.o \ pyfpe.o pystate.o pythonrun.o \
structmember.o sysmodule.o \ structmember.o sysmodule.o \
traceback.o \ traceback.o getopt.o \
$(DYNLOADFILE) \ $(DYNLOADFILE) \
$(LIBOBJS) $(LIBOBJS)
OBJS= $(AROBJS) sigcheck.o OBJS= $(AROBJS) sigcheck.o
......
...@@ -27,48 +27,35 @@ ...@@ -27,48 +27,35 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#define bool int int _PyOS_opterr = 1; /* generate error messages */
#ifndef TRUE int _PyOS_optind = 1; /* index into argv array */
#define TRUE 1 char *_PyOS_optarg = NULL; /* optional argument */
#endif
#ifndef FALSE
#define FALSE 0
#endif
bool opterr = TRUE; /* generate error messages */ int _PyOS_GetOpt(int argc, char **argv, char *optstring)
int optind = 1; /* index into argv array */
char * optarg = NULL; /* optional argument */
#ifndef __BEOS__
int getopt(int argc, char *argv[], char optstring[])
#else
int getopt(int argc, char *const *argv, const char *optstring)
#endif
{ {
static char *opt_ptr = ""; static char *opt_ptr = "";
register char *ptr; char *ptr;
int option; int option;
if (*opt_ptr == '\0') { if (*opt_ptr == '\0') {
if (optind >= argc || argv[optind][0] != '-' || if (_PyOS_optind >= argc || argv[_PyOS_optind][0] != '-' ||
argv[optind][1] == '\0' /* lone dash */ ) argv[_PyOS_optind][1] == '\0' /* lone dash */ )
return -1; return -1;
else if (strcmp(argv[optind], "--") == 0) { else if (strcmp(argv[_PyOS_optind], "--") == 0) {
++optind; ++_PyOS_optind;
return -1; return -1;
} }
opt_ptr = &argv[optind++][1]; opt_ptr = &argv[_PyOS_optind++][1];
} }
if ( (option = *opt_ptr++) == '\0') if ( (option = *opt_ptr++) == '\0')
return -1; return -1;
if ((ptr = strchr(optstring, option)) == NULL) { if ((ptr = strchr(optstring, option)) == NULL) {
if (opterr) if (_PyOS_opterr)
fprintf(stderr, "Unknown option: -%c\n", option); fprintf(stderr, "Unknown option: -%c\n", option);
return '?'; return '?';
...@@ -76,19 +63,19 @@ int getopt(int argc, char *const *argv, const char *optstring) ...@@ -76,19 +63,19 @@ int getopt(int argc, char *const *argv, const char *optstring)
if (*(ptr + 1) == ':') { if (*(ptr + 1) == ':') {
if (*opt_ptr != '\0') { if (*opt_ptr != '\0') {
optarg = opt_ptr; _PyOS_optarg = opt_ptr;
opt_ptr = ""; opt_ptr = "";
} }
else { else {
if (optind >= argc) { if (_PyOS_optind >= argc) {
if (opterr) if (_PyOS_opterr)
fprintf(stderr, fprintf(stderr,
"Argument expected for the -%c option\n", option); "Argument expected for the -%c option\n", option);
return '?'; return '?';
} }
optarg = argv[optind++]; _PyOS_optarg = argv[_PyOS_optind++];
} }
} }
......
...@@ -4839,7 +4839,7 @@ else ...@@ -4839,7 +4839,7 @@ else
int main() { int main() {
/* Ultrix mips cc rejects this. */ /* Ultrix mips cc rejects this. */
typedef int charset[2]; const charset x; typedef int charset[2]; const charset x = {0,0};
/* SunOS 4.1.1 cc rejects this. */ /* SunOS 4.1.1 cc rejects this. */
char const *const *ccp; char const *const *ccp;
char **p; char **p;
...@@ -4914,7 +4914,7 @@ for ac_kw in inline __inline__ __inline; do ...@@ -4914,7 +4914,7 @@ for ac_kw in inline __inline__ __inline; do
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
} $ac_kw foo() { } int $ac_kw foo() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:4921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
...@@ -5625,47 +5625,9 @@ done ...@@ -5625,47 +5625,9 @@ done
LIBS=$LIBS_SAVE LIBS=$LIBS_SAVE
# check for getopt
echo $ac_n "checking for genuine getopt""... $ac_c" 1>&6
echo "configure:5631: checking for genuine getopt" >&5
if eval "test \"`echo '$''{'ac_cv_func_getopt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_getopt=no
else
cat > conftest.$ac_ext <<EOF
#line 5639 "configure"
#include "confdefs.h"
#include <stdio.h>
extern int optind, opterr, getopt();
extern char* optarg;
int main() {
char* av[] = { "testprog", "parameter", "-fFlag", NULL };
opterr = 0;
if (getopt(3, av, "f:") == 'f') { exit(1); }
exit(0);
}
EOF
if { (eval echo configure:5651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_getopt=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_func_getopt=no
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_func_getopt" 1>&6
test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
# check whether malloc(0) returns NULL or not # check whether malloc(0) returns NULL or not
echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6 echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6
echo "configure:5669: checking what malloc(0) returns" >&5 echo "configure:5631: checking what malloc(0) returns" >&5
if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
...@@ -5673,7 +5635,7 @@ else ...@@ -5673,7 +5635,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5677 "configure" #line 5639 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STDLIB #ifdef HAVE_STDLIB
...@@ -5692,7 +5654,7 @@ main() { ...@@ -5692,7 +5654,7 @@ main() {
exit(0); exit(0);
} }
EOF EOF
if { (eval echo configure:5696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:5658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_malloc_zero=nonnull ac_cv_malloc_zero=nonnull
else else
...@@ -5718,17 +5680,17 @@ fi ...@@ -5718,17 +5680,17 @@ fi
# check for wchar.h # check for wchar.h
ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for wchar.h""... $ac_c" 1>&6 echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
echo "configure:5722: checking for wchar.h" >&5 echo "configure:5684: checking for wchar.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5727 "configure" #line 5689 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <wchar.h> #include <wchar.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:5694: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -5758,12 +5720,12 @@ fi ...@@ -5758,12 +5720,12 @@ fi
# check for usable wchar_t # check for usable wchar_t
usable_wchar_t="unkown" usable_wchar_t="unkown"
echo $ac_n "checking for usable wchar_t""... $ac_c" 1>&6 echo $ac_n "checking for usable wchar_t""... $ac_c" 1>&6
echo "configure:5762: checking for usable wchar_t" >&5 echo "configure:5724: checking for usable wchar_t" >&5
if test "$cross_compiling" = yes; then if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5767 "configure" #line 5729 "configure"
#include "confdefs.h" #include "confdefs.h"
#include "wchar.h" #include "wchar.h"
...@@ -5777,7 +5739,7 @@ main() { ...@@ -5777,7 +5739,7 @@ main() {
} }
EOF EOF
if { (eval echo configure:5781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:5743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define HAVE_USABLE_WCHAR_T 1 #define HAVE_USABLE_WCHAR_T 1
...@@ -5796,14 +5758,14 @@ echo "$ac_t""$usable_wchar_t" 1>&6 ...@@ -5796,14 +5758,14 @@ echo "$ac_t""$usable_wchar_t" 1>&6
# check for endianness # check for endianness
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:5800: checking whether byte ordering is bigendian" >&5 echo "configure:5762: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
ac_cv_c_bigendian=unknown ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro. # See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5807 "configure" #line 5769 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
...@@ -5814,11 +5776,11 @@ int main() { ...@@ -5814,11 +5776,11 @@ int main() {
#endif #endif
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:5818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:5780: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not. # It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5822 "configure" #line 5784 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
...@@ -5829,7 +5791,7 @@ int main() { ...@@ -5829,7 +5791,7 @@ int main() {
#endif #endif
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:5833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:5795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_c_bigendian=yes ac_cv_c_bigendian=yes
else else
...@@ -5849,7 +5811,7 @@ if test "$cross_compiling" = yes; then ...@@ -5849,7 +5811,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5853 "configure" #line 5815 "configure"
#include "confdefs.h" #include "confdefs.h"
main () { main () {
/* Are we little or big endian? From Harbison&Steele. */ /* Are we little or big endian? From Harbison&Steele. */
...@@ -5862,7 +5824,7 @@ main () { ...@@ -5862,7 +5824,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1); exit (u.c[sizeof (long) - 1] == 1);
} }
EOF EOF
if { (eval echo configure:5866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:5828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_c_bigendian=no ac_cv_c_bigendian=no
else else
...@@ -5889,7 +5851,7 @@ fi ...@@ -5889,7 +5851,7 @@ fi
# Check whether right shifting a negative integer extends the sign bit # Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters). # or fills with zeros (like the Cray J90, according to Tim Peters).
echo $ac_n "checking whether right shift extends the sign bit""... $ac_c" 1>&6 echo $ac_n "checking whether right shift extends the sign bit""... $ac_c" 1>&6
echo "configure:5893: checking whether right shift extends the sign bit" >&5 echo "configure:5855: checking whether right shift extends the sign bit" >&5
if eval "test \"`echo '$''{'ac_cv_rshift_extends_sign'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_rshift_extends_sign'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
...@@ -5898,7 +5860,7 @@ if test "$cross_compiling" = yes; then ...@@ -5898,7 +5860,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5902 "configure" #line 5864 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() int main()
...@@ -5907,7 +5869,7 @@ int main() ...@@ -5907,7 +5869,7 @@ int main()
} }
EOF EOF
if { (eval echo configure:5911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:5873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_rshift_extends_sign=yes ac_cv_rshift_extends_sign=yes
else else
...@@ -5939,12 +5901,12 @@ cat >> confdefs.h <<\EOF ...@@ -5939,12 +5901,12 @@ cat >> confdefs.h <<\EOF
#endif #endif
EOF EOF
echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
echo "configure:5943: checking for socklen_t" >&5 echo "configure:5905: checking for socklen_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5948 "configure" #line 5910 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#if STDC_HEADERS #if STDC_HEADERS
...@@ -5973,7 +5935,7 @@ fi ...@@ -5973,7 +5935,7 @@ fi
echo $ac_n "checking for Modules/Setup""... $ac_c" 1>&6 echo $ac_n "checking for Modules/Setup""... $ac_c" 1>&6
echo "configure:5977: checking for Modules/Setup" >&5 echo "configure:5939: checking for Modules/Setup" >&5
if test ! -f Modules/Setup ; then if test ! -f Modules/Setup ; then
if test ! -d Modules ; then if test ! -d Modules ; then
mkdir Modules mkdir Modules
......
...@@ -1204,22 +1204,6 @@ LIBS="$LIBS $LIBM" ...@@ -1204,22 +1204,6 @@ LIBS="$LIBS $LIBM"
AC_REPLACE_FUNCS(hypot) AC_REPLACE_FUNCS(hypot)
LIBS=$LIBS_SAVE LIBS=$LIBS_SAVE
# check for getopt
AC_MSG_CHECKING(for genuine getopt)
AC_CACHE_VAL(ac_cv_func_getopt,
[AC_TRY_RUN([#include <stdio.h>
extern int optind, opterr, getopt();
extern char* optarg;
int main() {
char* av[] = { "testprog", "parameter", "-fFlag", NULL };
opterr = 0;
if (getopt(3, av, "f:") == 'f') { exit(1); }
exit(0);
}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
AC_MSG_RESULT($ac_cv_func_getopt)
test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
AC_SUBST(LIBOBJS)dnl
# check whether malloc(0) returns NULL or not # check whether malloc(0) returns NULL or not
AC_MSG_CHECKING(what malloc(0) returns) AC_MSG_CHECKING(what malloc(0) returns)
AC_CACHE_VAL(ac_cv_malloc_zero, AC_CACHE_VAL(ac_cv_malloc_zero,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment