Skip to content

Commit

Permalink
Integrate git submodule initialization into configure script
Browse files Browse the repository at this point in the history
- Added automatic initialization and update of git submodules during the configure step.
- The script now checks if the project is within a Git repository and contains submodules.
- If submodules exist, they are initialized and updated using 'git submodule init' and 'git submodule update --recursive'.
- If the project is not a Git repository or contains no submodules, appropriate warnings are displayed.
  • Loading branch information
Knogle committed Sep 8, 2024
1 parent b885f02 commit 059532c
Showing 1 changed file with 69 additions and 51 deletions.
120 changes: 69 additions & 51 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,73 +15,73 @@ PKG_PROG_PKG_CONFIG

# Checks for libraries.
PKG_CHECK_MODULES(
[PANEL],
[panel],
[
CFLAGS="${CFLAGS} ${PANEL_CFLAGS}"
LIBS="${LIBS} ${PANEL_LIBS}"
],
[AC_CHECK_LIB([panel], [main], [
LIBS="-lpanel $LIBS"
AC_CHECK_HEADERS(panel.h,, [
AC_CHECK_HEADERS(ncurses/panel.h, [
AC_DEFINE([PANEL_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses panel headers not found])])
])
], [AC_MSG_ERROR([ncurses panel library not found])])]
[PANEL],
[panel],
[
CFLAGS="${CFLAGS} ${PANEL_CFLAGS}"
LIBS="${LIBS} ${PANEL_LIBS}"
],
[AC_CHECK_LIB([panel], [main], [
LIBS="-lpanel $LIBS"
AC_CHECK_HEADERS(panel.h,, [
AC_CHECK_HEADERS(ncurses/panel.h, [
AC_DEFINE([PANEL_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses panel headers not found])])
])
], [AC_MSG_ERROR([ncurses panel library not found])])]
)

PKG_CHECK_MODULES(
[NCURSES],
[ncurses],
[
CFLAGS="${CFLAGS} ${NCURSES_CFLAGS}"
LIBS="${LIBS} ${NCURSES_LIBS}"
],
[AC_CHECK_LIB([ncurses], [delscreen], [
LIBS="-lncurses $LIBS"
AC_CHECK_HEADERS(ncurses.h,, [
AC_CHECK_HEADERS(ncurses/ncurses.h, [
AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses headers not found])])
])
], [AC_MSG_ERROR([ncurses development library not found])]
)]
[NCURSES],
[ncurses],
[
CFLAGS="${CFLAGS} ${NCURSES_CFLAGS}"
LIBS="${LIBS} ${NCURSES_LIBS}"
],
[AC_CHECK_LIB([ncurses], [delscreen], [
LIBS="-lncurses $LIBS"
AC_CHECK_HEADERS(ncurses.h,, [
AC_CHECK_HEADERS(ncurses/ncurses.h, [
AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses headers not found])])
])
], [AC_MSG_ERROR([ncurses development library not found])]
)]
)

PKG_CHECK_MODULES(
[OPENSSL],
[openssl],
[
CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
LIBS="${LIBS} ${OPENSSL_LIBS}"
CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
LIBS="${LIBS} ${OPENSSL_LIBS}"
],
[AC_CHECK_LIB([ssl], [SSL_library_init], [
LIBS="-lssl -lcrypto $LIBS"
AC_CHECK_HEADERS(openssl/ssl.h,, [
AC_CHECK_HEADERS(openssl/crypto.h, [
AC_DEFINE([OPENSSL_IN_SUBDIR], [openssl/], [Look for openssl headers in subdir])
], [AC_MSG_ERROR([openssl headers not found])])
])
LIBS="-lssl -lcrypto $LIBS"
AC_CHECK_HEADERS(openssl/ssl.h,, [
AC_CHECK_HEADERS(openssl/crypto.h, [
AC_DEFINE([OPENSSL_IN_SUBDIR], [openssl/], [Look for openssl headers in subdir])
], [AC_MSG_ERROR([openssl headers not found])])
])
], [AC_MSG_ERROR([OpenSSL development library not found])]
)]
)

PKG_CHECK_MODULES(
[LIBCONFIG],
[libconfig],
[
CFLAGS="${CFLAGS} ${LIBCONFIG_CFLAGS}"
LIBS="${LIBS} ${LIBCONFIG_LIBS}"
],
[AC_CHECK_LIB([libconfig], [main], [
LIBS="-llibconfig $LIBS"
AC_CHECK_HEADERS(libconfig.h,, [
AC_CHECK_HEADERS(libconfig.h, [
AC_DEFINE([LIBCONFIG_IN_SUBDIR], [libconfig/], [Look for libconfig headers in subdir])
], [AC_MSG_ERROR([libconfig headers not found])])
])
], [AC_MSG_ERROR([libconfig library not found])])]
[LIBCONFIG],
[libconfig],
[
CFLAGS="${CFLAGS} ${LIBCONFIG_CFLAGS}"
LIBS="${LIBS} ${LIBCONFIG_LIBS}"
],
[AC_CHECK_LIB([libconfig], [main], [
LIBS="-llibconfig $LIBS"
AC_CHECK_HEADERS(libconfig.h,, [
AC_CHECK_HEADERS(libconfig.h, [
AC_DEFINE([LIBCONFIG_IN_SUBDIR], [libconfig/], [Look for libconfig headers in subdir])
], [AC_MSG_ERROR([libconfig headers not found])])
])
], [AC_MSG_ERROR([libconfig library not found])])]
)

AC_CHECK_LIB([intl], [libintl_dgettext]) # needed to statically link libparted, but not given in its pkgconfig file
Expand All @@ -100,5 +100,23 @@ AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_FUNC_MALLOC
AC_CHECK_FUNCS([fdatasync memset regcomp strdup strerror])

# Initialize and update git submodules
AC_MSG_NOTICE([Initializing and updating git submodules...])

m4_ifdef([AC_CONFIG_COMMANDS], [
AC_CONFIG_COMMANDS([submodules],
[if test -d .git; then
if git submodule status >/dev/null 2>&1; then
git submodule init
git submodule update --recursive
else
AC_MSG_WARN([Submodule directory does not exist. Skipping submodule init/update.])
fi
else
AC_MSG_WARN([Not a Git repository. Skipping submodule init/update.])
fi
])
])

AC_OUTPUT

0 comments on commit 059532c

Please sign in to comment.