Full_Name: Mark Version: 2.4.35 OS: Solaris 11 URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (203.63.89.15)
openldap-2.4.35/servers/slapd/back-ldif root# cc -I/usr/local/include -I../../../include -I../../../include -I.. -I./.. -I/usr/local/include -c ldif.c -o ldif.o "ldif.c", line 166: warning: no explicit type given "ldif.c", line 166: syntax error before or at: ldifcfg
This happens because there is a /usr/local/include/config.h from libstdc++ which is included before openldap-2.4.35/servers/slapd/config.h, according to the -I include path order. The Makefile sets CFLAGS to "AC_CFLAGS DEFS". DEFS includes XINCPATH which should precede AC_CFLAGS, not succeed it.
Either the order needs to be fixed, or more usefully config.h renamed to slapd_config.h
To have configure work correctly, CPPFLAGS needs to be set to "-I/usr/local/include" otherwise /usr/local/include isn't searched for db.h, it picks up /usr/include/db.h which is not the one it needs to link against.
+ print -r -- 'configure:20296: checking for Berkeley DB major version in db.h' [...] 1> conftest.c + /bin/ggrep -E __db_version + eval '$CPP $CPPFLAGS conftest.c' + cc -E conftest.c + set X __db_version 5 none none + ol_cv_bdb_major=5
You can see it's only using CPP and CPPFLAGS in the eval command. Not CFLAGS which has the path for the correct db.h to use. To fix that, CPPFLAGS also needs to point to /usr/local/include.
I'm using these fixes to move past both problems and get a properly working build:
./configure --prefix=/usr/local \ --with-cyrus-sasl \ --enable-bdb=yes \ --enable-spasswd=yes \ --enable-modules \ --enable-wrappers \ --enable-shared \ --with-tls=openssl \ ol_cv_berkeley_db_version=4.8.30 mv servers/slapd/config.h servers/slapd/slapd_config.h perl -pe 's#config.h#slapd_config.h#' -i servers/slapd/*.c perl -pe 's#"config.h"#"slapd_config.h"#' -i servers/slapd/*/*.c gmake depend gmake