Volevo compilare un programma che fa uso della funziona strnstr. Da quel che ho capito è una funzione compresa nella libreria C BSD, ma non in quella GNU
L'autore del programma mi ha detto di sistemare tramite automake ed autoconf, ma sinceramente non so dove andare a parare
come posso fare?
Tra l'altro avrei il sorgente si strnstr.c
Il pezzo di codice è
- Codice: Seleziona tutto
if (search_string) {
uint8_t *body;
uint32_t bodylen;
if (strnstr((char *)body, search_string, bodylen) == 0) {
return (0);
}
}
Il config.log mi da questo
- Codice: Seleziona tutto
onftest.c:72: undefined reference to `strnstr'
collect2: ld returned 1 exit status
configure:5205: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE ""
| #define VERSION "1.0"
| #define __USE_BSD 1
| #define HAVE_LIBNSL 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define TIME_WITH_SYS_TIME 1
| #define RETSIGTYPE void
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_SELECT 1
| #define HAVE_SOCKET 1
| #define HAVE_STRDUP 1
| #define HAVE_STRERROR 1
| #define HAVE_STRTOL 1
| #define HAVE_SETEUID 1
| #define HAVE_ERR 1
| #define HAVE_STRSEP 1
| /* end confdefs.h. */
| /* Define strnstr to an innocuous variant, in case <limits.h> declares strnstr.
| For example, HP-UX 11i <limits.h> declares gettimeofday. */
| #define strnstr innocuous_strnstr
|
| /* System header to define __stub macros and hopefully few prototypes,
| which can conflict with char strnstr (); 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 strnstr
|
| /* 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 strnstr ();
| /* 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_strnstr || defined __stub___strnstr
| choke me
| #endif
|
| int
| main ()
| {
| return strnstr ();
| ;
| return 0;
| }
configure:5223: result: no



.