diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf1c3fd..86765264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Clixon CHANGELOG ## 3.3.3 Upcoming + +* Apple Darwin port + * Added a format parameter to clicon_rpc_generate_error() and changed error printouts for backend errors, such as commit and validate. Example of the new format: diff --git a/apps/backend/Makefile.in b/apps/backend/Makefile.in index 002a0172..cb8bf940 100644 --- a/apps/backend/Makefile.in +++ b/apps/backend/Makefile.in @@ -47,6 +47,7 @@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ includedir = @includedir@ +HOST_VENDOR = @host_vendor@ SH_SUFFIX = @SH_SUFFIX@ CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@ @@ -131,7 +132,11 @@ $(APPL) : $(APPOBJ) $(MYLIBLINK) $(LIBDEPS) $(CC) $(LDFLAGS) $(APPOBJ) $(OBJS) -L. -l:$(MYLIB) $(LIBS) -o $@ $(MYLIB): $(LIBOBJ) +ifeq ($(HOST_VENDOR),apple) + $(CC) $(LDFLAGS) -shared -o $@ $(GENOBJS) $(OBJS) $(LIBS) -undefined dynamic_lookup -o $@ +else $(CC) $(LDFLAGS) -shared -Wl,-soname,$(MYLIBSO) -o $@ -lc $(LIBOBJ) -Wl,-soname=$(MYLIBSO) +endif # link-name is needed for application linking, eg for clixon_cli and clixon_backend $(MYLIBLINK) : $(MYLIB) diff --git a/apps/cli/Makefile.in b/apps/cli/Makefile.in index 0ba702bd..e9e7c75d 100644 --- a/apps/cli/Makefile.in +++ b/apps/cli/Makefile.in @@ -48,6 +48,7 @@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ includedir = @includedir@ +HOST_VENDOR = @host_vendor@ SH_SUFFIX = @SH_SUFFIX@ CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@ @@ -62,7 +63,8 @@ CLIXON_CLI_SYSDIR = $(libdir)/clixon/plugins/cli # even though it may exist in $(libdir). But the new version may not have been installed yet. LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB) -LIBS = -L$(top_srcdir)/lib/src @LIBS@ -l:$(CLIXON_LIB) -lpthread +LIBS = -L$(top_srcdir)/lib/src @LIBS@ $(top_srcdir)/lib/src/$(CLIXON_LIB) -lpthread + CPPFLAGS = @CPPFLAGS@ -fPIC INCLUDES = -I. -I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir) @INCLUDES@ @@ -121,13 +123,17 @@ test.c : echo "int main(){}" > $@ test: test.c $(LIBOBJ) - $(CC) $(INCLUDES) $(LDFLAGS) $< $(LIBOBJ) -L. -l:$(MYLIB) $(LIBS) -o $@ + $(CC) $(INCLUDES) $(LDFLAGS) $< $(LIBOBJ) -L. $(MYLIB) $(LIBS) -o $@ $(APPL): $(OBJS) $(MYLIBLINK) $(LIBDEPS) - $(CC) $(LDFLAGS) $(OBJS) -L. -l:$(MYLIB) $(LIBS) -o $@ + $(CC) $(LDFLAGS) $(OBJS) -L. $(MYLIB) $(LIBS) -o $@ $(MYLIB) : $(LIBOBJS) +ifeq ($(HOST_VENDOR),apple) + $(CC) $(LDFLAGS) -shared -undefined dynamic_lookup -o $@ $(LIBOBJS) $(LIBS) +else $(CC) $(LDFLAGS) -shared -Wl,-soname,$(MYLIBSO) -o $@ $(LIBOBJS) $(LIBS) -Wl,-soname=$(MYLIBSO) +endif # link-name is needed for application linking, eg for clixon_cli and clixon_config $(MYLIBLINK) : $(MYLIB) diff --git a/apps/cli/cli_show.c b/apps/cli/cli_show.c index c1128f6b..174952a3 100644 --- a/apps/cli/cli_show.c +++ b/apps/cli/cli_show.c @@ -328,6 +328,7 @@ expand_dir(char *dir, strerror(errno)); goto quit; } +#ifndef __APPLE__ if (0 &&detail){ if ((pw = getpwuid(st.st_uid)) == NULL){ fprintf(stderr, "expand_dir: getpwuid(%d): %s\n", @@ -361,6 +362,7 @@ expand_dir(char *dir, ); cmd = str; } +#endif /* __APPLE__ */ if (((*commands) = realloc(*commands, ((*nr)+1)*sizeof(char**))) == NULL){ perror("expand_dir: realloc"); diff --git a/apps/netconf/Makefile.in b/apps/netconf/Makefile.in index c1b0f5be..81e7cce6 100644 --- a/apps/netconf/Makefile.in +++ b/apps/netconf/Makefile.in @@ -47,6 +47,7 @@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ includedir = @includedir@ +HOST_VENDOR = @host_vendor@ SH_SUFFIX = @SH_SUFFIX@ CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@ @@ -58,7 +59,8 @@ CLIXON_LIB = libclixon.so.$(CLIXON_MAJOR).$(CLIXON_MINOR) # For dependency LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB) -LIBS = -L$(top_srcdir)/lib/src @LIBS@ -l:$(CLIXON_LIB) +LIBS = -L$(top_srcdir)/lib/src @LIBS@ $(top_srcdir)/lib/src/$(CLIXON_LIB) + CPPFLAGS = @CPPFLAGS@ -fPIC INCLUDES = -I. -I$(top_srcdir)/lib/src -I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir) @INCLUDES@ @@ -112,10 +114,14 @@ uninstall: $(CC) $(INCLUDES) $(CPPFLAGS) -D__PROGRAM__=\"$(APPL)\" $(CFLAGS) -c $< $(APPL) : $(OBJS) $(MYLIBLINK) $(LIBDEPS) - $(CC) $(LDFLAGS) $(OBJS) -L. -l:$(MYLIB) $(LIBS) -o $@ + $(CC) $(LDFLAGS) $(OBJS) -L. $(MYLIB) $(LIBS) -o $@ $(MYLIB) : $(LIBOBJS) +ifeq ($(HOST_VENDOR),apple) + $(CC) $(LDFLAGS) -shared -undefined dynamic_lookup -o $@ $(LIBOBJS) $(LIBS) +else $(CC) $(LDFLAGS) -shared -Wl,-soname,$(MYLIBSO) -o $@ $(LIBOBJS) $(LIBS) -Wl,-soname=$(MYLIBSO) +endif # link-name is needed for application linking, eg for clixon_cli and clixon_config $(MYLIBLINK) : $(MYLIB) diff --git a/configure b/configure index 05461f13..f108d6eb 100755 --- a/configure +++ b/configure @@ -681,6 +681,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -757,6 +758,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1009,6 +1011,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1146,7 +1157,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1299,6 +1310,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -3817,14 +3829,13 @@ fi done -as_ac_Lib=`$as_echo "ac_cv_lib_:libcligen.so.${CLIGEN_VERSION}''_cligen_init" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cligen_init in -l:libcligen.so.${CLIGEN_VERSION}" >&5 -$as_echo_n "checking for cligen_init in -l:libcligen.so.${CLIGEN_VERSION}... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cligen_init in -lcligen" >&5 +$as_echo_n "checking for cligen_init in -lcligen... " >&6; } +if ${ac_cv_lib_cligen_cligen_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-l:libcligen.so.${CLIGEN_VERSION} $LIBS" +LIBS="-lcligen $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3844,23 +3855,22 @@ return cligen_init (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_cligen_cligen_init=yes else - eval "$as_ac_Lib=no" + ac_cv_lib_cligen_cligen_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cligen_cligen_init" >&5 +$as_echo "$ac_cv_lib_cligen_cligen_init" >&6; } +if test "x$ac_cv_lib_cligen_cligen_init" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_LIB:libcligen.so.${CLIGEN_VERSION}" | $as_tr_cpp` 1 +#define HAVE_LIBCLIGEN 1 _ACEOF - LIBS="-l:libcligen.so.${CLIGEN_VERSION} $LIBS" + LIBS="-lcligen $LIBS" else as_fn_error $? "CLIgen${CLIGEN_VERSION} missing. Try: git clone https://github.com/olofhagsand/cligen.git" "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 00791bf1..fc423ddf 100644 --- a/configure.ac +++ b/configure.ac @@ -124,7 +124,7 @@ fi AC_CHECK_HEADERS(cligen/cligen.h,, AC_MSG_ERROR(cligen missing. Try: git clone https://github.com/olofhagsand/cligen.git)) -AC_CHECK_LIB(:libcligen.so.${CLIGEN_VERSION}, cligen_init,, AC_MSG_ERROR([CLIgen${CLIGEN_VERSION} missing. Try: git clone https://github.com/olofhagsand/cligen.git])) +AC_CHECK_LIB(cligen, cligen_init,, AC_MSG_ERROR([CLIgen${CLIGEN_VERSION} missing. Try: git clone https://github.com/olofhagsand/cligen.git])) # This is for restconf (and fastcgi) AC_ARG_WITH([restconf], diff --git a/datastore/Makefile.in b/datastore/Makefile.in index 907321e3..8660a609 100644 --- a/datastore/Makefile.in +++ b/datastore/Makefile.in @@ -60,7 +60,7 @@ CLIXON_LIB = libclixon.so.$(CLIXON_MAJOR).$(CLIXON_MINOR) # For dependency LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB) -LIBS = -L$(top_srcdir)/lib/src @LIBS@ -l:$(CLIXON_LIB) +LIBS = -L$(top_srcdir)/lib/src @LIBS@ $(top_srcdir)/lib/src/$(CLIXON_LIB) CPPFLAGS = @CPPFLAGS@ diff --git a/datastore/text/Makefile.in b/datastore/text/Makefile.in index 5cc95cb2..6a5e69f9 100644 --- a/datastore/text/Makefile.in +++ b/datastore/text/Makefile.in @@ -42,6 +42,7 @@ mandir = @mandir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ +HOST_VENDOR = @host_vendor@ VPATH = @srcdir@ CC = @CC@ @@ -64,7 +65,11 @@ all: $(PLUGIN) -include $(DESTDIR)$(datarootdir)/clixon/clixon.mk $(PLUGIN): $(SRC) +ifeq ($(HOST_VENDOR),apple) + $(CC) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) $(LDFLAGS) -shared -undefined dynamic_lookup -o $@ -lc $^ $(LIBS) +else $(CC) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) $(LDFLAGS) -shared -o $@ -lc $^ $(LIBS) +endif clean: rm -f $(PLUGIN) $(OBJS) *.core diff --git a/lib/src/Makefile.in b/lib/src/Makefile.in index 8c390233..6ded16d8 100644 --- a/lib/src/Makefile.in +++ b/lib/src/Makefile.in @@ -42,6 +42,7 @@ mandir = @mandir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ +HOST_VENDOR = @host_vendor@ SH_SUFFIX = @SH_SUFFIX@ CLIXON_VERSION = @CLIXON_VERSION@ @@ -162,7 +163,12 @@ build.c: $(MYLIB) : $(GENOBJS) $(OBJS) - $(CC) $(LDFLAGS) -shared -Wl,-soname,$(MYLIBSO) -o $@ $(GENOBJS) $(OBJS) $(LIBS) -Wl,-soname=$(MYLIBSO) +ifeq ($(HOST_VENDOR),apple) + $(CC) $(LDFLAGS) -shared -o $@ $(GENOBJS) $(OBJS) $(LIBS) -undefined dynamic_lookup -o $@ +else + $(CC) $(LDFLAGS) -shared -Wl,-soname,$(MYLIBSO) -o $@ $(GENOBJS) $(OBJS) $(LIBS) -Wl,-soname=$(MYLIBSO) +endif + # link-name is needed for application linking, eg for clixon_cli and clixon_config $(MYLIBLINK) : $(MYLIB) # ln -sf $(MYLIB) $@