Karlson2k / libmicrohttpd

GNU libmicrohttpd repository unofficial mirror on GitHub
https://www.gnu.org/software/libmicrohttpd/
Other
101 stars 29 forks source link

configure says syntax error near unexpected token `fi' #18

Closed hinxx closed 1 year ago

hinxx commented 1 year ago

Trying to compile git code on Ubuntu 22.04 fails in configure step:

$ git clone https://git.gnunet.org/libmicrohttpd.git
Cloning into 'libmicrohttpd'...
remote: Enumerating objects: 34718, done.
remote: Counting objects: 100% (34718/34718), done.
remote: Compressing objects: 100% (8929/8929), done.
remote: Total 34718 (delta 28002), reused 32054 (delta 25750), pack-reused 0
Receiving objects: 100% (34718/34718), 9.86 MiB | 7.67 MiB/s, done.
Resolving deltas: 100% (28002/28002), done.

$ cd libmicrohttpd/
$ ./bootstrap 
Installing uncrustify hook and configuration
Running autotools...
aclocal: installing 'm4/libtool.m4' from '/usr/share/aclocal/libtool.m4'
aclocal: installing 'm4/ltoptions.m4' from '/usr/share/aclocal/ltoptions.m4'
aclocal: installing 'm4/ltsugar.m4' from '/usr/share/aclocal/ltsugar.m4'
aclocal: installing 'm4/ltversion.m4' from '/usr/share/aclocal/ltversion.m4'
aclocal: installing 'm4/lt~obsolete.m4' from '/usr/share/aclocal/lt~obsolete.m4'
libtoolize: found 'configure.ac'
libtoolize: export M4='/usr/bin/m4'
libtoolize: ac_aux_dir='build-aux'
libtoolize: ltdl mode=''
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: cp -f /usr/share/libtool/build-aux/config.guess build-aux
libtoolize: cp -f /usr/share/libtool/build-aux/config.sub build-aux
libtoolize: cp -f /usr/share/libtool/build-aux/install-sh build-aux
libtoolize: cp -f /usr/share/libtool/build-aux/ltmain.sh build-aux
libtoolize: found 'Makefile.am'
libtoolize: aclocal_amflags=-I m4'
libtoolize: am_macro_dir='m4'
libtoolize: Not copying 'm4/ltargz.m4', libltdl not used.
libtoolize: Not copying 'm4/ltdl.m4', libltdl not used.
libtoolize: found LT_INIT invocation
configure.ac:134: installing 'build-aux/compile'
configure.ac:124: installing 'build-aux/missing'
Makefile.am: installing './INSTALL'
doc/Makefile.am:16: installing 'build-aux/mdate-sh'
doc/Makefile.am:16: installing 'build-aux/texinfo.tex'
doc/examples/Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
The ./configure is ready to run.

$ ./configure 
checking whether z/OS special settings are required... no
checking for build type... neutral. Defaults: use only user-specified compiler and linker flags
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gawk... (cached) gawk
checking for grep that handles long lines and -e... /usr/bin/grep
checking for fgrep... /usr/bin/grep -F
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for presence of stdio.h... yes
checking for presence of wchar.h... yes
checking for presence of stdlib.h... yes
checking for presence of string.h... yes
checking for presence of strings.h... yes
checking for presence of stdint.h... yes
checking for presence of fcntl.h... yes
checking for presence of sys/types.h... yes
checking for presence of time.h... yes
checking for presence of unistd.h... yes
checking whether _GNU_SOURCE is already defined... no
checking whether headers accept _GNU_SOURCE... yes
checking whether to try __BSD_VISIBLE macro... no
checking whether to try _DARWIN_C_SOURCE macro... no
checking whether to try __EXTENSIONS__ macro... no
checking whether to try _NETBSD_SOURCE macro... no
checking whether to try _BSD_SOURCE macro... no
checking whether to try _TANDEM_SOURCE macro... no
checking whether to try _ALL_SOURCE macro... no
checking whether _XOPEN_SOURCE is already defined... no
checking headers for POSIX.1-2008/SUSv4 features... available, works with _XOPEN_SOURCE=700, works with extension macro
checking for useful system-specific features... no
checking for final set of defined symbols... _GNU_SOURCE _XOPEN_SOURCE=700
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for egrep... /usr/bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for windres... no
checking whether MHD_FAVOR_SMALL_CODE is declared... no
checking whether MHD_FAVOR_FAST_CODE is declared... no
checking whether compiler is configured to optimize for size... no
checking whether to use a reduced size version of the code... no (by default)
checking for gcc flag to warn on unknown -W parameters... none needed
checking whether gcc supports -Wunused-command-line-argument flag... no
checking whether gcc supports -Wignored-optimization-argument flag... no
checking whether gcc supports -Winvalid-command-line-argument flag... no
checking whether gcc supports -Wunknown-argument flag... no
checking whether gcc supports -fno-strict-aliasing flag... yes
checking whether gcc supports -qlonglong flag... no
checking for stdio.h... yes
checking for string.h... (cached) yes
checking for stdint.h... (cached) yes
checking for errno.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/uio.h... yes
checking for sys/time.h... yes
checking for time.h... yes
checking for endian.h... yes
checking for machine/endian.h... no
checking for sys/endian.h... no
checking for sys/byteorder.h... no
checking for sys/machine.h... no
checking for machine/param.h... no
checking for sys/param.h... yes
checking for sys/isa_defs.h... no
checking for sys/ioctl.h... yes
checking for sys/socket.h... yes
checking for sys/select.h... yes
checking for netinet/in.h... yes
checking for arpa/inet.h... yes
checking for netinet/ip.h... yes
checking for netinet/tcp.h... yes
checking for net/if.h... yes
checking for netdb.h... yes
checking for sockLib.h... no
checking for inetLib.h... no
checking for sys/msg.h... yes
checking for sys/mman.h... yes
checking for signal.h... yes
checking for search.h... yes
checking for proper tsearch(), tfind() and tdelete()... yes
checking for sys/sysctl.h... yes
checking for netinet/ip_icmp.h... yes
checking for netinet/icmp_var.h... no
checking for stdbool.h... yes
checking for bool... yes
checking whether "true" is defined or builtin... yes
checking whether "false" is defined or builtin... yes
checking whether "true" and "false" could be used... yes
checking whether C compiler accepts -Werror=attributes... yes
checking whether -Werror=attributes actually works... yes
checking for function inline keywords supported by gcc... inline __attribute__((always_inline))
checking for stdalign.h... yes
checking for C11 'alignof()' support... yes
checking for target host OS... Linux
checking whether gcc is Clang... no
checking whether pthreads work with "-pthread" and "-lpthread"... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking whether pthread_sigmask(3) is available... yes
checking for threading lib to use with libmicrohttpd (auto)... posix
checking for pthread_np.h... no
checking whether pthread_attr_setname_np is declared... no
checking whether pthread_setname_np is declared... yes
checking for pthread_setname_np(3) in NetBSD or OSF1 form... no
checking for pthread_setname_np(3) in GNU/Linux form... yes
checking whether to enable thread names... yes
checking whether socket is declared... yes
checking for library containing function socket... none required
checking for sys/time.h... (cached) yes
checking for time.h... (cached) yes
checking whether gettimeofday is declared... yes
checking for function gettimeofday... yes
checking whether usleep is declared... yes
checking for function usleep... yes
checking whether nanosleep is declared... yes
checking for function nanosleep... yes
checking for string.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for netinet/in.h... (cached) yes
checking for time.h... (cached) yes
checking for sys/select.h... (cached) yes
checking for netinet/tcp.h... (cached) yes
checking whether shutdown of listen socket triggers select()... yes
checking whether writev is declared... yes
checking for function writev... yes
checking whether sendmsg is declared... yes
checking for library containing function sendmsg... none required
./configure: line 29263: syntax error near unexpected token `fi'
./configure: line 29263: `fi'
hinxx commented 1 year ago

I managed to hack my way through the configure step. Had to do this:

$ git diff
diff --git a/configure.ac b/configure.ac
index 9396240e..bbfc56ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1669,7 +1669,8 @@ MHD_FIND_LIB([sendmsg],
         MHD_LIBDEPS_PKGCFG="${mhd_cv_find_lib_sendmsg} $MHD_LIBDEPS_PKGCFG"
       ]
     )
-  ],[],
+  ],
+  [AC_MSG_ERROR([[cannot find header or library required for function sendmsg()]])],
   [MHD_LIBDEPS]
 )

@@ -2522,7 +2523,8 @@ MHD_FIND_LIB([clock_gettime],[[#include <time.h>]],
         MHD_LIBDEPS_PKGCFG="${mhd_cv_find_lib_clock_gettime} $MHD_LIBDEPS_PKGCFG"
       ]
     )
-  ],[],
+  ],
+  [AC_MSG_ERROR([[cannot find header or library required for function clock_gettime()]])],
   [MHD_LIBDEPS]
 )
Karlson2k commented 1 year ago

Sorry, I cannot reproduce with Ubuntu 22.04. The suggested fix is not correct, as it does not fix any syntax, but instead changes the behaviour of the configure: you made sendmsg and clock_gettime mandatory, while they are optional.

Could you please show the output of the following commands from your local clone directory?

$ autoconf --version

$ automake --version

$ libtoolize --version

$ apt list -a autoconf automake libtool

$ ./configure --version

$ git log -1

$ git status -vb
Karlson2k commented 1 year ago

@hinxx Probably you used original Ubuntu 22.04 without any updates. I was able to reproduce the issue with Debian 9.13. It should be fixed by fa6925600abe1b1890ef76e9f4ccf707e4766b98.