Skip to content

Commit

Permalink
Make the configure scripts work better on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Aug 22, 2023
1 parent f863c81 commit 3f46ff5
Show file tree
Hide file tree
Showing 34 changed files with 3,454 additions and 1,573 deletions.
234 changes: 195 additions & 39 deletions configure

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions m4/ax_smart_try.m4
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ AC_DEFUN([FR_SMART_CHECK_LIB], [
sm_lib_safe=`echo "$1" | sed 'y%./+-%__p_%'`
sm_func_safe=`echo "$2" | sed 'y%./+-%__p_%'`
dnl #
dnl # Optional name to set the package, i.e. subdir we're searching in
dnl #
if test "x$3" = "x"; then
sm_pkg="${sm_lib_safe}"
else
sm_pkg="$3"
fi
dnl #
dnl # We pass all arguments for linker testing in CCPFLAGS as these
dnl # will be passed to the compiler (then linker) first.
Expand All @@ -54,7 +63,7 @@ old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir="/usr/local/lib /opt/lib /opt/homebrew/lib"
smart_lib_dir="/usr/local/lib /opt/lib /usr/local/${sm_pkg}/lib /opt/homebrew/lib /opt/homebrew/opt/${sm_pkg}/lib"
dnl #
dnl # Try first any user-specified directory, otherwise we may pick up
Expand Down Expand Up @@ -137,10 +146,18 @@ dnl #
AC_DEFUN([FR_SMART_CHECK_INCLUDE], [
ac_safe=`echo "$1" | sed 'y%./+-%__pm%'`
dnl #
dnl # Optional name to set the package, i.e. subdir we're searching in
dnl #
if test "x$3" = "x"; then
sm_pkg=`echo "${ac_safe}" | sed 's/.h//;s/^lib//'`
else
sm_pkg="$3"
fi
old_CPPFLAGS="$CPPFLAGS"
smart_include=
dnl # The default directories we search in (in addition to the compilers search path)
smart_include_dir="/usr/local/include /opt/include /opt/homebrew/include"
smart_include_dir="/usr/local/include /opt/include /usr/local/${sm_pkg}/include /opt/homebrew/include /opt/homebrew/opt/${sm_pkg}/include"
dnl # Our local versions
_smart_try_dir=
Expand Down
1 change: 0 additions & 1 deletion src/lib/curl/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2273,7 +2273,6 @@ then :
fi



ac_config_headers="$ac_config_headers config.h"


Expand Down
1 change: 0 additions & 1 deletion src/lib/curl/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ AC_INIT
AC_CONFIG_SRCDIR([base.c])
AC_REVISION($Revision$)
FR_INIT_LIBRARY([libfreeradius-curl], [libcurl support])

AC_CONFIG_HEADERS([config.h])

FR_LIBRARY_START_TESTS
Expand Down
32 changes: 27 additions & 5 deletions src/lib/json/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3478,9 +3478,15 @@ fi


ac_safe=`echo "json/json.h" | sed 'y%./+-%__pm%'`

if test "x" = "x"; then
sm_pkg=`echo "${ac_safe}" | sed 's/.h//;s/^lib//'`
else
sm_pkg=""
fi

old_CPPFLAGS="$CPPFLAGS"
smart_include=
smart_include_dir="/usr/local/include /opt/include"
smart_include_dir="/usr/local/include /opt/include /usr/local/${sm_pkg}/include /opt/homebrew/include /opt/homebrew/opt/${sm_pkg}/include"

_smart_try_dir=
_smart_include_dir=
Expand Down Expand Up @@ -3676,9 +3682,15 @@ smart_prefix=


ac_safe=`echo "json-c/json.h" | sed 'y%./+-%__pm%'`

if test "x" = "x"; then
sm_pkg=`echo "${ac_safe}" | sed 's/.h//;s/^lib//'`
else
sm_pkg=""
fi

old_CPPFLAGS="$CPPFLAGS"
smart_include=
smart_include_dir="/usr/local/include /opt/include"
smart_include_dir="/usr/local/include /opt/include /usr/local/${sm_pkg}/include /opt/homebrew/include /opt/homebrew/opt/${sm_pkg}/include"

_smart_try_dir=
_smart_include_dir=
Expand Down Expand Up @@ -3892,11 +3904,17 @@ printf "%s\n" "#define HAVE_JSON_JSON_H 1" >>confdefs.h
sm_lib_safe=`echo "json-c" | sed 'y%./+-%__p_%'`
sm_func_safe=`echo "json_object_object_add_ex" | sed 'y%./+-%__p_%'`

if test "x" = "x"; then
sm_pkg="${sm_lib_safe}"
else
sm_pkg=""
fi

old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir="/usr/local/lib /opt/lib"
smart_lib_dir="/usr/local/lib /opt/lib /usr/local/${sm_pkg}/lib /opt/homebrew/lib /opt/homebrew/opt/${sm_pkg}/lib"

if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
Expand All @@ -3920,6 +3938,7 @@ then :

smart_lib="-ljson-c"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand Down Expand Up @@ -3954,6 +3973,7 @@ if ac_fn_c_try_link "$LINENO"
then :

smart_lib="-ljson-c"
smart_ld_found=""
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }

Expand Down Expand Up @@ -3988,6 +4008,7 @@ then :

smart_lib="-ljson-c"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand All @@ -4007,6 +4028,7 @@ if test "x$smart_lib" != "x"; then
eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes"
LIBS="$smart_ldflags $smart_lib $old_LIBS"
SMART_LIBS="$smart_ldflags $smart_lib $SMART_LIBS"
SMART_LD_FOUND="$smart_ld_found"
fi

if test "x$ac_cv_lib_json_c_json_object_object_add_ex" != "xyes"
Expand Down
22 changes: 19 additions & 3 deletions src/lib/kafka/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3244,9 +3244,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_safe=`echo "librdkafka/rdkafka.h" | sed 'y%./+-%__pm%'`
if test "x" = "x"; then
sm_pkg=`echo "${ac_safe}" | sed 's/.h//;s/^lib//'`
else
sm_pkg=""
fi
old_CPPFLAGS="$CPPFLAGS"
smart_include=
smart_include_dir="/usr/local/include /opt/include"
smart_include_dir="/usr/local/include /opt/include /usr/local/${sm_pkg}/include /opt/homebrew/include /opt/homebrew/opt/${sm_pkg}/include"
_smart_try_dir=
_smart_include_dir=
Expand Down Expand Up @@ -3450,11 +3456,17 @@ printf "%s\n" "$as_me: WARNING: rdkafka headers not found. Use --with-rdkafka-in
sm_lib_safe=`echo "rdkafka" | sed 'y%./+-%__p_%'`
sm_func_safe=`echo "rd_kafka_version" | sed 'y%./+-%__p_%'`
if test "x" = "x"; then
sm_pkg="${sm_lib_safe}"
else
sm_pkg=""
fi
old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir="/usr/local/lib /opt/lib"
smart_lib_dir="/usr/local/lib /opt/lib /usr/local/${sm_pkg}/lib /opt/homebrew/lib /opt/homebrew/opt/${sm_pkg}/lib"
if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
Expand All @@ -3478,6 +3490,7 @@ then :
smart_lib="-lrdkafka"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand Down Expand Up @@ -3512,6 +3525,7 @@ if ac_fn_c_try_link "$LINENO"
then :
smart_lib="-lrdkafka"
smart_ld_found=""
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
Expand Down Expand Up @@ -3546,6 +3560,7 @@ then :
smart_lib="-lrdkafka"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand All @@ -3565,6 +3580,7 @@ if test "x$smart_lib" != "x"; then
eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes"
LIBS="$smart_ldflags $smart_lib $old_LIBS"
SMART_LIBS="$smart_ldflags $smart_lib $SMART_LIBS"
SMART_LD_FOUND="$smart_ld_found"
fi
if test "x$ac_cv_lib_rdkafka_rd_kafka_version" != "xyes"
Expand Down
44 changes: 38 additions & 6 deletions src/lib/ldap/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3344,11 +3344,17 @@ fi
sm_lib_safe=`echo "ldap" | sed 'y%./+-%__p_%'`
sm_func_safe=`echo "ldap_install_tls" | sed 'y%./+-%__p_%'`

if test "x" = "x"; then
sm_pkg="${sm_lib_safe}"
else
sm_pkg=""
fi

old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir="/usr/local/lib /opt/lib"
smart_lib_dir="/usr/local/lib /opt/lib /usr/local/${sm_pkg}/lib /opt/homebrew/lib /opt/homebrew/opt/${sm_pkg}/lib"

if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
Expand All @@ -3372,6 +3378,7 @@ then :

smart_lib="-lldap"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand Down Expand Up @@ -3406,6 +3413,7 @@ if ac_fn_c_try_link "$LINENO"
then :

smart_lib="-lldap"
smart_ld_found=""
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }

Expand Down Expand Up @@ -3440,6 +3448,7 @@ then :

smart_lib="-lldap"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand All @@ -3459,6 +3468,7 @@ if test "x$smart_lib" != "x"; then
eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes"
LIBS="$smart_ldflags $smart_lib $old_LIBS"
SMART_LIBS="$smart_ldflags $smart_lib $SMART_LIBS"
SMART_LD_FOUND="$smart_ld_found"
fi

if test "x$ac_cv_lib_ldap_ldap_install_tls" != "xyes"; then
Expand All @@ -3470,11 +3480,17 @@ fi
sm_lib_safe=`echo "lber" | sed 'y%./+-%__p_%'`
sm_func_safe=`echo "ber_get_next" | sed 'y%./+-%__p_%'`

if test "x" = "x"; then
sm_pkg="${sm_lib_safe}"
else
sm_pkg=""
fi

old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir="/usr/local/lib /opt/lib"
smart_lib_dir="/usr/local/lib /opt/lib /usr/local/${sm_pkg}/lib /opt/homebrew/lib /opt/homebrew/opt/${sm_pkg}/lib"

if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
Expand All @@ -3498,6 +3514,7 @@ then :

smart_lib="-llber"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand Down Expand Up @@ -3532,6 +3549,7 @@ if ac_fn_c_try_link "$LINENO"
then :

smart_lib="-llber"
smart_ld_found=""
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }

Expand Down Expand Up @@ -3566,6 +3584,7 @@ then :

smart_lib="-llber"
smart_ldflags="-L$try -Wl,-rpath,$try"
smart_ld_found="$try"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
break
Expand All @@ -3585,6 +3604,7 @@ if test "x$smart_lib" != "x"; then
eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes"
LIBS="$smart_ldflags $smart_lib $old_LIBS"
SMART_LIBS="$smart_ldflags $smart_lib $SMART_LIBS"
SMART_LD_FOUND="$smart_ld_found"
fi

if test "x$ac_cv_lib_lber_ber_get_next" != "xyes"; then
Expand All @@ -3596,9 +3616,15 @@ fi


ac_safe=`echo "ldap.h" | sed 'y%./+-%__pm%'`

if test "x" = "x"; then
sm_pkg=`echo "${ac_safe}" | sed 's/.h//;s/^lib//'`
else
sm_pkg=""
fi

old_CPPFLAGS="$CPPFLAGS"
smart_include=
smart_include_dir="/usr/local/include /opt/include"
smart_include_dir="/usr/local/include /opt/include /usr/local/${sm_pkg}/include /opt/homebrew/include /opt/homebrew/opt/${sm_pkg}/include"

_smart_try_dir=
_smart_include_dir=
Expand Down Expand Up @@ -3904,9 +3930,15 @@ printf "%s\n" "#define HAVE_DECL_LDAP_CREATE_SESSION_TRACKING_CONTROL $ac_have_d


ac_safe=`echo "sasl/sasl.h" | sed 'y%./+-%__pm%'`

if test "x" = "x"; then
sm_pkg=`echo "${ac_safe}" | sed 's/.h//;s/^lib//'`
else
sm_pkg=""
fi

old_CPPFLAGS="$CPPFLAGS"
smart_include=
smart_include_dir="/usr/local/include /opt/include"
smart_include_dir="/usr/local/include /opt/include /usr/local/${sm_pkg}/include /opt/homebrew/include /opt/homebrew/opt/${sm_pkg}/include"

_smart_try_dir=
_smart_include_dir=
Expand Down
Loading

0 comments on commit 3f46ff5

Please sign in to comment.